@operato/input 8.0.0-alpha.51 → 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 (99) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +7 -7
  4. package/.editorconfig +0 -29
  5. package/.storybook/main.js +0 -3
  6. package/.storybook/preview.js +0 -52
  7. package/.storybook/server.mjs +0 -8
  8. package/src/index.ts +0 -35
  9. package/src/locale/locale-codes.ts +0 -18
  10. package/src/locale/locale-picker.ts +0 -43
  11. package/src/locale/localization.ts +0 -15
  12. package/src/locales/en.ts +0 -30
  13. package/src/locales/ko.ts +0 -30
  14. package/src/locales/ms.ts +0 -30
  15. package/src/locales/zh.ts +0 -30
  16. package/src/ox-buttons-radio.ts +0 -140
  17. package/src/ox-checkbox.ts +0 -181
  18. package/src/ox-form-field.ts +0 -53
  19. package/src/ox-input-3axis.ts +0 -77
  20. package/src/ox-input-3dish.ts +0 -211
  21. package/src/ox-input-angle.ts +0 -73
  22. package/src/ox-input-barcode.ts +0 -318
  23. package/src/ox-input-code.ts +0 -139
  24. package/src/ox-input-color-gradient.ts +0 -349
  25. package/src/ox-input-color-stops.ts +0 -525
  26. package/src/ox-input-color.ts +0 -338
  27. package/src/ox-input-container.ts +0 -32
  28. package/src/ox-input-crontab.ts +0 -595
  29. package/src/ox-input-data.ts +0 -219
  30. package/src/ox-input-direction.ts +0 -92
  31. package/src/ox-input-duration.ts +0 -175
  32. package/src/ox-input-file.ts +0 -209
  33. package/src/ox-input-hashtags.ts +0 -185
  34. package/src/ox-input-i18n-label.ts +0 -140
  35. package/src/ox-input-image.ts +0 -168
  36. package/src/ox-input-key-values.ts +0 -301
  37. package/src/ox-input-layout/ox-input-card-layout.ts +0 -58
  38. package/src/ox-input-layout/ox-input-grid-layout.ts +0 -64
  39. package/src/ox-input-layout/ox-input-layout.ts +0 -77
  40. package/src/ox-input-mass-fraction.ts +0 -437
  41. package/src/ox-input-multiple-colors.ts +0 -135
  42. package/src/ox-input-options.ts +0 -216
  43. package/src/ox-input-partition-keys.ts +0 -303
  44. package/src/ox-input-privilege.ts +0 -163
  45. package/src/ox-input-quantifier.ts +0 -62
  46. package/src/ox-input-range.ts +0 -146
  47. package/src/ox-input-scene-component-id.ts +0 -73
  48. package/src/ox-input-search.ts +0 -126
  49. package/src/ox-input-select-buttons.ts +0 -75
  50. package/src/ox-input-signature.ts +0 -208
  51. package/src/ox-input-stack.ts +0 -136
  52. package/src/ox-input-switch.ts +0 -117
  53. package/src/ox-input-table-column-config.ts +0 -211
  54. package/src/ox-input-table.ts +0 -404
  55. package/src/ox-input-textarea.ts +0 -86
  56. package/src/ox-input-unit-number.ts +0 -354
  57. package/src/ox-input-value-map.ts +0 -342
  58. package/src/ox-input-value-ranges.ts +0 -363
  59. package/src/ox-input-work-shift.ts +0 -290
  60. package/src/ox-select-floor.ts +0 -246
  61. package/src/ox-select.ts +0 -219
  62. package/stories/image-for-select-floor.ts +0 -2
  63. package/stories/ox-buttons-radio.stories.ts +0 -89
  64. package/stories/ox-checkbox.stories.ts +0 -111
  65. package/stories/ox-input-3axis.stories.ts +0 -77
  66. package/stories/ox-input-3dish.stories.ts +0 -106
  67. package/stories/ox-input-angle.stories.ts +0 -84
  68. package/stories/ox-input-barcode.stories.ts +0 -117
  69. package/stories/ox-input-code.stories.ts +0 -99
  70. package/stories/ox-input-crontab.stories.ts +0 -82
  71. package/stories/ox-input-data.stories.ts +0 -82
  72. package/stories/ox-input-direction.stories.ts +0 -91
  73. package/stories/ox-input-duration.stories.ts +0 -84
  74. package/stories/ox-input-file.stories.ts +0 -111
  75. package/stories/ox-input-hashtags.stories.ts +0 -82
  76. package/stories/ox-input-i18n-label.stories.ts +0 -103
  77. package/stories/ox-input-key-values.stories.ts +0 -97
  78. package/stories/ox-input-mass-fraction.stories.ts +0 -102
  79. package/stories/ox-input-multiple-colors.stories.ts +0 -72
  80. package/stories/ox-input-options.stories.ts +0 -80
  81. package/stories/ox-input-partition-keys.stories.ts +0 -84
  82. package/stories/ox-input-privilege.stories.ts +0 -108
  83. package/stories/ox-input-quantifier.stories.ts +0 -80
  84. package/stories/ox-input-range.stories.ts +0 -89
  85. package/stories/ox-input-search.stories.ts +0 -91
  86. package/stories/ox-input-select-buttons.stories.ts +0 -118
  87. package/stories/ox-input-signature.stories.ts +0 -75
  88. package/stories/ox-input-switch.stories.ts +0 -91
  89. package/stories/ox-input-table-column-config.stories.ts +0 -109
  90. package/stories/ox-input-unit.stories.ts +0 -151
  91. package/stories/ox-input-value-map.stories.ts +0 -92
  92. package/stories/ox-input-value-ranges.stories.ts +0 -92
  93. package/stories/ox-input-work-shift.stories.ts +0 -106
  94. package/stories/ox-select-floor.stories.ts +0 -197
  95. package/stories/ox-select-set-options.stories.ts +0 -208
  96. package/stories/ox-select.stories.ts +0 -181
  97. package/tsconfig.json +0 -25
  98. package/web-dev-server.config.mjs +0 -27
  99. package/web-test-runner.config.mjs +0 -41
@@ -1,301 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@material/web/icon/icon.js'
6
-
7
- import { css, html, nothing } from 'lit'
8
- import { customElement, property, queryAll } from 'lit/decorators.js'
9
-
10
- import { OxFormField } from './ox-form-field'
11
-
12
- type KeyValues = { [key: string]: any }
13
- type ArrayedKeyValues = { key: string; value: any }
14
-
15
- /**
16
- input component for key-value map
17
-
18
- Example:
19
-
20
- <ox-input-key-values
21
- value=${map}
22
- </ox-input-key-values>
23
- */
24
- @customElement('ox-input-key-values')
25
- export class OxInputKeyValues extends OxFormField {
26
- static styles = css`
27
- :host {
28
- display: flex;
29
- flex-direction: column;
30
- overflow: hidden;
31
- margin-bottom: var(--spacing-large);
32
-
33
- --md-icon-size: 14px;
34
- }
35
-
36
- div {
37
- display: flex;
38
- flex-flow: row nowrap;
39
- gap: var(--spacing-medium);
40
- margin-bottom: var(--spacing-small);
41
- }
42
-
43
- button {
44
- border: var(--button-border);
45
- border-radius: var(--border-radius);
46
- background-color: var(--button-background-color);
47
- padding: var(--spacing-small) var(--padding-default);
48
- line-height: 0.8;
49
- color: var(--button-color);
50
- cursor: pointer;
51
- }
52
- button + button {
53
- margin-left: -5px;
54
- }
55
- button:focus,
56
- button:hover,
57
- button:active {
58
- border: var(--button-activ-border);
59
- background-color: var(--button-background-focus-color);
60
- color: var(--md-sys-color-primary-container);
61
- }
62
-
63
- input {
64
- flex: 1;
65
- border: 0;
66
- border-bottom: 1px solid rgba(0, 0, 0, 0.15);
67
- padding: var(--spacing-tiny);
68
- font: var(--input-font);
69
- color: var(--md-sys-color-on-primary-container);
70
- min-width: 50px;
71
- }
72
- input:focus {
73
- outline: none;
74
- border-bottom: 1px solid var(--md-sys-color-on-primary-container);
75
- }
76
- button.hidden {
77
- opacity: 0;
78
- cursor: default;
79
- }
80
- `
81
-
82
- @property({ type: Object }) value: KeyValues = {}
83
- @property({ type: Array }) options: { display: string; value: string }[] = []
84
-
85
- private _changingNow: boolean = false
86
-
87
- firstUpdated() {
88
- this.renderRoot.addEventListener('change', this._onChange.bind(this))
89
- }
90
-
91
- render() {
92
- const value = !this.value || typeof this.value !== 'object' ? {} : this.value
93
- const options = this.options || []
94
-
95
- return html`
96
- ${this._toArray(value).map(
97
- item => html`
98
- <div data-record>
99
- <input type="text" data-key placeholder="key" .value=${item.key} ?disabled=${this.disabled} />
100
- <input
101
- type="text"
102
- data-value
103
- placeholder="value"
104
- .value=${item.value}
105
- list="value-template"
106
- ?disabled=${this.disabled}
107
- />
108
- <button
109
- class="record-action"
110
- @click=${(e: MouseEvent) => this._delete(e)}
111
- tabindex="-1"
112
- ?disabled=${this.disabled}
113
- >
114
- <md-icon>remove</md-icon>
115
- </button>
116
- <button
117
- class="record-action"
118
- @click=${(e: MouseEvent) => this._up(e)}
119
- tabindex="-1"
120
- ?disabled=${this.disabled}
121
- >
122
- <md-icon>arrow_upward</md-icon>
123
- </button>
124
- <button
125
- class="record-action"
126
- @click=${(e: MouseEvent) => this._down(e)}
127
- tabindex="-1"
128
- ?disabled=${this.disabled}
129
- >
130
- <md-icon>arrow_downward</md-icon>
131
- </button>
132
- </div>
133
- `
134
- )}
135
- ${this.disabled
136
- ? nothing
137
- : html`
138
- <div data-record-new>
139
- <input type="text" data-key placeholder="key" value="" />
140
- <input type="text" data-value placeholder="value" value="" list="value-template" />
141
- <button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
142
- <md-icon>add</md-icon>
143
- </button>
144
- <button class="hidden"><md-icon>add</md-icon></button>
145
- <button class="hidden"><md-icon>add</md-icon></button>
146
- </div>
147
- `}
148
-
149
- <datalist id="value-template">
150
- ${options.map(({ display, value }) => html` <option value="${value}">${display}</option> `)}
151
- </datalist>
152
- `
153
- }
154
-
155
- _onChange(e: Event) {
156
- if (this._changingNow) {
157
- return
158
- }
159
-
160
- this._changingNow = true
161
-
162
- const input = e.target as HTMLInputElement
163
-
164
- const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement
165
-
166
- if (record.hasAttribute('data-record')) {
167
- this._build()
168
- } else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {
169
- this._add()
170
- }
171
-
172
- this._changingNow = false
173
- }
174
-
175
- _build(includeNewRecord?: boolean) {
176
- if (includeNewRecord) {
177
- var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>
178
- } else {
179
- var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>
180
- }
181
-
182
- var newmap: KeyValues = {}
183
-
184
- for (var i = 0; i < records.length; i++) {
185
- var record = records[i]
186
-
187
- const key = (record.querySelector('[data-key]') as HTMLInputElement).value
188
- const inputs = record.querySelectorAll(
189
- '[data-value]:not([style*="display: none"])'
190
- ) as NodeListOf<HTMLInputElement>
191
-
192
- if (!inputs || inputs.length == 0) {
193
- continue
194
- }
195
-
196
- var input = inputs[inputs.length - 1]
197
-
198
- var value = input.value
199
-
200
- if (key) {
201
- newmap[key] = value || ''
202
- }
203
- }
204
-
205
- this.value = newmap
206
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
207
- }
208
-
209
- /* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */
210
- _toArray(map: KeyValues) {
211
- var array: ArrayedKeyValues[] = []
212
-
213
- for (var key in map) {
214
- array.push({
215
- key: key,
216
- value: map[key]
217
- })
218
- }
219
-
220
- return array
221
- }
222
-
223
- _add() {
224
- this._build(true)
225
-
226
- const inputs = this.renderRoot.querySelectorAll(
227
- '[data-record-new] input:not([style*="display: none"])'
228
- ) as NodeListOf<HTMLInputElement & { value: any }>
229
-
230
- for (var i = 0; i < inputs.length; i++) {
231
- let input = inputs[i]
232
-
233
- if (input.type == 'checkbox') input.checked = false
234
- else input.value = ''
235
- }
236
-
237
- inputs[0].focus()
238
- }
239
-
240
- _delete(e: MouseEvent) {
241
- const record = (e.target as Element).closest('[data-record]') as HTMLElement
242
-
243
- ;(record!.querySelector('[data-key]') as HTMLInputElement)!.value = ''
244
-
245
- this._build()
246
- }
247
-
248
- @queryAll('[data-record]') records!: NodeListOf<HTMLElement>
249
-
250
- _up(e: MouseEvent) {
251
- const record = (e.target as Element).closest('[data-record]') as HTMLElement
252
- const array = Array.from(this.records)
253
- const index = array.indexOf(record) - 1
254
-
255
- if (index < 0) {
256
- return
257
- }
258
-
259
- const deleted = array.splice(index, 1)
260
- array.splice(index + 1, 0, ...deleted)
261
-
262
- this.value = array.reduce(
263
- (sum, record) => {
264
- const key = (record.querySelector('[data-key]') as HTMLInputElement).value
265
- const value = (record.querySelector('[data-value]') as HTMLInputElement).value
266
-
267
- sum[key] = value
268
- return sum
269
- },
270
- {} as { [key: string]: string }
271
- )
272
-
273
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
274
- }
275
-
276
- _down(e: MouseEvent) {
277
- const record = (e.target as Element).closest('[data-record]') as HTMLElement
278
- const array = Array.from(this.records)
279
- const index = array.indexOf(record)
280
-
281
- if (index > array.length) {
282
- return
283
- }
284
-
285
- array.splice(index, 1)
286
- array.splice(index + 1, 0, record)
287
-
288
- this.value = array.reduce(
289
- (sum, record) => {
290
- const key = (record.querySelector('[data-key]') as HTMLInputElement).value
291
- const value = (record.querySelector('[data-value]') as HTMLInputElement).value
292
-
293
- sum[key] = value
294
- return sum
295
- },
296
- {} as { [key: string]: string }
297
- )
298
-
299
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
300
- }
301
- }
@@ -1,58 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { LitElement, PropertyValues, css, html } from 'lit'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
-
8
- const DEFAULT = {
9
- activeIndex: 0
10
- }
11
-
12
- @customElement('ox-input-card-layout')
13
- class OxInputCardLayout extends LitElement {
14
- static styles = css`
15
- :host {
16
- display: inline-block;
17
- }
18
- `
19
-
20
- @property({ type: Object }) value: any
21
- @property({ type: Number }) activeIndex: number = 0
22
-
23
- firstUpdated() {
24
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
25
- }
26
-
27
- updated(changes: PropertyValues<this>) {
28
- if (changes.has('value')) {
29
- let { activeIndex } = this.value || DEFAULT
30
-
31
- this.activeIndex = activeIndex
32
- }
33
- }
34
-
35
- render() {
36
- return html`
37
- <label>active index</label>
38
- <input type="number" value-key="activeIndex" .value=${this.activeIndex} />
39
- `
40
- }
41
-
42
- _onValueChange(e: Event) {
43
- var element = e.target as HTMLInputElement
44
- var key = element.getAttribute('value-key') as 'activeIndex'
45
-
46
- if (!key) {
47
- return
48
- }
49
-
50
- this[key] = Number(element.value)
51
-
52
- this.value = {
53
- activeIndex: this.activeIndex
54
- }
55
-
56
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
57
- }
58
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { LitElement, PropertyValues, css, html } from 'lit'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
-
8
- @customElement('ox-input-grid-layout')
9
- class OxInputGridLayout extends LitElement {
10
- static styles = css`
11
- :host {
12
- display: inline-block;
13
- }
14
- `
15
-
16
- @property({ type: Object }) value: any
17
- @property({ type: String }) direction: 'row' | 'column' = 'row'
18
-
19
- firstUpdated() {
20
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
21
- }
22
-
23
- updated(changes: PropertyValues<this>) {
24
- if (changes.has('value')) {
25
- let { direction = 'row' } = this.value || {}
26
-
27
- this.direction = direction
28
- }
29
-
30
- if (changes.has('value')) {
31
- }
32
- }
33
-
34
- render() {
35
- return html`
36
- <label>direction</label>
37
- <select value-key="direction" .value=${this.direction}>
38
- <option value="row" selected>row</option>
39
- <option value="column">column</option>
40
- </select>
41
- `
42
- }
43
-
44
- _onValueChange(e: Event) {
45
- var element = e.target as HTMLSelectElement
46
- var key = element.getAttribute('value-key')
47
-
48
- if (!key) {
49
- return
50
- }
51
-
52
- switch (key) {
53
- case 'direction':
54
- this.direction = element.value as 'row' | 'column'
55
- default:
56
- }
57
-
58
- this.value = {
59
- direction: this.direction
60
- }
61
-
62
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
63
- }
64
- }
@@ -1,77 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import './things-grid-layout'
6
- import './things-card-layout'
7
-
8
- import { LitElement, PropertyValues, html } from 'lit'
9
- import { customElement, property, state } from 'lit/decorators.js'
10
-
11
- // import './things-linear-horizontal-layout'
12
- // import './things-linear-vertical-layout'
13
-
14
- const layouts = ['absolute', 'card', 'grid', 'linear-horizontal', 'linear-vertical', 'table']
15
-
16
- @customElement('ox-input-layout')
17
- class OxInputLayout extends LitElement {
18
- @property({ type: Object }) value: any = {}
19
- @property({ type: String }) layout:
20
- | ''
21
- | 'absolute'
22
- | 'card'
23
- | 'grid'
24
- | 'linear-horizontal'
25
- | 'linear-vertical'
26
- | 'table' = ''
27
- @property({ type: Object }) options: any = {}
28
-
29
- firstUpdated() {
30
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
31
- }
32
-
33
- updated(changes: PropertyValues<this>) {
34
- if (changes.has('value')) {
35
- this.layout = this.value.layout
36
- this.options = this.value.options
37
- }
38
- }
39
-
40
- render() {
41
- return html`
42
- <div>
43
- <select value-key="layout" .value=${this.layout}>
44
- <option value="" selected></option>
45
- ${layouts.map(layout => {
46
- return html` <option value=${layout}>${layout}</option> `
47
- })}
48
- </select>
49
-
50
- ${this.layout == 'grid'
51
- ? html` <things-grid-layout value-key="options" .value=${this.options}></things-grid-layout> `
52
- : this.layout == 'card'
53
- ? html` <things-card-layout value-key="options" .value=${this.options}></things-card-layout> `
54
- : html``}
55
- </div>
56
- `
57
- }
58
-
59
- _onValueChange(e: Event) {
60
- var element = e.target as HTMLElement
61
- var key = element.getAttribute('value-key')
62
-
63
- if (!key) {
64
- return
65
- }
66
-
67
- //@ts-ignore
68
- this[key] = element.value
69
-
70
- this.value = {
71
- layout: this.layout,
72
- options: this.options
73
- }
74
-
75
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
76
- }
77
- }