@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,251 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import './ox-input-color'
6
+
7
+ import { css, html } from 'lit'
8
+ import { customElement, property } from 'lit/decorators.js'
9
+
10
+ import { OxFormField } from './ox-form-field.js'
11
+
12
+ type WorkShift = { name: string; fromDate: number; fromTime: string; toDate: number; toTime: string }
13
+
14
+ /**
15
+ work-shift array value editor element
16
+
17
+ Example:
18
+
19
+ <ox-input-work-shift
20
+ .value=${value}
21
+ </ox-input-work-shift>
22
+ */
23
+
24
+ @customElement('ox-input-work-shift')
25
+ export class OxInputWorkShift extends OxFormField {
26
+ static styles = css`
27
+ :host {
28
+ display: flex;
29
+ flex-direction: column;
30
+ align-content: center;
31
+
32
+ width: 100%;
33
+ overflow: hidden;
34
+ border: 1px solid #ccc;
35
+ }
36
+
37
+ div {
38
+ display: flex;
39
+ flex-flow: row nowrap;
40
+ align-items: center;
41
+
42
+ border-bottom: 1px solid #c0c0c0;
43
+ }
44
+
45
+ div:last-child {
46
+ border-bottom: none;
47
+ }
48
+
49
+ div > * {
50
+ min-width: 0px;
51
+ margin: 2px;
52
+ padding: 0;
53
+ }
54
+
55
+ button,
56
+ empty-element {
57
+ width: 20px;
58
+ text-align: center;
59
+ }
60
+
61
+ input,
62
+ select,
63
+ span {
64
+ flex: 1;
65
+ }
66
+
67
+ input:required:invalid {
68
+ border: 1px dashed red;
69
+ }
70
+
71
+ [placeholder='value'] {
72
+ flex: 2;
73
+ }
74
+
75
+ div {
76
+ border-bottom: 1px solid #c0c0c0;
77
+ }
78
+
79
+ div:last-child {
80
+ border-bottom: none;
81
+ }
82
+ `
83
+
84
+ @property({ type: Object }) value: WorkShift[] = []
85
+
86
+ private _changingNow: boolean = false
87
+
88
+ firstUpdated() {
89
+ this.renderRoot.addEventListener('change', this._onChange.bind(this))
90
+ }
91
+
92
+ render() {
93
+ return html`
94
+ <div data-header>
95
+ <span>name</span>
96
+ <span>from date</span>
97
+ <span>from time</span>
98
+ <span>to date</span>
99
+ <span>to time</span>
100
+ <empty-element></empty-element>
101
+ </div>
102
+
103
+ ${this.value.map(
104
+ item => html`
105
+ <div data-record>
106
+ <input type="text" data-name .value=${item.name} required />
107
+
108
+ <select data-from-date .value=${item.fromDate || 0}>
109
+ <option value="-1">The day before</option>
110
+ <option value="0">The day</option>
111
+ <option value="1">The day after</option>
112
+ </select>
113
+ <input type="time" data-from-time .value=${item.fromTime} step="1800" required />
114
+
115
+ <select data-to-date .value=${item.toDate || 0}>
116
+ <option value="-1">The day before</option>
117
+ <option value="0">The day</option>
118
+ <option value="1">The day after</option>
119
+ </select>
120
+ <input type="time" data-to-time .value=${item.toTime} step="1800" required />
121
+
122
+ <button class="record-action" @click=${(e: Event) => this._delete(e)} tabindex="-1">-</button>
123
+ </div>
124
+ `
125
+ )}
126
+
127
+ <div data-record-new>
128
+ <input type="text" data-name />
129
+
130
+ <select data-from-date>
131
+ <option value="-1">The day before</option>
132
+ <option value="0" selected>The day</option>
133
+ <option value="+1">The day after</option>
134
+ </select>
135
+ <input type="time" data-from-time step="1800" />
136
+
137
+ <select data-to-date>
138
+ <option value="-1">The day before</option>
139
+ <option value="0" selected>The day</option>
140
+ <option value="+1">The day after</option>
141
+ </select>
142
+ <input type="time" data-to-time step="1800" />
143
+
144
+ <button class="record-action" @click=${(e: Event) => this._add()} tabindex="-1">+</button>
145
+ </div>
146
+ `
147
+ }
148
+
149
+ _onChange(e: Event) {
150
+ if (this._changingNow) {
151
+ return
152
+ }
153
+
154
+ this._changingNow = true
155
+
156
+ const input = e.target as HTMLInputElement
157
+
158
+ const div = input.parentElement as HTMLDivElement
159
+
160
+ if (div.hasAttribute('data-record')) {
161
+ this._build()
162
+ } else if (div.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {
163
+ this._add()
164
+ }
165
+
166
+ this._changingNow = false
167
+ }
168
+
169
+ _build(includeNewRecord?: boolean) {
170
+ if (includeNewRecord) {
171
+ var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]')
172
+ } else {
173
+ var records = this.renderRoot.querySelectorAll('[data-record]')
174
+ }
175
+
176
+ var value: WorkShift[] = []
177
+ for (var i = 0; i < records.length; i++) {
178
+ const record = records[i]
179
+
180
+ const name = (record.querySelector('[data-name]') as HTMLInputElement).value
181
+
182
+ const fromDate = (record.querySelector('[data-from-date]') as HTMLSelectElement).value
183
+ const fromTime = (record.querySelector('[data-from-time]') as HTMLInputElement).value
184
+ const toDate = (record.querySelector('[data-to-date]') as HTMLSelectElement).value
185
+ const toTime = (record.querySelector('[data-to-time]') as HTMLInputElement).value
186
+
187
+ if (!name) {
188
+ ;(record.querySelector('[data-name]') as HTMLInputElement).focus()
189
+ return
190
+ }
191
+
192
+ if (!fromDate) {
193
+ ;(record.querySelector('[data-from-date]') as HTMLInputElement).focus()
194
+ return
195
+ }
196
+
197
+ if (!fromTime) {
198
+ ;(record.querySelector('[data-from-time]') as HTMLInputElement).focus()
199
+ return
200
+ }
201
+
202
+ if (!toDate) {
203
+ ;(record.querySelector('[data-to-date]') as HTMLInputElement).focus()
204
+ return
205
+ }
206
+
207
+ if (!toTime) {
208
+ ;(record.querySelector('[data-to-time]') as HTMLInputElement).focus()
209
+ return
210
+ }
211
+
212
+ if (name) {
213
+ value.push({
214
+ name,
215
+ fromDate: Number(fromDate),
216
+ fromTime,
217
+ toDate: Number(toDate),
218
+ toTime
219
+ })
220
+ }
221
+ }
222
+
223
+ this.value = value
224
+
225
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
226
+ }
227
+
228
+ _add() {
229
+ this._build(true)
230
+
231
+ const inputs = this.renderRoot.querySelectorAll(
232
+ '[data-record-new] input:not([style*="display: none"])'
233
+ ) as NodeListOf<HTMLInputElement & { value: any; type: string }>
234
+
235
+ for (var i = 0; i < inputs.length; i++) {
236
+ let input = inputs[i]
237
+ input.value = ''
238
+ }
239
+
240
+ inputs[0].focus()
241
+ }
242
+
243
+ _delete(e: Event) {
244
+ const record = (e.target as Element).parentElement
245
+
246
+ const dataName = record!.querySelector('[data-name]') as HTMLInputElement
247
+ dataName.name = ''
248
+
249
+ this._build()
250
+ }
251
+ }
package/src/ox-select.ts CHANGED
@@ -5,16 +5,30 @@
5
5
  import '@material/mwc-icon'
6
6
  import '@operato/popup/ox-popup-list.js'
7
7
 
8
- import { css, html } from 'lit'
9
- import { customElement, property } from 'lit/decorators.js'
8
+ import { PropertyValues, css, html } from 'lit'
9
+ import { customElement, property, query, state } from 'lit/decorators.js'
10
10
 
11
+ import { OxFormField } from './ox-form-field.js'
11
12
  import { OxPopupList } from '@operato/popup'
13
+ import { TooltipStyles } from '@operato/styles'
14
+ import { detectOverflow } from '@operato/utils'
12
15
 
13
- import { OxFormField } from './ox-form-field.js'
16
+ function onmouseover(e: Event) {
17
+ const element = e.target as HTMLSpanElement
18
+ if (detectOverflow(element)) {
19
+ element.setAttribute('data-tooltip', element.textContent!)
20
+ }
21
+ }
22
+
23
+ function onmouseout(e: Event) {
24
+ const element = e.target as HTMLSpanElement
25
+ element.removeAttribute('data-tooltip')
26
+ }
14
27
 
15
28
  @customElement('ox-select')
16
29
  export class Select extends OxFormField {
17
30
  static styles = [
31
+ TooltipStyles,
18
32
  css`
19
33
  :host {
20
34
  display: block;
@@ -54,12 +68,14 @@ export class Select extends OxFormField {
54
68
  @property({ type: String }) name: string = ''
55
69
  @property({ type: String }) placeholder: string = ''
56
70
 
71
+ @state() label: string | string[] = ''
72
+
57
73
  render() {
58
- const label = (this.value instanceof Array ? this.value.join(', ') : this.value) || this.placeholder || ''
74
+ const label = (this.label instanceof Array ? this.label.join(', ') : this.label?.trim()) || this.placeholder || ''
59
75
 
60
76
  return html`
61
77
  <div @click=${this.expand}>
62
- <span>${label}</span>
78
+ <span @mouseover=${onmouseover} @mouseout=${onmouseout}>${label}</span>
63
79
  <mwc-icon>expand_more</mwc-icon>
64
80
  </div>
65
81
 
@@ -93,6 +109,16 @@ export class Select extends OxFormField {
93
109
  })
94
110
  }
95
111
 
112
+ async updated(changes: PropertyValues<this>) {
113
+ if (changes.has('value')) {
114
+ const popupList = this.querySelector('ox-popup-list') as OxPopupList
115
+ popupList.value = this.value
116
+
117
+ await this.requestUpdate()
118
+ this.label = popupList.getSelectedLabels()
119
+ }
120
+ }
121
+
96
122
  expand() {
97
123
  const popupList = this.querySelector('ox-popup-list') as OxPopupList
98
124
 
@@ -1,31 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import '@operato/i18n/ox-i18n.js';
5
- import './things-editor-attachment-selector';
6
- import { OxFormField } from './ox-form-field';
7
- export declare type BackgroundPatternOption = {
8
- image?: HTMLImageElement | string;
9
- align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom';
10
- offsetX?: number;
11
- offsetY?: number;
12
- width?: number;
13
- height?: number;
14
- fitPattern?: boolean;
15
- };
16
- /**
17
- * 컴포넌트의 fill pattern을 편집하는 element
18
- *
19
- * Example:
20
- * <ox-input-background-pattern
21
- * @change="${e => { this.pattern = e.target.value }}"
22
- * .value=${this.pattern}"
23
- * ></ox-input-background-pattern>
24
- */
25
- export declare class OxInputBackgroundPattern extends OxFormField {
26
- static styles: import("lit").CSSResult;
27
- value?: BackgroundPatternOption;
28
- render(): import("lit-html").TemplateResult<1>;
29
- firstUpdated(): void;
30
- _onChange(e: Event): void;
31
- }
@@ -1,147 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import { __decorate } from "tslib";
5
- import '@operato/i18n/ox-i18n.js';
6
- import './things-editor-attachment-selector';
7
- import { css, html } from 'lit';
8
- import { customElement, property } from 'lit/decorators.js';
9
- import { OxFormField } from './ox-form-field';
10
- /**
11
- * 컴포넌트의 fill pattern을 편집하는 element
12
- *
13
- * Example:
14
- * <ox-input-background-pattern
15
- * @change="${e => { this.pattern = e.target.value }}"
16
- * .value=${this.pattern}"
17
- * ></ox-input-background-pattern>
18
- */
19
- let OxInputBackgroundPattern = class OxInputBackgroundPattern extends OxFormField {
20
- static { this.styles = css `
21
- :host,
22
- .grid-10 {
23
- display: grid;
24
- grid-template-columns: repeat(10, 1fr);
25
- grid-gap: 5px;
26
- grid-auto-rows: minmax(24px, auto);
27
-
28
- align-items: center;
29
- }
30
-
31
- * {
32
- align-self: stretch;
33
- }
34
-
35
- label {
36
- grid-column: span 2;
37
- text-align: right;
38
- text-transform: capitalize;
39
-
40
- align-self: center;
41
- }
42
-
43
- .grid-10 {
44
- grid-column: span 10;
45
- }
46
-
47
- select,
48
- input,
49
- [custom-editor] {
50
- grid-column: span 8;
51
- }
52
-
53
- select {
54
- height: 100%;
55
- border: 1px solid rgba(0, 0, 0, 0.2);
56
- }
57
-
58
- input[type='checkbox'] {
59
- grid-column: 3 / 4;
60
- align-self: center;
61
- }
62
-
63
- input[type='checkbox'] ~ label {
64
- grid-column: span 7;
65
- text-align: left;
66
- }
67
-
68
- .grid-10 > input[type='number'] {
69
- grid-column: span 3;
70
- border: 1px solid rgba(0, 0, 0, 0.2);
71
- }
72
-
73
- .grid-10 > label {
74
- grid-column: span 2;
75
- text-align: right;
76
- }
77
- `; }
78
- render() {
79
- const value = this.value || {};
80
- return html `
81
- <label> <ox-i18n msgid="label.image" auto="">image</ox-i18n> </label>
82
-
83
- <things-editor-attachment-selector
84
- value-key="image"
85
- .value=${value.image || ''}
86
- custom-editor
87
- ></things-editor-attachment-selector>
88
-
89
- <label> <ox-i18n msgid="label.align" auto="">align</ox-i18n> </label>
90
-
91
- <select value-key="align" class="select-content" .value=${value.align}>
92
- <option value="left-top">Left Top</option>
93
- <option value="top">Top</option>
94
- <option value="right-top">Right Top</option>
95
- <option value="left">Left</option>
96
- <option value="center">Center</option>
97
- <option value="right">Right</option>
98
- <option value="left-bottom">Left Bottom</option>
99
- <option value="bottom">Bottom</option>
100
- <option value="right-bottom">Right Bottom</option>
101
- </select>
102
-
103
- <div class="grid-10">
104
- <label> <ox-i18n msgid="label.offset-x" auto="">offsetX</ox-i18n> </label>
105
- <input type="number" value-key="offsetX" .value=${value.offsetX} />
106
-
107
- <label> <ox-i18n msgid="label.offset-y" auto="">offsetY</ox-i18n> </label>
108
- <input type="number" value-key="offsetY" .value=${value.offsetY} />
109
-
110
- <label> <ox-i18n msgid="label.width" auto="">width</ox-i18n> </label>
111
- <input type="number" value-key="width" .value=${value.width} />
112
-
113
- <label> <ox-i18n msgid="label.height" auto="">height</ox-i18n> </label>
114
- <input type="number" value-key="height" .value=${value.height} />
115
- </div>
116
-
117
- <div class="grid-10">
118
- <input value-key="fitPattern" type="checkbox" .checked=${value.fitPattern} required />
119
- <label> <ox-i18n msgid="label.fit" auto="">Fit</ox-i18n> </label>
120
- </div>
121
- `;
122
- }
123
- firstUpdated() {
124
- this.renderRoot.addEventListener('change', this._onChange.bind(this));
125
- }
126
- _onChange(e) {
127
- var element = e.target;
128
- var key = element.getAttribute('value-key');
129
- var value = element.value;
130
- if (key == 'fitPattern') {
131
- value = element.checked;
132
- }
133
- this.value = {
134
- ...this.value,
135
- [key]: value
136
- };
137
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
138
- }
139
- };
140
- __decorate([
141
- property({ type: Object })
142
- ], OxInputBackgroundPattern.prototype, "value", void 0);
143
- OxInputBackgroundPattern = __decorate([
144
- customElement('ox-input-background-pattern')
145
- ], OxInputBackgroundPattern);
146
- export { OxInputBackgroundPattern };
147
- //# sourceMappingURL=ox-input-background-pattern.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ox-input-background-pattern.js","sourceRoot":"","sources":["../../src/ox-input-background-pattern.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AACjC,OAAO,qCAAqC,CAAA;AAE5C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAY7C;;;;;;;;GAQG;AAGH,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,WAAW;aAChD,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDlB,CAAA;IAID,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAK,EAA8B,CAAA;QAE3D,OAAO,IAAI,CAAA;;;;;iBAKE,KAAK,CAAC,KAAK,IAAI,EAAE;;;;;;gEAM8B,KAAK,CAAC,KAAK;;;;;;;;;;;;;;0DAcjB,KAAK,CAAC,OAAO;;;0DAGb,KAAK,CAAC,OAAO;;;wDAGf,KAAK,CAAC,KAAK;;;yDAGV,KAAK,CAAC,MAAM;;;;iEAIJ,KAAK,CAAC,UAAU;;;KAG5E,CAAA;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,SAAS,CAAC,CAAQ;QAChB,IAAI,OAAO,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC1C,IAAI,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAC3C,IAAI,KAAK,GAAQ,OAAO,CAAC,KAAK,CAAA;QAE9B,IAAI,GAAG,IAAI,YAAY,EAAE;YACvB,KAAK,GAAG,OAAO,CAAC,OAAO,CAAA;SACxB;QAED,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,IAAI,CAAC,KAAK;YACb,CAAC,GAAI,CAAC,EAAE,KAAK;SACd,CAAA;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClF,CAAC;CACF,CAAA;AArE6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAgC;AA5DhD,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAiIpC;SAjIY,wBAAwB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/i18n/ox-i18n.js'\nimport './things-editor-attachment-selector'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\nexport type BackgroundPatternOption = {\n image?: HTMLImageElement | string\n align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'\n offsetX?: number\n offsetY?: number\n width?: number\n height?: number\n fitPattern?: boolean\n}\n\n/**\n * 컴포넌트의 fill pattern을 편집하는 element\n *\n * Example:\n * <ox-input-background-pattern\n * @change=\"${e => { this.pattern = e.target.value }}\"\n * .value=${this.pattern}\"\n * ></ox-input-background-pattern>\n */\n\n@customElement('ox-input-background-pattern')\nexport class OxInputBackgroundPattern extends OxFormField {\n static styles = css`\n :host,\n .grid-10 {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n\n align-items: center;\n }\n\n * {\n align-self: stretch;\n }\n\n label {\n grid-column: span 2;\n text-align: right;\n text-transform: capitalize;\n\n align-self: center;\n }\n\n .grid-10 {\n grid-column: span 10;\n }\n\n select,\n input,\n [custom-editor] {\n grid-column: span 8;\n }\n\n select {\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n input[type='checkbox'] {\n grid-column: 3 / 4;\n align-self: center;\n }\n\n input[type='checkbox'] ~ label {\n grid-column: span 7;\n text-align: left;\n }\n\n .grid-10 > input[type='number'] {\n grid-column: span 3;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n .grid-10 > label {\n grid-column: span 2;\n text-align: right;\n }\n `\n\n @property({ type: Object }) value?: BackgroundPatternOption\n\n render() {\n const value = this.value || ({} as BackgroundPatternOption)\n\n return html`\n <label> <ox-i18n msgid=\"label.image\" auto=\"\">image</ox-i18n> </label>\n\n <things-editor-attachment-selector\n value-key=\"image\"\n .value=${value.image || ''}\n custom-editor\n ></things-editor-attachment-selector>\n\n <label> <ox-i18n msgid=\"label.align\" auto=\"\">align</ox-i18n> </label>\n\n <select value-key=\"align\" class=\"select-content\" .value=${value.align}>\n <option value=\"left-top\">Left Top</option>\n <option value=\"top\">Top</option>\n <option value=\"right-top\">Right Top</option>\n <option value=\"left\">Left</option>\n <option value=\"center\">Center</option>\n <option value=\"right\">Right</option>\n <option value=\"left-bottom\">Left Bottom</option>\n <option value=\"bottom\">Bottom</option>\n <option value=\"right-bottom\">Right Bottom</option>\n </select>\n\n <div class=\"grid-10\">\n <label> <ox-i18n msgid=\"label.offset-x\" auto=\"\">offsetX</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetX\" .value=${value.offsetX} />\n\n <label> <ox-i18n msgid=\"label.offset-y\" auto=\"\">offsetY</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetY\" .value=${value.offsetY} />\n\n <label> <ox-i18n msgid=\"label.width\" auto=\"\">width</ox-i18n> </label>\n <input type=\"number\" value-key=\"width\" .value=${value.width} />\n\n <label> <ox-i18n msgid=\"label.height\" auto=\"\">height</ox-i18n> </label>\n <input type=\"number\" value-key=\"height\" .value=${value.height} />\n </div>\n\n <div class=\"grid-10\">\n <input value-key=\"fitPattern\" type=\"checkbox\" .checked=${value.fitPattern} required />\n <label> <ox-i18n msgid=\"label.fit\" auto=\"\">Fit</ox-i18n> </label>\n </div>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n _onChange(e: Event) {\n var element = e.target as HTMLInputElement\n var key = element.getAttribute('value-key')\n var value: any = element.value\n\n if (key == 'fitPattern') {\n value = element.checked\n }\n\n this.value = {\n ...this.value,\n [key!]: value\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -1,42 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import '@operato/i18n/ox-i18n.js';
5
- import './ox-input-color';
6
- import './ox-input-color-gradient';
7
- import './ox-input-background-pattern';
8
- import { BackgroundPatternOption } from './ox-input-background-pattern';
9
- import { GradientOption } from './ox-input-color-gradient';
10
- import { PropertyValues } from 'lit';
11
- import { ColorStop } from './ox-input-color-stops';
12
- import { OxFormField } from './ox-form-field';
13
- export declare type FillStyle = {
14
- type?: 'no' | 'solid' | 'gradient' | 'pattern';
15
- gradientType?: 'linear' | 'radial';
16
- colorStops?: ColorStop[];
17
- rotation?: number;
18
- center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom';
19
- image?: HTMLImageElement | string;
20
- offsetX?: number;
21
- offsetY?: number;
22
- width?: number;
23
- height?: number;
24
- align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom';
25
- fitPattern?: boolean;
26
- } | 'no' | string;
27
- export declare class OxInputColorStyle extends OxFormField {
28
- static styles: import("lit").CSSResult;
29
- value?: FillStyle;
30
- fillType?: string;
31
- solid?: string;
32
- gradient?: GradientOption;
33
- pattern?: BackgroundPatternOption;
34
- private _block_reset;
35
- updated(changes: PropertyValues<this>): void;
36
- render(): import("lit-html").TemplateResult<1>;
37
- _onChangedValue(value: FillStyle): Promise<void>;
38
- _onChangedFillType(e: Event): void;
39
- _onChangedSolid(e: Event): void;
40
- _onChandedGradient(e: Event): void;
41
- _onChangedPattern(e: Event): void;
42
- }