@operato/app 0.4.2 → 1.0.0-alpha.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 (46) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/demo/data-grist-test.html +456 -0
  3. package/dist/src/grist/code-editor.d.ts +6 -0
  4. package/dist/src/grist/code-editor.js +50 -0
  5. package/dist/src/grist/code-editor.js.map +1 -0
  6. package/dist/src/grist/id-selector.js +1 -1
  7. package/dist/src/grist/id-selector.js.map +1 -1
  8. package/dist/src/grist/index.js +4 -0
  9. package/dist/src/grist/index.js.map +1 -1
  10. package/dist/src/grist/object-editor.d.ts +18 -0
  11. package/dist/src/grist/object-editor.js +152 -0
  12. package/dist/src/grist/object-editor.js.map +1 -0
  13. package/dist/src/grist/object-selector.d.ts +38 -0
  14. package/dist/src/grist/object-selector.js +338 -0
  15. package/dist/src/grist/object-selector.js.map +1 -0
  16. package/dist/src/grist/parameters-editor-builder.d.ts +4 -0
  17. package/dist/src/grist/parameters-editor-builder.js +119 -0
  18. package/dist/src/grist/parameters-editor-builder.js.map +1 -0
  19. package/dist/src/grist/parameters-editor-popup.d.ts +13 -0
  20. package/dist/src/grist/parameters-editor-popup.js +111 -0
  21. package/dist/src/grist/parameters-editor-popup.js.map +1 -0
  22. package/dist/src/grist/parameters-editor.d.ts +19 -0
  23. package/dist/src/grist/parameters-editor.js +105 -0
  24. package/dist/src/grist/parameters-editor.js.map +1 -0
  25. package/dist/src/input/ox-input-background-pattern.d.ts +31 -0
  26. package/dist/src/input/ox-input-background-pattern.js +147 -0
  27. package/dist/src/input/ox-input-background-pattern.js.map +1 -0
  28. package/dist/src/input/ox-input-color-gradient.d.ts +25 -0
  29. package/dist/src/input/ox-input-color-gradient.js +318 -0
  30. package/dist/src/input/ox-input-color-gradient.js.map +1 -0
  31. package/dist/src/input/ox-input-fill-style.d.ts +42 -0
  32. package/dist/src/input/ox-input-fill-style.js +325 -0
  33. package/dist/src/input/ox-input-fill-style.js.map +1 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +22 -11
  36. package/src/grist/code-editor.ts +78 -0
  37. package/src/grist/id-selector.ts +2 -10
  38. package/src/grist/index.ts +4 -0
  39. package/src/grist/object-editor.ts +154 -0
  40. package/src/grist/object-selector.ts +346 -0
  41. package/src/grist/parameters-editor-builder.ts +130 -0
  42. package/src/grist/parameters-editor-popup.ts +106 -0
  43. package/src/grist/parameters-editor.ts +112 -0
  44. package/src/input/ox-input-background-pattern.ts +163 -0
  45. package/src/input/ox-input-color-gradient.ts +341 -0
  46. package/src/input/ox-input-fill-style.ts +360 -0
@@ -0,0 +1,341 @@
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 '@operato/input/ox-input-angle.js'
10
+ import '@operato/input/ox-input-color-stops.js'
11
+
12
+ import { ColorStop, OxFormField } from '@operato/input'
13
+ import { css, html } from 'lit'
14
+ import { customElement, property } from 'lit/decorators.js'
15
+
16
+ export type GradientOption = {
17
+ type: 'linear' | 'radial'
18
+ rotation: number
19
+ direction?:
20
+ | 'left-to-right'
21
+ | 'lefttop-to-rightbottom'
22
+ | 'top-to-bottom'
23
+ | 'righttop-to-leftbottom'
24
+ | 'right-to-left'
25
+ | 'rightbottom-to-lefttop'
26
+ | 'bottom-to-top'
27
+ | 'leftbottom-to-righttop'
28
+ | 'left-to-right'
29
+ | 'center-to-corner'
30
+ center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'
31
+ colorStops?: ColorStop[]
32
+ }
33
+
34
+ @customElement('ox-input-color-gradient')
35
+ export class OxInputColorGradient extends OxFormField {
36
+ static styles = css`
37
+ :host {
38
+ display: grid;
39
+
40
+ grid-template-columns: repeat(10, 1fr);
41
+ grid-gap: 5px;
42
+ grid-auto-rows: minmax(24px, auto);
43
+
44
+ align-items: center;
45
+ }
46
+
47
+ :host > * {
48
+ align-self: stretch;
49
+ }
50
+
51
+ :host > label {
52
+ grid-column: span 2;
53
+ text-align: right;
54
+ text-transform: capitalize;
55
+ align-self: center;
56
+ }
57
+
58
+ :host > .icon-only-label {
59
+ grid-column: span 1;
60
+ }
61
+
62
+ :host > input,
63
+ :host > [editors] {
64
+ grid-column: span 8;
65
+ }
66
+
67
+ :host > select {
68
+ grid-column: span 4;
69
+ height: 100%;
70
+ border: 1px solid rgba(0, 0, 0, 0.2);
71
+ }
72
+
73
+ :host > ox-input-angle {
74
+ grid-column: span 3;
75
+ }
76
+
77
+ ox-input-color-stops {
78
+ grid-column: span 10;
79
+ }
80
+
81
+ .host > input[type='checkbox'] {
82
+ grid-column: 3 / 4;
83
+ }
84
+
85
+ .host > input[type='checkbox'] ~ label {
86
+ grid-column: span 7;
87
+ text-align: left;
88
+ }
89
+
90
+ [editors] > :not([active-selector]) {
91
+ display: none;
92
+ }
93
+
94
+ [gradient-direction] {
95
+ overflow: hidden;
96
+ max-width: 210px;
97
+ }
98
+
99
+ [gradient-direction] paper-item {
100
+ background: url(/assets/images/icon-editor-gradient-direction.png) 50% 0 no-repeat;
101
+ min-height: 32px;
102
+ padding: 3px 5px;
103
+ width: 30px;
104
+ float: left;
105
+ }
106
+
107
+ [gradient-direction] [name='lefttop-to-rightbottom'] {
108
+ background-position: 50% 4px;
109
+ }
110
+
111
+ [gradient-direction] [name='left-top'] {
112
+ background-position: 50% 4px;
113
+ }
114
+
115
+ [gradient-direction] [name='top-to-bottom'] {
116
+ background-position: 50% -46px;
117
+ }
118
+
119
+ [gradient-direction] [name='righttop-to-leftbottom'] {
120
+ background-position: 50% -96px;
121
+ }
122
+
123
+ [gradient-direction] [name='right-top'] {
124
+ background-position: 50% -96px;
125
+ }
126
+
127
+ [gradient-direction] [name='right-to-left'] {
128
+ background-position: 50% -146px;
129
+ }
130
+
131
+ [gradient-direction] [name='rightbottom-to-lefttop'] {
132
+ background-position: 50% -196px;
133
+ }
134
+
135
+ [gradient-direction] [name='right-bottom'] {
136
+ background-position: 50% -196px;
137
+ }
138
+
139
+ [gradient-direction] [name='bottom-to-top'] {
140
+ background-position: 50% -246px;
141
+ }
142
+
143
+ [gradient-direction] [name='leftbottom-to-righttop'] {
144
+ background-position: 50% -296px;
145
+ }
146
+
147
+ [gradient-direction] [name='left-bottom'] {
148
+ background-position: 50% -296px;
149
+ }
150
+
151
+ [gradient-direction] [name='left-to-right'] {
152
+ background-position: 50% -346px;
153
+ }
154
+
155
+ [gradient-direction] [name='center-to-corner'] {
156
+ background-position: 50% -396px;
157
+ }
158
+
159
+ [gradient-direction] [name='center'] {
160
+ background-position: 50% -396px;
161
+ }
162
+
163
+ [gradient-direction] paper-item[focused] {
164
+ background-color: rgba(255, 246, 143, 0.5);
165
+ }
166
+
167
+ .icon-only-label {
168
+ top: 0 !important;
169
+ width: 30px !important;
170
+ height: 24px;
171
+ background: url(/assets/images/icon-properties-label.png) no-repeat;
172
+ }
173
+
174
+ .icon-only-label.color {
175
+ background-position: 70% -198px;
176
+ }
177
+ `
178
+
179
+ @property({ type: Object }) value: GradientOption = {
180
+ type: 'linear',
181
+ direction: 'left-to-right',
182
+ rotation: 0
183
+ }
184
+
185
+ firstUpdated() {
186
+ this.renderRoot.addEventListener('change', this._onChange.bind(this))
187
+ }
188
+
189
+ _onChange(e: Event) {
190
+ var element = e.target as HTMLElement & { type: string }
191
+ var key = element.getAttribute('value-key')
192
+
193
+ if (!key) {
194
+ return
195
+ }
196
+
197
+ var value
198
+
199
+ switch (element.tagName) {
200
+ case 'INPUT':
201
+ switch (element.type) {
202
+ case 'checkbox':
203
+ value = (element as HTMLInputElement).checked
204
+ break
205
+ case 'number':
206
+ value = Number((element as HTMLInputElement).value) || 0
207
+ break
208
+ case 'text':
209
+ value = String((element as HTMLInputElement).value)
210
+ }
211
+ break
212
+
213
+ case 'PAPER-BUTTON':
214
+ value = (element as any).active
215
+ break
216
+
217
+ case 'PAPER-LISTBOX':
218
+ value = (element as any).selected
219
+ break
220
+
221
+ default:
222
+ value = (element as HTMLInputElement).value
223
+ break
224
+ }
225
+
226
+ if (key === 'rotation') {
227
+ this.value = {
228
+ ...this.value,
229
+ rotation: value,
230
+ direction: undefined
231
+ }
232
+ } else if (key === 'direction') {
233
+ if (value) {
234
+ this.value = {
235
+ ...this.value,
236
+ direction: value,
237
+ rotation: this._convertDirectionToRotation(value)
238
+ }
239
+ }
240
+ } else {
241
+ this.value = {
242
+ ...this.value,
243
+ [key]: value
244
+ }
245
+ }
246
+
247
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
248
+ }
249
+
250
+ render() {
251
+ var selector = (this.value && this.value.type) || 'linear'
252
+ var value = this.value || {}
253
+
254
+ return html`
255
+ <label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
256
+ <select value-key="type" .value=${value.type || 'linear'}>
257
+ <option>linear</option>
258
+ <option>radial</option>
259
+ </select>
260
+
261
+ <label class="icon-only-label color"></label>
262
+ <ox-input-angle value-key="rotation" .value=${value.rotation || 0}> </ox-input-angle>
263
+
264
+ <label> <ox-i18n msgid="label.direction">direction</ox-i18n> </label>
265
+ <div editors>
266
+ <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'linear'} .value=${value.direction}>
267
+ <paper-listbox
268
+ @selected-changed=${(e: Event) => this._onChange(e)}
269
+ value-key="direction"
270
+ slot="dropdown-content"
271
+ gradient-direction
272
+ .selected=${value.direction}
273
+ attr-for-selected="name"
274
+ >
275
+ <paper-item name="lefttop-to-rightbottom"></paper-item>
276
+ <paper-item name="top-to-bottom"></paper-item>
277
+ <paper-item name="righttop-to-leftbottom"></paper-item>
278
+ <paper-item name="right-to-left"></paper-item>
279
+ <paper-item name="rightbottom-to-lefttop"></paper-item>
280
+ <paper-item name="bottom-to-top"></paper-item>
281
+ <paper-item name="leftbottom-to-righttop"></paper-item>
282
+ <paper-item name="left-to-right"></paper-item>
283
+ <paper-item name="center-to-corner"></paper-item>
284
+ </paper-listbox>
285
+ </paper-dropdown-menu>
286
+
287
+ <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'radial'} .value=${value.center}>
288
+ <paper-listbox
289
+ @selected-changed=${(e: Event) => this._onChange(e)}
290
+ value-key="center"
291
+ slot="dropdown-content"
292
+ gradient-direction
293
+ .selected=${value.center || 'center'}
294
+ attr-for-selected="name"
295
+ >
296
+ <paper-item name="center"></paper-item>
297
+ <paper-item name="left-top"></paper-item>
298
+ <paper-item name="right-top"></paper-item>
299
+ <paper-item name="right-bottom"></paper-item>
300
+ <paper-item name="left-bottom"></paper-item>
301
+ </paper-listbox>
302
+ </paper-dropdown-menu>
303
+ </div>
304
+
305
+ <ox-input-color-stops value-key="colorStops" type="gradient" .value=${value.colorStops}> </ox-input-color-stops>
306
+ `
307
+ }
308
+
309
+ _convertDirectionToRotation(direction: string): number {
310
+ var rotation
311
+ switch (direction) {
312
+ case 'lefttop-to-rightbottom':
313
+ rotation = 45
314
+ break
315
+ case 'top-to-bottom':
316
+ rotation = 90
317
+ break
318
+ case 'righttop-to-leftbottom':
319
+ rotation = 135
320
+ break
321
+ case 'right-to-left':
322
+ rotation = 180
323
+ break
324
+ case 'rightbottom-to-lefttop':
325
+ rotation = 215
326
+ break
327
+ case 'bottom-to-top':
328
+ rotation = 270
329
+ break
330
+ case 'leftbottom-to-righttop':
331
+ rotation = 315
332
+ break
333
+ case 'left-to-right':
334
+ default:
335
+ rotation = 0
336
+ break
337
+ }
338
+
339
+ return (rotation / 360) * Math.PI * 2
340
+ }
341
+ }
@@ -0,0 +1,360 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@operato/i18n/ox-i18n.js'
6
+ import '@operato/input/ox-input-color.js'
7
+ import '@operato/input/ox-input-color-stops.js'
8
+ import './ox-input-color-gradient.js'
9
+ import './ox-input-background-pattern.js'
10
+
11
+ import { BackgroundPatternOption, OxInputBackgroundPattern } from './ox-input-background-pattern.js'
12
+ import { ColorStop, OxFormField } from '@operato/input'
13
+ import { GradientOption, OxInputColorGradient } from './ox-input-color-gradient.js'
14
+ import { PropertyValues, css, html } from 'lit'
15
+ import { customElement, property, query } from 'lit/decorators.js'
16
+
17
+ export type FillStyle =
18
+ | {
19
+ type?: 'no' | 'solid' | 'gradient' | 'pattern'
20
+ gradientType?: 'linear' | 'radial'
21
+ colorStops?: ColorStop[]
22
+ rotation?: number
23
+ center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'
24
+ image?: HTMLImageElement | string
25
+ offsetX?: number
26
+ offsetY?: number
27
+ width?: number
28
+ height?: number
29
+ align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'
30
+ fitPattern?: boolean
31
+ }
32
+ | 'no'
33
+ | string
34
+
35
+ @customElement('ox-input-color-style')
36
+ export class OxInputColorStyle extends OxFormField {
37
+ static styles = css`
38
+ :host {
39
+ display: flex;
40
+ flex-direction: column;
41
+ }
42
+
43
+ [fill-type] {
44
+ display: flex;
45
+ margin: 0 0 14px 0;
46
+ }
47
+
48
+ [fill-type] * {
49
+ flex: auto;
50
+ margin: 0;
51
+ text-align: left;
52
+ align-self: center;
53
+ }
54
+
55
+ .grid-10 {
56
+ display: grid;
57
+
58
+ grid-template-columns: repeat(10, 1fr);
59
+ grid-gap: 5px;
60
+ grid-auto-rows: minmax(24px, auto);
61
+ }
62
+
63
+ .grid-10 > ox-input-color {
64
+ grid-column: span 4;
65
+ }
66
+
67
+ .grid-10 > .icon-only-label {
68
+ grid-column: span 1;
69
+
70
+ background: url(/assets/images/icon-properties-label.png) no-repeat;
71
+ float: left;
72
+ margin: 0;
73
+ }
74
+
75
+ .icon-only-label.color {
76
+ background-position: 70% -498px;
77
+ }
78
+
79
+ [editors] > :not([active]) {
80
+ display: none;
81
+ }
82
+ `
83
+
84
+ @property({ type: Object }) value?: FillStyle
85
+ @property({ type: String }) fillType?: string
86
+ @property({ type: String }) solid?: string
87
+ @property({ type: Object }) gradient?: GradientOption
88
+ @property({ type: Object }) pattern?: BackgroundPatternOption
89
+
90
+ private _block_reset: boolean = false
91
+
92
+ updated(changes: PropertyValues<this>) {
93
+ changes.has('value') && this._onChangedValue(this.value || {})
94
+ }
95
+
96
+ render() {
97
+ return html`
98
+ <div @change=${(e: Event) => this._onChangedFillType(e)} fill-type>
99
+ <input
100
+ type="radio"
101
+ id="fill-type-no"
102
+ name="fill-type"
103
+ value="no"
104
+ .checked=${!this.fillType || this.fillType == 'no'}
105
+ />
106
+ <label for="fill-type-no"><ox-i18n msgid="label.no-fill">no fill</ox-i18n></label>
107
+ <input type="radio" id="fill-type-solid" name="fill-type" value="solid" .checked=${this.fillType == 'solid'} />
108
+ <label for="fill-type-solid"><ox-i18n msgid="label.solid">solid</ox-i18n></label>
109
+ <input
110
+ type="radio"
111
+ id="fill-type-gradient"
112
+ name="fill-type"
113
+ value="gradient"
114
+ .checked=${this.fillType == 'gradient'}
115
+ />
116
+ <label for="fill-type-gradient"><ox-i18n msgid="label.gradient">gradient</ox-i18n></label>
117
+ <input
118
+ type="radio"
119
+ id="fill-type-pattern"
120
+ name="fill-type"
121
+ value="pattern"
122
+ .checked=${this.fillType == 'pattern'}
123
+ />
124
+ <label for="fill-type-pattern"><ox-i18n msgid="label.pattern">pattern</ox-i18n></label>
125
+ </div>
126
+
127
+ <div editors>
128
+ <div ?active=${this.fillType == 'no'}></div>
129
+
130
+ <div class="grid-10" ?active=${this.fillType == 'solid'}>
131
+ <label class="icon-only-label color"></label>
132
+ <ox-input-color @change=${(e: Event) => this._onChangedSolid(e)} .value=${this.solid}> </ox-input-color>
133
+ </div>
134
+
135
+ <div ?active=${this.fillType == 'gradient'}>
136
+ <ox-input-color-gradient @change=${(e: Event) => this._onChandedGradient(e)} .value=${this.gradient}>
137
+ </ox-input-color-gradient>
138
+ </div>
139
+
140
+ <div ?active=${this.fillType == 'pattern'}>
141
+ <ox-input-background-pattern @change=${(e: Event) => this._onChangedPattern(e)} .value=${this.pattern}>
142
+ </ox-input-background-pattern>
143
+ </div>
144
+ </div>
145
+ `
146
+ }
147
+
148
+ async _onChangedValue(value: FillStyle) {
149
+ /*
150
+ * this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.
151
+ */
152
+ await this.requestUpdate()
153
+
154
+ /* 설정 값에 따라서, 멤버 속성을 설정한다. */
155
+ if (!value) {
156
+ this.fillType = 'no'
157
+
158
+ if (!this._block_reset) {
159
+ this.solid = undefined
160
+ this.gradient = undefined
161
+ this.pattern = undefined
162
+ }
163
+
164
+ this._block_reset = false
165
+ return
166
+ }
167
+
168
+ switch (typeof value) {
169
+ case 'string':
170
+ this.fillType = 'solid'
171
+ this.solid = value
172
+
173
+ if (!this._block_reset) {
174
+ this.gradient = undefined
175
+ this.pattern = undefined
176
+ }
177
+ break
178
+ case 'object':
179
+ this.fillType = value.type
180
+
181
+ if (value.type === 'gradient') {
182
+ this.gradient = {
183
+ type: value.gradientType || 'linear',
184
+ colorStops: value.colorStops || [
185
+ {
186
+ position: 0,
187
+ color: this.solid || '#000000'
188
+ },
189
+ {
190
+ position: 1,
191
+ color: this.solid || '#FFFFFF'
192
+ }
193
+ ],
194
+ rotation: Number(value.rotation) || 0,
195
+ center: value.center
196
+ }
197
+
198
+ if (!this._block_reset) {
199
+ this.pattern = undefined
200
+ this.solid = undefined
201
+ }
202
+ } else if (value.type === 'pattern') {
203
+ this.pattern = {
204
+ image: value.image,
205
+ offsetX: Number(value.offsetX) || 0,
206
+ offsetY: Number(value.offsetY) || 0,
207
+ width: Number(value.width),
208
+ height: Number(value.height),
209
+ align: value.align,
210
+ fitPattern: value.fitPattern
211
+ }
212
+
213
+ if (!this._block_reset) {
214
+ this.gradient = undefined
215
+ this.solid = undefined
216
+ }
217
+ }
218
+
219
+ break
220
+ default:
221
+ }
222
+
223
+ this._block_reset = false
224
+ }
225
+
226
+ _onChangedFillType(e: Event) {
227
+ const element = e.target as HTMLInputElement
228
+ this.fillType = element.value
229
+
230
+ switch (this.fillType) {
231
+ case 'gradient':
232
+ if (!this.gradient) {
233
+ this.gradient = {
234
+ type: 'linear',
235
+ colorStops: [
236
+ {
237
+ position: 0,
238
+ color: this.solid || '#000000'
239
+ },
240
+ {
241
+ position: 1,
242
+ color: this.solid || '#FFFFFF'
243
+ }
244
+ ],
245
+ rotation: 0,
246
+ center: 'center'
247
+ }
248
+ }
249
+
250
+ this.value = {
251
+ type: 'gradient',
252
+ gradientType: this.gradient.type || 'linear',
253
+ colorStops: this.gradient.colorStops || [
254
+ {
255
+ position: 0,
256
+ color: this.solid || '#000000'
257
+ },
258
+ {
259
+ position: 1,
260
+ color: this.solid || '#FFFFFF'
261
+ }
262
+ ],
263
+ rotation: Number(this.gradient.rotation) || 0,
264
+ center: this.gradient.center
265
+ }
266
+ break
267
+
268
+ case 'pattern':
269
+ if (!this.pattern) this.pattern = {}
270
+
271
+ this.value = {
272
+ type: 'pattern',
273
+ image: this.pattern.image,
274
+ offsetX: Number(this.pattern.offsetX) || 0,
275
+ offsetY: Number(this.pattern.offsetY) || 0,
276
+ width: Number(this.pattern.width),
277
+ height: Number(this.pattern.height),
278
+ align: this.pattern.align,
279
+ fitPattern: this.pattern.fitPattern
280
+ }
281
+ break
282
+
283
+ case 'solid':
284
+ if (!this.solid) this.solid = '#fff'
285
+ this.value = this.solid
286
+ break
287
+
288
+ case 'no':
289
+ this.value = ''
290
+ break
291
+ }
292
+
293
+ this._block_reset = true
294
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
295
+ }
296
+
297
+ _onChangedSolid(e: Event) {
298
+ if (this.fillType !== 'solid') return
299
+
300
+ this.solid = (e.target as HTMLInputElement).value
301
+
302
+ this.value = this.solid
303
+
304
+ this._block_reset = true
305
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
306
+ }
307
+
308
+ _onChandedGradient(e: Event) {
309
+ /*
310
+ * TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.
311
+ * 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.
312
+ */
313
+
314
+ if (this.fillType !== 'gradient') {
315
+ return
316
+ }
317
+
318
+ this.gradient = (e.target as OxInputColorGradient).value
319
+
320
+ this.value = {
321
+ type: 'gradient',
322
+ gradientType: this.gradient.type || 'linear',
323
+ colorStops: this.gradient.colorStops || [
324
+ {
325
+ position: 0,
326
+ color: this.solid || '#000000'
327
+ },
328
+ {
329
+ position: 1,
330
+ color: this.solid || '#FFFFFF'
331
+ }
332
+ ],
333
+ rotation: Number(this.gradient.rotation) || 0,
334
+ center: this.gradient.center
335
+ }
336
+
337
+ this._block_reset = true
338
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
339
+ }
340
+
341
+ _onChangedPattern(e: Event) {
342
+ if (this.fillType !== 'pattern') return
343
+
344
+ this.pattern = (e.target as OxInputBackgroundPattern).value
345
+
346
+ this.value = {
347
+ type: 'pattern',
348
+ image: this.pattern?.image,
349
+ offsetX: Number(this.pattern?.offsetX) || 0,
350
+ offsetY: Number(this.pattern?.offsetY) || 0,
351
+ width: Number(this.pattern?.width),
352
+ height: Number(this.pattern?.height),
353
+ align: this.pattern?.align,
354
+ fitPattern: this.pattern?.fitPattern
355
+ }
356
+
357
+ this._block_reset = true
358
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
359
+ }
360
+ }