@operato/data-grist 2.0.0-alpha.136 → 2.0.0-alpha.139

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 (63) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/src/data-grid/data-grid-body.d.ts +0 -1
  3. package/dist/src/data-grid/data-grid-body.js +0 -16
  4. package/dist/src/data-grid/data-grid-body.js.map +1 -1
  5. package/dist/src/data-grist.js +1 -1
  6. package/dist/src/data-grist.js.map +1 -1
  7. package/dist/src/data-report/data-report-header.js +2 -2
  8. package/dist/src/data-report/data-report-header.js.map +1 -1
  9. package/dist/src/filters/filters-form.js +3 -0
  10. package/dist/src/filters/filters-form.js.map +1 -1
  11. package/dist/stories/barcode-input-filter.stories.js +10 -0
  12. package/dist/stories/barcode-input-filter.stories.js.map +1 -1
  13. package/dist/stories/bounded-select-filters.stories.js +10 -0
  14. package/dist/stories/bounded-select-filters.stories.js.map +1 -1
  15. package/dist/stories/bounded-select-record.stories.js +10 -0
  16. package/dist/stories/bounded-select-record.stories.js.map +1 -1
  17. package/dist/stories/creatable-only-column.stories.js +10 -0
  18. package/dist/stories/creatable-only-column.stories.js.map +1 -1
  19. package/dist/stories/default-filters.stories.js +10 -0
  20. package/dist/stories/default-filters.stories.js.map +1 -1
  21. package/dist/stories/dynamic-editable.stories.js +10 -0
  22. package/dist/stories/dynamic-editable.stories.js.map +1 -1
  23. package/dist/stories/empty-sorters.stories.js +10 -0
  24. package/dist/stories/empty-sorters.stories.js.map +1 -1
  25. package/dist/stories/explicit-fetch.stories.js +10 -0
  26. package/dist/stories/explicit-fetch.stories.js.map +1 -1
  27. package/dist/stories/fixed-column.stories.js +10 -0
  28. package/dist/stories/fixed-column.stories.js.map +1 -1
  29. package/dist/stories/grid-setting.stories.js +10 -0
  30. package/dist/stories/grid-setting.stories.js.map +1 -1
  31. package/dist/stories/grist-modes.stories.d.ts +3 -2
  32. package/dist/stories/grist-modes.stories.js +10 -0
  33. package/dist/stories/grist-modes.stories.js.map +1 -1
  34. package/dist/stories/group-header.stories.js +10 -0
  35. package/dist/stories/group-header.stories.js.map +1 -1
  36. package/dist/stories/textarea.stories.d.ts +3 -2
  37. package/dist/stories/textarea.stories.js +10 -0
  38. package/dist/stories/textarea.stories.js.map +1 -1
  39. package/dist/stories/tree-column-with-checkbox.stories.js +10 -0
  40. package/dist/stories/tree-column-with-checkbox.stories.js.map +1 -1
  41. package/dist/stories/tree-column.stories.js +10 -0
  42. package/dist/stories/tree-column.stories.js.map +1 -1
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +3 -3
  45. package/src/data-grid/data-grid-body.ts +0 -22
  46. package/src/data-grist.ts +1 -1
  47. package/src/data-report/data-report-header.ts +2 -2
  48. package/src/filters/filters-form.ts +5 -0
  49. package/stories/barcode-input-filter.stories.ts +10 -0
  50. package/stories/bounded-select-filters.stories.ts +10 -0
  51. package/stories/bounded-select-record.stories.ts +10 -0
  52. package/stories/creatable-only-column.stories.ts +10 -0
  53. package/stories/default-filters.stories.ts +10 -0
  54. package/stories/dynamic-editable.stories.ts +10 -0
  55. package/stories/empty-sorters.stories.ts +10 -0
  56. package/stories/explicit-fetch.stories.ts +10 -0
  57. package/stories/fixed-column.stories.ts +10 -0
  58. package/stories/grid-setting.stories.ts +10 -0
  59. package/stories/grist-modes.stories.ts +12 -2
  60. package/stories/group-header.stories.ts +10 -0
  61. package/stories/textarea.stories.ts +14 -3
  62. package/stories/tree-column-with-checkbox.stories.ts +10 -0
  63. package/stories/tree-column.stories.ts +10 -0
@@ -348,8 +348,6 @@ export class DataGridBody extends LitElement {
348
348
 
349
349
  this.addEventListener('focus-change', dataGridBodyFocusChangeHandler.bind(this))
350
350
 
351
- this.addEventListener('wheel', this._onWheelEvent.bind(this))
352
-
353
351
  const primaryColor = getComputedStyle(this).getPropertyValue('--primary-color')
354
352
  this.style.setProperty(
355
353
  '--focused-background-image',
@@ -380,26 +378,6 @@ export class DataGridBody extends LitElement {
380
378
  ) as DataGridField
381
379
  }
382
380
 
383
- _onWheelEvent(e: WheelEvent) {
384
- if (this.scrollHeight <= this.clientHeight) {
385
- var delta = Math.max(-1, Math.min(1, e.deltaY || 0))
386
- this.scrollLeft = Math.max(0, this.scrollLeft - delta * 40)
387
-
388
- var maxScrollLeft = this.scrollWidth - this.clientWidth
389
-
390
- var atStart = this.scrollLeft === 0
391
- var atEnd = this.scrollLeft === maxScrollLeft
392
-
393
- // 스크롤이 맨 앞으로 와 있는 상태에서 휠을 올리는 경우 또는
394
- // 스크롤이 맨 끝으로 가 있는 상태에서 휠을 내리는 경우에만 디폴트 동작 허용
395
- if ((atStart && delta > 0) || (atEnd && delta < 0)) {
396
- return true
397
- }
398
-
399
- e.preventDefault()
400
- }
401
- }
402
-
403
381
  startEditTarget(row: number, column: number, valueWith: string | null = null) {
404
382
  var { editable } = this.columns.filter(column => !column.hidden)[column].record
405
383
  if (typeof editable === 'function') {
package/src/data-grist.ts CHANGED
@@ -319,7 +319,7 @@ export class DataGrist extends LitElement implements DataConsumer {
319
319
  }
320
320
 
321
321
  public applyUpdatedConfiguration() {
322
- if (!this.personalConfig) {
322
+ if (!this.personalConfig || !this.config) {
323
323
  return
324
324
  }
325
325
 
@@ -73,7 +73,7 @@ class DataReportHeader extends LitElement {
73
73
 
74
74
  private throttledNotifier?: (idx: number, width: number) => void
75
75
 
76
- _onWheelEvent(e: WheelEvent) {
76
+ onWheelEvent(e: WheelEvent) {
77
77
  if (this.scrollWidth > this.clientWidth) {
78
78
  var delta = Math.max(-1, Math.min(1, e.deltaY || 0))
79
79
  this.scrollLeft = Math.max(0, this.scrollLeft - delta * 40)
@@ -94,7 +94,7 @@ class DataReportHeader extends LitElement {
94
94
  }
95
95
 
96
96
  firstUpdated() {
97
- this.addEventListener('wheel', this._onWheelEvent.bind(this))
97
+ this.addEventListener('wheel', this.onWheelEvent.bind(this))
98
98
  }
99
99
 
100
100
  async updated(changed: PropertyValues<this>) {
@@ -264,7 +264,12 @@ export class OxFiltersForm extends LitElement {
264
264
  }
265
265
 
266
266
  applyUpdatedConfiguration() {
267
+ if (!this.config) {
268
+ return
269
+ }
270
+
267
271
  const filters = this.config.columns.filter(columnConfig => !!columnConfig.filter)
272
+
268
273
  this.filterColumns = filters.filter((columnConfig: ColumnConfig) => {
269
274
  const filter = columnConfig.filter as FilterConfigObject
270
275
  return filter!.operator !== 'search'
@@ -159,6 +159,16 @@ const Template: Story<ArgTypes> = ({ englishOnly, selectAfterChange, headerFilte
159
159
  ${CommonHeaderStyles.cssText}
160
160
  </style>
161
161
 
162
+ <style>
163
+ ox-grist {
164
+ height: 600px;
165
+ }
166
+
167
+ ox-filters-form {
168
+ flex: 1;
169
+ }
170
+ </style>
171
+
162
172
  <ox-grist
163
173
  .config=${buildConfig({ englishOnly, selectAfterChange, headerFilter })}
164
174
  mode="GRID"
@@ -294,6 +294,16 @@ const Template: Story<ArgTypes> = ({ headerFilter }: ArgTypes) =>
294
294
  ${CommonHeaderStyles.cssText}
295
295
  </style>
296
296
 
297
+ <style>
298
+ ox-grist {
299
+ height: 600px;
300
+ }
301
+
302
+ ox-filters-form {
303
+ flex: 1;
304
+ }
305
+ </style>
306
+
297
307
  <ox-grist
298
308
  .config=${buildConfig({ headerFilter })}
299
309
  mode="GRID"
@@ -297,6 +297,16 @@ const Template: Story<ArgTypes> = ({ headerFilter }: ArgTypes) =>
297
297
  ${CommonHeaderStyles.cssText}
298
298
  </style>
299
299
 
300
+ <style>
301
+ ox-grist {
302
+ height: 600px;
303
+ }
304
+
305
+ ox-filters-form {
306
+ flex: 1;
307
+ }
308
+ </style>
309
+
300
310
  <ox-grist
301
311
  .config=${buildConfig({ headerFilter })}
302
312
  mode="GRID"
@@ -189,6 +189,16 @@ const Template: Story<ArgTypes> = ({ headerFilter }: ArgTypes) =>
189
189
  ${CommonHeaderStyles.cssText}
190
190
  </style>
191
191
 
192
+ <style>
193
+ ox-grist {
194
+ height: 600px;
195
+ }
196
+
197
+ ox-filters-form {
198
+ flex: 1;
199
+ }
200
+ </style>
201
+
192
202
  <ox-grist
193
203
  .config=${buildConfig({ headerFilter })}
194
204
  mode="GRID"
@@ -185,6 +185,16 @@ const Template: Story<ArgTypes> = ({ headerFilter }: ArgTypes) =>
185
185
  ${CommonHeaderStyles.cssText}
186
186
  </style>
187
187
 
188
+ <style>
189
+ ox-grist {
190
+ height: 600px;
191
+ }
192
+
193
+ ox-filters-form {
194
+ flex: 1;
195
+ }
196
+ </style>
197
+
188
198
  <ox-grist
189
199
  .config=${buildConfig({ headerFilter })}
190
200
  mode="GRID"
@@ -217,6 +217,16 @@ const Template: Story<ArgTypes> = ({ headerFilter }: ArgTypes) =>
217
217
  ${CommonHeaderStyles.cssText}
218
218
  </style>
219
219
 
220
+ <style>
221
+ ox-grist {
222
+ height: 600px;
223
+ }
224
+
225
+ ox-filters-form {
226
+ flex: 1;
227
+ }
228
+ </style>
229
+
220
230
  <ox-grist
221
231
  .config=${buildConfig({ headerFilter })}
222
232
  mode="GRID"
@@ -126,6 +126,16 @@ const Template: Story<ArgTypes> = ({}: ArgTypes) =>
126
126
  ${CommonHeaderStyles.cssText}
127
127
  </style>
128
128
 
129
+ <style>
130
+ ox-grist {
131
+ height: 600px;
132
+ }
133
+
134
+ ox-filters-form {
135
+ flex: 1;
136
+ }
137
+ </style>
138
+
129
139
  <ox-grist
130
140
  .config=${config}
131
141
  mode="GRID"
@@ -131,6 +131,16 @@ const Template: Story<ArgTypes> = ({ explicitFetch = false }: ArgTypes) =>
131
131
  ${CommonHeaderStyles.cssText}
132
132
  </style>
133
133
 
134
+ <style>
135
+ ox-grist {
136
+ height: 600px;
137
+ }
138
+
139
+ ox-filters-form {
140
+ flex: 1;
141
+ }
142
+ </style>
143
+
134
144
  <ox-grist
135
145
  .config=${config}
136
146
  mode="GRID"
@@ -355,6 +355,16 @@ const Template: Story<ArgTypes> = ({ config }: ArgTypes) =>
355
355
  ${CommonHeaderStyles.cssText}
356
356
  </style>
357
357
 
358
+ <style>
359
+ ox-grist {
360
+ height: 600px;
361
+ }
362
+
363
+ ox-filters-form {
364
+ flex: 1;
365
+ }
366
+ </style>
367
+
358
368
  <ox-grist
359
369
  mode="GRID"
360
370
  .config=${config}
@@ -407,6 +407,16 @@ const Template: Story<ArgTypes> = ({
407
407
  ${CommonGristStyles.cssText} ${CommonHeaderStyles.cssText}
408
408
  </style>
409
409
 
410
+ <style>
411
+ ox-grist {
412
+ height: 600px;
413
+ }
414
+
415
+ ox-filters-form {
416
+ flex: 1;
417
+ }
418
+ </style>
419
+
410
420
  <ox-grist
411
421
  .mode=${mode}
412
422
  .config=${config}
@@ -352,9 +352,9 @@ interface Story<T> {
352
352
 
353
353
  interface ArgTypes {
354
354
  config: object
355
- mode: string
355
+ mode: 'GRID' | 'LIST' | 'CARD'
356
356
  urlParamsSensitive: boolean
357
- fetchHandler: object
357
+ fetchHandler: FetchHandler
358
358
  }
359
359
 
360
360
  const Template: Story<ArgTypes> = ({ config, mode = 'GRID', urlParamsSensitive = false, fetchHandler }: ArgTypes) =>
@@ -380,6 +380,16 @@ const Template: Story<ArgTypes> = ({ config, mode = 'GRID', urlParamsSensitive =
380
380
  ${CommonHeaderStyles.cssText}
381
381
  </style>
382
382
 
383
+ <style>
384
+ ox-grist {
385
+ height: 600px;
386
+ }
387
+
388
+ ox-filters-form {
389
+ flex: 1;
390
+ }
391
+ </style>
392
+
383
393
  <ox-grist
384
394
  .config=${config}
385
395
  .mode=${mode}
@@ -385,6 +385,16 @@ const Template: Story<ArgTypes> = ({ config }: ArgTypes) =>
385
385
  ${CommonHeaderStyles.cssText}
386
386
  </style>
387
387
 
388
+ <style>
389
+ ox-grist {
390
+ height: 600px;
391
+ }
392
+
393
+ ox-filters-form {
394
+ flex: 1;
395
+ }
396
+ </style>
397
+
388
398
  <ox-grist
389
399
  mode="GRID"
390
400
  .config=${config}
@@ -12,13 +12,14 @@ import { CommonHeaderStyles, CommonGristStyles } from '@operato/styles'
12
12
  import {
13
13
  ColumnConfig,
14
14
  FetchHandler,
15
+ FetchOption,
15
16
  GristClassifier,
16
17
  GristEventHandlerSet,
17
18
  GristRecord,
18
19
  ValidationCallback
19
20
  } from '../src/types.js'
20
21
 
21
- const fetchHandler: FetchHandler = async ({ page, limit }) => {
22
+ const fetchHandler: FetchHandler = async ({ page, limit }: FetchOption) => {
22
23
  var total = 3
23
24
  var start = (page! - 1) * limit!
24
25
 
@@ -186,9 +187,9 @@ interface Story<T> {
186
187
 
187
188
  interface ArgTypes {
188
189
  config: object
189
- mode: string
190
+ mode: 'GRID' | 'LIST' | 'CARD'
190
191
  urlParamsSensitive: boolean
191
- fetchHandler: object
192
+ fetchHandler: FetchHandler
192
193
  }
193
194
 
194
195
  const Template: Story<ArgTypes> = ({ config, mode = 'GRID', urlParamsSensitive = false, fetchHandler }: ArgTypes) =>
@@ -214,6 +215,16 @@ const Template: Story<ArgTypes> = ({ config, mode = 'GRID', urlParamsSensitive =
214
215
  ${CommonHeaderStyles.cssText}
215
216
  </style>
216
217
 
218
+ <style>
219
+ ox-grist {
220
+ height: 600px;
221
+ }
222
+
223
+ ox-filters-form {
224
+ flex: 1;
225
+ }
226
+ </style>
227
+
217
228
  <ox-grist
218
229
  .config=${config}
219
230
  .mode=${mode}
@@ -239,6 +239,16 @@ const Template: Story<ArgTypes> = ({ config }: ArgTypes) =>
239
239
  ${CommonHeaderStyles.cssText}
240
240
  </style>
241
241
 
242
+ <style>
243
+ ox-grist {
244
+ height: 600px;
245
+ }
246
+
247
+ ox-filters-form {
248
+ flex: 1;
249
+ }
250
+ </style>
251
+
242
252
  <ox-grist
243
253
  mode="GRID"
244
254
  .config=${config}
@@ -238,6 +238,16 @@ const Template: Story<ArgTypes> = ({ config }: ArgTypes) =>
238
238
  ${CommonHeaderStyles.cssText}
239
239
  </style>
240
240
 
241
+ <style>
242
+ ox-grist {
243
+ height: 600px;
244
+ }
245
+
246
+ ox-filters-form {
247
+ flex: 1;
248
+ }
249
+ </style>
250
+
241
251
  <ox-grist
242
252
  mode="GRID"
243
253
  .config=${config}