@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,136 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { css, html } from 'lit'
6
- import { customElement, property } from 'lit/decorators.js'
7
-
8
- import { OxFormField } from './ox-form-field'
9
-
10
- @customElement('ox-input-stack')
11
- export class OxInputStack extends OxFormField {
12
- static styles = [
13
- css`
14
- :host {
15
- display: block;
16
- }
17
-
18
- #add-floor {
19
- width: 100%;
20
- height: 20px;
21
- background-color: blue;
22
- color: white;
23
- }
24
-
25
- div {
26
- background-color: blue;
27
- width: calc(100% - 40px);
28
- width: -webkit-calc(100% - 40px);
29
- min-height: 20px;
30
- }
31
-
32
- div[active] {
33
- background-color: red;
34
- }
35
-
36
- div button {
37
- position: absolute;
38
- right: 10px;
39
- width: 30px;
40
- min-height: 20px;
41
- }
42
- `
43
- ]
44
-
45
- /**
46
- * `stack`은 stack에 의해 만들어진 층의 배열을 유지한다.
47
- */
48
- @property({ type: Array }) stack: { name: string; active?: boolean }[] = []
49
-
50
- /**
51
- * `activeIndex`은 현재 active된 층의 인덱스를 유지한다.
52
- */
53
- // @property({ type: Number }) activeIndex: number = 0
54
-
55
- render() {
56
- const stack = [...this.stack].reverse()
57
- const length = stack.length
58
-
59
- return html`
60
- <button id="add-floor" @click=${(e: Event) => this._onClickAddFloor(e)} ?disabled=${this.disabled}>+</button>
61
-
62
- ${stack.map(
63
- (item, index) => html`
64
- <div
65
- floor
66
- ?active=${item.active}
67
- @click=${(e: Event) => !this.disabled && this._onClickToActive(e)}
68
- idx=${length - index - 1}
69
- >
70
- ${item.name}
71
- <button @click=${(e: Event) => this._onClickRemoveFloor(e)} ?disabled=${this.disabled}>-</button>
72
- </div>
73
- `
74
- )}
75
- `
76
- }
77
-
78
- _notifyChange() {
79
- this.value = this.stack
80
-
81
- this.dispatchEvent(
82
- new CustomEvent('change', {
83
- detail: this.value,
84
- bubbles: true,
85
- composed: true
86
- })
87
- )
88
- }
89
-
90
- _onClickAddFloor(e: Event) {
91
- this.stack.push({ name: String(this.stack.length + 1) })
92
- this.requestUpdate()
93
-
94
- this._notifyChange()
95
- }
96
-
97
- _onClickToActive(e: Event) {
98
- const floor = (e.target as HTMLElement).closest('[floor]')
99
-
100
- if (!floor) {
101
- return
102
- }
103
-
104
- e.stopPropagation()
105
-
106
- const activeIndex = Number(floor.getAttribute('idx'))
107
- this.stack = this.stack.map((floor, index) => {
108
- return activeIndex === index
109
- ? {
110
- name: floor.name,
111
- active: true
112
- }
113
- : { name: floor.name }
114
- })
115
-
116
- this._notifyChange()
117
- }
118
-
119
- _onClickRemoveFloor(e: Event) {
120
- const floor = (e.target as HTMLElement).closest('[floor]')
121
-
122
- if (!floor) {
123
- return
124
- }
125
-
126
- e.stopPropagation()
127
-
128
- const idx = Number(floor.getAttribute('idx'))
129
-
130
- this.stack.splice(idx, 1)
131
-
132
- this.requestUpdate()
133
-
134
- this._notifyChange()
135
- }
136
- }
@@ -1,117 +0,0 @@
1
- import { css, html } from 'lit'
2
- import { customElement, property } from 'lit/decorators.js'
3
-
4
- import { OxFormField } from './ox-form-field'
5
-
6
- @customElement('ox-input-switch')
7
- export class OxInputSwitch extends OxFormField {
8
- static styles = css`
9
- :host {
10
- --ox-simple-switch-fullwidth: 2em;
11
- --ox-simple-switch-fullheight: 1em;
12
- --ox-simple-switch-thumbnail-size: 1em;
13
- }
14
-
15
- label {
16
- position: relative;
17
- display: inline-block;
18
- width: 100%;
19
- height: 100%;
20
- }
21
-
22
- label input {
23
- opacity: 0;
24
- width: 0;
25
- height: 0;
26
- }
27
-
28
- span {
29
- position: absolute;
30
- cursor: pointer;
31
- width: var(--ox-simple-switch-fullwidth);
32
- height: var(--ox-simple-switch-fullheight);
33
- top: calc(0 - var(--ox-simple-switch-thumbnail-size));
34
- left: 0;
35
- background-color: var(--ox-simple-switch-off-color, #ccc);
36
- -webkit-transition: 0.4s;
37
- transition: 0.4s;
38
- }
39
-
40
- span:before {
41
- position: absolute;
42
- content: '';
43
- height: calc(var(--ox-simple-switch-thumbnail-size) - 8px);
44
- width: calc(var(--ox-simple-switch-thumbnail-size) - 8px);
45
- left: 4px;
46
- top: 4px;
47
- background-color: var(--ox-simple-switch-thumbnail-color, white);
48
- -webkit-transition: 0.4s;
49
- transition: 0.4s;
50
- }
51
-
52
- input:checked + span {
53
- background-color: var(--ox-simple-switch-on-color, #2196f3);
54
- }
55
-
56
- input + span:before {
57
- -webkit-transform: translateY(
58
- calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)
59
- );
60
- -ms-transform: translateY(
61
- calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)
62
- );
63
- transform: translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
64
- }
65
-
66
- input:checked + span:before {
67
- -webkit-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
68
- translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
69
- -ms-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
70
- translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
71
- transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
72
- translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
73
- }
74
-
75
- /* Rounded sliders */
76
- span[round] {
77
- border-radius: calc(var(--ox-simple-switch-thumbnail-size) / 2);
78
- }
79
-
80
- span[round]:before {
81
- border-radius: calc((var(--ox-simple-switch-thumbnail-size) - 8px) / 2);
82
- }
83
- `
84
-
85
- @property({ type: Boolean }) round: boolean = false
86
- @property({ type: Boolean }) value: boolean = false
87
- @property({ type: Boolean }) disabled: boolean = false
88
-
89
- render() {
90
- return html`
91
- <label>
92
- <input type="checkbox" .checked=${this.value} ?disabled=${this.disabled} />
93
- <span ?round=${this.round}></span>
94
- </label>
95
- `
96
- }
97
-
98
- firstUpdated() {
99
- this.renderRoot.addEventListener('change', (e: Event) => {
100
- e.preventDefault()
101
- e.stopPropagation()
102
-
103
- this.value = (e.target as HTMLInputElement)?.checked
104
- this.dispatchEvent(
105
- new CustomEvent('change', {
106
- bubbles: true,
107
- composed: true,
108
- detail: this.value
109
- })
110
- )
111
- })
112
- }
113
-
114
- protected appendFormData({ formData }: FormDataEvent): void {
115
- this.name && formData.append(this.name, this.value ? 'true' : 'false')
116
- }
117
- }
@@ -1,211 +0,0 @@
1
- import { css, html } from 'lit'
2
- import { customElement, property } from 'lit/decorators.js'
3
- import { OxFormField } from './ox-form-field'
4
- import '@material/web/icon/icon.js'
5
-
6
- export interface ColumnConfig {
7
- name: string
8
- label: string
9
- visible: boolean
10
- width: number
11
- order: number
12
- }
13
-
14
- @customElement('ox-input-table-column-config')
15
- export class OxInputTableColumnConfig extends OxFormField {
16
- static styles = [
17
- css`
18
- :host {
19
- display: block;
20
- padding: 4px;
21
- border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
22
- background-color: var(--ox-input-table-column-config-background-color, var(--md-sys-color-surface));
23
- color: var(--ox-input-table-column-config-color, var(--md-sys-color-on-surface));
24
- }
25
-
26
- table {
27
- width: auto;
28
- border-collapse: collapse;
29
- font-size: 12px;
30
- border: 0;
31
- }
32
-
33
- tr {
34
- border-bottom: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
35
- }
36
-
37
- th,
38
- td {
39
- padding: 0 var(--spacing-small, 2px);
40
- text-align: left;
41
- }
42
-
43
- th {
44
- text-transform: capitalize;
45
- text-align: center;
46
- background-color: var(
47
- --ox-input-table-column-config-header-background-color,
48
- var(--md-sys-color-secondary-container)
49
- );
50
- color: var(--ox-input-table-column-config-header-background-color, var(--md-sys-color-on-secondary-container));
51
- white-space: nowrap;
52
- }
53
-
54
- th *,
55
- td * {
56
- vertical-align: middle;
57
- }
58
-
59
- td[width] {
60
- width: 60px;
61
- text-align: right;
62
- }
63
-
64
- input {
65
- font-size: 12px;
66
- padding: 0;
67
- margin: 0;
68
- border: none;
69
- width: 100%;
70
- box-sizing: border-box;
71
- outline: none;
72
- background-color: var(--ox-input-table-column-config-input-background-color, var(--md-sys-color-surface));
73
- color: var(--ox-input-table-column-config-input-color, var(--md-sys-color-on-surface));
74
- }
75
-
76
- input[type='number'] {
77
- text-align: right;
78
- }
79
-
80
- md-icon {
81
- cursor: pointer;
82
- padding: 0;
83
- margin: 0;
84
- border: none;
85
- background: none;
86
-
87
- --md-icon-size: 16px;
88
- }
89
-
90
- md-icon[disabled] {
91
- cursor: not-allowed;
92
- color: var(--ox-input-table-column-config-disabled-color, var(--md-sys-color-surface-variant, #ccc));
93
- }
94
- `
95
- ]
96
-
97
- @property({ type: Array }) value: ColumnConfig[] = []
98
-
99
- render() {
100
- console.log('this.value', this.value)
101
- return html`
102
- <table>
103
- <thead>
104
- <tr>
105
- <th></th>
106
- <th>name</th>
107
- <th>label</th>
108
- <th>width</th>
109
- <th></th>
110
- </tr>
111
- </thead>
112
- <tbody>
113
- ${(this.value || []).map(
114
- (col, index) => html`
115
- <tr name=${col.name}>
116
- <td>
117
- <input
118
- type="checkbox"
119
- .checked=${col.visible}
120
- @change=${(e: Event) => this._updateVisibility(e, index)}
121
- />
122
- </td>
123
- <td name>${col.name}</td>
124
- <td>
125
- <input type="text" .value=${col.label} @input=${(e: Event) => this._updateLabel(e, index)} />
126
- </td>
127
- <td width>
128
- <input
129
- type="number"
130
- .value=${String(col.width)}
131
- @input=${(e: Event) => this._updateWidth(e, index)}
132
- />
133
- </td>
134
- <td buttons>
135
- <md-icon class="icon-button" @click=${() => this._moveUp(index)} ?disabled=${index === 0}>
136
- arrow_upward
137
- </md-icon>
138
- <md-icon
139
- class="icon-button"
140
- @click=${() => this._moveDown(index)}
141
- ?disabled=${index === this.value.length - 1}
142
- >
143
- arrow_downward
144
- </md-icon>
145
- </td>
146
- </tr>
147
- `
148
- )}
149
- </tbody>
150
- </table>
151
- `
152
- }
153
-
154
- private _updateVisibility(event: Event, index: number) {
155
- const target = event.target as HTMLInputElement
156
- this.value[index].visible = target.checked
157
- this.requestUpdate()
158
- this._notifyChange()
159
- }
160
-
161
- private _updateLabel(event: Event, index: number) {
162
- const target = event.target as HTMLInputElement
163
- this.value[index].label = target.value
164
- this.requestUpdate()
165
- this._notifyChange()
166
- }
167
-
168
- private _updateWidth(event: Event, index: number) {
169
- const target = event.target as HTMLInputElement
170
- this.value[index].width = target.valueAsNumber
171
- this.requestUpdate()
172
- this._notifyChange()
173
- }
174
-
175
- private _moveUp(index: number) {
176
- if (index === 0) return
177
- const temp = this.value[index]
178
- this.value[index] = this.value[index - 1]
179
- this.value[index - 1] = temp
180
- this._updateOrder()
181
- this.requestUpdate()
182
- this._notifyChange()
183
- }
184
-
185
- private _moveDown(index: number) {
186
- if (index === this.value.length - 1) return
187
- const temp = this.value[index]
188
- this.value[index] = this.value[index + 1]
189
- this.value[index + 1] = temp
190
- this._updateOrder()
191
- this.requestUpdate()
192
- this._notifyChange()
193
- }
194
-
195
- private _updateOrder() {
196
- this.value = this.value.map((col, index) => ({
197
- ...col,
198
- order: index + 1
199
- }))
200
- }
201
-
202
- private _notifyChange() {
203
- this.dispatchEvent(
204
- new CustomEvent('change', {
205
- detail: this.value,
206
- bubbles: true,
207
- composed: true
208
- })
209
- )
210
- }
211
- }