@operato/input 1.0.0-alpha.11 → 1.0.0-alpha.14
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.
- package/CHANGELOG.md +26 -0
- package/assets/images/icon-properties-line-type.png +0 -0
- package/assets/images/icon-properties-table.png +0 -0
- package/demo/index-table.html +39 -0
- package/demo/index-value-map.html +80 -0
- package/demo/index-value-ranges.html +80 -0
- package/demo/index.html +3 -0
- package/dist/src/index.d.ts +6 -3
- package/dist/src/index.js +6 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-input-multiple-colors.d.ts +2 -2
- package/dist/src/ox-input-multiple-colors.js +2 -2
- package/dist/src/ox-input-multiple-colors.js.map +1 -1
- package/dist/src/ox-input-table.d.ts +8 -0
- package/dist/src/ox-input-table.js +379 -0
- package/dist/src/ox-input-table.js.map +1 -0
- package/dist/src/ox-input-value-map.d.ts +41 -0
- package/dist/src/ox-input-value-map.js +278 -0
- package/dist/src/ox-input-value-map.js.map +1 -0
- package/dist/src/ox-input-value-ranges.d.ts +41 -0
- package/dist/src/ox-input-value-ranges.js +298 -0
- package/dist/src/ox-input-value-ranges.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -6
- package/src/index.ts +6 -3
- package/src/ox-input-multiple-colors.ts +2 -2
- package/src/ox-input-table.ts +404 -0
- package/src/{ox-input-keyvalues.ts.ing → ox-input-value-map.ts} +117 -88
- package/src/ox-input-value-ranges.ts +325 -0
- package/src/ox-input-background-pattern.ts.xxx +0 -163
- package/src/ox-input-color-gradient.ts.xxx +0 -343
- package/src/ox-input-fill-style.ts.xxx +0 -361
- package/src/ox-input-ranges.ts.ing +0 -292
@@ -1,163 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import '@operato/i18n/ox-i18n.js'
|
6
|
-
import './things-editor-attachment-selector'
|
7
|
-
|
8
|
-
import { css, html } from 'lit'
|
9
|
-
import { customElement, property } from 'lit/decorators.js'
|
10
|
-
|
11
|
-
import { OxFormField } from './ox-form-field'
|
12
|
-
|
13
|
-
export type BackgroundPatternOption = {
|
14
|
-
image?: HTMLImageElement | string
|
15
|
-
align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'
|
16
|
-
offsetX?: number
|
17
|
-
offsetY?: number
|
18
|
-
width?: number
|
19
|
-
height?: number
|
20
|
-
fitPattern?: boolean
|
21
|
-
}
|
22
|
-
|
23
|
-
/**
|
24
|
-
* 컴포넌트의 fill pattern을 편집하는 element
|
25
|
-
*
|
26
|
-
* Example:
|
27
|
-
* <ox-input-background-pattern
|
28
|
-
* @change="${e => { this.pattern = e.target.value }}"
|
29
|
-
* .value=${this.pattern}"
|
30
|
-
* ></ox-input-background-pattern>
|
31
|
-
*/
|
32
|
-
|
33
|
-
@customElement('ox-input-background-pattern')
|
34
|
-
export class OxInputBackgroundPattern extends OxFormField {
|
35
|
-
static styles = css`
|
36
|
-
:host,
|
37
|
-
.grid-10 {
|
38
|
-
display: grid;
|
39
|
-
grid-template-columns: repeat(10, 1fr);
|
40
|
-
grid-gap: 5px;
|
41
|
-
grid-auto-rows: minmax(24px, auto);
|
42
|
-
|
43
|
-
align-items: center;
|
44
|
-
}
|
45
|
-
|
46
|
-
* {
|
47
|
-
align-self: stretch;
|
48
|
-
}
|
49
|
-
|
50
|
-
label {
|
51
|
-
grid-column: span 2;
|
52
|
-
text-align: right;
|
53
|
-
text-transform: capitalize;
|
54
|
-
|
55
|
-
align-self: center;
|
56
|
-
}
|
57
|
-
|
58
|
-
.grid-10 {
|
59
|
-
grid-column: span 10;
|
60
|
-
}
|
61
|
-
|
62
|
-
select,
|
63
|
-
input,
|
64
|
-
[custom-editor] {
|
65
|
-
grid-column: span 8;
|
66
|
-
}
|
67
|
-
|
68
|
-
select {
|
69
|
-
height: 100%;
|
70
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
71
|
-
}
|
72
|
-
|
73
|
-
input[type='checkbox'] {
|
74
|
-
grid-column: 3 / 4;
|
75
|
-
align-self: center;
|
76
|
-
}
|
77
|
-
|
78
|
-
input[type='checkbox'] ~ label {
|
79
|
-
grid-column: span 7;
|
80
|
-
text-align: left;
|
81
|
-
}
|
82
|
-
|
83
|
-
.grid-10 > input[type='number'] {
|
84
|
-
grid-column: span 3;
|
85
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
86
|
-
}
|
87
|
-
|
88
|
-
.grid-10 > label {
|
89
|
-
grid-column: span 2;
|
90
|
-
text-align: right;
|
91
|
-
}
|
92
|
-
`
|
93
|
-
|
94
|
-
@property({ type: Object }) value?: BackgroundPatternOption
|
95
|
-
|
96
|
-
render() {
|
97
|
-
const value = this.value || ({} as BackgroundPatternOption)
|
98
|
-
|
99
|
-
return html`
|
100
|
-
<label> <ox-i18n msgid="label.image" auto="">image</ox-i18n> </label>
|
101
|
-
|
102
|
-
<things-editor-attachment-selector
|
103
|
-
value-key="image"
|
104
|
-
.value=${value.image || ''}
|
105
|
-
custom-editor
|
106
|
-
></things-editor-attachment-selector>
|
107
|
-
|
108
|
-
<label> <ox-i18n msgid="label.align" auto="">align</ox-i18n> </label>
|
109
|
-
|
110
|
-
<select value-key="align" class="select-content" .value=${value.align}>
|
111
|
-
<option value="left-top">Left Top</option>
|
112
|
-
<option value="top">Top</option>
|
113
|
-
<option value="right-top">Right Top</option>
|
114
|
-
<option value="left">Left</option>
|
115
|
-
<option value="center">Center</option>
|
116
|
-
<option value="right">Right</option>
|
117
|
-
<option value="left-bottom">Left Bottom</option>
|
118
|
-
<option value="bottom">Bottom</option>
|
119
|
-
<option value="right-bottom">Right Bottom</option>
|
120
|
-
</select>
|
121
|
-
|
122
|
-
<div class="grid-10">
|
123
|
-
<label> <ox-i18n msgid="label.offset-x" auto="">offsetX</ox-i18n> </label>
|
124
|
-
<input type="number" value-key="offsetX" .value=${value.offsetX} />
|
125
|
-
|
126
|
-
<label> <ox-i18n msgid="label.offset-y" auto="">offsetY</ox-i18n> </label>
|
127
|
-
<input type="number" value-key="offsetY" .value=${value.offsetY} />
|
128
|
-
|
129
|
-
<label> <ox-i18n msgid="label.width" auto="">width</ox-i18n> </label>
|
130
|
-
<input type="number" value-key="width" .value=${value.width} />
|
131
|
-
|
132
|
-
<label> <ox-i18n msgid="label.height" auto="">height</ox-i18n> </label>
|
133
|
-
<input type="number" value-key="height" .value=${value.height} />
|
134
|
-
</div>
|
135
|
-
|
136
|
-
<div class="grid-10">
|
137
|
-
<input value-key="fitPattern" type="checkbox" .checked=${value.fitPattern} required />
|
138
|
-
<label> <ox-i18n msgid="label.fit" auto="">Fit</ox-i18n> </label>
|
139
|
-
</div>
|
140
|
-
`
|
141
|
-
}
|
142
|
-
|
143
|
-
firstUpdated() {
|
144
|
-
this.renderRoot.addEventListener('change', this._onChange.bind(this))
|
145
|
-
}
|
146
|
-
|
147
|
-
_onChange(e: Event) {
|
148
|
-
var element = e.target as HTMLInputElement
|
149
|
-
var key = element.getAttribute('value-key')
|
150
|
-
var value: any = element.value
|
151
|
-
|
152
|
-
if (key == 'fitPattern') {
|
153
|
-
value = element.checked
|
154
|
-
}
|
155
|
-
|
156
|
-
this.value = {
|
157
|
-
...this.value,
|
158
|
-
[key!]: value
|
159
|
-
}
|
160
|
-
|
161
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
162
|
-
}
|
163
|
-
}
|
@@ -1,343 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import '@operato/i18n/ox-i18n.js'
|
6
|
-
import '@polymer/paper-dropdown-menu/paper-dropdown-menu'
|
7
|
-
import '@polymer/paper-listbox/paper-listbox'
|
8
|
-
import '@polymer/paper-item/paper-item'
|
9
|
-
import './ox-input-angle.js'
|
10
|
-
import './ox-input-color-stops.js'
|
11
|
-
|
12
|
-
import { css, html } from 'lit'
|
13
|
-
import { customElement, property } from 'lit/decorators.js'
|
14
|
-
|
15
|
-
import { ColorStop } from './ox-input-color-stops'
|
16
|
-
import { OxFormField } from './ox-form-field'
|
17
|
-
|
18
|
-
export type GradientOption = {
|
19
|
-
type: 'linear' | 'radial'
|
20
|
-
rotation: number
|
21
|
-
direction?:
|
22
|
-
| 'left-to-right'
|
23
|
-
| 'lefttop-to-rightbottom'
|
24
|
-
| 'top-to-bottom'
|
25
|
-
| 'righttop-to-leftbottom'
|
26
|
-
| 'right-to-left'
|
27
|
-
| 'rightbottom-to-lefttop'
|
28
|
-
| 'bottom-to-top'
|
29
|
-
| 'leftbottom-to-righttop'
|
30
|
-
| 'left-to-right'
|
31
|
-
| 'center-to-corner'
|
32
|
-
center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'
|
33
|
-
colorStops?: ColorStop[]
|
34
|
-
}
|
35
|
-
|
36
|
-
@customElement('ox-input-color-gradient')
|
37
|
-
export class OxInputColorGradient extends OxFormField {
|
38
|
-
static styles = css`
|
39
|
-
:host {
|
40
|
-
display: grid;
|
41
|
-
|
42
|
-
grid-template-columns: repeat(10, 1fr);
|
43
|
-
grid-gap: 5px;
|
44
|
-
grid-auto-rows: minmax(24px, auto);
|
45
|
-
|
46
|
-
align-items: center;
|
47
|
-
}
|
48
|
-
|
49
|
-
:host > * {
|
50
|
-
align-self: stretch;
|
51
|
-
}
|
52
|
-
|
53
|
-
:host > label {
|
54
|
-
grid-column: span 2;
|
55
|
-
text-align: right;
|
56
|
-
text-transform: capitalize;
|
57
|
-
align-self: center;
|
58
|
-
}
|
59
|
-
|
60
|
-
:host > .icon-only-label {
|
61
|
-
grid-column: span 1;
|
62
|
-
}
|
63
|
-
|
64
|
-
:host > input,
|
65
|
-
:host > [editors] {
|
66
|
-
grid-column: span 8;
|
67
|
-
}
|
68
|
-
|
69
|
-
:host > select {
|
70
|
-
grid-column: span 4;
|
71
|
-
height: 100%;
|
72
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
73
|
-
}
|
74
|
-
|
75
|
-
:host > ox-input-angle {
|
76
|
-
grid-column: span 3;
|
77
|
-
}
|
78
|
-
|
79
|
-
ox-input-color-stops {
|
80
|
-
grid-column: span 10;
|
81
|
-
}
|
82
|
-
|
83
|
-
.host > input[type='checkbox'] {
|
84
|
-
grid-column: 3 / 4;
|
85
|
-
}
|
86
|
-
|
87
|
-
.host > input[type='checkbox'] ~ label {
|
88
|
-
grid-column: span 7;
|
89
|
-
text-align: left;
|
90
|
-
}
|
91
|
-
|
92
|
-
[editors] > :not([active-selector]) {
|
93
|
-
display: none;
|
94
|
-
}
|
95
|
-
|
96
|
-
[gradient-direction] {
|
97
|
-
overflow: hidden;
|
98
|
-
max-width: 210px;
|
99
|
-
}
|
100
|
-
|
101
|
-
[gradient-direction] paper-item {
|
102
|
-
background: url(/assets/images/icon-editor-gradient-direction.png) 50% 0 no-repeat;
|
103
|
-
min-height: 32px;
|
104
|
-
padding: 3px 5px;
|
105
|
-
width: 30px;
|
106
|
-
float: left;
|
107
|
-
}
|
108
|
-
|
109
|
-
[gradient-direction] [name='lefttop-to-rightbottom'] {
|
110
|
-
background-position: 50% 4px;
|
111
|
-
}
|
112
|
-
|
113
|
-
[gradient-direction] [name='left-top'] {
|
114
|
-
background-position: 50% 4px;
|
115
|
-
}
|
116
|
-
|
117
|
-
[gradient-direction] [name='top-to-bottom'] {
|
118
|
-
background-position: 50% -46px;
|
119
|
-
}
|
120
|
-
|
121
|
-
[gradient-direction] [name='righttop-to-leftbottom'] {
|
122
|
-
background-position: 50% -96px;
|
123
|
-
}
|
124
|
-
|
125
|
-
[gradient-direction] [name='right-top'] {
|
126
|
-
background-position: 50% -96px;
|
127
|
-
}
|
128
|
-
|
129
|
-
[gradient-direction] [name='right-to-left'] {
|
130
|
-
background-position: 50% -146px;
|
131
|
-
}
|
132
|
-
|
133
|
-
[gradient-direction] [name='rightbottom-to-lefttop'] {
|
134
|
-
background-position: 50% -196px;
|
135
|
-
}
|
136
|
-
|
137
|
-
[gradient-direction] [name='right-bottom'] {
|
138
|
-
background-position: 50% -196px;
|
139
|
-
}
|
140
|
-
|
141
|
-
[gradient-direction] [name='bottom-to-top'] {
|
142
|
-
background-position: 50% -246px;
|
143
|
-
}
|
144
|
-
|
145
|
-
[gradient-direction] [name='leftbottom-to-righttop'] {
|
146
|
-
background-position: 50% -296px;
|
147
|
-
}
|
148
|
-
|
149
|
-
[gradient-direction] [name='left-bottom'] {
|
150
|
-
background-position: 50% -296px;
|
151
|
-
}
|
152
|
-
|
153
|
-
[gradient-direction] [name='left-to-right'] {
|
154
|
-
background-position: 50% -346px;
|
155
|
-
}
|
156
|
-
|
157
|
-
[gradient-direction] [name='center-to-corner'] {
|
158
|
-
background-position: 50% -396px;
|
159
|
-
}
|
160
|
-
|
161
|
-
[gradient-direction] [name='center'] {
|
162
|
-
background-position: 50% -396px;
|
163
|
-
}
|
164
|
-
|
165
|
-
[gradient-direction] paper-item[focused] {
|
166
|
-
background-color: rgba(255, 246, 143, 0.5);
|
167
|
-
}
|
168
|
-
|
169
|
-
.icon-only-label {
|
170
|
-
top: 0 !important;
|
171
|
-
width: 30px !important;
|
172
|
-
height: 24px;
|
173
|
-
background: url(/assets/images/icon-properties-label.png) no-repeat;
|
174
|
-
}
|
175
|
-
|
176
|
-
.icon-only-label.color {
|
177
|
-
background-position: 70% -198px;
|
178
|
-
}
|
179
|
-
`
|
180
|
-
|
181
|
-
@property({ type: Object }) value: GradientOption = {
|
182
|
-
type: 'linear',
|
183
|
-
direction: 'left-to-right',
|
184
|
-
rotation: 0
|
185
|
-
}
|
186
|
-
|
187
|
-
firstUpdated() {
|
188
|
-
this.renderRoot.addEventListener('change', this._onChange.bind(this))
|
189
|
-
}
|
190
|
-
|
191
|
-
_onChange(e: Event) {
|
192
|
-
var element = e.target as HTMLElement & { type: string }
|
193
|
-
var key = element.getAttribute('value-key')
|
194
|
-
|
195
|
-
if (!key) {
|
196
|
-
return
|
197
|
-
}
|
198
|
-
|
199
|
-
var value
|
200
|
-
|
201
|
-
switch (element.tagName) {
|
202
|
-
case 'INPUT':
|
203
|
-
switch (element.type) {
|
204
|
-
case 'checkbox':
|
205
|
-
value = (element as HTMLInputElement).checked
|
206
|
-
break
|
207
|
-
case 'number':
|
208
|
-
value = Number((element as HTMLInputElement).value) || 0
|
209
|
-
break
|
210
|
-
case 'text':
|
211
|
-
value = String((element as HTMLInputElement).value)
|
212
|
-
}
|
213
|
-
break
|
214
|
-
|
215
|
-
case 'PAPER-BUTTON':
|
216
|
-
value = (element as any).active
|
217
|
-
break
|
218
|
-
|
219
|
-
case 'PAPER-LISTBOX':
|
220
|
-
value = (element as any).selected
|
221
|
-
break
|
222
|
-
|
223
|
-
default:
|
224
|
-
value = (element as HTMLInputElement).value
|
225
|
-
break
|
226
|
-
}
|
227
|
-
|
228
|
-
if (key === 'rotation') {
|
229
|
-
this.value = {
|
230
|
-
...this.value,
|
231
|
-
rotation: value,
|
232
|
-
direction: undefined
|
233
|
-
}
|
234
|
-
} else if (key === 'direction') {
|
235
|
-
if (value) {
|
236
|
-
this.value = {
|
237
|
-
...this.value,
|
238
|
-
direction: value,
|
239
|
-
rotation: this._convertDirectionToRotation(value)
|
240
|
-
}
|
241
|
-
}
|
242
|
-
} else {
|
243
|
-
this.value = {
|
244
|
-
...this.value,
|
245
|
-
[key]: value
|
246
|
-
}
|
247
|
-
}
|
248
|
-
|
249
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
250
|
-
}
|
251
|
-
|
252
|
-
render() {
|
253
|
-
var selector = (this.value && this.value.type) || 'linear'
|
254
|
-
var value = this.value || {}
|
255
|
-
|
256
|
-
return html`
|
257
|
-
<label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
|
258
|
-
<select value-key="type" .value=${value.type || 'linear'}>
|
259
|
-
<option>linear</option>
|
260
|
-
<option>radial</option>
|
261
|
-
</select>
|
262
|
-
|
263
|
-
<label class="icon-only-label color"></label>
|
264
|
-
<ox-input-angle value-key="rotation" .value=${value.rotation || 0}> </ox-input-angle>
|
265
|
-
|
266
|
-
<label> <ox-i18n msgid="label.direction">direction</ox-i18n> </label>
|
267
|
-
<div editors>
|
268
|
-
<paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'linear'} .value=${value.direction}>
|
269
|
-
<paper-listbox
|
270
|
-
@selected-changed=${(e: Event) => this._onChange(e)}
|
271
|
-
value-key="direction"
|
272
|
-
slot="dropdown-content"
|
273
|
-
gradient-direction
|
274
|
-
.selected=${value.direction}
|
275
|
-
attr-for-selected="name"
|
276
|
-
>
|
277
|
-
<paper-item name="lefttop-to-rightbottom"></paper-item>
|
278
|
-
<paper-item name="top-to-bottom"></paper-item>
|
279
|
-
<paper-item name="righttop-to-leftbottom"></paper-item>
|
280
|
-
<paper-item name="right-to-left"></paper-item>
|
281
|
-
<paper-item name="rightbottom-to-lefttop"></paper-item>
|
282
|
-
<paper-item name="bottom-to-top"></paper-item>
|
283
|
-
<paper-item name="leftbottom-to-righttop"></paper-item>
|
284
|
-
<paper-item name="left-to-right"></paper-item>
|
285
|
-
<paper-item name="center-to-corner"></paper-item>
|
286
|
-
</paper-listbox>
|
287
|
-
</paper-dropdown-menu>
|
288
|
-
|
289
|
-
<paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'radial'} .value=${value.center}>
|
290
|
-
<paper-listbox
|
291
|
-
@selected-changed=${(e: Event) => this._onChange(e)}
|
292
|
-
value-key="center"
|
293
|
-
slot="dropdown-content"
|
294
|
-
gradient-direction
|
295
|
-
.selected=${value.center || 'center'}
|
296
|
-
attr-for-selected="name"
|
297
|
-
>
|
298
|
-
<paper-item name="center"></paper-item>
|
299
|
-
<paper-item name="left-top"></paper-item>
|
300
|
-
<paper-item name="right-top"></paper-item>
|
301
|
-
<paper-item name="right-bottom"></paper-item>
|
302
|
-
<paper-item name="left-bottom"></paper-item>
|
303
|
-
</paper-listbox>
|
304
|
-
</paper-dropdown-menu>
|
305
|
-
</div>
|
306
|
-
|
307
|
-
<ox-input-color-stops value-key="colorStops" type="gradient" .value=${value.colorStops}> </ox-input-color-stops>
|
308
|
-
`
|
309
|
-
}
|
310
|
-
|
311
|
-
_convertDirectionToRotation(direction: string): number {
|
312
|
-
var rotation
|
313
|
-
switch (direction) {
|
314
|
-
case 'lefttop-to-rightbottom':
|
315
|
-
rotation = 45
|
316
|
-
break
|
317
|
-
case 'top-to-bottom':
|
318
|
-
rotation = 90
|
319
|
-
break
|
320
|
-
case 'righttop-to-leftbottom':
|
321
|
-
rotation = 135
|
322
|
-
break
|
323
|
-
case 'right-to-left':
|
324
|
-
rotation = 180
|
325
|
-
break
|
326
|
-
case 'rightbottom-to-lefttop':
|
327
|
-
rotation = 215
|
328
|
-
break
|
329
|
-
case 'bottom-to-top':
|
330
|
-
rotation = 270
|
331
|
-
break
|
332
|
-
case 'leftbottom-to-righttop':
|
333
|
-
rotation = 315
|
334
|
-
break
|
335
|
-
case 'left-to-right':
|
336
|
-
default:
|
337
|
-
rotation = 0
|
338
|
-
break
|
339
|
-
}
|
340
|
-
|
341
|
-
return (rotation / 360) * Math.PI * 2
|
342
|
-
}
|
343
|
-
}
|