@operato/input 9.0.0-beta.7 → 9.0.0-beta.70
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 +240 -0
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-form-field.d.ts +2 -5
- package/dist/src/ox-form-field.js +2 -5
- package/dist/src/ox-form-field.js.map +1 -1
- package/dist/src/ox-input-angle.js +1 -3
- package/dist/src/ox-input-angle.js.map +1 -1
- package/dist/src/ox-input-background-pattern.d.ts +36 -0
- package/dist/src/ox-input-background-pattern.js +114 -0
- package/dist/src/ox-input-background-pattern.js.map +1 -0
- package/dist/src/ox-input-color-gradient.d.ts +12 -10
- package/dist/src/ox-input-color-gradient.js +104 -222
- package/dist/src/ox-input-color-gradient.js.map +1 -1
- package/dist/src/ox-input-color-stops.d.ts +26 -22
- package/dist/src/ox-input-color-stops.js +122 -151
- package/dist/src/ox-input-color-stops.js.map +1 -1
- package/dist/src/ox-input-color.d.ts +13 -5
- package/dist/src/ox-input-color.js +169 -96
- package/dist/src/ox-input-color.js.map +1 -1
- package/dist/src/ox-input-crontab.js +1 -0
- package/dist/src/ox-input-crontab.js.map +1 -1
- package/dist/src/ox-input-direction.js +1 -0
- package/dist/src/ox-input-direction.js.map +1 -1
- package/dist/src/ox-input-duration.js +4 -0
- package/dist/src/ox-input-duration.js.map +1 -1
- package/dist/src/ox-input-fill-style.d.ts +48 -0
- package/dist/src/ox-input-fill-style.js +330 -0
- package/dist/src/ox-input-fill-style.js.map +1 -0
- 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-options.js +0 -1
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-privilege.js +1 -0
- package/dist/src/ox-input-privilege.js.map +1 -1
- package/dist/src/ox-input-range.js +2 -0
- package/dist/src/ox-input-range.js.map +1 -1
- package/dist/src/ox-input-select-buttons.d.ts +1 -1
- package/dist/src/ox-input-select-buttons.js +2 -2
- package/dist/src/ox-input-select-buttons.js.map +1 -1
- package/dist/src/ox-input-table.d.ts +20 -2
- package/dist/src/ox-input-table.js +67 -160
- package/dist/src/ox-input-table.js.map +1 -1
- package/dist/src/ox-input-value-map.js +7 -3
- package/dist/src/ox-input-value-map.js.map +1 -1
- package/dist/src/ox-select-floor.js +1 -0
- package/dist/src/ox-select-floor.js.map +1 -1
- package/dist/src/ox-select.d.ts +3 -0
- package/dist/src/ox-select.js +19 -9
- package/dist/src/ox-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -25
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/stories/image-for-select-floor.d.ts +0 -1
- package/dist/stories/image-for-select-floor.js +0 -2
- package/dist/stories/image-for-select-floor.js.map +0 -1
- package/dist/stories/ox-buttons-radio.stories.d.ts +0 -26
- package/dist/stories/ox-buttons-radio.stories.js +0 -75
- package/dist/stories/ox-buttons-radio.stories.js.map +0 -1
- package/dist/stories/ox-checkbox.stories.d.ts +0 -44
- package/dist/stories/ox-checkbox.stories.js +0 -84
- package/dist/stories/ox-checkbox.stories.js.map +0 -1
- package/dist/stories/ox-input-3axis.stories.d.ts +0 -26
- package/dist/stories/ox-input-3axis.stories.js +0 -63
- package/dist/stories/ox-input-3axis.stories.js.map +0 -1
- package/dist/stories/ox-input-3dish.stories.d.ts +0 -30
- package/dist/stories/ox-input-3dish.stories.js +0 -91
- package/dist/stories/ox-input-3dish.stories.js.map +0 -1
- package/dist/stories/ox-input-angle.stories.d.ts +0 -30
- package/dist/stories/ox-input-angle.stories.js +0 -69
- package/dist/stories/ox-input-angle.stories.js.map +0 -1
- package/dist/stories/ox-input-barcode.stories.d.ts +0 -47
- package/dist/stories/ox-input-barcode.stories.js +0 -89
- package/dist/stories/ox-input-barcode.stories.js.map +0 -1
- package/dist/stories/ox-input-code.stories.d.ts +0 -38
- package/dist/stories/ox-input-code.stories.js +0 -76
- package/dist/stories/ox-input-code.stories.js.map +0 -1
- package/dist/stories/ox-input-crontab.stories.d.ts +0 -29
- package/dist/stories/ox-input-crontab.stories.js +0 -67
- package/dist/stories/ox-input-crontab.stories.js.map +0 -1
- package/dist/stories/ox-input-data.stories.d.ts +0 -29
- package/dist/stories/ox-input-data.stories.js +0 -67
- package/dist/stories/ox-input-data.stories.js.map +0 -1
- package/dist/stories/ox-input-direction.stories.d.ts +0 -29
- package/dist/stories/ox-input-direction.stories.js +0 -76
- package/dist/stories/ox-input-direction.stories.js.map +0 -1
- package/dist/stories/ox-input-duration.stories.d.ts +0 -30
- package/dist/stories/ox-input-duration.stories.js +0 -69
- package/dist/stories/ox-input-duration.stories.js.map +0 -1
- package/dist/stories/ox-input-file.stories.d.ts +0 -53
- package/dist/stories/ox-input-file.stories.js +0 -80
- package/dist/stories/ox-input-file.stories.js.map +0 -1
- package/dist/stories/ox-input-hashtags.stories.d.ts +0 -33
- package/dist/stories/ox-input-hashtags.stories.js +0 -66
- package/dist/stories/ox-input-hashtags.stories.js.map +0 -1
- package/dist/stories/ox-input-i18n-label.stories.d.ts +0 -29
- package/dist/stories/ox-input-i18n-label.stories.js +0 -88
- package/dist/stories/ox-input-i18n-label.stories.js.map +0 -1
- package/dist/stories/ox-input-key-values.stories.d.ts +0 -33
- package/dist/stories/ox-input-key-values.stories.js +0 -81
- package/dist/stories/ox-input-key-values.stories.js.map +0 -1
- package/dist/stories/ox-input-mass-fraction.stories.d.ts +0 -37
- package/dist/stories/ox-input-mass-fraction.stories.js +0 -79
- package/dist/stories/ox-input-mass-fraction.stories.js.map +0 -1
- package/dist/stories/ox-input-multiple-colors.stories.d.ts +0 -24
- package/dist/stories/ox-input-multiple-colors.stories.js +0 -59
- package/dist/stories/ox-input-multiple-colors.stories.js.map +0 -1
- package/dist/stories/ox-input-options.stories.d.ts +0 -29
- package/dist/stories/ox-input-options.stories.js +0 -65
- package/dist/stories/ox-input-options.stories.js.map +0 -1
- package/dist/stories/ox-input-partition-keys.stories.d.ts +0 -29
- package/dist/stories/ox-input-partition-keys.stories.js +0 -69
- package/dist/stories/ox-input-partition-keys.stories.js.map +0 -1
- package/dist/stories/ox-input-privilege.stories.d.ts +0 -40
- package/dist/stories/ox-input-privilege.stories.js +0 -87
- package/dist/stories/ox-input-privilege.stories.js.map +0 -1
- package/dist/stories/ox-input-quantifier.stories.d.ts +0 -29
- package/dist/stories/ox-input-quantifier.stories.js +0 -63
- package/dist/stories/ox-input-quantifier.stories.js.map +0 -1
- package/dist/stories/ox-input-range.stories.d.ts +0 -41
- package/dist/stories/ox-input-range.stories.js +0 -64
- package/dist/stories/ox-input-range.stories.js.map +0 -1
- package/dist/stories/ox-input-search.stories.d.ts +0 -36
- package/dist/stories/ox-input-search.stories.js +0 -68
- package/dist/stories/ox-input-search.stories.js.map +0 -1
- package/dist/stories/ox-input-select-buttons.stories.d.ts +0 -38
- package/dist/stories/ox-input-select-buttons.stories.js +0 -94
- package/dist/stories/ox-input-select-buttons.stories.js.map +0 -1
- package/dist/stories/ox-input-signature.stories.d.ts +0 -25
- package/dist/stories/ox-input-signature.stories.js +0 -60
- package/dist/stories/ox-input-signature.stories.js.map +0 -1
- package/dist/stories/ox-input-switch.stories.d.ts +0 -38
- package/dist/stories/ox-input-switch.stories.js +0 -68
- package/dist/stories/ox-input-switch.stories.js.map +0 -1
- package/dist/stories/ox-input-table-column-config.stories.d.ts +0 -29
- package/dist/stories/ox-input-table-column-config.stories.js +0 -94
- package/dist/stories/ox-input-table-column-config.stories.js.map +0 -1
- package/dist/stories/ox-input-unit.stories.d.ts +0 -42
- package/dist/stories/ox-input-unit.stories.js +0 -123
- package/dist/stories/ox-input-unit.stories.js.map +0 -1
- package/dist/stories/ox-input-value-map.stories.d.ts +0 -39
- package/dist/stories/ox-input-value-map.stories.js +0 -69
- package/dist/stories/ox-input-value-map.stories.js.map +0 -1
- package/dist/stories/ox-input-value-ranges.stories.d.ts +0 -39
- package/dist/stories/ox-input-value-ranges.stories.js +0 -69
- package/dist/stories/ox-input-value-ranges.stories.js.map +0 -1
- package/dist/stories/ox-input-work-shift.stories.d.ts +0 -30
- package/dist/stories/ox-input-work-shift.stories.js +0 -91
- package/dist/stories/ox-input-work-shift.stories.js.map +0 -1
- package/dist/stories/ox-select-floor.stories.d.ts +0 -45
- package/dist/stories/ox-select-floor.stories.js +0 -166
- package/dist/stories/ox-select-floor.stories.js.map +0 -1
- package/dist/stories/ox-select-set-options.stories.d.ts +0 -48
- package/dist/stories/ox-select-set-options.stories.js +0 -178
- package/dist/stories/ox-select-set-options.stories.js.map +0 -1
- package/dist/stories/ox-select.stories.d.ts +0 -34
- package/dist/stories/ox-select.stories.js +0 -151
- package/dist/stories/ox-select.stories.js.map +0 -1
@@ -2,142 +2,109 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
import { __decorate } from "tslib";
|
5
|
+
import '@material/web/icon/icon.js';
|
5
6
|
import './ox-input-color.js';
|
6
7
|
import { css, html } from 'lit';
|
7
8
|
import { customElement, property, query } from 'lit/decorators.js';
|
8
|
-
import { OxFormField } from './ox-form-field.js';
|
9
9
|
import deepEquals from 'lodash-es/isEqual.js';
|
10
|
+
import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js';
|
11
|
+
import { OxFormField } from './ox-form-field.js';
|
10
12
|
/**
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
*/
|
13
|
+
* This component allows editing an array of color sets (position and color) within a range.
|
14
|
+
*
|
15
|
+
* The preview bar shows the color sets in gradient or solid form.
|
16
|
+
*
|
17
|
+
* To add a new color set, double-click the preview bar.
|
18
|
+
* To remove a color set, drag the color set marker downward.
|
19
|
+
* To move the position of a color set, drag the color set marker left or right, or select the color set marker with the mouse and directly edit the position in the position input editor.
|
20
|
+
* To change the color of a color set, double-click the color set marker to pop up the color palette and select a color, or directly edit the color in the color input editor.
|
21
|
+
*
|
22
|
+
* Example:
|
23
|
+
*
|
24
|
+
* <ox-input-color-stops type="gradient" .value=${gradient.colorStops}>
|
25
|
+
* </ox-input-color-stops>
|
26
|
+
*/
|
26
27
|
let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
27
28
|
constructor() {
|
28
29
|
super(...arguments);
|
29
30
|
/**
|
30
|
-
* `type
|
31
|
-
* - 'solid'
|
32
|
-
* - 'gradient'
|
31
|
+
* `type` indicates how the color-stop bar is displayed.
|
32
|
+
* - 'solid': Fills with solid color from one color stop to the next.
|
33
|
+
* - 'gradient': Fills with gradient color from one color stop to the next.
|
33
34
|
*/
|
34
35
|
this.type = 'solid';
|
35
36
|
/**
|
36
|
-
* `min
|
37
|
+
* `min` indicates the minimum value of the color-stop bar's position range.
|
37
38
|
*/
|
38
39
|
this.min = 0;
|
39
40
|
/**
|
40
|
-
* `max
|
41
|
+
* `max` indicates the maximum value of the color-stop bar's position range.
|
41
42
|
*/
|
42
43
|
this.max = 1;
|
44
|
+
/**
|
45
|
+
* `value` maintains the array of color stops created by the color-stops.
|
46
|
+
*/
|
47
|
+
this.value = undefined;
|
43
48
|
this.dragstart = { position: 0, x: 0, y: 0 };
|
44
49
|
}
|
45
|
-
static { this.styles =
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
#color-stops {
|
54
|
-
grid-column: 1 / 11;
|
55
|
-
grid-row: 1;
|
56
|
-
|
57
|
-
clear: both;
|
58
|
-
margin-bottom: -3px;
|
59
|
-
}
|
60
|
-
|
61
|
-
#colorbar {
|
62
|
-
width: 95%;
|
63
|
-
height: 12px;
|
64
|
-
margin: auto;
|
65
|
-
margin-bottom: 25px;
|
66
|
-
border: 1px solid #ccc;
|
67
|
-
}
|
68
|
-
|
69
|
-
#markers {
|
70
|
-
position: relative;
|
71
|
-
top: 30px;
|
72
|
-
}
|
73
|
-
|
74
|
-
#markers div {
|
75
|
-
width: 10px;
|
76
|
-
height: 10px;
|
77
|
-
margin-top: -15px;
|
78
|
-
position: absolute;
|
79
|
-
border: 2px solid #fff;
|
80
|
-
cursor: pointer;
|
81
|
-
-webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
82
|
-
-moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
83
|
-
box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
84
|
-
}
|
85
|
-
|
86
|
-
#markers div::before {
|
87
|
-
border-bottom: 6px solid #fff;
|
88
|
-
border-left: 7px solid transparent;
|
89
|
-
border-right: 7px solid transparent;
|
90
|
-
content: '';
|
91
|
-
width: 0;
|
92
|
-
height: 0;
|
93
|
-
left: -2px;
|
94
|
-
position: absolute;
|
95
|
-
top: -8px;
|
96
|
-
}
|
97
|
-
|
98
|
-
#markers div[focused] {
|
99
|
-
border-color: var(--things-editor-colorbar-marker-focused-color, #585858);
|
100
|
-
}
|
101
|
-
|
102
|
-
#markers div[focused]:before {
|
103
|
-
border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);
|
104
|
-
}
|
50
|
+
static { this.styles = [
|
51
|
+
PropertyGridStyles,
|
52
|
+
css `
|
53
|
+
:host {
|
54
|
+
display: flex;
|
55
|
+
}
|
105
56
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
57
|
+
#color-stops {
|
58
|
+
clear: both;
|
59
|
+
margin-bottom: -3px;
|
60
|
+
}
|
111
61
|
|
112
|
-
|
113
|
-
|
114
|
-
|
62
|
+
#colorbar {
|
63
|
+
width: 95%;
|
64
|
+
height: 12px;
|
65
|
+
margin: auto;
|
66
|
+
margin-bottom: 25px;
|
67
|
+
border: 1px solid #ccc;
|
68
|
+
}
|
115
69
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
70
|
+
#markers {
|
71
|
+
position: relative;
|
72
|
+
top: 30px;
|
73
|
+
}
|
120
74
|
|
121
|
-
|
122
|
-
|
123
|
-
|
75
|
+
#markers div {
|
76
|
+
width: 10px;
|
77
|
+
height: 10px;
|
78
|
+
margin-top: -15px;
|
79
|
+
position: absolute;
|
80
|
+
border: 2px solid #fff;
|
81
|
+
cursor: pointer;
|
82
|
+
-webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
83
|
+
-moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
84
|
+
box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
85
|
+
}
|
124
86
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
87
|
+
#markers div::before {
|
88
|
+
border-bottom: 6px solid #fff;
|
89
|
+
border-left: 7px solid transparent;
|
90
|
+
border-right: 7px solid transparent;
|
91
|
+
content: '';
|
92
|
+
width: 0;
|
93
|
+
height: 0;
|
94
|
+
left: -2px;
|
95
|
+
position: absolute;
|
96
|
+
top: -8px;
|
97
|
+
}
|
129
98
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
}
|
99
|
+
#markers div[focused] {
|
100
|
+
border-color: var(--things-editor-colorbar-marker-focused-color, #585858);
|
101
|
+
}
|
134
102
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
}
|
140
|
-
`; }
|
103
|
+
#markers div[focused]:before {
|
104
|
+
border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);
|
105
|
+
}
|
106
|
+
`
|
107
|
+
]; }
|
141
108
|
connectedCallback() {
|
142
109
|
super.connectedCallback();
|
143
110
|
this._dragImage = new Image();
|
@@ -155,8 +122,8 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
155
122
|
if (this.focused &&
|
156
123
|
(!oldValue ||
|
157
124
|
this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)) {
|
158
|
-
/*
|
159
|
-
*
|
125
|
+
/* Clear focused if there was no previous value.
|
126
|
+
* Even if there was a previous value, focused can only be selected and modified within this editor, so if there is no value with the same position, it is considered that a new editor has started and focused is cleared.
|
160
127
|
*/
|
161
128
|
this.focused = null;
|
162
129
|
}
|
@@ -177,45 +144,49 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
177
144
|
}
|
178
145
|
render() {
|
179
146
|
return html `
|
180
|
-
<div
|
181
|
-
<div id="
|
182
|
-
<div
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
147
|
+
<div class="property-grid">
|
148
|
+
<div id="color-stops" class="fullwidth">
|
149
|
+
<div id="colorbar" @dblclick=${(e) => this._onDblClickColorbar(e)}>
|
150
|
+
<div
|
151
|
+
id="markers"
|
152
|
+
@dblclick=${(e) => this._onDblClickMarkers(e)}
|
153
|
+
@pointerdown=${(e) => this._onPointerDown(e)}
|
154
|
+
@dragstart=${(e) => this._onDragStart(e)}
|
155
|
+
@drag=${this._throttled(100, this._onDrag.bind(this))}
|
156
|
+
@dragend=${(e) => this._onDragEnd(e)}
|
157
|
+
>
|
158
|
+
${this._refinedValue(this.value).map((item, index) => html `
|
159
|
+
<div
|
160
|
+
.style="background-color:${item.color};margin-left:${this._calculatePosition(item.position, this.min, this.max)}px;"
|
161
|
+
marker-index=${index}
|
162
|
+
draggable="true"
|
163
|
+
></div>
|
164
|
+
`)}
|
165
|
+
</div>
|
197
166
|
</div>
|
198
167
|
</div>
|
199
|
-
</div>
|
200
168
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
169
|
+
<label class="icon-only-label twothird-label"><md-icon>format_color_fill</md-icon></label>
|
170
|
+
<ox-input-color
|
171
|
+
id="color-editor"
|
172
|
+
.value=${this.focused && this.focused.color}
|
173
|
+
@change=${(e) => this._onChangeSubComponent(e)}
|
174
|
+
?disabled=${this.disabled}
|
175
|
+
class="twothird-editor"
|
176
|
+
>
|
177
|
+
</ox-input-color>
|
209
178
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
179
|
+
<label class="icon-only-label twothird-label"><md-icon>arrows_outward</md-icon></label>
|
180
|
+
<input
|
181
|
+
type="number"
|
182
|
+
id="color-position"
|
183
|
+
.value=${this.focused && this.focused.position}
|
184
|
+
@change=${(e) => this._onChangeSubComponent(e)}
|
185
|
+
step="0.01"
|
186
|
+
?disabled=${this.disabled}
|
187
|
+
class="onethird-editor"
|
188
|
+
/>
|
189
|
+
</div>
|
219
190
|
`;
|
220
191
|
}
|
221
192
|
_refinedValue(value) {
|
@@ -335,7 +306,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
335
306
|
if (this.disabled) {
|
336
307
|
return;
|
337
308
|
}
|
338
|
-
/*
|
309
|
+
/* Filter out cases where the marker is clicked. */
|
339
310
|
if (e.target !== this.colorbar)
|
340
311
|
return;
|
341
312
|
var width = this.colorbar.offsetWidth;
|
@@ -372,7 +343,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
372
343
|
if (this.disabled) {
|
373
344
|
return;
|
374
345
|
}
|
375
|
-
/*
|
346
|
+
/* Prevent ghost image from appearing during drag */
|
376
347
|
e.dataTransfer?.setDragImage(this._dragImage, 0, 0);
|
377
348
|
this.dragstart = {
|
378
349
|
position: this.focused.position,
|
@@ -380,7 +351,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
380
351
|
y: e.clientY
|
381
352
|
};
|
382
353
|
}
|
383
|
-
// TODO onDrag
|
354
|
+
// TODO onDrag event keeps occurring, causing performance degradation. So throttling is applied.
|
384
355
|
_throttled(delay, fn) {
|
385
356
|
let lastCall = 0;
|
386
357
|
return function (...args) {
|
@@ -421,7 +392,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
421
392
|
}
|
422
393
|
}
|
423
394
|
_calculatePosition(position, min, max) {
|
424
|
-
/* TODO 7 ==>
|
395
|
+
/* TODO 7 ==> Should be calculated as half the marker width. */
|
425
396
|
var calculated = position;
|
426
397
|
if (calculated > this.max)
|
427
398
|
calculated = this.max;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-color-stops.js","sourceRoot":"","sources":["../../src/ox-input-color-stops.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAO7C;;;;;;;;;;;;;;;EAeE;AAEK,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,WAAW;IAA3C;;QAkGL;;;;WAIG;QACyB,SAAI,GAAyB,OAAO,CAAA;QAChE;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAC3C;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAiSnC,cAAS,GAA+C,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;IAyF7F,CAAC;aAxeQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FlB,AA/FY,CA+FZ;IA2BD,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,UAAU,GAAG,IAAI,K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AC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACvG,CAAA;IACH,CAAC;;AAjY2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqC;AAIpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIhB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAAoB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAa;AAEpB;IAAnB,KAAK,CAAC,WAAW,CAAC;mDAAuB;AAClB;IAAvB,KAAK,CAAC,eAAe,CAAC;sDAA2B;AAvHvC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAye7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color.js'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { OxInputColor } from './ox-input-color.js'\nimport deepEquals from 'lodash-es/isEqual.js'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n범위내에서 여러 컬러셋(포지션과 색깔) 배열을 편집하는 컴포넌트이다.\n\n미리보기 Bar에서는 gradient나, solid 형태의 컬러셋을 보여준다.\n\n새로운 컬러셋을 추가고자 할 때는 미리보기 Bar를 더블클릭한다.\n컬러셋을 제거하고자 할 때는 컬러셋 마커를 아래방향으로 드래깅한다.\n컬러셋의 위치를 옮기고자 할 때는, 컬러셋 마커를 좌우로 드래깅하여 이동시키거나,\n옮기고자하는 컬러셋 마커를 마우스로 선택하고, 포지션 입력 에디터에서 직접 수정한다.\n컬러셋의 색상을 바꾸고자 할 때는, 컬러셋 마커를 더블클릭하여 컬러파레트를 팝업시켜서 색상을 선택하거나, 색상 입력 에디터에서 직접 색상을 수정할 수 있다.\n\nExample:\n\n <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n </ox-input-color-stops>\n*/\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 0;\n grid-auto-rows: minmax(0, auto);\n }\n\n #color-stops {\n grid-column: 1 / 11;\n grid-row: 1;\n\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n .icon-only-label {\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n width: 30px;\n height: 24px;\n }\n\n .icon-only-label.color {\n grid-column: 1 / 2;\n grid-row: 2;\n\n background-position: 70% -498px;\n float: left;\n margin-top: 0;\n }\n\n .icon-only-label.position {\n grid-column: 7 / 8;\n grid-row: 2;\n\n background-position: 70% -797px;\n float: left;\n margin-top: 0;\n }\n\n ox-input-color {\n grid-column: 2 / 7;\n grid-row: 2;\n }\n\n input[type='number'] {\n grid-column: 8 / 11;\n grid-row: 2;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n /**\n * `type`은 color-stop bar의 표시 방법을 의미한다.\n * - 'solid' : 컬러스톱위치에서 다음 컬러스톱까지 solid color로 채운다.\n * - 'gradient' : 컬러스톱위치에서 다음 컬러스톱까지 gradient color로 채운다.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min`은 color-stop bar의 위치값 범위의 최소값을 의미한다.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max`은 color-stop bar의 위치값 범위의 최대값을 의미한다.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value`은 color-stops에 의해 만들어진 color-stop 배열을 유지한다.\n */\n @property({ type: Array }) value?: ColorStop[]\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* 이전 값이 없었던 경우에 focused를 클리어시킨다.\n * 이전 값이 있던 경우에도, focused는 이 에디터 내부에서만 선택될 수 있으며, 수정될 수 있으므로 동일한 포지션을 갖는 value가 없으면, 새로운 에디터가 시작된 것으로 판단하여 focused를 클리어시킨다.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div id=\"color-stops\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @pointerdown=${(e: PointerEvent) => this._onPointerDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n >\n </ox-input-color>\n\n <label class=\"icon-only-label position\"></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n />\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* 마커를 클릭한 경우를 걸러낸다. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onPointerDown(e: PointerEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* drag 시에 ghost image를 보이지 않게 하려고 함 */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag 이벤트가 계속 발생하므로 처리하는 성능 저하됨. 그래서 throttling 하도록 함\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> 마커 폭의 절반으로 계산해야함. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ox-input-color-stops.js","sourceRoot":"","sources":["../../src/ox-input-color-stops.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAA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ClB;IAAvB,KAAK,CAAC,eAAe,CAAC;sDAA2B;AArFvC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CA2c7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\nimport './ox-input-color.js'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport deepEquals from 'lodash-es/isEqual.js'\n\nimport { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { OxInputColor } from './ox-input-color.js'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n * This component allows editing an array of color sets (position and color) within a range.\n *\n * The preview bar shows the color sets in gradient or solid form.\n *\n * To add a new color set, double-click the preview bar.\n * To remove a color set, drag the color set marker downward.\n * To move the position of a color set, drag the color set marker left or right, or select the color set marker with the mouse and directly edit the position in the position input editor.\n * To change the color of a color set, double-click the color set marker to pop up the color palette and select a color, or directly edit the color in the color input editor.\n *\n * Example:\n *\n * <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n * </ox-input-color-stops>\n */\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = [\n PropertyGridStyles,\n css`\n :host {\n display: flex;\n }\n\n #color-stops {\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n `\n ]\n\n /**\n * `type` indicates how the color-stop bar is displayed.\n * - 'solid': Fills with solid color from one color stop to the next.\n * - 'gradient': Fills with gradient color from one color stop to the next.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min` indicates the minimum value of the color-stop bar's position range.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max` indicates the maximum value of the color-stop bar's position range.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value` maintains the array of color stops created by the color-stops.\n */\n @property({ type: Array }) value?: ColorStop[] = undefined\n /**\n * Represents the focused state of the input component.\n * This property can be of any type.\n */\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* Clear focused if there was no previous value.\n * Even if there was a previous value, focused can only be selected and modified within this editor, so if there is no value with the same position, it is considered that a new editor has started and focused is cleared.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div class=\"property-grid\">\n <div id=\"color-stops\" class=\"fullwidth\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @pointerdown=${(e: PointerEvent) => this._onPointerDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label twothird-label\"><md-icon>format_color_fill</md-icon></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n class=\"twothird-editor\"\n >\n </ox-input-color>\n\n <label class=\"icon-only-label twothird-label\"><md-icon>arrows_outward</md-icon></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n class=\"onethird-editor\"\n />\n </div>\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* Filter out cases where the marker is clicked. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onPointerDown(e: PointerEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* Prevent ghost image from appearing during drag */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag event keeps occurring, causing performance degradation. So throttling is applied.\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> Should be calculated as half the marker width. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
|
-
import '
|
4
|
+
import { PropertyValues } from 'lit';
|
5
5
|
import { OxFormField } from './ox-form-field.js';
|
6
6
|
/**
|
7
7
|
색상을 입력하는데 사용되는 입력 컴포넌트이다.
|
@@ -162,13 +162,21 @@ Example:
|
|
162
162
|
</ox-input-color>
|
163
163
|
*/
|
164
164
|
export declare class OxInputColor extends OxFormField {
|
165
|
-
static styles: import("lit").CSSResult;
|
165
|
+
static styles: import("lit").CSSResult[];
|
166
166
|
value?: string;
|
167
167
|
properties: any;
|
168
|
+
defaultColor: string;
|
169
|
+
pickrElement: HTMLAnchorElement;
|
170
|
+
pickrButton?: HTMLButtonElement;
|
171
|
+
private pickr;
|
172
|
+
constructor();
|
173
|
+
ensureStyles(): void;
|
168
174
|
render(): import("lit-html").TemplateResult<1>;
|
169
|
-
|
170
|
-
|
171
|
-
|
175
|
+
disconnectedCallback(): void;
|
176
|
+
connectedCallback(): void;
|
177
|
+
updated(changed: PropertyValues<this>): void;
|
178
|
+
private setColorString;
|
179
|
+
private onInputChanged;
|
172
180
|
/**
|
173
181
|
* 외부에서 호출 가능한 메쏘드임.
|
174
182
|
*/
|