@operato/input 1.0.0-alpha.9 → 1.0.0-beta.10

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 (101) hide show
  1. package/CHANGELOG.md +709 -0
  2. package/assets/images/icon-properties-line-type.png +0 -0
  3. package/assets/images/icon-properties-table.png +0 -0
  4. package/demo/index-crontab.html +37 -0
  5. package/demo/index-partition-keys.html +71 -0
  6. package/demo/index-select.html +22 -15
  7. package/demo/index-table.html +39 -0
  8. package/demo/index-value-map.html +80 -0
  9. package/demo/index-value-ranges.html +80 -0
  10. package/demo/index-work-shift.html +59 -0
  11. package/demo/index.html +10 -0
  12. package/dist/src/index.d.ts +9 -3
  13. package/dist/src/index.js +9 -3
  14. package/dist/src/index.js.map +1 -1
  15. package/dist/src/ox-checkbox.d.ts +1 -1
  16. package/dist/src/ox-checkbox.js +1 -1
  17. package/dist/src/ox-checkbox.js.map +1 -1
  18. package/dist/src/ox-form-field.d.ts +2 -2
  19. package/dist/src/ox-form-field.js.map +1 -1
  20. package/dist/src/ox-input-barcode.d.ts +1 -1
  21. package/dist/src/ox-input-barcode.js +1 -1
  22. package/dist/src/ox-input-barcode.js.map +1 -1
  23. package/dist/src/ox-input-code.d.ts +1 -1
  24. package/dist/src/ox-input-code.js +12 -7
  25. package/dist/src/ox-input-code.js.map +1 -1
  26. package/dist/src/ox-input-color-gradient.d.ts +4 -4
  27. package/dist/src/ox-input-color-gradient.js +3 -3
  28. package/dist/src/ox-input-color-gradient.js.map +1 -1
  29. package/dist/src/ox-input-color-stops.js +1 -1
  30. package/dist/src/ox-input-color-stops.js.map +1 -1
  31. package/dist/src/ox-input-crontab.d.ts +23 -0
  32. package/dist/src/ox-input-crontab.js +560 -0
  33. package/dist/src/ox-input-crontab.js.map +1 -0
  34. package/dist/src/ox-input-layout/ox-input-card-layout.d.ts +4 -0
  35. package/dist/src/ox-input-layout/ox-input-card-layout.js +57 -0
  36. package/dist/src/ox-input-layout/ox-input-card-layout.js.map +1 -0
  37. package/dist/src/ox-input-layout/ox-input-grid-layout.d.ts +4 -0
  38. package/dist/src/ox-input-layout/ox-input-grid-layout.js +63 -0
  39. package/dist/src/ox-input-layout/ox-input-grid-layout.js.map +1 -0
  40. package/dist/src/ox-input-layout/ox-input-layout.d.ts +5 -0
  41. package/dist/src/ox-input-layout/ox-input-layout.js +73 -0
  42. package/dist/src/ox-input-layout/ox-input-layout.js.map +1 -0
  43. package/dist/src/ox-input-multiple-colors.d.ts +2 -2
  44. package/dist/src/ox-input-multiple-colors.js +2 -2
  45. package/dist/src/ox-input-multiple-colors.js.map +1 -1
  46. package/dist/src/ox-input-options.js.map +1 -1
  47. package/dist/src/ox-input-partition-keys.d.ts +36 -0
  48. package/dist/src/ox-input-partition-keys.js +204 -0
  49. package/dist/src/ox-input-partition-keys.js.map +1 -0
  50. package/dist/src/ox-input-search.d.ts +1 -0
  51. package/dist/src/ox-input-search.js +7 -3
  52. package/dist/src/ox-input-search.js.map +1 -1
  53. package/dist/src/ox-input-table.d.ts +8 -0
  54. package/dist/src/ox-input-table.js +379 -0
  55. package/dist/src/ox-input-table.js.map +1 -0
  56. package/dist/src/ox-input-value-map.d.ts +41 -0
  57. package/dist/src/ox-input-value-map.js +279 -0
  58. package/dist/src/ox-input-value-map.js.map +1 -0
  59. package/dist/src/ox-input-value-ranges.d.ts +41 -0
  60. package/dist/src/ox-input-value-ranges.js +298 -0
  61. package/dist/src/ox-input-value-ranges.js.map +1 -0
  62. package/dist/src/ox-input-work-shift.d.ts +33 -0
  63. package/dist/src/ox-input-work-shift.js +229 -0
  64. package/dist/src/ox-input-work-shift.js.map +1 -0
  65. package/dist/src/ox-select.d.ts +3 -0
  66. package/dist/src/ox-select.js +28 -3
  67. package/dist/src/ox-select.js.map +1 -1
  68. package/dist/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +18 -8
  70. package/src/index.ts +9 -3
  71. package/src/ox-checkbox.ts +2 -2
  72. package/src/ox-form-field.ts +2 -2
  73. package/src/ox-input-barcode.ts +2 -3
  74. package/src/ox-input-code.ts +14 -8
  75. package/src/{ox-input-color-gradient.ts.xxx → ox-input-color-gradient.ts} +4 -4
  76. package/src/ox-input-color-stops.ts +1 -1
  77. package/src/ox-input-crontab.ts +561 -0
  78. package/src/ox-input-layout/ox-input-card-layout.ts +58 -0
  79. package/src/ox-input-layout/ox-input-grid-layout.ts +64 -0
  80. package/src/ox-input-layout/ox-input-layout.ts +77 -0
  81. package/src/ox-input-multiple-colors.ts +2 -2
  82. package/src/ox-input-options.ts +1 -1
  83. package/src/ox-input-partition-keys.ts +243 -0
  84. package/src/ox-input-search.ts +9 -3
  85. package/src/ox-input-table.ts +404 -0
  86. package/src/{ox-input-keyvalues.ts.ing → ox-input-value-map.ts} +120 -89
  87. package/src/ox-input-value-ranges.ts +325 -0
  88. package/src/ox-input-work-shift.ts +251 -0
  89. package/src/ox-select.ts +31 -5
  90. package/dist/src/ox-input-background-pattern.d.ts +0 -31
  91. package/dist/src/ox-input-background-pattern.js +0 -147
  92. package/dist/src/ox-input-background-pattern.js.map +0 -1
  93. package/dist/src/ox-input-fill-style.d.ts +0 -42
  94. package/dist/src/ox-input-fill-style.js +0 -323
  95. package/dist/src/ox-input-fill-style.js.map +0 -1
  96. package/dist/src/ox-input-id.d.ts +0 -11
  97. package/dist/src/ox-input-id.js +0 -68
  98. package/dist/src/ox-input-id.js.map +0 -1
  99. package/src/ox-input-background-pattern.ts.xxx +0 -163
  100. package/src/ox-input-fill-style.ts.xxx +0 -361
  101. package/src/ox-input-ranges.ts.ing +0 -292
@@ -0,0 +1,404 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@material/mwc-icon'
6
+ import '@polymer/paper-dropdown-menu/paper-dropdown-menu'
7
+ import '@polymer/paper-item/paper-item'
8
+ import '@operato/i18n/ox-i18n.js'
9
+ import './ox-input-color.js'
10
+
11
+ import { css, html } from 'lit'
12
+ import { customElement, property, query } from 'lit/decorators.js'
13
+
14
+ import { OxFormField } from './ox-form-field'
15
+
16
+ type BorderStyle =
17
+ | 'solid'
18
+ | 'round-dot'
19
+ | 'square-dot'
20
+ | 'dash'
21
+ | 'dash-dot'
22
+ | 'long-dash'
23
+ | 'long-dash-dot'
24
+ | 'long-dash-dot-dot'
25
+
26
+ /**
27
+ * 테이블 셀의 좌,우,상,하 경계선의 스타일을 편집하는 컴포넌트이다.
28
+ * Example:
29
+ * <ox-input-table value=${border}>
30
+ * </ox-input-table>
31
+ */
32
+
33
+ @customElement('ox-input-table')
34
+ class OxInputTable extends OxFormField {
35
+ static get styles() {
36
+ return [
37
+ css`
38
+ :host {
39
+ display: block;
40
+ }
41
+
42
+ fieldset {
43
+ border: none;
44
+ border-bottom: 1px solid #cfd8dc;
45
+ color: var(--primary-text-color);
46
+ font-size: 12px;
47
+ padding: 0 0 10px 0;
48
+ margin: 0 0 10px 0;
49
+ }
50
+
51
+ fieldset legend {
52
+ padding: 5px 0 0 5px;
53
+ font-size: 11px;
54
+ color: #e46c2e;
55
+ font-weight: bold;
56
+ text-transform: capitalize;
57
+ }
58
+
59
+ .icon-only-label {
60
+ background: url(/assets/images/icon-properties-label.png) no-repeat;
61
+ width: 30px;
62
+ height: 24px;
63
+ }
64
+
65
+ .property-grid {
66
+ display: grid;
67
+ grid-template-columns: repeat(10, 1fr);
68
+ grid-gap: 5px;
69
+ grid-auto-rows: minmax(24px, auto);
70
+ margin: 10px 0 0 0;
71
+ }
72
+
73
+ .property-grid > * {
74
+ line-height: 1.5;
75
+ }
76
+
77
+ #border-set > mwc-icon {
78
+ grid-column: span 2;
79
+ margin: 0 0 0 8px;
80
+ width: 32px;
81
+ height: 32px;
82
+ }
83
+
84
+ .property-grid > label {
85
+ grid-column: span 3;
86
+ text-align: right;
87
+ text-transform: capitalize;
88
+ }
89
+
90
+ .property-grid > label.icon-only-label {
91
+ grid-column: span 1;
92
+ }
93
+
94
+ .property-grid > ox-input-color,
95
+ .property-grid > input[type='number'] {
96
+ grid-column: span 4;
97
+ padding: 0;
98
+ margin: 0;
99
+ }
100
+
101
+ .property-grid > paper-dropdown-menu {
102
+ grid-column: span 7;
103
+ padding: 0;
104
+ margin: 0;
105
+ }
106
+
107
+ [table-event] {
108
+ position: relative;
109
+ background: url('/assets/images/icon-properties-table.png') no-repeat;
110
+ grid-column: span 2;
111
+ min-height: 65px;
112
+ }
113
+
114
+ [table-event] span {
115
+ position: absolute;
116
+ bottom: 0;
117
+ font-size: 0.9em;
118
+ line-height: 1.2;
119
+ text-transform: capitalize;
120
+ text-align: center;
121
+ vertical-align: bottom;
122
+ }
123
+
124
+ #merge-cells {
125
+ background-position: 50% 3px;
126
+ }
127
+
128
+ #split-cells {
129
+ background-position: 50% -97px;
130
+ }
131
+
132
+ #delete-row {
133
+ background-position: 50% -197px;
134
+ }
135
+
136
+ #delete-column {
137
+ background-position: 50% -297px;
138
+ }
139
+
140
+ #insert-above {
141
+ background-position: 50% -397px;
142
+ }
143
+
144
+ #insert-below {
145
+ background-position: 50% -497px;
146
+ }
147
+
148
+ #insert-left {
149
+ background-position: 50% -597px;
150
+ }
151
+
152
+ #insert-right {
153
+ background-position: 50% -697px;
154
+ }
155
+
156
+ #distribute-horizontal {
157
+ background-position: 50% -797px;
158
+ }
159
+
160
+ #distribute-vertical {
161
+ background-position: 50% -897px;
162
+ }
163
+
164
+ .line-type paper-item {
165
+ background: no-repeat url(/assets/images/icon-properties-line-type.png);
166
+ width: 80px;
167
+ min-height: 25px;
168
+ }
169
+ .line-type paper-item.solid {
170
+ background-position: 50% 12px;
171
+ }
172
+ .line-type paper-item.round-dot {
173
+ background-position: 50% -38px;
174
+ }
175
+ .line-type paper-item.square-dot {
176
+ background-position: 50% -88px;
177
+ }
178
+ .line-type paper-item.dash {
179
+ background-position: 50% -138px;
180
+ }
181
+ .line-type paper-item.dash-dot {
182
+ background-position: 50% -188px;
183
+ }
184
+ .line-type paper-item.long-dash {
185
+ background-position: 50% -238px;
186
+ }
187
+ .line-type paper-item.long-dash-dot {
188
+ background-position: 50% -288px;
189
+ }
190
+ .line-type paper-item.long-dash-dot-dot {
191
+ background-position: 50% -338px;
192
+ }
193
+ `
194
+ ]
195
+ }
196
+
197
+ @property({ type: Number }) borderWidth: number = 1
198
+ @property({ type: String }) borderColor: string = 'black'
199
+ @property({ type: String }) borderStyle: BorderStyle = 'solid'
200
+ @property({ type: Object }) value: any
201
+
202
+ @query('#border-fieldset') borderFieldSet!: HTMLElement
203
+
204
+ firstUpdated() {
205
+ this.borderFieldSet.addEventListener('change', this._onClickType.bind(this))
206
+ }
207
+
208
+ render() {
209
+ return html`
210
+ <fieldset id="border-fieldset">
211
+ <legend><ox-i18n msgid="label.border-style">border style</ox-i18n></legend>
212
+
213
+ <div
214
+ id="border-set"
215
+ class="property-grid
216
+ border-style-btn"
217
+ @click=${(e: Event) => this._onClickType(e)}
218
+ >
219
+ <mwc-icon data-value="out">border_outer</mwc-icon>
220
+ <mwc-icon data-value="in">border_inner</mwc-icon>
221
+ <mwc-icon data-value="all">border_all</mwc-icon>
222
+ <mwc-icon data-value="left">border_left</mwc-icon>
223
+ <mwc-icon data-value="center">border_vertical</mwc-icon>
224
+ <mwc-icon data-value="right">border_right</mwc-icon>
225
+ <mwc-icon data-value="top">border_top</mwc-icon>
226
+ <mwc-icon data-value="middle">border_horizontal</mwc-icon>
227
+ <mwc-icon data-value="bottom">border_bottom</mwc-icon>
228
+ <mwc-icon data-value="clear">border_clear</mwc-icon>
229
+ </div>
230
+
231
+ <div class="property-grid">
232
+ <label class="icon-only-label linewidth"> </label>
233
+ <input
234
+ type="number"
235
+ id="border-width"
236
+ @change=${(e: Event) => (this.borderWidth = Number((e.target as HTMLInputElement).value))}
237
+ .value=${this.borderWidth}
238
+ />
239
+
240
+ <label class="icon-only-label color"> </label>
241
+ <ox-input-color
242
+ id="border-color"
243
+ @change=${(e: Event) => (this.borderColor = (e.target as any).value)}
244
+ .value=${this.borderColor}
245
+ >
246
+ </ox-input-color>
247
+
248
+ <label> <ox-i18n msgid="label.border-type">border type</ox-i18n> </label>
249
+ <paper-dropdown-menu no-label-float="true" class="line-type solid">
250
+ <!-- solid는 선택된 항목 보여주기위한 class로 하위 paper-item의 class와 동일하게 -->
251
+ <paper-listbox
252
+ id="border-style"
253
+ @iron-select=${(e: Event) => (this.borderStyle = (e.target as any).selected)}
254
+ slot="dropdown-content"
255
+ .selected=${this.borderStyle}
256
+ attr-for-selected="name"
257
+ >
258
+ <paper-item class="solid" name="solid"></paper-item>
259
+ <paper-item class="round-dot" name="round-dot"></paper-item>
260
+ <paper-item class="square-dot" name="square-dot"></paper-item>
261
+ <paper-item class="dash" name="dash"></paper-item>
262
+ <paper-item class="dash-dot" name="dash-dot"></paper-item>
263
+ <paper-item class="long-dash" name="long-dash"></paper-item>
264
+ <paper-item class="long-dash-dot" name="long-dash-dot"></paper-item>
265
+ <paper-item class="long-dash-dot-dot" name="long-dash-dot-dot"></paper-item>
266
+ </paper-listbox>
267
+ </paper-dropdown-menu>
268
+ </div>
269
+ </fieldset>
270
+
271
+ <fieldset id="cell-fieldset" @click=${(e: Event) => this._onClickCell(e)}>
272
+ <div class="property-grid">
273
+ <div id="merge-cells" table-event><span>merge cells</span></div>
274
+ <div id="split-cells" table-event><span>split cells</span></div>
275
+ <div id="delete-row" table-event><span>delete row</span></div>
276
+ <div id="delete-column" table-event><span>delete column</span></div>
277
+ <div id="insert-above" table-event><span>insert above</span></div>
278
+ <div id="insert-below" table-event><span>insert below</span></div>
279
+ <div id="insert-left" table-event><span>insert left</span></div>
280
+ <div id="insert-right" table-event><span>insert right</span></div>
281
+ <div id="distribute-horizontal" table-event><span>distribute horizontal</span></div>
282
+ <div id="distribute-vertical" table-event><span>distribute vertical</span></div>
283
+ </div>
284
+ </fieldset>
285
+ `
286
+ }
287
+
288
+ _onClickCell(e: Event) {
289
+ var target = e.target as HTMLElement
290
+
291
+ const event = target?.closest('[table-event]')?.getAttribute('id')
292
+ if (!event) {
293
+ return
294
+ }
295
+
296
+ this.dispatchEvent(
297
+ new CustomEvent('i-need-selected', {
298
+ bubbles: true,
299
+ composed: true,
300
+ detail: {
301
+ callback: (selected: any[]) => {
302
+ const table = selected[0].parent
303
+
304
+ switch (event) {
305
+ case 'delete-row':
306
+ table.deleteRows(selected)
307
+ break
308
+ case 'delete-column':
309
+ table.deleteColumns(selected)
310
+ break
311
+ case 'insert-above':
312
+ table.insertCellsAbove(selected)
313
+ break
314
+ case 'insert-below':
315
+ table.insertCellsBelow(selected)
316
+ break
317
+ case 'insert-left':
318
+ table.insertCellsLeft(selected)
319
+ break
320
+ case 'insert-right':
321
+ table.insertCellsRight(selected)
322
+ break
323
+ case 'merge-cells':
324
+ table.mergeCells(selected)
325
+ break
326
+ case 'split-cells':
327
+ table.splitCells(selected)
328
+ break
329
+ case 'distribute-horizontal':
330
+ table.distributeHorizontal(selected)
331
+ break
332
+ case 'distribute-vertical':
333
+ table.distributeVertical(selected)
334
+ break
335
+ }
336
+ }
337
+ }
338
+ })
339
+ )
340
+
341
+ this.value = {
342
+ borderWidth: this.borderWidth,
343
+ borderColor: this.borderColor,
344
+ borderStyle: this.borderStyle
345
+ }
346
+
347
+ this.dispatchEvent(
348
+ new CustomEvent('change', {
349
+ detail: this.value,
350
+ bubbles: true,
351
+ composed: true
352
+ })
353
+ )
354
+
355
+ e.stopPropagation()
356
+ }
357
+
358
+ _onClickType(e: Event) {
359
+ var target = e.target as HTMLElement
360
+
361
+ const where = target?.closest('[data-value]')?.getAttribute('data-value')
362
+ if (!where) {
363
+ return
364
+ }
365
+
366
+ this.dispatchEvent(
367
+ new CustomEvent('i-need-selected', {
368
+ bubbles: true,
369
+ composed: true,
370
+ detail: {
371
+ callback: (selected: any[]) => {
372
+ const table = selected[0].parent
373
+
374
+ table.setCellsStyle(
375
+ selected,
376
+ {
377
+ strokeStyle: this.borderColor,
378
+ lineDash: this.borderStyle,
379
+ lineWidth: this.borderWidth
380
+ },
381
+ where
382
+ )
383
+ }
384
+ }
385
+ })
386
+ )
387
+
388
+ this.value = {
389
+ borderWidth: this.borderWidth,
390
+ borderColor: this.borderColor,
391
+ borderStyle: this.borderStyle
392
+ }
393
+
394
+ this.dispatchEvent(
395
+ new CustomEvent('change', {
396
+ detail: this.value,
397
+ bubbles: true,
398
+ composed: true
399
+ })
400
+ )
401
+
402
+ e.stopPropagation()
403
+ }
404
+ }