@operato/data-grist 8.0.0-beta.0 → 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 (164) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +10 -10
  3. package/.storybook/main.js +0 -3
  4. package/.storybook/preview.js +0 -52
  5. package/.storybook/server.mjs +0 -8
  6. package/src/accumulator/accumulator.ts +0 -63
  7. package/src/configure/column-builder.ts +0 -114
  8. package/src/configure/config-builder.ts +0 -40
  9. package/src/configure/filters-option-builder.ts +0 -8
  10. package/src/configure/imex-option-builder.ts +0 -5
  11. package/src/configure/list-option-builder.ts +0 -9
  12. package/src/configure/rows-option-builder.ts +0 -38
  13. package/src/configure/tree-option-builder.ts +0 -22
  14. package/src/configure/zero-config.ts +0 -83
  15. package/src/const.ts +0 -1
  16. package/src/data-card/data-card-field.ts +0 -94
  17. package/src/data-card/data-card-gutter-menu.ts +0 -94
  18. package/src/data-card/data-card-gutter.ts +0 -103
  19. package/src/data-card/data-card.ts +0 -154
  20. package/src/data-card/event-handlers/record-card-click-handler.ts +0 -34
  21. package/src/data-card/event-handlers/record-card-dblclick-handler.ts +0 -34
  22. package/src/data-card/record-card.ts +0 -298
  23. package/src/data-consumer.ts +0 -11
  24. package/src/data-grid/data-grid-accum-field.ts +0 -109
  25. package/src/data-grid/data-grid-body-style.ts +0 -85
  26. package/src/data-grid/data-grid-body.ts +0 -765
  27. package/src/data-grid/data-grid-field.ts +0 -227
  28. package/src/data-grid/data-grid-footer.ts +0 -119
  29. package/src/data-grid/data-grid-header.ts +0 -578
  30. package/src/data-grid/data-grid.ts +0 -293
  31. package/src/data-grid/event-handlers/data-grid-body-click-handler.ts +0 -69
  32. package/src/data-grid/event-handlers/data-grid-body-contextmenu-handler.ts +0 -32
  33. package/src/data-grid/event-handlers/data-grid-body-dblclick-handler.ts +0 -42
  34. package/src/data-grid/event-handlers/data-grid-body-focus-change-handler.ts +0 -24
  35. package/src/data-grid/event-handlers/data-grid-body-keydown-handler.ts +0 -234
  36. package/src/data-grist.ts +0 -1233
  37. package/src/data-list/data-list-field.ts +0 -82
  38. package/src/data-list/data-list-gutter.ts +0 -108
  39. package/src/data-list/data-list.ts +0 -145
  40. package/src/data-list/event-handlers/record-partial-click-handler.ts +0 -34
  41. package/src/data-list/event-handlers/record-partial-dblclick-handler.ts +0 -33
  42. package/src/data-list/event-handlers/record-partial-long-press-handler.ts +0 -33
  43. package/src/data-list/record-partial.ts +0 -264
  44. package/src/data-manipulator.ts +0 -426
  45. package/src/data-provider.ts +0 -271
  46. package/src/data-report/data-report-body-style.ts +0 -58
  47. package/src/data-report/data-report-body.ts +0 -189
  48. package/src/data-report/data-report-component.ts +0 -138
  49. package/src/data-report/data-report-field.ts +0 -83
  50. package/src/data-report/data-report-header.ts +0 -242
  51. package/src/data-report/event-handlers/data-report-body-click-handler.ts +0 -38
  52. package/src/data-report/event-handlers/data-report-body-dblclick-handler.ts +0 -25
  53. package/src/data-report/event-handlers/data-report-body-keydown-handler.ts +0 -68
  54. package/src/data-report.ts +0 -424
  55. package/src/editors/index.ts +0 -4
  56. package/src/editors/ox-grist-editor-checkbox.ts +0 -28
  57. package/src/editors/ox-grist-editor-color.ts +0 -10
  58. package/src/editors/ox-grist-editor-date.ts +0 -10
  59. package/src/editors/ox-grist-editor-datetime.ts +0 -27
  60. package/src/editors/ox-grist-editor-email.ts +0 -10
  61. package/src/editors/ox-grist-editor-file.ts +0 -28
  62. package/src/editors/ox-grist-editor-image.ts +0 -31
  63. package/src/editors/ox-grist-editor-month.ts +0 -10
  64. package/src/editors/ox-grist-editor-multiple-select.ts +0 -57
  65. package/src/editors/ox-grist-editor-number.ts +0 -27
  66. package/src/editors/ox-grist-editor-password.ts +0 -10
  67. package/src/editors/ox-grist-editor-select.ts +0 -55
  68. package/src/editors/ox-grist-editor-tel.ts +0 -10
  69. package/src/editors/ox-grist-editor-text.ts +0 -14
  70. package/src/editors/ox-grist-editor-textarea.ts +0 -16
  71. package/src/editors/ox-grist-editor-time.ts +0 -10
  72. package/src/editors/ox-grist-editor-tree.ts +0 -27
  73. package/src/editors/ox-grist-editor-varname.ts +0 -36
  74. package/src/editors/ox-grist-editor-week.ts +0 -10
  75. package/src/editors/ox-grist-editor.ts +0 -207
  76. package/src/editors/ox-input-tree.ts +0 -226
  77. package/src/editors/registry.ts +0 -82
  78. package/src/empty-note.ts +0 -46
  79. package/src/filters/filter-checkbox.ts +0 -49
  80. package/src/filters/filter-input-barcode.ts +0 -34
  81. package/src/filters/filter-input.ts +0 -30
  82. package/src/filters/filter-range-date.ts +0 -81
  83. package/src/filters/filter-range-number.ts +0 -64
  84. package/src/filters/filter-select-buttons.ts +0 -60
  85. package/src/filters/filter-select.ts +0 -68
  86. package/src/filters/filter-styles.ts +0 -119
  87. package/src/filters/filters-form.ts +0 -476
  88. package/src/filters/index.ts +0 -10
  89. package/src/filters/registry.ts +0 -56
  90. package/src/formatters/date-formatter.ts +0 -3
  91. package/src/formatters/index.ts +0 -1
  92. package/src/formatters/number-formatter.ts +0 -3
  93. package/src/formatters/registry.ts +0 -30
  94. package/src/formatters/text-formatter.ts +0 -3
  95. package/src/gutters/gutter-button.ts +0 -51
  96. package/src/gutters/gutter-dirty.ts +0 -96
  97. package/src/gutters/gutter-row-selector.ts +0 -89
  98. package/src/gutters/gutter-sequence.ts +0 -54
  99. package/src/gutters/index.ts +0 -1
  100. package/src/gutters/registry.ts +0 -32
  101. package/src/handlers/contextmenu-tree-mutation.ts +0 -80
  102. package/src/handlers/index.ts +0 -1
  103. package/src/handlers/move-down.ts +0 -44
  104. package/src/handlers/move-up.ts +0 -44
  105. package/src/handlers/record-copy.ts +0 -38
  106. package/src/handlers/record-delete.ts +0 -30
  107. package/src/handlers/record-view-handler.ts +0 -27
  108. package/src/handlers/registry.ts +0 -42
  109. package/src/handlers/select-row-toggle.ts +0 -30
  110. package/src/handlers/select-row.ts +0 -27
  111. package/src/index.ts +0 -17
  112. package/src/personalizer/index.ts +0 -1
  113. package/src/personalizer/ox-grist-filter-personalizer.ts +0 -192
  114. package/src/personalizer/ox-grist-personalizer.ts +0 -226
  115. package/src/record-view/event-handlers/record-view-body-click-handler.ts +0 -33
  116. package/src/record-view/event-handlers/record-view-body-keydown-handler.ts +0 -26
  117. package/src/record-view/index.ts +0 -2
  118. package/src/record-view/ox-record-creator.ts +0 -289
  119. package/src/record-view/record-view-body.ts +0 -257
  120. package/src/record-view/record-view-handler.ts +0 -86
  121. package/src/record-view/record-view.ts +0 -122
  122. package/src/renderers/index.ts +0 -14
  123. package/src/renderers/ox-grist-renderer-boolean.ts +0 -43
  124. package/src/renderers/ox-grist-renderer-color.ts +0 -15
  125. package/src/renderers/ox-grist-renderer-date.ts +0 -62
  126. package/src/renderers/ox-grist-renderer-file.ts +0 -31
  127. package/src/renderers/ox-grist-renderer-image.ts +0 -27
  128. package/src/renderers/ox-grist-renderer-json5.ts +0 -36
  129. package/src/renderers/ox-grist-renderer-link.ts +0 -17
  130. package/src/renderers/ox-grist-renderer-password.ts +0 -7
  131. package/src/renderers/ox-grist-renderer-progress.ts +0 -45
  132. package/src/renderers/ox-grist-renderer-select.ts +0 -58
  133. package/src/renderers/ox-grist-renderer-text.ts +0 -16
  134. package/src/renderers/ox-grist-renderer-textarea.ts +0 -7
  135. package/src/renderers/ox-grist-renderer-tree.ts +0 -189
  136. package/src/renderers/ox-grist-renderer.ts +0 -35
  137. package/src/renderers/registry.ts +0 -111
  138. package/src/sorters/sorters-control.ts +0 -143
  139. package/src/types.ts +0 -813
  140. package/src/utils/index.ts +0 -2
  141. package/src/utils/list-param.ts +0 -72
  142. package/src/utils/supports-passive.ts +0 -13
  143. package/stories/accumulator-format.stories.ts +0 -276
  144. package/stories/barcode-input-filter.stories.ts +0 -216
  145. package/stories/bounded-select-filters.stories.ts +0 -333
  146. package/stories/bounded-select-record.stories.ts +0 -336
  147. package/stories/click-event-custom.stories.ts +0 -287
  148. package/stories/click-event.stories.ts +0 -283
  149. package/stories/creatable-only-column.stories.ts +0 -253
  150. package/stories/default-filters.stories.ts +0 -241
  151. package/stories/dynamic-editable.stories.ts +0 -313
  152. package/stories/empty-sorters.stories.ts +0 -180
  153. package/stories/explicit-fetch.stories.ts +0 -186
  154. package/stories/fixed-column.stories.ts +0 -416
  155. package/stories/grid-setting.stories.ts +0 -501
  156. package/stories/grist-modes.stories.ts +0 -451
  157. package/stories/group-header.stories.ts +0 -442
  158. package/stories/record-view.stories.ts +0 -143
  159. package/stories/textarea.stories.ts +0 -261
  160. package/stories/tree-column-with-checkbox.stories.ts +0 -297
  161. package/stories/tree-column.stories.ts +0 -296
  162. package/tsconfig.json +0 -26
  163. package/web-dev-server.config.mjs +0 -27
  164. package/web-test-runner.config.mjs +0 -45
@@ -1,226 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { PropertyValues, css, html, nothing } from 'lit'
6
- import { customElement, property, query, state } from 'lit/decorators.js'
7
- import { ifDefined } from 'lit/directives/if-defined.js'
8
-
9
- import { OxFormField } from '@operato/input'
10
- import { GristRecord } from '../types'
11
-
12
- @customElement('ox-input-tree')
13
- export class OxInputTree extends OxFormField {
14
- static styles = css`
15
- :host {
16
- overflow: hidden;
17
- }
18
-
19
- div[wrap] {
20
- flex: 1;
21
-
22
- position: relative;
23
-
24
- display: flex;
25
- align-items: center;
26
- gap: 6px;
27
-
28
- padding-left: calc(var(--tree-depth, 0) * 18px);
29
- }
30
-
31
- span[expander] {
32
- display: inline-block;
33
- vertical-align: middle;
34
- width: 12px;
35
- height: 20px;
36
- cursor: pointer;
37
- position: relative;
38
- }
39
-
40
- span[expander][collapsed]::before {
41
- position: absolute;
42
- top: 50%;
43
- left: 50%;
44
- transform: translate(-25%, -50%) rotate(-90deg);
45
- content: ' ';
46
- border: 5px solid transparent;
47
- border-top: 5px solid var(--md-sys-color-on-primary-container, #1890ff);
48
- }
49
-
50
- span[expander][expanded]::before {
51
- position: absolute;
52
- top: 50%;
53
- left: 50%;
54
- transform: translate(-50%, -25%);
55
- content: ' ';
56
- border: 5px solid transparent;
57
- border-top: 5px solid var(--md-sys-color-on-primary-container, #1890ff);
58
- }
59
-
60
- span[checkbox] {
61
- display: inline-block;
62
- vertical-align: middle;
63
- width: 12px;
64
- height: 20px;
65
- cursor: pointer;
66
- position: relative;
67
- }
68
-
69
- span[checkbox]::before {
70
- cursor: pointer;
71
- position: absolute;
72
- top: 50%;
73
- left: 50%;
74
- transform: translate(-50%, -50%);
75
- content: ' ';
76
- display: block;
77
- width: 10px;
78
- height: 10px;
79
- border: 1px solid var(--md-sys-color-on-primary-container, #1890ff);
80
- border-radius: 2px;
81
- }
82
-
83
- span[checkbox][checked='checked']::before {
84
- background-color: var(--md-sys-color-on-primary-container, #1890ff);
85
- border-color: var(--md-sys-color-on-primary-container, #1890ff);
86
- }
87
-
88
- span[checkbox][checked='checked']::after {
89
- position: absolute;
90
- content: ' ';
91
- display: block;
92
- top: 50%;
93
- left: 50%;
94
- width: 3px;
95
- height: 7px;
96
- border: 2px solid #fff;
97
- border-top: none;
98
- border-left: none;
99
- -webkit-transform: translate(-50%, -50%) rotate(45deg);
100
- -ms-transform: translate(-50%, -50%) rotate(45deg);
101
- transform: translate(-50%, -50%) rotate(45deg);
102
- }
103
-
104
- span[checkbox][checked='half-checked']::before {
105
- background-color: var(--md-sys-color-on-primary-container, #1890ff);
106
- border-color: var(--md-sys-color-on-primary-container, #1890ff);
107
- }
108
-
109
- span[checkbox][checked='half-checked']::after {
110
- position: absolute;
111
- content: ' ';
112
- display: block;
113
- top: 50%;
114
- left: 50%;
115
- transform: translate(-50%, -50%);
116
- width: 10px;
117
- height: 2px;
118
- background-color: var(--md-sys-color-surface);
119
- }
120
-
121
- span[label] {
122
- flex: 1;
123
- }
124
-
125
- input {
126
- width: 100%;
127
- height: 100%;
128
- border: 0;
129
- background-color: transparent;
130
- box-sizing: border-box;
131
- }
132
-
133
- input:focus {
134
- outline: none;
135
- }
136
- `
137
-
138
- @property({ type: Object }) record!: GristRecord
139
- @property({ type: Boolean }) selectable?: boolean
140
-
141
- @state() private checked?: 'checked' | 'half-checked' | 'unchecked'
142
- @state() private expanded?: boolean = false
143
-
144
- @query('input') input!: HTMLInputElement
145
-
146
- render() {
147
- var { __children__ } = this.record
148
-
149
- const expandable = __children__ && __children__.length > 0
150
-
151
- return html`
152
- <div wrap>
153
- ${expandable
154
- ? html`
155
- <span
156
- expander
157
- @click=${this.onClickExpander.bind(this)}
158
- ?expanded=${this.expanded}
159
- ?collapsed=${!this.expanded}
160
- ></span>
161
- `
162
- : html`<span expander></span>`}
163
- ${this.selectable
164
- ? html` <span checkbox @click=${this.onClickCheckbox.bind(this)} checked=${ifDefined(this.checked)}></span>`
165
- : nothing}
166
-
167
- <span label
168
- ><input
169
- value=${ifDefined(this.value)}
170
- @change=${(e: Event) => {
171
- e.stopPropagation()
172
- this.value = (e.target as HTMLInputElement).value
173
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
174
- }}
175
- focus
176
- /></span>
177
-
178
- <!-- <span label>${this.value}</span> -->
179
- </div>
180
- `
181
- }
182
-
183
- updated(changes: PropertyValues<this>) {
184
- var { __depth__, __check_in_tree__, __expanded__ } = this.record
185
- this.checked = __check_in_tree__
186
- this.expanded = __expanded__
187
-
188
- this.style.setProperty('--tree-depth', String(__depth__))
189
- }
190
-
191
- focus() {
192
- this.input.focus()
193
- }
194
-
195
- select() {
196
- this.input.select()
197
- }
198
-
199
- onClickCheckbox(e: MouseEvent) {
200
- e.stopPropagation()
201
-
202
- this.dispatchEvent(
203
- new CustomEvent('check-in-tree', {
204
- bubbles: true,
205
- composed: true,
206
- detail: this.record
207
- })
208
- )
209
-
210
- this.requestUpdate()
211
- }
212
-
213
- onClickExpander(e: MouseEvent) {
214
- e.stopPropagation()
215
-
216
- this.dispatchEvent(
217
- new CustomEvent(this.record.__expanded__ ? 'collapse-node' : 'expand-node', {
218
- bubbles: true,
219
- composed: true,
220
- detail: this.record
221
- })
222
- )
223
-
224
- this.requestUpdate()
225
- }
226
- }
@@ -1,82 +0,0 @@
1
- import { DataGridField } from '../data-grid/data-grid-field'
2
- import { ColumnConfig, FieldEditor, GristRecord } from '../types'
3
- import { OxGristEditor } from './ox-grist-editor'
4
- import { OxGristEditorCheckbox } from './ox-grist-editor-checkbox'
5
- import { OxGristEditorColor } from './ox-grist-editor-color'
6
- import { OxGristEditorDate } from './ox-grist-editor-date'
7
- import { OxGristEditorDateTime } from './ox-grist-editor-datetime'
8
- import { OxGristEditorEmail } from './ox-grist-editor-email'
9
- import { OxGristEditorFile } from './ox-grist-editor-file'
10
- import { OxGristEditorImage } from './ox-grist-editor-image'
11
- import { OxGristEditorMonth } from './ox-grist-editor-month'
12
- import { OxGristEditorMultipleSelect } from './ox-grist-editor-multiple-select'
13
- import { OxGristEditorNumber } from './ox-grist-editor-number'
14
- import { OxGristEditorPassword } from './ox-grist-editor-password'
15
- import { OxGristEditorSelect } from './ox-grist-editor-select'
16
- import { OxGristEditorTel } from './ox-grist-editor-tel'
17
- import { OxGristEditorText } from './ox-grist-editor-text'
18
- import { OxGristEditorTextarea } from './ox-grist-editor-textarea'
19
- import { OxGristEditorTime } from './ox-grist-editor-time'
20
- import { OxGristEditorTree } from './ox-grist-editor-tree'
21
- import { OxGristEditorWeek } from './ox-grist-editor-week'
22
- import { OxGristEditorVarname } from './ox-grist-editor-varname'
23
-
24
- var EDITORS: { [name: string]: { new (): OxGristEditor } } = {
25
- string: OxGristEditorText,
26
- text: OxGristEditorText,
27
- textarea: OxGristEditorTextarea,
28
- email: OxGristEditorEmail,
29
- tel: OxGristEditorTel,
30
- password: OxGristEditorPassword,
31
- integer: OxGristEditorNumber,
32
- float: OxGristEditorNumber,
33
- number: OxGristEditorNumber,
34
- select: OxGristEditorSelect,
35
- boolean: OxGristEditorCheckbox,
36
- checkbox: OxGristEditorCheckbox,
37
- month: OxGristEditorMonth,
38
- week: OxGristEditorWeek,
39
- date: OxGristEditorDate,
40
- time: OxGristEditorTime,
41
- datetime: OxGristEditorDateTime,
42
- color: OxGristEditorColor,
43
- progress: OxGristEditorNumber,
44
- link: OxGristEditorText,
45
- image: OxGristEditorImage,
46
- file: OxGristEditorFile,
47
- 'string[]': OxGristEditorMultipleSelect,
48
- tree: OxGristEditorTree,
49
- varname: OxGristEditorVarname
50
- }
51
-
52
- export function registerEditor(type: string, editor: { new (): OxGristEditor }) {
53
- EDITORS[type] = editor
54
- }
55
-
56
- export function unregisterEditor(type: string) {
57
- delete EDITORS[type]
58
- }
59
-
60
- export function getEditors(): { [name: string]: { new (): OxGristEditor } } {
61
- return { ...EDITORS }
62
- }
63
-
64
- export function getEditor(type: string): FieldEditor {
65
- if (typeof type == 'function') {
66
- return type
67
- }
68
-
69
- return function (value: any, column: ColumnConfig, record: GristRecord, rowIndex: number, field: DataGridField) {
70
- var clazz = EDITORS[type || 'text'] || OxGristEditorText
71
-
72
- var element = new clazz()
73
-
74
- element.value = value
75
- element.record = record
76
- element.column = column
77
- element.row = rowIndex
78
- element.field = field
79
-
80
- return element
81
- }
82
- }
package/src/empty-note.ts DELETED
@@ -1,46 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
-
3
- import { LitElement, css, html } from 'lit'
4
- import { customElement, property } from 'lit/decorators.js'
5
-
6
- @customElement('ox-empty-note')
7
- export class EmptyNote extends LitElement {
8
- static styles = css`
9
- :host {
10
- display: block;
11
- text-align: center;
12
- }
13
-
14
- md-icon {
15
- font: var(--oops-note-icon-font);
16
- color: var(--oops-note-icon-color);
17
- border: var(--oops-note-icon-border);
18
- border-radius: var(--oops-note-icon-border-radius);
19
- padding: var(--oops-note-icon-padding);
20
- }
21
-
22
- [titler] {
23
- margin: var(--oops-note-title-margin);
24
- font: var(--oops-note-title-font);
25
- color: var(--oops-note-title-color);
26
- text-transform: capitalize;
27
- }
28
-
29
- [description] {
30
- font: var(--oops-note-description-font);
31
- color: var(--oops-note-description-color);
32
- }
33
- `
34
-
35
- @property() icon?: string
36
- @property() title!: string
37
- @property() description?: string
38
-
39
- render() {
40
- return html`
41
- ${this.icon ? html`<md-icon>${this.icon}</md-icon>` : html``}
42
- <div titler>${this.title}</div>
43
- ${this.description ? html`<div description>${this.description}</div>` : html``}
44
- `
45
- }
46
- }
@@ -1,49 +0,0 @@
1
- import '@operato/input/ox-checkbox.js'
2
-
3
- import { html } from 'lit-html'
4
-
5
- import { FilterConfigObject, FilterSelectRenderer } from '../types.js'
6
-
7
- export const FilterCheckbox: FilterSelectRenderer = (column, value, owner) => {
8
- const { name, header, label, filter } = column
9
-
10
- const { label: filterLabel, operator } = filter! as FilterConfigObject
11
-
12
- const labelText =
13
- filterLabel !== undefined
14
- ? filterLabel
15
- : typeof label === 'object' && label.renderer
16
- ? label.renderer(column)
17
- : header.renderer(column) || name
18
-
19
- // 텍스트 형태로 받았을시 의도가 boolean이면 boolean 타입으로 변환
20
- if (value === 'false') {
21
- value = false;
22
- } else if (value === 'true') {
23
- value = true;
24
- }
25
-
26
- return html`
27
- <ox-checkbox
28
- name=${column.name}
29
- ?checked=${value}
30
- indeterminatable
31
- ?indeterminate=${value === undefined}
32
- left-label
33
- @change=${(e: CustomEvent) => {
34
- ;(e.target as HTMLElement).dispatchEvent(
35
- new CustomEvent('filter-change', {
36
- bubbles: true,
37
- composed: true,
38
- detail: {
39
- name,
40
- operator,
41
- value: (e.target as Element & { checked: boolean | undefined }).checked
42
- }
43
- })
44
- )
45
- }}
46
- ><label filter-title><span>${labelText}</span></label></ox-checkbox
47
- >
48
- `
49
- }
@@ -1,34 +0,0 @@
1
- import '@operato/input/ox-input-barcode.js'
2
-
3
- import { html } from 'lit-html'
4
-
5
- import { FilterConfigObject, FilterSelectRenderer } from '../types.js'
6
-
7
- export const FilterInputBarcode: FilterSelectRenderer = (column, value, owner) => {
8
- const filter = column.filter as FilterConfigObject
9
- const { englishOnly, selectAfterChange } = filter.options || {}
10
-
11
- return html`
12
- <ox-input-barcode
13
- name=${column.name}
14
- ?english-only=${englishOnly}
15
- ?select-after-change=${selectAfterChange}
16
- .value=${value == null ? '' : value}
17
- @change=${(e: CustomEvent) => {
18
- const input = e.target as HTMLInputElement
19
- input.dispatchEvent(
20
- new CustomEvent('filter-change', {
21
- bubbles: true,
22
- composed: true,
23
- detail: {
24
- name: column.name,
25
- operator: filter.operator,
26
- value: input.value
27
- }
28
- })
29
- )
30
- }}
31
- filter-input
32
- ></ox-input-barcode>
33
- `
34
- }
@@ -1,30 +0,0 @@
1
- import { html } from 'lit-html'
2
-
3
- import { FilterConfigObject, FilterSelectRenderer } from '../types'
4
-
5
- export const FilterInput: FilterSelectRenderer = (column, value, owner) => {
6
- const filter = column.filter as FilterConfigObject
7
- const type = filter?.type || column.type
8
-
9
- return html`
10
- <input
11
- type=${type as any}
12
- name=${column.name}
13
- .value=${value == null ? '' : value}
14
- @change=${(e: CustomEvent) => {
15
- const input = e.target as HTMLInputElement
16
- input.dispatchEvent(
17
- new CustomEvent('filter-change', {
18
- bubbles: true,
19
- composed: true,
20
- detail: {
21
- name: column.name,
22
- operator: filter.operator,
23
- value: input.value
24
- }
25
- })
26
- )
27
- }}
28
- />
29
- `
30
- }
@@ -1,81 +0,0 @@
1
- import { FilterConfigObject, FilterSelectRenderer } from '../types'
2
-
3
- import { html } from 'lit-html'
4
-
5
- function formatDate(type: string, date: Date) {
6
- var year = date.getFullYear()
7
- var month = ('0' + (date.getMonth() + 1)).slice(-2)
8
- var day = ('0' + date.getDate()).slice(-2)
9
- var hours = ('0' + date.getHours()).slice(-2)
10
- var minutes = ('0' + date.getMinutes()).slice(-2)
11
-
12
- var formatDate = year + '-' + month + '-' + day
13
-
14
- return type == 'date' ? formatDate : formatDate + 'T' + hours + ':' + minutes
15
- }
16
-
17
- export const FilterRangeDate: FilterSelectRenderer = (column, value, owner) => {
18
- const filter = column.filter as FilterConfigObject
19
-
20
- var [from, to] = value instanceof Array ? value : []
21
-
22
- var type: any = filter?.type || column.type
23
- if (type === 'datetime') {
24
- type = 'datetime-local'
25
- }
26
-
27
- from = formatDate(type, new Date(from))
28
- to = formatDate(type, new Date(to))
29
-
30
- return html`
31
- <input
32
- name=${column.name}
33
- type=${type}
34
- .value=${from}
35
- from
36
- @keyup=${(e: KeyboardEvent) => {
37
- if (e.key !== 'Enter') {
38
- return
39
- }
40
- ;(e.target as HTMLElement).dispatchEvent(
41
- new CustomEvent('filter-change', {
42
- bubbles: true,
43
- composed: true,
44
- detail: {
45
- name: column.name,
46
- operator: filter.operator,
47
- value: Array.from(
48
- (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')
49
- ).map(input => (input as HTMLInputElement).value)
50
- }
51
- })
52
- )
53
- }}
54
- />
55
- ~
56
- <input
57
- name=${column.name}
58
- type=${type}
59
- .value=${to}
60
- to
61
- @keyup=${(e: KeyboardEvent) => {
62
- if (e.key !== 'Enter') {
63
- return
64
- }
65
- ;(e.target as HTMLElement).dispatchEvent(
66
- new CustomEvent('filter-change', {
67
- bubbles: true,
68
- composed: true,
69
- detail: {
70
- name: column.name,
71
- operator: filter.operator,
72
- value: Array.from(
73
- (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')
74
- ).map(input => (input as HTMLInputElement).value)
75
- }
76
- })
77
- )
78
- }}
79
- />
80
- `
81
- }
@@ -1,64 +0,0 @@
1
- import { FilterConfigObject, FilterSelectRenderer } from '../types'
2
-
3
- import { html } from 'lit-html'
4
-
5
- export const FilterRangeNumber: FilterSelectRenderer = (column, value, owner) => {
6
- const filter = column.filter as FilterConfigObject
7
- const type = filter?.type || column.type
8
-
9
- const [from, to] = value instanceof Array ? value : []
10
-
11
- return html`
12
- <input
13
- name=${column.name}
14
- type="number"
15
- placeholder="minimum"
16
- .value=${from}
17
- from
18
- @keyup=${(e: KeyboardEvent) => {
19
- if (e.key !== 'Enter') {
20
- return
21
- }
22
- ;(e.target as HTMLElement).dispatchEvent(
23
- new CustomEvent('filter-change', {
24
- bubbles: true,
25
- composed: true,
26
- detail: {
27
- name: column.name,
28
- operator: filter.operator,
29
- value: Array.from(
30
- (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')
31
- ).map(input => (input as HTMLInputElement).value)
32
- }
33
- })
34
- )
35
- }}
36
- />
37
- ~
38
- <input
39
- name=${column.name}
40
- type="number"
41
- placeholder="maximum"
42
- .value=${to}
43
- to
44
- @keyup=${(e: KeyboardEvent) => {
45
- if (e.key !== 'Enter') {
46
- return
47
- }
48
- ;(e.target as HTMLElement).dispatchEvent(
49
- new CustomEvent('filter-change', {
50
- bubbles: true,
51
- composed: true,
52
- detail: {
53
- name: column.name,
54
- operator: filter.operator,
55
- value: Array.from(
56
- (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')
57
- ).map(input => (input as HTMLInputElement).value)
58
- }
59
- })
60
- )
61
- }}
62
- />
63
- `
64
- }
@@ -1,60 +0,0 @@
1
- import '@operato/input/ox-input-select-buttons.js'
2
-
3
- import { FilterConfigObject, FilterSelectRenderer } from '../types'
4
-
5
- import { html } from 'lit-html'
6
-
7
- export const FilterSelectButtons: FilterSelectRenderer = (column, value, owner) => {
8
- const filter = column.filter as FilterConfigObject
9
- const operator = filter?.operator
10
-
11
- var options = filter?.options || column.record.options || []
12
-
13
- if (typeof options === 'function') {
14
- if (!filter?.options) {
15
- console.warn(
16
- 'ox-grist의 column.filter 속성에서는 column.record.options의 함수형 options을 사용할 수 없으므로, filter 속성에서 재지정해야한다.'
17
- )
18
- }
19
- options = options.call(column, owner)
20
- }
21
-
22
- options = options.map((option: any) => {
23
- switch (typeof option) {
24
- case 'string':
25
- return {
26
- display: option,
27
- value: option
28
- }
29
- case 'object':
30
- return {
31
- display: option.display,
32
- value: option.value
33
- }
34
- default:
35
- return option
36
- }
37
- })
38
-
39
- return html`
40
- <ox-input-select-buttons
41
- name=${column.name}
42
- .value=${value}
43
- .options=${options}
44
- ?multiple=${operator === 'in'}
45
- @change=${(e: CustomEvent) => {
46
- ;(e.target as HTMLElement).dispatchEvent(
47
- new CustomEvent('filter-change', {
48
- bubbles: true,
49
- composed: true,
50
- detail: {
51
- name: column.name,
52
- operator: filter.operator,
53
- value: (e.target as HTMLInputElement).value
54
- }
55
- })
56
- )
57
- }}
58
- ></ox-input-select-buttons>
59
- `
60
- }