@operato/property-panel 9.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -0
- package/.storybook/main.js +5 -0
- package/.storybook/preview.js +52 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/demo/index.html +30 -0
- package/dist/src/graphql/board.d.ts +6 -0
- package/dist/src/graphql/board.js +130 -0
- package/dist/src/graphql/board.js.map +1 -0
- package/dist/src/graphql/data-subscription.d.ts +5 -0
- package/dist/src/graphql/data-subscription.js +24 -0
- package/dist/src/graphql/data-subscription.js.map +1 -0
- package/dist/src/graphql/favorite-board.d.ts +1 -0
- package/dist/src/graphql/favorite-board.js +23 -0
- package/dist/src/graphql/favorite-board.js.map +1 -0
- package/dist/src/graphql/group.d.ts +7 -0
- package/dist/src/graphql/group.js +125 -0
- package/dist/src/graphql/group.js.map +1 -0
- package/dist/src/graphql/index.d.ts +4 -0
- package/dist/src/graphql/index.js +5 -0
- package/dist/src/graphql/index.js.map +1 -0
- package/dist/src/graphql/play-group.d.ts +13 -0
- package/dist/src/graphql/play-group.js +205 -0
- package/dist/src/graphql/play-group.js.map +1 -0
- package/dist/src/graphql/scenario.d.ts +6 -0
- package/dist/src/graphql/scenario.js +69 -0
- package/dist/src/graphql/scenario.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ox-property-panel.d.ts +46 -0
- package/dist/src/ox-property-panel.js +346 -0
- package/dist/src/ox-property-panel.js.map +1 -0
- package/dist/src/property-panel/abstract-property.d.ts +10 -0
- package/dist/src/property-panel/abstract-property.js +53 -0
- package/dist/src/property-panel/abstract-property.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding-mapper.d.ts +58 -0
- package/dist/src/property-panel/data-binding/data-binding-mapper.js +380 -0
- package/dist/src/property-panel/data-binding/data-binding-mapper.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding-value-map.d.ts +6 -0
- package/dist/src/property-panel/data-binding/data-binding-value-map.js +20 -0
- package/dist/src/property-panel/data-binding/data-binding-value-map.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding-value-range.d.ts +6 -0
- package/dist/src/property-panel/data-binding/data-binding-value-range.js +20 -0
- package/dist/src/property-panel/data-binding/data-binding-value-range.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding.d.ts +44 -0
- package/dist/src/property-panel/data-binding/data-binding.js +442 -0
- package/dist/src/property-panel/data-binding/data-binding.js.map +1 -0
- package/dist/src/property-panel/effects/effects.d.ts +24 -0
- package/dist/src/property-panel/effects/effects.js +72 -0
- package/dist/src/property-panel/effects/effects.js.map +1 -0
- package/dist/src/property-panel/effects/property-animation.d.ts +23 -0
- package/dist/src/property-panel/effects/property-animation.js +147 -0
- package/dist/src/property-panel/effects/property-animation.js.map +1 -0
- package/dist/src/property-panel/effects/property-animations.d.ts +22 -0
- package/dist/src/property-panel/effects/property-animations.js +70 -0
- package/dist/src/property-panel/effects/property-animations.js.map +1 -0
- package/dist/src/property-panel/effects/property-event-hover.d.ts +21 -0
- package/dist/src/property-panel/effects/property-event-hover.js +193 -0
- package/dist/src/property-panel/effects/property-event-hover.js.map +1 -0
- package/dist/src/property-panel/effects/property-event-tap.d.ts +36 -0
- package/dist/src/property-panel/effects/property-event-tap.js +262 -0
- package/dist/src/property-panel/effects/property-event-tap.js.map +1 -0
- package/dist/src/property-panel/effects/property-event.d.ts +22 -0
- package/dist/src/property-panel/effects/property-event.js +64 -0
- package/dist/src/property-panel/effects/property-event.js.map +1 -0
- package/dist/src/property-panel/effects/property-shadow.d.ts +23 -0
- package/dist/src/property-panel/effects/property-shadow.js +66 -0
- package/dist/src/property-panel/effects/property-shadow.js.map +1 -0
- package/dist/src/property-panel/effects/value-converter.d.ts +1 -0
- package/dist/src/property-panel/effects/value-converter.js +17 -0
- package/dist/src/property-panel/effects/value-converter.js.map +1 -0
- package/dist/src/property-panel/inspector/inspector.d.ts +27 -0
- package/dist/src/property-panel/inspector/inspector.js +357 -0
- package/dist/src/property-panel/inspector/inspector.js.map +1 -0
- package/dist/src/property-panel/shapes/shapes.d.ts +26 -0
- package/dist/src/property-panel/shapes/shapes.js +312 -0
- package/dist/src/property-panel/shapes/shapes.js.map +1 -0
- package/dist/src/property-panel/specifics/specific-properties-builder.d.ts +16 -0
- package/dist/src/property-panel/specifics/specific-properties-builder.js +138 -0
- package/dist/src/property-panel/specifics/specific-properties-builder.js.map +1 -0
- package/dist/src/property-panel/specifics/specifics.d.ts +25 -0
- package/dist/src/property-panel/specifics/specifics.js +84 -0
- package/dist/src/property-panel/specifics/specifics.js.map +1 -0
- package/dist/src/property-panel/styles/styles.d.ts +23 -0
- package/dist/src/property-panel/styles/styles.js +269 -0
- package/dist/src/property-panel/styles/styles.js.map +1 -0
- package/dist/src/types.d.ts +43 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/stories/index.stories.d.ts +22 -0
- package/dist/stories/index.stories.js +121 -0
- package/dist/stories/index.stories.js.map +1 -0
- package/dist/stories/input-table-property.stories.d.ts +21 -0
- package/dist/stories/input-table-property.stories.js +84 -0
- package/dist/stories/input-table-property.stories.js.map +1 -0
- package/dist/test/ox-property-panel.test.d.ts +1 -0
- package/dist/test/ox-property-panel.test.js +24 -0
- package/dist/test/ox-property-panel.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +108 -0
- package/src/graphql/board.ts +144 -0
- package/src/graphql/data-subscription.ts +30 -0
- package/src/graphql/favorite-board.ts +25 -0
- package/src/graphql/group.ts +138 -0
- package/src/graphql/index.ts +4 -0
- package/src/graphql/play-group.ts +225 -0
- package/src/graphql/scenario.ts +79 -0
- package/src/index.ts +8 -0
- package/src/ox-property-panel.ts +347 -0
- package/src/property-panel/abstract-property.ts +67 -0
- package/src/property-panel/data-binding/data-binding-mapper.ts +412 -0
- package/src/property-panel/data-binding/data-binding-value-map.ts +19 -0
- package/src/property-panel/data-binding/data-binding-value-range.ts +19 -0
- package/src/property-panel/data-binding/data-binding.ts +464 -0
- package/src/property-panel/effects/effects.ts +77 -0
- package/src/property-panel/effects/property-animation.ts +155 -0
- package/src/property-panel/effects/property-animations.ts +74 -0
- package/src/property-panel/effects/property-event-hover.ts +212 -0
- package/src/property-panel/effects/property-event-tap.ts +269 -0
- package/src/property-panel/effects/property-event.ts +73 -0
- package/src/property-panel/effects/property-shadow.ts +77 -0
- package/src/property-panel/effects/value-converter.ts +17 -0
- package/src/property-panel/inspector/inspector.ts +407 -0
- package/src/property-panel/shapes/shapes.ts +321 -0
- package/src/property-panel/specifics/specific-properties-builder.ts +152 -0
- package/src/property-panel/specifics/specifics.ts +81 -0
- package/src/property-panel/styles/styles.ts +287 -0
- package/src/types.ts +63 -0
- package/stories/index.stories.ts +134 -0
- package/stories/input-table-property.stories.ts +96 -0
- package/test/ox-property-panel.test.ts +32 -0
- package/themes/app-theme.css +138 -0
- package/themes/calendar-theme.css +61 -0
- package/themes/dark.css +51 -0
- package/themes/grist-theme.css +175 -0
- package/themes/help-theme.css +57 -0
- package/themes/layout-theme.css +94 -0
- package/themes/light.css +51 -0
- package/themes/material-theme.css +23 -0
- package/themes/md-typescale-styles.css +100 -0
- package/themes/oops-theme.css +22 -0
- package/themes/report-theme.css +47 -0
- package/themes/spacing.css +23 -0
- package/themes/state-color.css +6 -0
- package/themes/tooltip-theme.css +11 -0
- package/translations/en.json +723 -0
- package/translations/ja.json +727 -0
- package/translations/ko.json +727 -0
- package/translations/ms.json +609 -0
- package/translations/zh.json +726 -0
- package/tsconfig.json +25 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import '@operato/input/ox-input-angle.js';
|
|
6
|
+
import '@operato/input/ox-buttons-radio.js';
|
|
7
|
+
import '@material/web/icon/icon.js';
|
|
8
|
+
import '@operato/i18n/ox-i18n.js';
|
|
9
|
+
import '@operato/help/ox-title-with-help.js';
|
|
10
|
+
import { html } from 'lit';
|
|
11
|
+
import { property, state } from 'lit/decorators.js';
|
|
12
|
+
import { keyed } from 'lit/directives/keyed.js';
|
|
13
|
+
import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js';
|
|
14
|
+
import { BoxPaddingEditorStyles } from '@operato/styles/box-padding-editor-styles.js';
|
|
15
|
+
import { AbstractProperty } from '../abstract-property.js';
|
|
16
|
+
export class PropertyShapes extends AbstractProperty {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.bounds = null;
|
|
20
|
+
this.selected = [];
|
|
21
|
+
this._3dExpanded = false;
|
|
22
|
+
}
|
|
23
|
+
firstUpdated() {
|
|
24
|
+
this.renderRoot.addEventListener('change', this.onValueChange.bind(this));
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
const value = this.value || {};
|
|
28
|
+
const { width, height } = this.bounds || {};
|
|
29
|
+
return html `
|
|
30
|
+
<fieldset>
|
|
31
|
+
<div class="property-grid">
|
|
32
|
+
${this._isIdentifiable(this.selected)
|
|
33
|
+
? html `
|
|
34
|
+
<label> <ox-i18n msgid="label.id">ID</ox-i18n> </label>
|
|
35
|
+
<input value-key="id" .value=${value.id || ''} />
|
|
36
|
+
`
|
|
37
|
+
: html ``}
|
|
38
|
+
${this._isClassIdentifiable(this.selected)
|
|
39
|
+
? html `
|
|
40
|
+
<label> <ox-i18n msgid="label.class">Class</ox-i18n> </label>
|
|
41
|
+
<input value-key="class" .value=${value.class || ''} />
|
|
42
|
+
`
|
|
43
|
+
: html ``}
|
|
44
|
+
${this._hasTextProperty(this.selected)
|
|
45
|
+
? html `
|
|
46
|
+
<label> <ox-i18n msgid="label.text">Text</ox-i18n> </label>
|
|
47
|
+
<input value-key="text" .value=${value.text || ''} />
|
|
48
|
+
<label> <ox-i18n msgid="label.text-format">Text Format</ox-i18n> </label>
|
|
49
|
+
<input value-key="textFormat" .value=${value.textFormat || ''} list="format-list" />
|
|
50
|
+
<datalist id="format-list">
|
|
51
|
+
<option value="#,###."></option>
|
|
52
|
+
<option value="#,###.#"></option>
|
|
53
|
+
<option value="#,###.0"></option>
|
|
54
|
+
<option value="#,##0.#"></option>
|
|
55
|
+
<option value="#,##0.0"></option>
|
|
56
|
+
<option value="#,##0.0%"></option>
|
|
57
|
+
</datalist>
|
|
58
|
+
`
|
|
59
|
+
: html ``}
|
|
60
|
+
${this._hasProperties(this.selected)
|
|
61
|
+
? html `
|
|
62
|
+
<input id="checkbox-hidden" value-key="hidden" type="checkbox" .checked=${value.hidden} />
|
|
63
|
+
<label for="checkbox-hidden"> <ox-i18n msgid="label.item-hidden">Item Hidden</ox-i18n> </label>
|
|
64
|
+
|
|
65
|
+
<input id="checkbox-locked" value-key="locked" type="checkbox" .checked=${value.locked} />
|
|
66
|
+
<label for="checkbox-locked"> <ox-i18n msgid="label.locked">Locked</ox-i18n> </label>
|
|
67
|
+
`
|
|
68
|
+
: html ``}
|
|
69
|
+
</div>
|
|
70
|
+
</fieldset>
|
|
71
|
+
|
|
72
|
+
${!this._isLine(this.selected)
|
|
73
|
+
? keyed(this.selected, html `
|
|
74
|
+
<fieldset class="icon-label unit ratio">
|
|
75
|
+
<legend>
|
|
76
|
+
<ox-title-with-help topic="board-modeller/shapes/size" msgid="label.size">size</ox-title-with-help>
|
|
77
|
+
</legend>
|
|
78
|
+
|
|
79
|
+
<div class="property-grid">
|
|
80
|
+
<label class="width"> <ox-i18n msgid="label.width">width</ox-i18n> </label>
|
|
81
|
+
<input type="number" value-key="bounds.width" .value=${String(width)} />
|
|
82
|
+
<label class="height"> <ox-i18n msgid="label.height">height</ox-i18n> </label>
|
|
83
|
+
<input type="number" value-key="bounds.height" .value=${String(height)} />
|
|
84
|
+
|
|
85
|
+
${this.selected.length && this.selected[0].isRootModel()
|
|
86
|
+
? html ``
|
|
87
|
+
: html `
|
|
88
|
+
<label class="rotate"> <ox-i18n msgid="label.rotate">rotate</ox-i18n> </label>
|
|
89
|
+
<ox-input-angle value-key="rotation" .value=${value.rotation}> </ox-input-angle>
|
|
90
|
+
`}
|
|
91
|
+
</div>
|
|
92
|
+
</fieldset>
|
|
93
|
+
`)
|
|
94
|
+
: html ``}
|
|
95
|
+
${this._is3dish(this.selected)
|
|
96
|
+
? html `
|
|
97
|
+
<fieldset class="icon-label unit ratio" collapsable ?collapsed=${!this._3dExpanded}>
|
|
98
|
+
<legend>
|
|
99
|
+
<ox-title-with-help topic="board-modeller/shapes/3dish" msgid="label.3dish">3D</ox-title-with-help>
|
|
100
|
+
<md-icon
|
|
101
|
+
@click=${(e) => {
|
|
102
|
+
this._3dExpanded = !this._3dExpanded;
|
|
103
|
+
}}
|
|
104
|
+
>${this._3dExpanded ? 'expand_less' : 'expand_more'}</md-icon
|
|
105
|
+
>
|
|
106
|
+
</legend>
|
|
107
|
+
|
|
108
|
+
<div class="property-grid">
|
|
109
|
+
<label class="zPos"> <ox-i18n msgid="label.z-pos">pos. Z</ox-i18n> </label>
|
|
110
|
+
<input type="number" value-key="zPos" .value=${value.zPos} />
|
|
111
|
+
<label class="depth"> <ox-i18n msgid="label.depth">depth</ox-i18n> </label>
|
|
112
|
+
<input type="number" value-key="depth" .value=${value.depth} />
|
|
113
|
+
|
|
114
|
+
<label class="rotationX"> <ox-i18n msgid="label.rotation-x">rot. X</ox-i18n> </label>
|
|
115
|
+
<ox-input-angle value-key="rotationX" .value=${value.rotationX}> </ox-input-angle>
|
|
116
|
+
|
|
117
|
+
<label class="rotationY"> <ox-i18n msgid="label.rotation-y">rot. Y</ox-i18n> </label>
|
|
118
|
+
<ox-input-angle value-key="rotationY" .value=${value.rotationY}> </ox-input-angle>
|
|
119
|
+
|
|
120
|
+
<label class="rotationZ"> <ox-i18n msgid="label.rotation-z">rot. Z</ox-i18n> </label>
|
|
121
|
+
<ox-input-angle value-key="rotation" .value=${value.rotation}> </ox-input-angle>
|
|
122
|
+
</div>
|
|
123
|
+
</fieldset>
|
|
124
|
+
`
|
|
125
|
+
: html ``}
|
|
126
|
+
${this._hasTextProperty(this.selected)
|
|
127
|
+
? html `
|
|
128
|
+
<fieldset>
|
|
129
|
+
<legend>
|
|
130
|
+
<ox-title-with-help topic="board-modeller/shapes/text-box" msgid="label.text-box"
|
|
131
|
+
>text box</ox-title-with-help
|
|
132
|
+
>
|
|
133
|
+
</legend>
|
|
134
|
+
|
|
135
|
+
<div class="property-grid">
|
|
136
|
+
<label> <ox-i18n msgid="label.horizontal">horizontal</ox-i18n> </label>
|
|
137
|
+
<ox-buttons-radio value-key="textAlign" .value=${value.textAlign}>
|
|
138
|
+
<md-icon data-value="left">format_align_left</md-icon>
|
|
139
|
+
<md-icon data-value="center">format_align_center</md-icon>
|
|
140
|
+
<md-icon data-value="right">format_align_right</md-icon>
|
|
141
|
+
<md-icon data-value="justify">format_align_justify</md-icon>
|
|
142
|
+
</ox-buttons-radio>
|
|
143
|
+
|
|
144
|
+
<label> <ox-i18n msgid="label.vertical">vertical</ox-i18n> </label>
|
|
145
|
+
<ox-buttons-radio value-key="textBaseline" .value=${value.textBaseline}>
|
|
146
|
+
<md-icon data-value="top">align_vertical_top</md-icon>
|
|
147
|
+
<md-icon data-value="middle">align_vertical_center</md-icon>
|
|
148
|
+
<md-icon data-value="bottom">align_vertical_bottom</md-icon>
|
|
149
|
+
</ox-buttons-radio>
|
|
150
|
+
|
|
151
|
+
<input
|
|
152
|
+
id="checkbox-support-markdown"
|
|
153
|
+
type="checkbox"
|
|
154
|
+
value-key="supportMarkdown"
|
|
155
|
+
.checked=${value.supportMarkdown}
|
|
156
|
+
/>
|
|
157
|
+
<label for="checkbox-support-markdown">
|
|
158
|
+
<ox-i18n msgid="label.support-markdown">Support Markdown</ox-i18n>
|
|
159
|
+
</label>
|
|
160
|
+
|
|
161
|
+
<input id="checkbox-textwrap" type="checkbox" value-key="textWrap" .checked=${value.textWrap} />
|
|
162
|
+
<label for="checkbox-textwrap"> <ox-i18n msgid="label.text-wrap">Text Wrap</ox-i18n> </label>
|
|
163
|
+
|
|
164
|
+
${!value.textWrap
|
|
165
|
+
? html ` <label for="checkbox-textOverflow">
|
|
166
|
+
<ox-i18n msgid="label.text-overflow">Text Overflow</ox-i18n>
|
|
167
|
+
</label>
|
|
168
|
+
<select value-key="textOverflow" .value=${value.textOverflow || ''}>
|
|
169
|
+
<option value="" selected>none</option>
|
|
170
|
+
<option value="ellipsis">ellipsis</option>
|
|
171
|
+
<option value="clip">clip</option>
|
|
172
|
+
</select>`
|
|
173
|
+
: ''}
|
|
174
|
+
|
|
175
|
+
<label> <ox-i18n msgid="label.padding">padding</ox-i18n> </label>
|
|
176
|
+
<table class="box-padding">
|
|
177
|
+
<tr>
|
|
178
|
+
<td class="slide1"></td>
|
|
179
|
+
<td class="slide2"></td>
|
|
180
|
+
<td class="slide3"></td>
|
|
181
|
+
</tr>
|
|
182
|
+
<tr>
|
|
183
|
+
<td class="slide4"></td>
|
|
184
|
+
<td class="slide5">
|
|
185
|
+
<input type="number" value-key="paddingTop" .value=${value.paddingTop || 0} />
|
|
186
|
+
<input type="number" value-key="paddingLeft" .value=${value.paddingLeft || 0} />
|
|
187
|
+
<input type="number" value-key="paddingRight" .value=${value.paddingRight || 0} />
|
|
188
|
+
<input type="number" value-key="paddingBottom" .value=${value.paddingBottom || 0} />
|
|
189
|
+
</td>
|
|
190
|
+
<td class="slide6"></td>
|
|
191
|
+
</tr>
|
|
192
|
+
<tr>
|
|
193
|
+
<td class="slide7"></td>
|
|
194
|
+
<td class="slide8"></td>
|
|
195
|
+
<td class="slide9"></td>
|
|
196
|
+
</tr>
|
|
197
|
+
</table>
|
|
198
|
+
</div>
|
|
199
|
+
</fieldset>
|
|
200
|
+
`
|
|
201
|
+
: html ``}
|
|
202
|
+
${this.selected.length && this.selected[0].isRootModel()
|
|
203
|
+
? html `
|
|
204
|
+
<fieldset class="icon-label">
|
|
205
|
+
<legend>
|
|
206
|
+
<ox-title-with-help topic="board-modeller/shapes/viewer-option" msgid="label.viewer-option"
|
|
207
|
+
>Viewer Option</ox-title-with-help
|
|
208
|
+
>
|
|
209
|
+
</legend>
|
|
210
|
+
|
|
211
|
+
<div class="property-grid">
|
|
212
|
+
<label><ox-i18n msgid="label.fit">Fit</ox-i18n></label>
|
|
213
|
+
<select value-key="fitMode" .value=${value.fitMode || 'ratio'}>
|
|
214
|
+
<option value="none">none</option>
|
|
215
|
+
<option value="center">center</option>
|
|
216
|
+
<option value="ratio" selected>ratio</option>
|
|
217
|
+
<option value="both">both</option>
|
|
218
|
+
<option value="width">width</option>
|
|
219
|
+
<option value="height">height</option>
|
|
220
|
+
</select>
|
|
221
|
+
</div>
|
|
222
|
+
</fieldset>
|
|
223
|
+
<fieldset class="icon-label">
|
|
224
|
+
<legend>
|
|
225
|
+
<ox-title-with-help topic="board-modeller/shapes/print-option" msgid="label.label-print"
|
|
226
|
+
>Print Option</ox-title-with-help
|
|
227
|
+
>
|
|
228
|
+
</legend>
|
|
229
|
+
|
|
230
|
+
<div class="property-grid">
|
|
231
|
+
<label class="rotate"><ox-i18n msgid="label.label-rotation">Label Rotation</ox-i18n></label>
|
|
232
|
+
<select value-key="labelRotation" .value=${value.labelRotation || 'N'}>
|
|
233
|
+
<option value="N" selected>0°</option>
|
|
234
|
+
<option value="B">90°</option>
|
|
235
|
+
<option value="I">180°</option>
|
|
236
|
+
<option value="R">270°</option>
|
|
237
|
+
</select>
|
|
238
|
+
</div>
|
|
239
|
+
</fieldset>
|
|
240
|
+
`
|
|
241
|
+
: html ``}
|
|
242
|
+
`;
|
|
243
|
+
}
|
|
244
|
+
onValueChange(e) {
|
|
245
|
+
var element = e.target;
|
|
246
|
+
var key = element.getAttribute('value-key');
|
|
247
|
+
if (!key) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
var value = this.getValueFromEventTarget(element);
|
|
251
|
+
if (key.indexOf('bounds.') == 0) {
|
|
252
|
+
if (isNaN(value))
|
|
253
|
+
return;
|
|
254
|
+
this.dispatchEvent(new CustomEvent('bounds-change', {
|
|
255
|
+
bubbles: true,
|
|
256
|
+
composed: true,
|
|
257
|
+
detail: {
|
|
258
|
+
[key.substr(7)]: value
|
|
259
|
+
}
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
this.onAfterValueChange(key, value);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
_hasTextProperty(selected) {
|
|
267
|
+
for (let i = 0; i < selected.length; i++) {
|
|
268
|
+
if (!selected[i].hasTextProperty)
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
_hasProperties(selected) {
|
|
274
|
+
if (!selected || selected.length == 0 || (selected[0] && selected[0].isLayer && selected[0].isLayer()))
|
|
275
|
+
return false;
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
_isIdentifiable(selected) {
|
|
279
|
+
if (!selected || selected.length == 0 || selected.length > 1 || (selected[0].isLayer && selected[0].isLayer()))
|
|
280
|
+
return false;
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
_isClassIdentifiable(selected) {
|
|
284
|
+
if (!selected || (selected[0] && selected[0].isLayer()))
|
|
285
|
+
return false;
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
_isLine(selected) {
|
|
289
|
+
if (!selected || !(selected[0] && selected[0].isLine()))
|
|
290
|
+
return false;
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
_is3dish(selected) {
|
|
294
|
+
if (!selected || !(selected[0] && selected[0].is3dish()))
|
|
295
|
+
return false;
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
PropertyShapes.styles = [PropertyGridStyles, BoxPaddingEditorStyles];
|
|
300
|
+
__decorate([
|
|
301
|
+
property({ type: Object })
|
|
302
|
+
], PropertyShapes.prototype, "value", void 0);
|
|
303
|
+
__decorate([
|
|
304
|
+
property({ type: Object })
|
|
305
|
+
], PropertyShapes.prototype, "bounds", void 0);
|
|
306
|
+
__decorate([
|
|
307
|
+
property({ type: Array })
|
|
308
|
+
], PropertyShapes.prototype, "selected", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
state()
|
|
311
|
+
], PropertyShapes.prototype, "_3dExpanded", void 0);
|
|
312
|
+
//# sourceMappingURL=shapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes.js","sourceRoot":"","sources":["../../../../src/property-panel/shapes/shapes.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,kCAAkC,CAAA;AACzC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AACjC,OAAO,qCAAqC,CAAA;AAE5C,OAAO,EAAO,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAA;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,MAAM,OAAO,cAAe,SAAQ,gBAAgB;IAApD;;QAI8B,WAAM,GAAkB,IAAI,CAAA;QAC7B,aAAQ,GAAgB,EAAE,CAAA;QAEpC,gBAAW,GAAY,KAAK,CAAA;IAqS/C,CAAC;IAnSC,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,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tE,OAAO,IAAI,CAAA;IACb,CAAC;;AA1SM,qBAAM,GAAG,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,AAA/C,CAA+C;AAEhC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA6B;AAC7B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAA2B;AAEpC;IAAhB,KAAK,EAAE;mDAAqC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/input/ox-input-angle.js'\nimport '@operato/input/ox-buttons-radio.js'\nimport '@material/web/icon/icon.js'\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/help/ox-title-with-help.js'\n\nimport { css, html } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { BOUNDS, Component, Properties } from '@hatiolab/things-scene'\nimport { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'\nimport { BoxPaddingEditorStyles } from '@operato/styles/box-padding-editor-styles.js'\n\nimport { AbstractProperty } from '../abstract-property.js'\n\nexport class PropertyShapes extends AbstractProperty {\n static styles = [PropertyGridStyles, BoxPaddingEditorStyles]\n\n @property({ type: Object }) value?: Properties\n @property({ type: Object }) bounds: BOUNDS | null = null\n @property({ type: Array }) selected: Component[] = []\n\n @state() private _3dExpanded: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this.onValueChange.bind(this))\n }\n\n render() {\n const value = this.value || {}\n const { width, height } = this.bounds || {}\n\n return html`\n <fieldset>\n <div class=\"property-grid\">\n ${this._isIdentifiable(this.selected)\n ? html`\n <label> <ox-i18n msgid=\"label.id\">ID</ox-i18n> </label>\n <input value-key=\"id\" .value=${value.id || ''} />\n `\n : html``}\n ${this._isClassIdentifiable(this.selected)\n ? html`\n <label> <ox-i18n msgid=\"label.class\">Class</ox-i18n> </label>\n <input value-key=\"class\" .value=${value.class || ''} />\n `\n : html``}\n ${this._hasTextProperty(this.selected)\n ? html`\n <label> <ox-i18n msgid=\"label.text\">Text</ox-i18n> </label>\n <input value-key=\"text\" .value=${value.text || ''} />\n <label> <ox-i18n msgid=\"label.text-format\">Text Format</ox-i18n> </label>\n <input value-key=\"textFormat\" .value=${value.textFormat || ''} list=\"format-list\" />\n <datalist id=\"format-list\">\n <option value=\"#,###.\"></option>\n <option value=\"#,###.#\"></option>\n <option value=\"#,###.0\"></option>\n <option value=\"#,##0.#\"></option>\n <option value=\"#,##0.0\"></option>\n <option value=\"#,##0.0%\"></option>\n </datalist>\n `\n : html``}\n ${this._hasProperties(this.selected)\n ? html`\n <input id=\"checkbox-hidden\" value-key=\"hidden\" type=\"checkbox\" .checked=${value.hidden} />\n <label for=\"checkbox-hidden\"> <ox-i18n msgid=\"label.item-hidden\">Item Hidden</ox-i18n> </label>\n\n <input id=\"checkbox-locked\" value-key=\"locked\" type=\"checkbox\" .checked=${value.locked} />\n <label for=\"checkbox-locked\"> <ox-i18n msgid=\"label.locked\">Locked</ox-i18n> </label>\n `\n : html``}\n </div>\n </fieldset>\n\n ${!this._isLine(this.selected)\n ? keyed(\n this.selected,\n html`\n <fieldset class=\"icon-label unit ratio\">\n <legend>\n <ox-title-with-help topic=\"board-modeller/shapes/size\" msgid=\"label.size\">size</ox-title-with-help>\n </legend>\n\n <div class=\"property-grid\">\n <label class=\"width\"> <ox-i18n msgid=\"label.width\">width</ox-i18n> </label>\n <input type=\"number\" value-key=\"bounds.width\" .value=${String(width)} />\n <label class=\"height\"> <ox-i18n msgid=\"label.height\">height</ox-i18n> </label>\n <input type=\"number\" value-key=\"bounds.height\" .value=${String(height)} />\n\n ${this.selected.length && this.selected[0].isRootModel()\n ? html``\n : html`\n <label class=\"rotate\"> <ox-i18n msgid=\"label.rotate\">rotate</ox-i18n> </label>\n <ox-input-angle value-key=\"rotation\" .value=${value.rotation}> </ox-input-angle>\n `}\n </div>\n </fieldset>\n `\n )\n : html``}\n ${this._is3dish(this.selected)\n ? html`\n <fieldset class=\"icon-label unit ratio\" collapsable ?collapsed=${!this._3dExpanded}>\n <legend>\n <ox-title-with-help topic=\"board-modeller/shapes/3dish\" msgid=\"label.3dish\">3D</ox-title-with-help>\n <md-icon\n @click=${(e: Event) => {\n this._3dExpanded = !this._3dExpanded\n }}\n >${this._3dExpanded ? 'expand_less' : 'expand_more'}</md-icon\n >\n </legend>\n\n <div class=\"property-grid\">\n <label class=\"zPos\"> <ox-i18n msgid=\"label.z-pos\">pos. Z</ox-i18n> </label>\n <input type=\"number\" value-key=\"zPos\" .value=${value.zPos} />\n <label class=\"depth\"> <ox-i18n msgid=\"label.depth\">depth</ox-i18n> </label>\n <input type=\"number\" value-key=\"depth\" .value=${value.depth} />\n\n <label class=\"rotationX\"> <ox-i18n msgid=\"label.rotation-x\">rot. X</ox-i18n> </label>\n <ox-input-angle value-key=\"rotationX\" .value=${value.rotationX}> </ox-input-angle>\n\n <label class=\"rotationY\"> <ox-i18n msgid=\"label.rotation-y\">rot. Y</ox-i18n> </label>\n <ox-input-angle value-key=\"rotationY\" .value=${value.rotationY}> </ox-input-angle>\n\n <label class=\"rotationZ\"> <ox-i18n msgid=\"label.rotation-z\">rot. Z</ox-i18n> </label>\n <ox-input-angle value-key=\"rotation\" .value=${value.rotation}> </ox-input-angle>\n </div>\n </fieldset>\n `\n : html``}\n ${this._hasTextProperty(this.selected)\n ? html`\n <fieldset>\n <legend>\n <ox-title-with-help topic=\"board-modeller/shapes/text-box\" msgid=\"label.text-box\"\n >text box</ox-title-with-help\n >\n </legend>\n\n <div class=\"property-grid\">\n <label> <ox-i18n msgid=\"label.horizontal\">horizontal</ox-i18n> </label>\n <ox-buttons-radio value-key=\"textAlign\" .value=${value.textAlign}>\n <md-icon data-value=\"left\">format_align_left</md-icon>\n <md-icon data-value=\"center\">format_align_center</md-icon>\n <md-icon data-value=\"right\">format_align_right</md-icon>\n <md-icon data-value=\"justify\">format_align_justify</md-icon>\n </ox-buttons-radio>\n\n <label> <ox-i18n msgid=\"label.vertical\">vertical</ox-i18n> </label>\n <ox-buttons-radio value-key=\"textBaseline\" .value=${value.textBaseline}>\n <md-icon data-value=\"top\">align_vertical_top</md-icon>\n <md-icon data-value=\"middle\">align_vertical_center</md-icon>\n <md-icon data-value=\"bottom\">align_vertical_bottom</md-icon>\n </ox-buttons-radio>\n\n <input\n id=\"checkbox-support-markdown\"\n type=\"checkbox\"\n value-key=\"supportMarkdown\"\n .checked=${value.supportMarkdown}\n />\n <label for=\"checkbox-support-markdown\">\n <ox-i18n msgid=\"label.support-markdown\">Support Markdown</ox-i18n>\n </label>\n\n <input id=\"checkbox-textwrap\" type=\"checkbox\" value-key=\"textWrap\" .checked=${value.textWrap} />\n <label for=\"checkbox-textwrap\"> <ox-i18n msgid=\"label.text-wrap\">Text Wrap</ox-i18n> </label>\n\n ${!value.textWrap\n ? html` <label for=\"checkbox-textOverflow\">\n <ox-i18n msgid=\"label.text-overflow\">Text Overflow</ox-i18n>\n </label>\n <select value-key=\"textOverflow\" .value=${value.textOverflow || ''}>\n <option value=\"\" selected>none</option>\n <option value=\"ellipsis\">ellipsis</option>\n <option value=\"clip\">clip</option>\n </select>`\n : ''}\n\n <label> <ox-i18n msgid=\"label.padding\">padding</ox-i18n> </label>\n <table class=\"box-padding\">\n <tr>\n <td class=\"slide1\"></td>\n <td class=\"slide2\"></td>\n <td class=\"slide3\"></td>\n </tr>\n <tr>\n <td class=\"slide4\"></td>\n <td class=\"slide5\">\n <input type=\"number\" value-key=\"paddingTop\" .value=${value.paddingTop || 0} />\n <input type=\"number\" value-key=\"paddingLeft\" .value=${value.paddingLeft || 0} />\n <input type=\"number\" value-key=\"paddingRight\" .value=${value.paddingRight || 0} />\n <input type=\"number\" value-key=\"paddingBottom\" .value=${value.paddingBottom || 0} />\n </td>\n <td class=\"slide6\"></td>\n </tr>\n <tr>\n <td class=\"slide7\"></td>\n <td class=\"slide8\"></td>\n <td class=\"slide9\"></td>\n </tr>\n </table>\n </div>\n </fieldset>\n `\n : html``}\n ${this.selected.length && this.selected[0].isRootModel()\n ? html`\n <fieldset class=\"icon-label\">\n <legend>\n <ox-title-with-help topic=\"board-modeller/shapes/viewer-option\" msgid=\"label.viewer-option\"\n >Viewer Option</ox-title-with-help\n >\n </legend>\n\n <div class=\"property-grid\">\n <label><ox-i18n msgid=\"label.fit\">Fit</ox-i18n></label>\n <select value-key=\"fitMode\" .value=${value.fitMode || 'ratio'}>\n <option value=\"none\">none</option>\n <option value=\"center\">center</option>\n <option value=\"ratio\" selected>ratio</option>\n <option value=\"both\">both</option>\n <option value=\"width\">width</option>\n <option value=\"height\">height</option>\n </select>\n </div>\n </fieldset>\n <fieldset class=\"icon-label\">\n <legend>\n <ox-title-with-help topic=\"board-modeller/shapes/print-option\" msgid=\"label.label-print\"\n >Print Option</ox-title-with-help\n >\n </legend>\n\n <div class=\"property-grid\">\n <label class=\"rotate\"><ox-i18n msgid=\"label.label-rotation\">Label Rotation</ox-i18n></label>\n <select value-key=\"labelRotation\" .value=${value.labelRotation || 'N'}>\n <option value=\"N\" selected>0°</option>\n <option value=\"B\">90°</option>\n <option value=\"I\">180°</option>\n <option value=\"R\">270°</option>\n </select>\n </div>\n </fieldset>\n `\n : html``}\n `\n }\n\n onValueChange(e: Event) {\n var element = e.target as HTMLElement\n var key = element.getAttribute('value-key')\n\n if (!key) {\n return\n }\n\n var value = this.getValueFromEventTarget(element)\n\n if (key.indexOf('bounds.') == 0) {\n if (isNaN(value)) return\n this.dispatchEvent(\n new CustomEvent('bounds-change', {\n bubbles: true,\n composed: true,\n detail: {\n [key.substr(7)]: value\n }\n })\n )\n } else {\n this.onAfterValueChange(key, value)\n }\n }\n\n _hasTextProperty(selected: Component[]) {\n for (let i = 0; i < selected.length; i++) {\n if (!selected[i].hasTextProperty) return false\n }\n\n return true\n }\n\n _hasProperties(selected: Component[]) {\n if (!selected || selected.length == 0 || (selected[0] && selected[0].isLayer && selected[0].isLayer())) return false\n\n return true\n }\n\n _isIdentifiable(selected: Component[]) {\n if (!selected || selected.length == 0 || selected.length > 1 || (selected[0].isLayer && selected[0].isLayer()))\n return false\n\n return true\n }\n\n _isClassIdentifiable(selected: Component[]) {\n if (!selected || (selected[0] && selected[0].isLayer())) return false\n\n return true\n }\n\n _isLine(selected: Component[]) {\n if (!selected || !(selected[0] && selected[0].isLine())) return false\n\n return true\n }\n\n _is3dish(selected: Component[]) {\n if (!selected || !(selected[0] && selected[0].is3dish())) return false\n\n return true\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@operato/app/property-editor.js';
|
|
5
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
6
|
+
export declare class SpecificPropertiesBuilder extends LitElement {
|
|
7
|
+
value: any;
|
|
8
|
+
props: any[];
|
|
9
|
+
propertyEditor: any;
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
firstUpdated(): void;
|
|
12
|
+
updated(changes: PropertyValues<this>): void;
|
|
13
|
+
_onPropsChanged(props: any[]): void;
|
|
14
|
+
_setValues(): void;
|
|
15
|
+
onValueChanged(e: Event): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import '@operato/app/property-editor.js'; /* for registering property editors */
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
|
+
import { property } from 'lit/decorators.js';
|
|
8
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
9
|
+
/**
|
|
10
|
+
모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
|
|
11
|
+
|
|
12
|
+
Example:
|
|
13
|
+
|
|
14
|
+
<specific-properties-builder value="{{value}}">
|
|
15
|
+
<label>Center X</label>
|
|
16
|
+
<input type="number" .value="${value.cx}">
|
|
17
|
+
<label>Width</label>
|
|
18
|
+
<input type="number" .value="${value.width}">
|
|
19
|
+
</specific-properties-builder>
|
|
20
|
+
*/
|
|
21
|
+
const DEFAULT_VALUE = {
|
|
22
|
+
legend: '',
|
|
23
|
+
// number: 0, // should be undefined
|
|
24
|
+
angle: 0,
|
|
25
|
+
string: '',
|
|
26
|
+
password: '',
|
|
27
|
+
textarea: '',
|
|
28
|
+
checkbox: false,
|
|
29
|
+
select: '',
|
|
30
|
+
color: '#000000',
|
|
31
|
+
'solidcolor-stops': null,
|
|
32
|
+
'gradientcolor-stops': null,
|
|
33
|
+
'gltf-selector': '',
|
|
34
|
+
'image-selector': '',
|
|
35
|
+
multiplecolor: null,
|
|
36
|
+
editortable: null,
|
|
37
|
+
imageselector: '',
|
|
38
|
+
options: null,
|
|
39
|
+
date: null
|
|
40
|
+
};
|
|
41
|
+
function convertValue(type, value) {
|
|
42
|
+
var converted = String(value).trim() == '' ? undefined : value;
|
|
43
|
+
switch (type) {
|
|
44
|
+
case 'number':
|
|
45
|
+
case 'angle':
|
|
46
|
+
converted = parseFloat(value);
|
|
47
|
+
converted = isNaN(converted) ? undefined : converted;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return converted;
|
|
51
|
+
}
|
|
52
|
+
export class SpecificPropertiesBuilder extends LitElement {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
this.props = [];
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
return html `<slot></slot>`;
|
|
59
|
+
}
|
|
60
|
+
firstUpdated() {
|
|
61
|
+
this.addEventListener('change', this.onValueChanged.bind(this));
|
|
62
|
+
}
|
|
63
|
+
updated(changes) {
|
|
64
|
+
changes.has('props') && this._onPropsChanged(this.props);
|
|
65
|
+
changes.has('value') && this._setValues();
|
|
66
|
+
}
|
|
67
|
+
_onPropsChanged(props) {
|
|
68
|
+
this.textContent = '';
|
|
69
|
+
(props || []).forEach((spec) => {
|
|
70
|
+
const { label, type, placeholder, name, observe, property, editor, quantifier, defaultValue, disabled } = spec;
|
|
71
|
+
let elementType = OxPropertyEditor.getEditor(type);
|
|
72
|
+
if (!elementType) {
|
|
73
|
+
console.warn('Property Editor not defined', type);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
let element = document.createElement(elementType);
|
|
77
|
+
element.label = label;
|
|
78
|
+
element.type = type;
|
|
79
|
+
element.placeholder = placeholder;
|
|
80
|
+
element.name = name;
|
|
81
|
+
element.setAttribute('name', name);
|
|
82
|
+
if (observe) {
|
|
83
|
+
element.observeHandler = observe;
|
|
84
|
+
}
|
|
85
|
+
element.property = property;
|
|
86
|
+
element.editor = editor;
|
|
87
|
+
element.quantifier = quantifier;
|
|
88
|
+
element.defaultValue = defaultValue;
|
|
89
|
+
element.setAttribute('property-editor', 'true');
|
|
90
|
+
element.disabled = disabled;
|
|
91
|
+
this.appendChild(element);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
_setValues() {
|
|
95
|
+
this.value &&
|
|
96
|
+
Array.from(this.querySelectorAll('[name]')).forEach((prop) => {
|
|
97
|
+
let name = prop.getAttribute('name');
|
|
98
|
+
if (!name) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
var convertedValue = convertValue(prop.type, this.value[name]);
|
|
102
|
+
if (convertedValue === undefined) {
|
|
103
|
+
convertedValue = DEFAULT_VALUE[prop.type];
|
|
104
|
+
}
|
|
105
|
+
prop.value = convertedValue;
|
|
106
|
+
prop.observe.call(prop, prop.value);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
onValueChanged(e) {
|
|
110
|
+
e.stopPropagation();
|
|
111
|
+
var target = e.target;
|
|
112
|
+
const prop = target.closest('[property-editor]');
|
|
113
|
+
var name = prop.getAttribute('name');
|
|
114
|
+
if (!name) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.value[name] = prop.value;
|
|
118
|
+
prop.observe(prop.value);
|
|
119
|
+
this._setValues();
|
|
120
|
+
this.dispatchEvent(new CustomEvent('property-change', {
|
|
121
|
+
bubbles: true,
|
|
122
|
+
composed: true,
|
|
123
|
+
detail: {
|
|
124
|
+
[name]: prop.value
|
|
125
|
+
}
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
__decorate([
|
|
130
|
+
property({ type: Object })
|
|
131
|
+
], SpecificPropertiesBuilder.prototype, "value", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
property({ type: Array })
|
|
134
|
+
], SpecificPropertiesBuilder.prototype, "props", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
property({ type: Object })
|
|
137
|
+
], SpecificPropertiesBuilder.prototype, "propertyEditor", void 0);
|
|
138
|
+
//# sourceMappingURL=specific-properties-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specific-properties-builder.js","sourceRoot":"","sources":["../../../../src/property-panel/specifics/specific-properties-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,iCAAiC,CAAA,CAAC,sCAAsC;AAE/E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG5C,OAAO,EAAE,gBAAgB,EAAgB,MAAM,0BAA0B,CAAA;AAEzE;;;;;;;;;;;EAWE;AAEF,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,EAAE;IACV,oCAAoC;IACpC,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,SAAS;IAChB,kBAAkB,EAAE,IA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,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK;aACnB;SACF,CAAC,CACH,CAAA;IACH,CAAC;CACF;AA3F6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAW;AACX;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wDAAkB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAAoB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/app/property-editor.js' /* for registering property editors */\n\nimport { html, LitElement, PropertyValues } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { Properties } from '@hatiolab/things-scene'\nimport { OxPropertyEditor, PropertySpec } from '@operato/property-editor'\n\n/**\n모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.\n\nExample:\n\n <specific-properties-builder value=\"{{value}}\">\n <label>Center X</label>\n <input type=\"number\" .value=\"${value.cx}\">\n <label>Width</label>\n <input type=\"number\" .value=\"${value.width}\">\n </specific-properties-builder>\n*/\n\nconst DEFAULT_VALUE = {\n legend: '',\n // number: 0, // should be undefined\n angle: 0,\n string: '',\n password: '',\n textarea: '',\n checkbox: false,\n select: '',\n color: '#000000',\n 'solidcolor-stops': null,\n 'gradientcolor-stops': null,\n 'gltf-selector': '',\n 'image-selector': '',\n multiplecolor: null,\n editortable: null,\n imageselector: '',\n options: null,\n date: null\n}\n\nfunction convertValue(type: string, value: any) {\n var converted = String(value).trim() == '' ? undefined : value\n switch (type) {\n case 'number':\n case 'angle':\n converted = parseFloat(value)\n converted = isNaN(converted) ? undefined : converted\n break\n }\n\n return converted\n}\n\nexport class SpecificPropertiesBuilder extends LitElement {\n @property({ type: Object }) value: any\n @property({ type: Array }) props: any[] = []\n @property({ type: Object }) propertyEditor: any\n\n render() {\n return html`<slot></slot>`\n }\n\n firstUpdated() {\n this.addEventListener('change', this.onValueChanged.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n changes.has('props') && this._onPropsChanged(this.props)\n changes.has('value') && this._setValues()\n }\n\n _onPropsChanged(props: any[]) {\n this.textContent = ''\n ;(props || []).forEach((spec: PropertySpec) => {\n const { label, type, placeholder, name, observe, property, editor, quantifier, defaultValue, disabled } = spec\n\n let elementType = OxPropertyEditor.getEditor(type)\n if (!elementType) {\n console.warn('Property Editor not defined', type)\n return\n }\n let element = document.createElement(elementType) as OxPropertyEditor\n\n element.label = label\n element.type = type\n element.placeholder = placeholder\n element.name = name\n element.setAttribute('name', name)\n\n if (observe) {\n element.observeHandler = observe\n }\n element.property = property\n element.editor = editor\n element.quantifier = quantifier\n element.defaultValue = defaultValue\n element.setAttribute('property-editor', 'true')\n element.disabled = disabled\n\n this.appendChild(element)\n })\n }\n\n _setValues() {\n this.value &&\n Array.from(this.querySelectorAll('[name]')).forEach((prop: Properties) => {\n let name = prop.getAttribute('name')\n if (!name) {\n return\n }\n var convertedValue = convertValue(prop.type, this.value[name])\n if (convertedValue === undefined) {\n convertedValue = (DEFAULT_VALUE as any)[prop.type]\n }\n prop.value = convertedValue\n prop.observe.call(prop, prop.value)\n })\n }\n\n onValueChanged(e: Event) {\n e.stopPropagation()\n var target = e.target as Element\n\n const prop = target.closest('[property-editor]') as OxPropertyEditor\n\n var name = prop.getAttribute('name')\n if (!name) {\n return\n }\n\n this.value[name] = prop.value\n\n prop.observe(prop.value)\n this._setValues()\n\n this.dispatchEvent(\n new CustomEvent('property-change', {\n bubbles: true,\n composed: true,\n detail: {\n [name]: prop.value\n }\n })\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@operato/help/ox-help-icon.js';
|
|
5
|
+
import { LitElement } from 'lit';
|
|
6
|
+
import { Component, Scene } from '@hatiolab/things-scene';
|
|
7
|
+
import { SpecificPropertiesBuilder } from './specific-properties-builder.js';
|
|
8
|
+
declare const PropertySpecific_base: typeof LitElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types.js").ScopedElementsHost>;
|
|
9
|
+
export declare class PropertySpecific extends PropertySpecific_base {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
value: any;
|
|
12
|
+
scene: Scene | null;
|
|
13
|
+
selected: Component[];
|
|
14
|
+
props: any[];
|
|
15
|
+
propertyEditor: any[];
|
|
16
|
+
private boundINeedSelected;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
static get scopedElements(): {
|
|
20
|
+
'specific-properties-builder': typeof SpecificPropertiesBuilder;
|
|
21
|
+
};
|
|
22
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
23
|
+
private onINeedSelected;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import '@operato/help/ox-help-icon.js';
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
|
+
import { property } from 'lit/decorators.js';
|
|
8
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
9
|
+
import { i18next } from '@operato/i18n';
|
|
10
|
+
import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js';
|
|
11
|
+
import { SpecificPropertiesBuilder } from './specific-properties-builder.js';
|
|
12
|
+
export class PropertySpecific extends ScopedElementsMixin(LitElement) {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.scene = null;
|
|
16
|
+
this.selected = [];
|
|
17
|
+
this.props = [];
|
|
18
|
+
this.propertyEditor = [];
|
|
19
|
+
this.boundINeedSelected = this.onINeedSelected.bind(this);
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
super.connectedCallback();
|
|
23
|
+
this.addEventListener('i-need-selected', this.boundINeedSelected);
|
|
24
|
+
}
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
super.disconnectedCallback();
|
|
27
|
+
this.removeEventListener('i-need-selected', this.boundINeedSelected);
|
|
28
|
+
}
|
|
29
|
+
static get scopedElements() {
|
|
30
|
+
return {
|
|
31
|
+
'specific-properties-builder': SpecificPropertiesBuilder
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
var _a;
|
|
36
|
+
const selected = this.selected && this.selected[0];
|
|
37
|
+
const value = this.value || {};
|
|
38
|
+
return html `
|
|
39
|
+
<label
|
|
40
|
+
>${i18next.t(`component.${value.type}`)}<ox-help-icon .topic=${(_a = selected === null || selected === void 0 ? void 0 : selected.nature) === null || _a === void 0 ? void 0 : _a.help}></ox-help-icon
|
|
41
|
+
></label>
|
|
42
|
+
|
|
43
|
+
<specific-properties-builder .value=${value} .props=${this.props} .propertyEditor=${this.propertyEditor}>
|
|
44
|
+
</specific-properties-builder>
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
onINeedSelected(e) {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
var { callback } = e.detail;
|
|
50
|
+
this.scene.undoableChange(() => {
|
|
51
|
+
callback.call(null, this.selected);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
PropertySpecific.styles = [
|
|
56
|
+
PropertyGridStyles,
|
|
57
|
+
css `
|
|
58
|
+
label {
|
|
59
|
+
display: block;
|
|
60
|
+
margin: 10px;
|
|
61
|
+
|
|
62
|
+
text-align: right;
|
|
63
|
+
font: bold 14px var(--theme-font);
|
|
64
|
+
color: var(--md-sys-color-on-primary-container);
|
|
65
|
+
text-transform: capitalize;
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
];
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: Object })
|
|
71
|
+
], PropertySpecific.prototype, "value", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
property({ type: Object })
|
|
74
|
+
], PropertySpecific.prototype, "scene", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
property({ type: Array })
|
|
77
|
+
], PropertySpecific.prototype, "selected", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
property({ type: Array })
|
|
80
|
+
], PropertySpecific.prototype, "props", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: Array })
|
|
83
|
+
], PropertySpecific.prototype, "propertyEditor", void 0);
|
|
84
|
+
//# sourceMappingURL=specifics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specifics.js","sourceRoot":"","sources":["../../../../src/property-panel/specifics/specifics.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,+BAA+B,CAAA;AAEtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAE5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAE5E,MAAM,OAAO,gBAAiB,SAAQ,mBAAmB,CAAC,UAAU,CAAC;IAArE;;QAiB8B,UAAK,GAAiB,IAAI,CAAA;QAC3B,aAAQ,GAAgB,EAAE,CAAA;QAC1B,UAAK,GAAU,EAAE,CAAA;QACjB,mBAAc,GAAU,EAAE,CAAA;QAE7C,uBAAkB,GAAQ,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAyCnE,CAAC;IAvCC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAA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AM,EAAE,CAAC;+CAA2B;AAC3B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAA2B;AAC1B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;+CAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wDAA2B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/help/ox-help-icon.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { Component, Scene } from '@hatiolab/things-scene'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\n\nimport { i18next } from '@operato/i18n'\nimport { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'\n\nimport { SpecificPropertiesBuilder } from './specific-properties-builder.js'\n\nexport class PropertySpecific extends ScopedElementsMixin(LitElement) {\n static styles = [\n PropertyGridStyles,\n css`\n label {\n display: block;\n margin: 10px;\n\n text-align: right;\n font: bold 14px var(--theme-font);\n color: var(--md-sys-color-on-primary-container);\n text-transform: capitalize;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: Object }) scene: Scene | null = null\n @property({ type: Array }) selected: Component[] = []\n @property({ type: Array }) props: any[] = []\n @property({ type: Array }) propertyEditor: any[] = []\n\n private boundINeedSelected: any = this.onINeedSelected.bind(this)\n\n connectedCallback() {\n super.connectedCallback()\n\n this.addEventListener('i-need-selected', this.boundINeedSelected)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.removeEventListener('i-need-selected', this.boundINeedSelected)\n }\n static get scopedElements() {\n return {\n 'specific-properties-builder': SpecificPropertiesBuilder\n }\n }\n render() {\n const selected = this.selected && this.selected[0]\n const value = this.value || {}\n\n return html`\n <label\n >${i18next.t(`component.${value.type}`)}<ox-help-icon .topic=${selected?.nature?.help}></ox-help-icon\n ></label>\n\n <specific-properties-builder .value=${value} .props=${this.props} .propertyEditor=${this.propertyEditor}>\n </specific-properties-builder>\n `\n }\n\n private onINeedSelected(e: CustomEvent) {\n e.stopPropagation()\n\n var { callback } = e.detail\n\n this.scene!.undoableChange(() => {\n callback.call(null, this.selected)\n })\n }\n}\n"]}
|