@things-factory/modeller-ui 4.0.7 → 4.0.12

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.
@@ -1,6 +1,33 @@
1
- import { store } from '@things-factory/shell'
2
- import modeller from './reducers/modeller'
1
+ import { OxPropertyEditor } from '@operato/property-editor'
3
2
 
4
3
  export default function bootstrap() {
5
- store.addReducers({ modeller })
4
+ OxPropertyEditor.register({
5
+ legend: 'property-editor-legend',
6
+ number: 'property-editor-number',
7
+ password: 'property-editor-password',
8
+ angle: 'property-editor-angle',
9
+ string: 'property-editor-string',
10
+ textarea: 'property-editor-textarea',
11
+ javascript: 'property-editor-textarea',
12
+ graphql: 'property-editor-graphql',
13
+ data: 'property-editor-data',
14
+ checkbox: 'property-editor-checkbox',
15
+ boolean: 'property-editor-checkbox',
16
+ select: 'property-editor-select',
17
+ color: 'property-editor-color',
18
+ 'solid-color-stops': 'property-editor-solid-colorstops',
19
+ 'gradient-color-stops': 'property-editor-gradient-colorstops',
20
+ 'multiple-color': 'property-editor-multiple-color',
21
+ 'editor-table': 'property-editor-table',
22
+ 'id-input': 'property-editor-id',
23
+ 'range-input': 'property-editor-range-input',
24
+ options: 'property-editor-options',
25
+ date: 'property-editor-date',
26
+ map: 'property-editor-value-map',
27
+ range: 'property-editor-value-range',
28
+ 'attachment-selector': 'property-editor-attachment-selector',
29
+ 'gltf-selector': 'property-editor-attachment-selector',
30
+ 'image-selector': 'property-editor-image-selector',
31
+ 'font-selector': 'property-editor-font-selector'
32
+ })
6
33
  }
@@ -3,8 +3,6 @@
3
3
  */
4
4
 
5
5
  import '@things-factory/i18n-base'
6
- import { deepClone } from '@things-factory/utils'
7
- import { html, LitElement } from 'lit-element'
8
6
  import './things-editor-angle-input'
9
7
  import './things-editor-range-input'
10
8
  import './things-editor-code'
@@ -21,94 +19,16 @@ import './things-editor-value-range'
21
19
  import './things-editor-attachment-selector'
22
20
  import './things-editor-font-selector'
23
21
 
24
- import { ThingsEditorPropertyStyles } from './things-editor-property-styles'
22
+ import { OxPropertyEditor } from '@operato/property-editor'
23
+ import { html } from 'lit'
25
24
 
26
- export default class ThingsEditorProperty extends LitElement {
27
- static get is() {
28
- return 'things-editor-property'
29
- }
30
-
31
- static get properties() {
32
- return {
33
- value: Object,
34
- type: String,
35
- label: String,
36
- placeholder: String,
37
- property: Object,
38
- host: Object
39
- }
40
- }
41
-
42
- static get styles() {
43
- return [ThingsEditorPropertyStyles]
44
- }
45
-
46
- connectedCallback() {
47
- super.connectedCallback()
48
-
49
- this.shadowRoot.addEventListener('change', this._valueChanged.bind(this))
50
- }
51
-
52
- editorTemplate(props) {
53
- return html``
54
- }
55
-
56
- render() {
57
- return html`
58
- ${this.editorTemplate(this)}
59
- ${this.label
60
- ? html`
61
- <label for="editor">
62
- <i18n-msg msgid=${this._computeLabelId(this.label)}>${this.label}</i18n-msg>
63
- </label>
64
- `
65
- : html``}
66
- `
67
- }
68
-
69
- shouldUpdate(changedProperties) {
70
- if (this.__by_me) {
71
- return false
72
- }
73
-
74
- if (changedProperties.has('value')) {
75
- this.__by_me = true
76
- this.value = deepClone(this.value)
77
- this.__by_me = false
78
- }
79
-
80
- return true
81
- }
82
-
83
- get valueProperty() {
84
- return 'value'
85
- }
86
-
87
- _computeLabelId(label) {
88
- if (label.indexOf('label.') >= 0) return label
89
-
90
- return 'label.' + label
91
- }
92
-
93
- _valueChanged(e) {
94
- e.stopPropagation()
95
-
96
- this.value = deepClone(e.target[this.valueProperty])
97
-
98
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
99
-
100
- if (!this.observe) return
101
- this.observe.call(this, this.value)
102
- }
103
- }
104
-
105
- class PropertyEditorLegend extends ThingsEditorProperty {
25
+ class PropertyEditorLegend extends OxPropertyEditor {
106
26
  static get is() {
107
27
  return 'property-editor-legend'
108
28
  }
109
29
 
110
30
  static get styles() {
111
- return [ThingsEditorPropertyStyles]
31
+ return [...OxPropertyEditor.styles]
112
32
  }
113
33
 
114
34
  editorTemplate(props) {
@@ -118,13 +38,13 @@ class PropertyEditorLegend extends ThingsEditorProperty {
118
38
 
119
39
  customElements.define(PropertyEditorLegend.is, PropertyEditorLegend)
120
40
 
121
- class PropertyEditorNumber extends ThingsEditorProperty {
41
+ class PropertyEditorNumber extends OxPropertyEditor {
122
42
  static get is() {
123
43
  return 'property-editor-number'
124
44
  }
125
45
 
126
46
  static get styles() {
127
- return [ThingsEditorPropertyStyles]
47
+ return [...OxPropertyEditor.styles]
128
48
  }
129
49
 
130
50
  editorTemplate(props) {
@@ -158,13 +78,13 @@ class PropertyEditorNumber extends ThingsEditorProperty {
158
78
 
159
79
  customElements.define(PropertyEditorNumber.is, PropertyEditorNumber)
160
80
 
161
- class PropertyEditorRangeInput extends ThingsEditorProperty {
81
+ class PropertyEditorRangeInput extends OxPropertyEditor {
162
82
  static get is() {
163
83
  return 'property-editor-range-input'
164
84
  }
165
85
 
166
86
  static get styles() {
167
- return [ThingsEditorPropertyStyles]
87
+ return [...OxPropertyEditor.styles]
168
88
  }
169
89
 
170
90
  editorTemplate(props) {
@@ -182,13 +102,13 @@ class PropertyEditorRangeInput extends ThingsEditorProperty {
182
102
 
183
103
  customElements.define(PropertyEditorRangeInput.is, PropertyEditorRangeInput)
184
104
 
185
- class PropertyEditorAngle extends ThingsEditorProperty {
105
+ class PropertyEditorAngle extends OxPropertyEditor {
186
106
  static get is() {
187
107
  return 'property-editor-angle'
188
108
  }
189
109
 
190
110
  static get styles() {
191
- return [ThingsEditorPropertyStyles]
111
+ return [...OxPropertyEditor.styles]
192
112
  }
193
113
 
194
114
  get valueProperty() {
@@ -208,13 +128,13 @@ class PropertyEditorAngle extends ThingsEditorProperty {
208
128
 
209
129
  customElements.define(PropertyEditorAngle.is, PropertyEditorAngle)
210
130
 
211
- class PropertyEditorString extends ThingsEditorProperty {
131
+ class PropertyEditorString extends OxPropertyEditor {
212
132
  static get is() {
213
133
  return 'property-editor-string'
214
134
  }
215
135
 
216
136
  static get styles() {
217
- return [ThingsEditorPropertyStyles]
137
+ return [...OxPropertyEditor.styles]
218
138
  }
219
139
 
220
140
  editorTemplate(props) {
@@ -224,13 +144,13 @@ class PropertyEditorString extends ThingsEditorProperty {
224
144
 
225
145
  customElements.define(PropertyEditorString.is, PropertyEditorString)
226
146
 
227
- class PropertyEditorPassword extends ThingsEditorProperty {
147
+ class PropertyEditorPassword extends OxPropertyEditor {
228
148
  static get is() {
229
149
  return 'property-editor-password'
230
150
  }
231
151
 
232
152
  static get styles() {
233
- return [ThingsEditorPropertyStyles]
153
+ return [...OxPropertyEditor.styles]
234
154
  }
235
155
 
236
156
  editorTemplate(props) {
@@ -240,30 +160,39 @@ class PropertyEditorPassword extends ThingsEditorProperty {
240
160
 
241
161
  customElements.define(PropertyEditorPassword.is, PropertyEditorPassword)
242
162
 
243
- class PropertyEditorTextArea extends ThingsEditorProperty {
163
+ class PropertyEditorTextArea extends OxPropertyEditor {
244
164
  static get is() {
245
165
  return 'property-editor-textarea'
246
166
  }
247
167
 
248
168
  static get styles() {
249
- return [ThingsEditorPropertyStyles]
169
+ return [...OxPropertyEditor.styles]
250
170
  }
251
171
 
252
172
  editorTemplate(props) {
253
- return html` <things-editor-code id="editor" .value=${props.value} mode="${props.property?.mode || ''}"
254
- tab-size="${props.property?.tabSize || ''}" tab-as-space="${props.property?.tabAsSpace || 'false'}" fullwidth> </things-editor-code> `
173
+ return html`
174
+ <things-editor-code
175
+ id="editor"
176
+ .value=${props.value}
177
+ mode="${props.property?.mode || ''}"
178
+ tab-size="${props.property?.tabSize || ''}"
179
+ tab-as-space="${props.property?.tabAsSpace || 'false'}"
180
+ fullwidth
181
+ >
182
+ </things-editor-code>
183
+ `
255
184
  }
256
185
  }
257
186
 
258
187
  customElements.define(PropertyEditorTextArea.is, PropertyEditorTextArea)
259
188
 
260
- class PropertyEditorGraphQL extends ThingsEditorProperty {
189
+ class PropertyEditorGraphQL extends OxPropertyEditor {
261
190
  static get is() {
262
191
  return 'property-editor-graphql'
263
192
  }
264
193
 
265
194
  static get styles() {
266
- return [ThingsEditorPropertyStyles]
195
+ return [...OxPropertyEditor.styles]
267
196
  }
268
197
 
269
198
  editorTemplate(props) {
@@ -273,13 +202,13 @@ class PropertyEditorGraphQL extends ThingsEditorProperty {
273
202
 
274
203
  customElements.define(PropertyEditorGraphQL.is, PropertyEditorGraphQL)
275
204
 
276
- class PropertyEditorData extends ThingsEditorProperty {
205
+ class PropertyEditorData extends OxPropertyEditor {
277
206
  static get is() {
278
207
  return 'property-editor-data'
279
208
  }
280
209
 
281
210
  static get styles() {
282
- return [ThingsEditorPropertyStyles]
211
+ return [...OxPropertyEditor.styles]
283
212
  }
284
213
 
285
214
  editorTemplate(props) {
@@ -289,13 +218,13 @@ class PropertyEditorData extends ThingsEditorProperty {
289
218
 
290
219
  customElements.define(PropertyEditorData.is, PropertyEditorData)
291
220
 
292
- class PropertyEditorCheckbox extends ThingsEditorProperty {
221
+ class PropertyEditorCheckbox extends OxPropertyEditor {
293
222
  static get is() {
294
223
  return 'property-editor-checkbox'
295
224
  }
296
225
 
297
226
  static get styles() {
298
- return [ThingsEditorPropertyStyles]
227
+ return [...OxPropertyEditor.styles]
299
228
  }
300
229
 
301
230
  get valueProperty() {
@@ -309,13 +238,13 @@ class PropertyEditorCheckbox extends ThingsEditorProperty {
309
238
 
310
239
  customElements.define(PropertyEditorCheckbox.is, PropertyEditorCheckbox)
311
240
 
312
- class PropertyEditorSelect extends ThingsEditorProperty {
241
+ class PropertyEditorSelect extends OxPropertyEditor {
313
242
  static get is() {
314
243
  return 'property-editor-select'
315
244
  }
316
245
 
317
246
  static get styles() {
318
- return [ThingsEditorPropertyStyles]
247
+ return [...OxPropertyEditor.styles]
319
248
  }
320
249
 
321
250
  async connectedCallback() {
@@ -368,13 +297,13 @@ class PropertyEditorSelect extends ThingsEditorProperty {
368
297
 
369
298
  customElements.define(PropertyEditorSelect.is, PropertyEditorSelect)
370
299
 
371
- class PropertyEditorColor extends ThingsEditorProperty {
300
+ class PropertyEditorColor extends OxPropertyEditor {
372
301
  static get is() {
373
302
  return 'property-editor-color'
374
303
  }
375
304
 
376
305
  static get styles() {
377
- return [ThingsEditorPropertyStyles]
306
+ return [...OxPropertyEditor.styles]
378
307
  }
379
308
 
380
309
  editorTemplate(props) {
@@ -391,13 +320,13 @@ class PropertyEditorColor extends ThingsEditorProperty {
391
320
 
392
321
  customElements.define(PropertyEditorColor.is, PropertyEditorColor)
393
322
 
394
- class PropertyEditorSolidColorStops extends ThingsEditorProperty {
323
+ class PropertyEditorSolidColorStops extends OxPropertyEditor {
395
324
  static get is() {
396
325
  return 'property-editor-solid-colorstops'
397
326
  }
398
327
 
399
328
  static get styles() {
400
- return [ThingsEditorPropertyStyles]
329
+ return [...OxPropertyEditor.styles]
401
330
  }
402
331
 
403
332
  editorTemplate(props) {
@@ -417,13 +346,13 @@ class PropertyEditorSolidColorStops extends ThingsEditorProperty {
417
346
 
418
347
  customElements.define(PropertyEditorSolidColorStops.is, PropertyEditorSolidColorStops)
419
348
 
420
- class PropertyEditorGradientColorStops extends ThingsEditorProperty {
349
+ class PropertyEditorGradientColorStops extends OxPropertyEditor {
421
350
  static get is() {
422
351
  return 'property-editor-gradient-colorstops'
423
352
  }
424
353
 
425
354
  static get styles() {
426
- return [ThingsEditorPropertyStyles]
355
+ return [...OxPropertyEditor.styles]
427
356
  }
428
357
 
429
358
  editorTemplate(props) {
@@ -443,13 +372,13 @@ class PropertyEditorGradientColorStops extends ThingsEditorProperty {
443
372
 
444
373
  customElements.define(PropertyEditorGradientColorStops.is, PropertyEditorGradientColorStops)
445
374
 
446
- class PropertyEditorMultipleColor extends ThingsEditorProperty {
375
+ class PropertyEditorMultipleColor extends OxPropertyEditor {
447
376
  static get is() {
448
377
  return 'property-editor-multiple-color'
449
378
  }
450
379
 
451
380
  static get styles() {
452
- return [ThingsEditorPropertyStyles]
381
+ return [...OxPropertyEditor.styles]
453
382
  }
454
383
 
455
384
  get valueProperty() {
@@ -463,13 +392,13 @@ class PropertyEditorMultipleColor extends ThingsEditorProperty {
463
392
 
464
393
  customElements.define(PropertyEditorMultipleColor.is, PropertyEditorMultipleColor)
465
394
 
466
- class PropertyEditorDate extends ThingsEditorProperty {
395
+ class PropertyEditorDate extends OxPropertyEditor {
467
396
  static get is() {
468
397
  return 'property-editor-date'
469
398
  }
470
399
 
471
400
  static get styles() {
472
- return [ThingsEditorPropertyStyles]
401
+ return [...OxPropertyEditor.styles]
473
402
  }
474
403
 
475
404
  editorTemplate(props) {
@@ -479,13 +408,13 @@ class PropertyEditorDate extends ThingsEditorProperty {
479
408
 
480
409
  customElements.define(PropertyEditorDate.is, PropertyEditorDate)
481
410
 
482
- class PropertyEditorOptions extends ThingsEditorProperty {
411
+ class PropertyEditorOptions extends OxPropertyEditor {
483
412
  static get is() {
484
413
  return 'property-editor-options'
485
414
  }
486
415
 
487
416
  static get styles() {
488
- return [ThingsEditorPropertyStyles]
417
+ return [...OxPropertyEditor.styles]
489
418
  }
490
419
 
491
420
  get valueProperty() {
@@ -499,13 +428,13 @@ class PropertyEditorOptions extends ThingsEditorProperty {
499
428
 
500
429
  customElements.define(PropertyEditorOptions.is, PropertyEditorOptions)
501
430
 
502
- class PropertyEditorTable extends ThingsEditorProperty {
431
+ class PropertyEditorTable extends OxPropertyEditor {
503
432
  static get is() {
504
433
  return 'property-editor-table'
505
434
  }
506
435
 
507
436
  static get styles() {
508
- return [ThingsEditorPropertyStyles]
437
+ return [...OxPropertyEditor.styles]
509
438
  }
510
439
 
511
440
  editorTemplate(props) {
@@ -515,13 +444,13 @@ class PropertyEditorTable extends ThingsEditorProperty {
515
444
 
516
445
  customElements.define(PropertyEditorTable.is, PropertyEditorTable)
517
446
 
518
- class PropertyEditorId extends ThingsEditorProperty {
447
+ class PropertyEditorId extends OxPropertyEditor {
519
448
  static get is() {
520
449
  return 'property-editor-id'
521
450
  }
522
451
 
523
452
  static get styles() {
524
- return [ThingsEditorPropertyStyles]
453
+ return [...OxPropertyEditor.styles]
525
454
  }
526
455
 
527
456
  editorTemplate(props) {
@@ -531,9 +460,9 @@ class PropertyEditorId extends ThingsEditorProperty {
531
460
 
532
461
  customElements.define(PropertyEditorId.is, PropertyEditorId)
533
462
 
534
- class PropertyEditorValueMap extends ThingsEditorProperty {
463
+ class PropertyEditorValueMap extends OxPropertyEditor {
535
464
  static get styles() {
536
- return [ThingsEditorPropertyStyles]
465
+ return [...OxPropertyEditor.styles]
537
466
  }
538
467
 
539
468
  editorTemplate(props) {
@@ -549,9 +478,9 @@ class PropertyEditorValueMap extends ThingsEditorProperty {
549
478
 
550
479
  customElements.define('property-editor-value-map', PropertyEditorValueMap)
551
480
 
552
- class PropertyEditorValueRange extends ThingsEditorProperty {
481
+ class PropertyEditorValueRange extends OxPropertyEditor {
553
482
  static get styles() {
554
- return [ThingsEditorPropertyStyles]
483
+ return [...OxPropertyEditor.styles]
555
484
  }
556
485
 
557
486
  editorTemplate(props) {
@@ -572,9 +501,9 @@ class PropertyEditorValueRange extends ThingsEditorProperty {
572
501
 
573
502
  customElements.define('property-editor-value-range', PropertyEditorValueRange)
574
503
 
575
- class PropertyEditorAttachmentSelector extends ThingsEditorProperty {
504
+ class PropertyEditorAttachmentSelector extends OxPropertyEditor {
576
505
  static get styles() {
577
- return [ThingsEditorPropertyStyles]
506
+ return [...OxPropertyEditor.styles]
578
507
  }
579
508
 
580
509
  editorTemplate(props) {
@@ -590,9 +519,9 @@ class PropertyEditorAttachmentSelector extends ThingsEditorProperty {
590
519
 
591
520
  customElements.define('property-editor-attachment-selector', PropertyEditorAttachmentSelector)
592
521
 
593
- class PropertyEditorImageSelector extends ThingsEditorProperty {
522
+ class PropertyEditorImageSelector extends OxPropertyEditor {
594
523
  static get styles() {
595
- return [ThingsEditorPropertyStyles]
524
+ return [...OxPropertyEditor.styles]
596
525
  }
597
526
 
598
527
  editorTemplate(props) {
@@ -608,9 +537,9 @@ class PropertyEditorImageSelector extends ThingsEditorProperty {
608
537
 
609
538
  customElements.define('property-editor-image-selector', PropertyEditorImageSelector)
610
539
 
611
- class PropertyEditorFontSelector extends ThingsEditorProperty {
540
+ class PropertyEditorFontSelector extends OxPropertyEditor {
612
541
  static get styles() {
613
- return [ThingsEditorPropertyStyles]
542
+ return [...OxPropertyEditor.styles]
614
543
  }
615
544
 
616
545
  editorTemplate(props) {
package/client/index.js CHANGED
@@ -1,4 +0,0 @@
1
- export * from './actions/modeller'
2
-
3
- export { default as ThingsEditorProperty } from './editors/things-editor-property'
4
- export { ThingsEditorPropertyStyles } from './editors/things-editor-property-styles'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/modeller-ui",
3
- "version": "4.0.7",
3
+ "version": "4.0.12",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -29,6 +29,7 @@
29
29
  "@graphql-tools/url-loader": "^7.2.0",
30
30
  "@graphql-tools/wrap": "^8.1.1",
31
31
  "@material/mwc-icon": "^0.25.3",
32
+ "@operato/property-editor": "^0.2.43",
32
33
  "@polymer/iron-flex-layout": "^3.0.1",
33
34
  "@polymer/iron-form-element-behavior": "^3.0.1",
34
35
  "@polymer/iron-resizable-behavior": "^3.0.1",
@@ -42,9 +43,9 @@
42
43
  "@polymer/paper-ripple": "^3.0.2",
43
44
  "@polymer/paper-slider": "^3.0.1",
44
45
  "@polymer/polymer": "^3.3.1",
45
- "@things-factory/attachment-ui": "^4.0.7",
46
- "@things-factory/font-ui": "^4.0.7",
47
- "@things-factory/i18n-base": "^4.0.7",
46
+ "@things-factory/attachment-ui": "^4.0.12",
47
+ "@things-factory/font-ui": "^4.0.12",
48
+ "@things-factory/i18n-base": "^4.0.12",
48
49
  "ace-builds": "^1.4.11",
49
50
  "brace": "^0.11.1",
50
51
  "codemirror": "^5.59.1",
@@ -56,5 +57,5 @@
56
57
  "devDependencies": {
57
58
  "@types/codemirror": "^0.0.105"
58
59
  },
59
- "gitHead": "035fa60359aefa9b9111f807fc7e8db6a15a4a6e"
60
+ "gitHead": "29d59ff95fcb473cb43c6f798cd04f3ec3a779a0"
60
61
  }
@@ -1 +0,0 @@
1
- export const ADD_MODELLER_EDITORS = 'ADD_MODELLER_EDITORS'
@@ -1,53 +0,0 @@
1
- import { ADD_MODELLER_EDITORS } from '../actions/modeller.js'
2
-
3
- const INITIAL_STATE = {
4
- editors: {
5
- legend: 'property-editor-legend',
6
- number: 'property-editor-number',
7
- password: 'property-editor-password',
8
- angle: 'property-editor-angle',
9
- string: 'property-editor-string',
10
- textarea: 'property-editor-textarea',
11
- javascript: 'property-editor-textarea',
12
- graphql: 'property-editor-graphql',
13
- data: 'property-editor-data',
14
- checkbox: 'property-editor-checkbox',
15
- boolean: 'property-editor-checkbox',
16
- select: 'property-editor-select',
17
- color: 'property-editor-color',
18
- 'solid-color-stops': 'property-editor-solid-colorstops',
19
- 'gradient-color-stops': 'property-editor-gradient-colorstops',
20
- 'multiple-color': 'property-editor-multiple-color',
21
- 'editor-table': 'property-editor-table',
22
- 'id-input': 'property-editor-id',
23
- 'range-input': 'property-editor-range-input',
24
- options: 'property-editor-options',
25
- date: 'property-editor-date',
26
- map: 'property-editor-value-map',
27
- range: 'property-editor-value-range',
28
- 'attachment-selector': 'property-editor-attachment-selector',
29
- 'gltf-selector': 'property-editor-attachment-selector',
30
- 'image-selector': 'property-editor-image-selector',
31
- 'font-selector': 'property-editor-font-selector'
32
- }
33
- }
34
-
35
- const modeller = (state = INITIAL_STATE, action) => {
36
- switch (action.type) {
37
- case ADD_MODELLER_EDITORS:
38
- let editors = {
39
- ...state.editors,
40
- ...(action.editors || {})
41
- }
42
-
43
- return {
44
- ...state,
45
- editors
46
- }
47
-
48
- default:
49
- return state
50
- }
51
- }
52
-
53
- export default modeller