@things-factory/modeller-ui 5.0.0-alpha.3 → 5.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/client/bootstrap.js +22 -26
  2. package/client/editors/things-editor-layout/things-card-layout.js +1 -1
  3. package/client/editors/things-editor-property.js +1 -546
  4. package/package.json +15 -14
  5. package/client/editors/paper-color-picker/paper-color-circle.js +0 -466
  6. package/client/editors/paper-color-picker/paper-color-input.js +0 -266
  7. package/client/editors/paper-color-picker/paper-color-picker.js +0 -584
  8. package/client/editors/things-editor-3dish.js +0 -164
  9. package/client/editors/things-editor-angle-input.js +0 -69
  10. package/client/editors/things-editor-attachment-selector.js +0 -110
  11. package/client/editors/things-editor-buttons-radio.js +0 -93
  12. package/client/editors/things-editor-code.js +0 -152
  13. package/client/editors/things-editor-color-stops.js +0 -499
  14. package/client/editors/things-editor-color-style.js +0 -345
  15. package/client/editors/things-editor-color.js +0 -313
  16. package/client/editors/things-editor-data.js +0 -152
  17. package/client/editors/things-editor-gradient.js +0 -335
  18. package/client/editors/things-editor-graphql.js +0 -173
  19. package/client/editors/things-editor-id.js +0 -85
  20. package/client/editors/things-editor-multiple-color.js +0 -132
  21. package/client/editors/things-editor-options.js +0 -155
  22. package/client/editors/things-editor-pattern.js +0 -161
  23. package/client/editors/things-editor-property-styles.js +0 -71
  24. package/client/editors/things-editor-range-input.js +0 -166
  25. package/client/editors/things-editor-script.js +0 -213
  26. package/client/editors/things-editor-stack.js +0 -107
  27. package/client/editors/things-editor-table.js +0 -376
  28. package/client/editors/things-editor-value-map.js +0 -290
  29. package/client/editors/things-editor-value-range.js +0 -292
@@ -1,85 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { LitElement, html, css } from 'lit'
6
-
7
- class ThingsEditorId extends LitElement {
8
- static get is() {
9
- return 'things-editor-id'
10
- }
11
-
12
- static get properties() {
13
- return {
14
- value: String,
15
- property: Object,
16
- _ids: Array
17
- }
18
- }
19
-
20
- static get styles() {
21
- return [
22
- css`
23
- :host {
24
- position: relative;
25
- display: inline-flex;
26
- align-items: center;
27
- justify-content: flex-end;
28
- }
29
-
30
- input {
31
- width: 100%;
32
- height: 100%;
33
- box-sizing: border-box;
34
- border: 1px solid rgba(0, 0, 0, 0.2);
35
- }
36
- `
37
- ]
38
- }
39
-
40
- render() {
41
- return html`
42
- <input
43
- id="text"
44
- type="text"
45
- .value=${this.value || ''}
46
- @focusin=${e => this._onInputFocused(e)}
47
- @change=${e => this._onInputChanged(e)}
48
- .placeholder=${this.getAttribute('placeholder') || ''}
49
- list="ids"
50
- />
51
- <datalist id="ids">${this._ids.map(id => html` <option value=${id}></option> `)}</datalist>
52
- `
53
- }
54
-
55
- connectedCallback() {
56
- super.connectedCallback()
57
-
58
- this._ids = []
59
- }
60
-
61
- _onInputFocused(e) {
62
- this._ids = []
63
- var { component } = this.property || {}
64
-
65
- document.dispatchEvent(
66
- new CustomEvent('get-all-scene-component-ids', {
67
- detail: {
68
- component,
69
- callback: ids => {
70
- this._ids = ids
71
- }
72
- }
73
- })
74
- )
75
- }
76
-
77
- _onInputChanged(e) {
78
- e.stopPropagation()
79
- this.value = e.target.value
80
-
81
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
82
- }
83
- }
84
-
85
- customElements.define(ThingsEditorId.is, ThingsEditorId)
@@ -1,132 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- // TODO LitElement 로 변경 후 검증하지 않음.
6
- import { LitElement, html, css } from 'lit'
7
-
8
- import './things-editor-color'
9
-
10
- /**
11
- 색상 배열을 편집하는 컴포넌트이다.
12
-
13
- 새로운 색상을 추가하고자 할 때는 `+` 버튼을 클릭한다.<br />
14
- 색상을 제거하고자 할 때는 `-` 버튼을 클릭한다.<br />
15
-
16
- Example:
17
-
18
- <things-editor-multiple-color values=${values}>
19
- </things-editor-multiple-color>
20
- */
21
-
22
- export default class ThingsEditorMultipleColor extends LitElement {
23
- static get is() {
24
- return 'things-editor-multiple-color'
25
- }
26
-
27
- static get properties() {
28
- return {
29
- values: Array
30
- }
31
- }
32
-
33
- static get styles() {
34
- return [
35
- css`
36
- :host {
37
- display: inline-block;
38
- }
39
-
40
- #colors-container > div {
41
- display: grid;
42
- grid-template-columns: 22px 1fr 22px;
43
- grid-gap: 5px;
44
- align-items: center;
45
- justify-content: left;
46
- }
47
-
48
- things-editor-color {
49
- height: 25px;
50
- width: 100%;
51
- }
52
-
53
- input[type='button'] {
54
- width: 22px;
55
- height: 25px;
56
- border: 1px solid rgba(0, 0, 0, 0.15);
57
- padding-top: 0px;
58
- padding-bottom: 2px;
59
- background-color: #f1f2f4;
60
- color: #8f9192;
61
- font-size: 16px;
62
- }
63
- `
64
- ]
65
- }
66
-
67
- constructor() {
68
- super()
69
-
70
- this.values = []
71
- }
72
-
73
- firstUpdated() {
74
- this.shadowRoot.addEventListener('change', this._onValueChanged.bind(this))
75
- }
76
-
77
- // TODO style for things-editor-color
78
- render() {
79
- return html`
80
- <div id="colors-container">
81
- ${(this.values || []).map(
82
- (item, index) => html`
83
- <div>
84
- <input type="button" value="+" @click="${e => this._appendEditorColor(e)}" data-index=${index} />
85
-
86
- <things-editor-color .value=${item}> </things-editor-color>
87
-
88
- ${(this.values || []).length > 1
89
- ? html`
90
- <input type="button" value="-" @click=${e => this._removeEditorColor(e)} data-index=${index} />
91
- `
92
- : html``}
93
- </div>
94
- `
95
- )}
96
- </div>
97
- `
98
- }
99
-
100
- _onValueChanged(e) {
101
- this.values = this._getheringValues()
102
- }
103
-
104
- _appendEditorColor(e) {
105
- this.values = [...this.values, 'black']
106
-
107
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
108
- }
109
-
110
- _removeEditorColor(e) {
111
- var values = []
112
- for (var i = 0; i < this.values.length; i++) {
113
- if (i == e.target.dataset.index) continue
114
- else values.push(this.values[i])
115
- }
116
-
117
- this.values = values
118
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
119
- }
120
-
121
- _getheringValues() {
122
- var colorsContainer = this.shadowRoot.querySelector('#colors-container')
123
- var values = []
124
- Array.from(colorsContainer.querySelectorAll('things-editor-color')).forEach(c => {
125
- values.push(c.value)
126
- })
127
-
128
- return values
129
- }
130
- }
131
-
132
- customElements.define(ThingsEditorMultipleColor.is, ThingsEditorMultipleColor)
@@ -1,155 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- // TODO LitElement 로 변경 후 검증하지 않음.
6
- import { LitElement, html, css } from 'lit'
7
-
8
- export default class ThingsEditorOptions extends LitElement {
9
- static get is() {
10
- return 'things-editor-options'
11
- }
12
-
13
- static get properties() {
14
- return {
15
- options: Array
16
- }
17
- }
18
-
19
- static get styles() {
20
- return [
21
- css`
22
- div {
23
- display: grid;
24
- grid-template-columns: repeat(10, 1fr);
25
- grid-gap: 5px;
26
- grid-auto-rows: minmax(24px, auto);
27
- }
28
-
29
- input[data-text] {
30
- grid-column: span 5;
31
- }
32
-
33
- input[data-value] {
34
- grid-column: span 4;
35
- }
36
-
37
- button {
38
- grid-column: span 1;
39
- }
40
- `
41
- ]
42
- }
43
-
44
- constructor() {
45
- super()
46
-
47
- this.options = []
48
- }
49
-
50
- firstUpdated() {
51
- this.shadowRoot.addEventListener('change', this._onChange.bind(this))
52
- }
53
-
54
- render() {
55
- return html`
56
- ${(this.options || []).map(
57
- item => html`
58
- <div data-record="">
59
- <input type="text" data-text="" placeholder="text" .value=${item.text} />
60
- <input type="text" data-value="" placeholder="value" .value=${item.value} />
61
- <button class="record-action" @click=${e => this._delete(e)} tabindex="-1">-</button>
62
- </div>
63
- `
64
- )}
65
-
66
- <div data-record-new="">
67
- <input type="text" data-text="" placeholder="text" value="" />
68
- <input type="text" data-value="" placeholder="value" value="" @change=${e => this._add(e)} />
69
- <button class="record-action" @click=${e => this._add(e)} tabindex="-1">+</button>
70
- </div>
71
- `
72
- }
73
-
74
- _onChange(e) {
75
- if (this._changingNow) return
76
-
77
- this._changingNow = true
78
-
79
- var input = e.target
80
- var value = input.value
81
-
82
- var div = input.parentElement
83
-
84
- if (div.hasAttribute('data-record')) {
85
- var dataList = div.querySelectorAll('[data-value]:not([hidden])')
86
- for (var i = 0; i < dataList.length; i++) if (dataList[i] !== input) dataList[i].value = value || ''
87
- }
88
-
89
- if (div.hasAttribute('data-record')) this._build(true)
90
- else if (div.hasAttribute('data-record-new') && input.hasAttribute('data-value')) this._add()
91
-
92
- e.stopPropagation()
93
-
94
- this._changingNow = false
95
- }
96
-
97
- _build(includeNewRecord) {
98
- if (includeNewRecord) var records = this.shadowRoot.querySelectorAll('[data-record],[data-record-new]')
99
- else var records = this.shadowRoot.querySelectorAll('[data-record]')
100
-
101
- var newoptions = []
102
-
103
- for (var i = 0; i < records.length; i++) {
104
- var record = records[i]
105
-
106
- var text = record.querySelector('[data-text]').value
107
- var inputs = record.querySelectorAll('[data-value]:not([style*="display: none"])')
108
- if (!inputs || inputs.length == 0) continue
109
-
110
- var input = inputs[inputs.length - 1]
111
- var value = input.value
112
-
113
- if (text) newoptions.push({ text: text, value: value || text })
114
- }
115
-
116
- this.options = newoptions
117
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
118
- }
119
-
120
- _sort(e) {
121
- var sorter = function (a, b) {
122
- return b.text < a.text
123
- }
124
-
125
- this.options = this._toArray(this.options)
126
- .sort(sorter)
127
- .reduce(function (sum, i) {
128
- sum[i.text] = i.value
129
- return sum
130
- }, {})
131
-
132
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
133
- }
134
-
135
- _add(e) {
136
- this._build(true)
137
-
138
- var inputs = this.shadowRoot.querySelectorAll('[data-record-new] input:not([style*="display: none"])')
139
-
140
- for (var i = 0; i < inputs.length; i++) {
141
- let input = inputs[i]
142
- input.value = ''
143
- }
144
-
145
- inputs[0].focus()
146
- }
147
-
148
- _delete(e) {
149
- var record = e.target.parentElement
150
- record.querySelector('[data-text]').value = ''
151
- this._build()
152
- }
153
- }
154
-
155
- customElements.define(ThingsEditorOptions.is, ThingsEditorOptions)
@@ -1,161 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/i18n/ox-i18n.js'
6
- import './things-editor-attachment-selector'
7
-
8
- import { css, html, LitElement } from 'lit'
9
-
10
- /**
11
- * 컴포넌트의 fill pattern을 편집하는 element
12
- *
13
- * Example:
14
- * <things-editor-pattern
15
- * @change="${e => { this.pattern = e.target.value }}"
16
- * .value=${this.pattern}"
17
- * ></things-editor-pattern>
18
- */
19
-
20
- export default class ThingsEditorPattern extends LitElement {
21
- static get is() {
22
- return 'things-editor-pattern'
23
- }
24
-
25
- static get properties() {
26
- return {
27
- value: Object
28
- }
29
- }
30
-
31
- static get styles() {
32
- return [
33
- css`
34
- :host,
35
- .grid-10 {
36
- display: grid;
37
- grid-template-columns: repeat(10, 1fr);
38
- grid-gap: 5px;
39
- grid-auto-rows: minmax(24px, auto);
40
-
41
- align-items: center;
42
- }
43
-
44
- * {
45
- align-self: stretch;
46
- }
47
-
48
- label {
49
- grid-column: span 2;
50
- text-align: right;
51
- text-transform: capitalize;
52
-
53
- align-self: center;
54
- }
55
-
56
- .grid-10 {
57
- grid-column: span 10;
58
- }
59
-
60
- select,
61
- input,
62
- [custom-editor] {
63
- grid-column: span 8;
64
- }
65
-
66
- select {
67
- height: 100%;
68
- border: 1px solid rgba(0, 0, 0, 0.2);
69
- }
70
-
71
- input[type='checkbox'] {
72
- grid-column: 3 / 4;
73
- align-self: center;
74
- }
75
-
76
- input[type='checkbox'] ~ label {
77
- grid-column: span 7;
78
- text-align: left;
79
- }
80
-
81
- .grid-10 > input[type='number'] {
82
- grid-column: span 3;
83
- border: 1px solid rgba(0, 0, 0, 0.2);
84
- }
85
-
86
- .grid-10 > label {
87
- grid-column: span 2;
88
- text-align: right;
89
- }
90
- `
91
- ]
92
- }
93
-
94
- render() {
95
- return html`
96
- <label> <ox-i18n msgid="label.image" auto="">image</ox-i18n> </label>
97
-
98
- <things-editor-attachment-selector
99
- value-key="image"
100
- .value=${(this.value && this.value.image) || ''}
101
- custom-editor
102
- ></things-editor-attachment-selector>
103
-
104
- <label> <ox-i18n msgid="label.align" auto="">align</ox-i18n> </label>
105
-
106
- <select value-key="align" class="select-content" .value=${this.value && this.value.align}>
107
- <option value="left-top">Left Top</option>
108
- <option value="top">Top</option>
109
- <option value="right-top">Right Top</option>
110
- <option value="left">Left</option>
111
- <option value="center">Center</option>
112
- <option value="right">Right</option>
113
- <option value="left-bottom">Left Bottom</option>
114
- <option value="bottom">Bottom</option>
115
- <option value="right-bottom">Right Bottom</option>
116
- </select>
117
-
118
- <div class="grid-10">
119
- <label> <ox-i18n msgid="label.offset-x" auto="">offsetX</ox-i18n> </label>
120
- <input type="number" value-key="offsetX" .value=${this.value && this.value.offsetX} />
121
-
122
- <label> <ox-i18n msgid="label.offset-y" auto="">offsetY</ox-i18n> </label>
123
- <input type="number" value-key="offsetY" .value=${this.value && this.value.offsetY} />
124
-
125
- <label> <ox-i18n msgid="label.width" auto="">width</ox-i18n> </label>
126
- <input type="number" value-key="width" .value=${this.value && this.value.width} />
127
-
128
- <label> <ox-i18n msgid="label.height" auto="">height</ox-i18n> </label>
129
- <input type="number" value-key="height" .value=${this.value && this.value.height} />
130
- </div>
131
-
132
- <div class="grid-10">
133
- <input value-key="fitPattern" type="checkbox" .checked=${this.value && this.value.fitPattern} required />
134
- <label> <ox-i18n msgid="label.fit" auto="">Fit</ox-i18n> </label>
135
- </div>
136
- `
137
- }
138
-
139
- firstUpdated() {
140
- this.shadowRoot.addEventListener('change', this._onChange.bind(this))
141
- }
142
-
143
- _onChange(e) {
144
- var element = e.target
145
- var key = element.getAttribute('value-key')
146
- var value = element.value
147
-
148
- if (key == 'fitPattern') {
149
- value = element.checked
150
- }
151
-
152
- this.value = {
153
- ...this.value,
154
- [key]: value
155
- }
156
-
157
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
158
- }
159
- }
160
-
161
- customElements.define(ThingsEditorPattern.is, ThingsEditorPattern)
@@ -1,71 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const ThingsEditorPropertyStyles = css`
4
- :host {
5
- margin: 5px;
6
-
7
- display: grid;
8
- grid-template-columns: repeat(10, 1fr);
9
- grid-gap: 5px;
10
-
11
- align-items: center;
12
-
13
- color: var(--property-sidebar-fieldset-legend-color);
14
- }
15
-
16
- :host > * {
17
- box-sizing: border-box;
18
-
19
- grid-column: span 7;
20
- order: 2;
21
-
22
- align-self: stretch;
23
- }
24
-
25
- :host > label {
26
- grid-column: span 3;
27
- order: 1;
28
-
29
- text-align: right;
30
-
31
- font-size: 0.8em;
32
- line-height: 2;
33
- text-transform: capitalize;
34
-
35
- align-self: center;
36
- }
37
-
38
- :host > input[type='checkbox'] ~ label {
39
- grid-column: span 6;
40
- order: 2;
41
-
42
- text-align: left;
43
- }
44
-
45
- :host > select,
46
- :host > input[type='text'],
47
- :host > input[type='number'] {
48
- border: 1px solid rgba(0, 0, 0, 0.2);
49
- }
50
-
51
- :host > legend {
52
- grid-column: 1 / -1;
53
-
54
- display: inline-block;
55
-
56
- text-align: left;
57
- text-transform: capitalize;
58
- }
59
-
60
- :host > [fullwidth] {
61
- grid-column: 1 / -1;
62
- }
63
-
64
- :host > input[type='checkbox'] {
65
- grid-column: span 4;
66
- order: 1;
67
-
68
- justify-self: end;
69
- align-self: center;
70
- }
71
- `