@operato/scene-chartjs 2.0.0-beta.0 → 2.0.0-beta.7

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 (27) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/editors/property-editor-chartjs-abstract.d.ts +3 -3
  3. package/dist/editors/property-editor-chartjs-abstract.js +0 -8
  4. package/dist/editors/property-editor-chartjs-abstract.js.map +1 -1
  5. package/dist/editors/property-editor-chartjs-hbar.d.ts +3 -4
  6. package/dist/editors/property-editor-chartjs-hbar.js +38 -42
  7. package/dist/editors/property-editor-chartjs-hbar.js.map +1 -1
  8. package/dist/editors/property-editor-chartjs-mixed.d.ts +1 -1
  9. package/dist/editors/property-editor-chartjs-multi-series-abstract.d.ts +6 -8
  10. package/dist/editors/property-editor-chartjs-multi-series-abstract.js +90 -97
  11. package/dist/editors/property-editor-chartjs-multi-series-abstract.js.map +1 -1
  12. package/dist/editors/property-editor-chartjs-pie.d.ts +1 -1
  13. package/dist/editors/property-editor-chartjs-radar.d.ts +1 -1
  14. package/dist/editors/property-editor-chartjs-styles.js +35 -29
  15. package/dist/editors/property-editor-chartjs-styles.js.map +1 -1
  16. package/dist/editors/property-editor-chartjs.d.ts +1 -1
  17. package/dist/editors/property-editor-chartjs.js +3 -1
  18. package/dist/editors/property-editor-chartjs.js.map +1 -1
  19. package/dist/ox-chart.d.ts +1 -1
  20. package/package.json +2 -4
  21. package/schema.graphql +61 -42
  22. package/src/editors/property-editor-chartjs-abstract.ts +0 -12
  23. package/src/editors/property-editor-chartjs-hbar.ts +38 -44
  24. package/src/editors/property-editor-chartjs-multi-series-abstract.ts +111 -120
  25. package/src/editors/property-editor-chartjs-styles.ts +35 -29
  26. package/src/editors/property-editor-chartjs.ts +3 -1
  27. package/tsconfig.tsbuildinfo +1 -1
@@ -1,14 +1,11 @@
1
- import '@material/web/button/elevated-button.js'
2
- import '@polymer/iron-pages/iron-pages'
3
- import '@polymer/paper-tabs/paper-tabs'
4
-
1
+ import '@material/web/icon/icon.js'
5
2
  import '@operato/i18n/ox-i18n.js'
6
3
 
7
4
  import { css, html } from 'lit'
8
5
  import { query } from 'lit/decorators.js'
9
6
 
10
7
  import { Properties } from '@hatiolab/things-scene'
11
- import { MdElevatedButton } from '@material/web/button/elevated-button.js'
8
+ import { MdIcon } from '@material/web/icon/icon.js'
12
9
 
13
10
  import PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract'
14
11
 
@@ -16,7 +13,7 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
16
13
  static styles = [
17
14
  ...PropertyEditorChartJSAbstract.styles,
18
15
  css`
19
- paper-tabs {
16
+ md-tabs {
20
17
  background-color: rgb(204, 204, 204);
21
18
  }
22
19
  input[type='text'],
@@ -52,8 +49,8 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
52
49
  }
53
50
 
54
51
  @query('#tabs') tabs!: HTMLElement
55
- @query('#tab-nav-left-button') tabNavLeftButton!: MdElevatedButton
56
- @query('#tab-nav-right-button') tabNavRightButton!: MdElevatedButton
52
+ @query('#tab-nav-left-button') tabNavLeftButton!: MdIcon
53
+ @query('#tab-nav-right-button') tabNavRightButton!: MdIcon
57
54
 
58
55
  get color() {
59
56
  var oldVersionColor = this.series.backgroundColor
@@ -101,7 +98,7 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
101
98
  }
102
99
 
103
100
  get tabContainer(): HTMLElement | null | undefined {
104
- return this.tabs.shadowRoot?.querySelector('#tabsContainer')
101
+ return this.tabs
105
102
  }
106
103
 
107
104
  firstUpdated() {
@@ -214,133 +211,127 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
214
211
  return html`
215
212
  <div id="series-properties-container" fullwidth>
216
213
  <div id="tab-header">
217
- <md-elevated-button
214
+ <md-icon
218
215
  id="tab-nav-left-button"
219
- @click=${(e: Event) => {
216
+ @tap=${(e: Event) => {
220
217
  this._onTabScrollNavLeft(e)
221
218
  }}
222
219
  disabled
223
- ><md-icon>chevron_left</md-icon></md-elevated-button
220
+ >chevron_left</md-icon
224
221
  >
225
- <paper-tabs
222
+ <div
226
223
  id="tabs"
227
- @iron-select=${(e: Event) => (this.currentSeriesIndex = (e.target as any).selected)}
228
- .selected=${this.currentSeriesIndex}
229
- no-bar
230
- noink
231
- scrollable
232
- hide-scroll-buttons
224
+ @change=${(e: Event) => {
225
+ this.currentSeriesIndex = (e.target as any).activeTabIndex
226
+ }}
227
+ active-tab-index=${this.currentSeriesIndex}
233
228
  fit-container
234
229
  >
235
230
  ${this.datasets.map(
236
231
  (dataset: any, index: number) => html`
237
- <paper-tab data-series="${index + 1}" noink
238
- >${index + 1}
232
+ <div
233
+ data-series=${index + 1}
234
+ data-tab-index=${index}
235
+ tab
236
+ ?selected=${index == this.currentSeriesIndex}
237
+ @click=${(e: Event) => {
238
+ const target = e.target as HTMLDivElement
239
+ this.currentSeriesIndex = Number(target.getAttribute('data-tab-index'))
240
+ }}
241
+ >
242
+ ${index + 1}
239
243
  ${!this.datasets || (this.datasets.length != 1 && this.currentSeriesIndex == index)
240
- ? html`
241
- <md-elevated-button @tap=${(e: Event) => this.onTapRemoveCurrentTab(e)}>
242
- <md-icon>close</md-icon>
243
- </md-elevated-button>
244
- `
244
+ ? html` <md-icon @tap="${(e: Event) => this.onTapRemoveCurrentTab(e)}"> close </md-icon> `
245
245
  : html``}
246
- </paper-tab>
246
+ </div>
247
247
  `
248
248
  )}
249
- </paper-tabs>
250
- <md-elevated-button
249
+ </div>
250
+ <md-icon
251
251
  id="tab-nav-right-button"
252
252
  @click=${(e: Event) => {
253
253
  this._onTabScrollNavRight(e)
254
254
  }}
255
255
  disabled
256
- ><md-icon>chevron_right</md-icon></md-elevated-button
256
+ >chevron_right</md-icon
257
257
  >
258
258
  </div>
259
259
  <div id="add-series-button-container">
260
- <md-elevated-button id="add-series-button" @tap=${(e: Event) => this.onTapAddTab(e)}
261
- ><md-icon>add</md-icon></md-elevated-button
262
- >
260
+ <md-icon id="add-series-button" @tap=${(e: Event) => this.onTapAddTab(e)}>add</md-icon>
263
261
  </div>
264
262
 
265
- <iron-pages .selected=${this.currentSeriesIndex} .attr-for-selected="series-index">
266
- ${this.datasets.map(
267
- (dataset: any, index: number) => html`
268
- <div class="tab-content" series-index="${index}">
269
- <label> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
270
- <input type="text" value-key="dataKey" .value=${this.dataKey} />
271
-
272
- ${this.value.type == 'bar'
273
- ? html`
274
- <label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
275
- <select class="select-content" value-key="series.type" .value=${this.series.type}>
276
- <option value="bar" selected>bar</option>
277
- <option value="line">line</option>
278
- </select>
279
- `
280
- : html``}
281
-
282
- <label> <ox-i18n msgid="label.label">label</ox-i18n> </label>
283
- <input type="text" value-key="series.label" .value=${this.series.label} />
284
-
285
- ${this.series.type == 'line'
286
- ? html`
287
- <label> <ox-i18n msgid="label.line-tension">line tension</ox-i18n> </label>
288
- <select class="select-content" value-key="series.lineTension" .value=${this.series.lineTension}>
289
- <option value="0.4">smooth</option>
290
- <option value="0">angled</option>
291
- </select>
292
- `
293
- : html``}
294
- ${this.series.type == 'line'
295
- ? html`
296
- <label> <ox-i18n msgid="label.border-width">border width</ox-i18n> </label>
297
- <input type="number" value-key="series.borderWidth" .value=${this.series.borderWidth} />
298
- `
299
- : html``}
300
-
301
- <label> <ox-i18n msgid="label.color">color</ox-i18n> </label>
302
- <ox-input-color value-key="color" .value=${this.color}></ox-input-color>
303
-
304
- ${this.series.type == 'line'
305
- ? html`
306
- <label> <ox-i18n msgid="label.point-shape">point shape</ox-i18n> </label>
307
- <select class="select-content" value-key="series.pointStyle" .value=${this.series.pointStyle}>
308
- <option value="circle">⚬</option>
309
- <option value="triangle">▵</option>
310
- <option value="rect">□</option>
311
- <option value="rectRot">◇</option>
312
- <option value="cross">+</option>
313
- <option value="crossRot">⨉</option>
314
- <option value="star">✱</option>
315
- <option value="line">―</option>
316
- <option value="dash">┄</option>
317
- </select>
318
-
319
- <label> <ox-i18n msgid="label.point-size">point size</ox-i18n> </label>
320
- <input type="number" value-key="series.pointRadius" .value=${this.series.pointRadius} />
321
- `
322
- : html``} <label> <ox-i18n msgid="label.stack-group">Stack group</ox-i18n> </label>
323
- <input type="text" value-key="series.stack" .value=${this.series.stack || ''} /> ${this.series.type ==
324
- 'line'
325
- ? html`
326
- <input type="checkbox" value-key="series.fill" .checked=${this.series.fill} />
327
- <label> <ox-i18n msgid="label.fill">fill</ox-i18n> </label>
328
- `
329
- : html``}
330
- ${this.multiAxis
331
- ? html`
332
- <label> <ox-i18n msgid="label.target-axis">target axis</ox-i18n> </label>
333
- <select class="select-content" value-key="series.yAxisID" .value=${this.series.yAxisID}>
334
- <option value="left">left</option>
335
- <option value="right">right</option>
336
- </select>
337
- `
338
- : html``}
339
- ${this.displayValueTemplate()}
340
- </div>
341
- `
342
- )}
343
- </iron-pages>
263
+ <div class="tab-content">
264
+ <label> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
265
+ <input type="text" value-key="dataKey" .value=${this.dataKey} />
266
+
267
+ ${this.value.type == 'bar'
268
+ ? html`
269
+ <label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
270
+ <select class="select-content" value-key="series.type" .value=${this.series.type}>
271
+ <option value="bar" selected>bar</option>
272
+ <option value="line">line</option>
273
+ </select>
274
+ `
275
+ : html``}
276
+
277
+ <label> <ox-i18n msgid="label.label">label</ox-i18n> </label>
278
+ <input type="text" value-key="series.label" .value=${this.series.label} />
279
+
280
+ ${this.series.type == 'line'
281
+ ? html`
282
+ <label> <ox-i18n msgid="label.line-tension">line tension</ox-i18n> </label>
283
+ <select class="select-content" value-key="series.lineTension" .value=${this.series.lineTension}>
284
+ <option value="0.4">smooth</option>
285
+ <option value="0">angled</option>
286
+ </select>
287
+ `
288
+ : html``}
289
+ ${this.series.type == 'line'
290
+ ? html`
291
+ <label> <ox-i18n msgid="label.border-width">border width</ox-i18n> </label>
292
+ <input type="number" value-key="series.borderWidth" .value=${this.series.borderWidth} />
293
+ `
294
+ : html``}
295
+
296
+ <label> <ox-i18n msgid="label.color">color</ox-i18n> </label>
297
+ <ox-input-color value-key="color" .value=${this.color}></ox-input-color>
298
+
299
+ ${this.series.type == 'line'
300
+ ? html`
301
+ <label> <ox-i18n msgid="label.point-shape">point shape</ox-i18n> </label>
302
+ <select class="select-content" value-key="series.pointStyle" .value=${this.series.pointStyle}>
303
+ <option value="circle">⚬</option>
304
+ <option value="triangle">▵</option>
305
+ <option value="rect">□</option>
306
+ <option value="rectRot">◇</option>
307
+ <option value="cross">+</option>
308
+ <option value="crossRot">⨉</option>
309
+ <option value="star">✱</option>
310
+ <option value="line">―</option>
311
+ <option value="dash">┄</option>
312
+ </select>
313
+
314
+ <label> <ox-i18n msgid="label.point-size">point size</ox-i18n> </label>
315
+ <input type="number" value-key="series.pointRadius" .value=${this.series.pointRadius} />
316
+ `
317
+ : html``} <label> <ox-i18n msgid="label.stack-group">Stack group</ox-i18n> </label>
318
+ <input type="text" value-key="series.stack" .value=${this.series.stack || ''} /> ${this.series.type == 'line'
319
+ ? html`
320
+ <input type="checkbox" value-key="series.fill" .checked=${this.series.fill} />
321
+ <label> <ox-i18n msgid="label.fill">fill</ox-i18n> </label>
322
+ `
323
+ : html``}
324
+ ${this.multiAxis
325
+ ? html`
326
+ <label> <ox-i18n msgid="label.target-axis">target axis</ox-i18n> </label>
327
+ <select class="select-content" value-key="series.yAxisID" .value=${this.series.yAxisID}>
328
+ <option value="left">left</option>
329
+ <option value="right">right</option>
330
+ </select>
331
+ `
332
+ : html``}
333
+ ${this.displayValueTemplate()}
334
+ </div>
344
335
  </div>
345
336
  `
346
337
  }
@@ -351,21 +342,21 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
351
342
  }
352
343
 
353
344
  if (this.tabContainer.clientWidth == this.tabContainer.scrollWidth) {
354
- this.tabNavLeftButton.disabled = true
355
- this.tabNavRightButton.disabled = true
345
+ this.tabNavLeftButton.setAttribute('disabled', '')
346
+ this.tabNavRightButton.setAttribute('disabled', '')
356
347
  }
357
348
  // left-end
358
349
  else if (this.tabContainer.scrollLeft == 0) {
359
- this.tabNavLeftButton.disabled = true
360
- this.tabNavRightButton.disabled = false
350
+ this.tabNavLeftButton.setAttribute('disabled', '')
351
+ this.tabNavRightButton.removeAttribute('disabled')
361
352
  }
362
353
  // right-end
363
354
  else if (this.tabContainer.scrollLeft + this.tabContainer.clientWidth >= this.tabContainer.scrollWidth) {
364
- this.tabNavLeftButton.disabled = false
365
- this.tabNavRightButton.disabled = true
355
+ this.tabNavLeftButton.removeAttribute('disabled')
356
+ this.tabNavRightButton.setAttribute('disabled', '')
366
357
  } else {
367
- this.tabNavLeftButton.disabled = false
368
- this.tabNavRightButton.disabled = false
358
+ this.tabNavLeftButton.removeAttribute('disabled')
359
+ this.tabNavRightButton.removeAttribute('disabled')
369
360
  }
370
361
  }
371
362
 
@@ -5,9 +5,6 @@ export const PropertyEditorChartJSStyles = css`
5
5
  display: grid;
6
6
  grid-template-columns: repeat(10, 1fr);
7
7
  grid-gap: 5px;
8
-
9
- --mdc-icon-button-size: 24px;
10
- --mdc-icon-size: 24px;
11
8
  }
12
9
 
13
10
  :host > * {
@@ -23,7 +20,7 @@ export const PropertyEditorChartJSStyles = css`
23
20
  :host > legend {
24
21
  box-sizing: border-box;
25
22
  grid-column: 1 / -1;
26
- color: var(--secondary-text-color, #e46c2e);
23
+ color: var(--md-sys-color-on-secondary-container, #e46c2e);
27
24
  font: var(--property-sidebar-fieldset-legend, bold 13px var(--theme-font));
28
25
  text-transform: capitalize;
29
26
  }
@@ -35,7 +32,7 @@ export const PropertyEditorChartJSStyles = css`
35
32
  justify-content: center;
36
33
  }
37
34
 
38
- #series-properties-container > iron-pages {
35
+ #series-properties-container > [tab-content] {
39
36
  grid-column: span 2;
40
37
  }
41
38
 
@@ -46,23 +43,32 @@ export const PropertyEditorChartJSStyles = css`
46
43
  overflow: hidden;
47
44
  border: 1px solid rgba(0, 0, 0, 0.2);
48
45
  border-bottom: 0;
49
- background-color: #ccc;
46
+ background-color: var(--md-sys-color-surface-variant);
47
+ color: var(--md-sys-color-on-surface);
50
48
  box-sizing: border-box;
51
49
  padding-top: 3px;
52
50
  align-items: center;
53
51
  }
54
52
 
55
- #tab-header > paper-tabs {
53
+ #tab-header > div {
56
54
  height: 25px;
57
55
  }
58
56
 
59
- #tab-header paper-tabs mwc-icon-button {
57
+ #tab-header md-icon[disabled] {
58
+ opacity: 0.1;
59
+ }
60
+
61
+ #tabs {
60
62
  display: flex;
63
+ overflow: hidden;
64
+ }
65
+
66
+ #tab-header #tabs [tab] md-icon {
61
67
  margin-left: 5px;
62
68
  padding: 2px;
63
- color: #585858;
69
+ color: var(--md-sys-color-on-surface);
64
70
 
65
- --mdc-icon-size: 16px;
71
+ --md-icon-size: 12px;
66
72
  }
67
73
 
68
74
  #add-series-button-container {
@@ -79,10 +85,12 @@ export const PropertyEditorChartJSStyles = css`
79
85
  width: 20px;
80
86
  height: 20px;
81
87
  padding: 0;
82
- color: var(--primary-text-color);
88
+ color: var(--md-sys-color-on-secondary-container);
83
89
  }
84
90
 
85
91
  .tab-content {
92
+ grid-column: 1 / -1;
93
+
86
94
  background-color: rgba(255, 255, 255, 0.5);
87
95
  border: 1px solid rgba(0, 0, 0, 0.2);
88
96
  border-width: 0 1px 1px 1px;
@@ -101,12 +109,18 @@ export const PropertyEditorChartJSStyles = css`
101
109
  .tab-content > label {
102
110
  grid-column: span 3;
103
111
  text-align: right;
104
- color: var(--primary-text-color);
112
+ color: var(--md-sys-color-on-secondary-container);
105
113
  font-size: 0.8em;
106
114
  line-height: 2;
107
115
  text-transform: capitalize;
108
116
  }
109
117
 
118
+ input,
119
+ select {
120
+ border: 1px solid rgba(0, 0, 0, 0.2);
121
+ border-radius: var(--spacing-small);
122
+ }
123
+
110
124
  input[type='checkbox'],
111
125
  .tab-content > input[type='checkbox'] {
112
126
  grid-column: span 4;
@@ -127,35 +141,27 @@ export const PropertyEditorChartJSStyles = css`
127
141
  border: 0;
128
142
  }
129
143
 
130
- select {
131
- border: 1px solid rgba(0, 0, 0, 0.2);
132
- }
133
- input[type='text'] {
134
- border: 1px solid rgba(0, 0, 0, 0.2);
135
- }
136
-
137
- paper-tab {
144
+ div[tab] {
145
+ display: flex;
146
+ align-items: center;
138
147
  background-color: rgba(0, 0, 0, 0.2);
139
- background-color: #ccc;
140
148
  border-width: 1px 1px 0 1px;
141
149
  padding: 0 5px;
142
- color: #fff;
143
- font-size: 13px;
150
+ color: var(--md-sys-color-on-surface);
144
151
  box-sizing: border-box;
145
152
  min-width: 45px;
146
153
  }
147
154
 
148
- paper-tab[disabled] {
155
+ div[tab][disabled] {
149
156
  background-color: rgba(0, 0, 0, 0.1);
150
157
  }
151
158
 
152
- paper-tab:last-child {
159
+ div[tab]:last-child {
153
160
  border-width: 0;
154
161
  }
155
162
 
156
- paper-tabs paper-tab.iron-selected {
157
- background-color: #f6f8f9;
158
- border-radius: 5px 5px 0 0;
159
- color: #585858;
163
+ div[tab][selected] {
164
+ background-color: var(--md-sys-color-surface);
165
+ color: var(--md-sys-color-on-surface);
160
166
  }
161
167
  `
@@ -17,6 +17,8 @@ export default class ChartJSEditor extends OxPropertyEditor {
17
17
  :host {
18
18
  display: block;
19
19
  padding: 5px;
20
+
21
+ --md-elevated-button-container-height: 20px;
20
22
  }
21
23
 
22
24
  #chart-type {
@@ -31,7 +33,7 @@ export default class ChartJSEditor extends OxPropertyEditor {
31
33
 
32
34
  text-align: right;
33
35
 
34
- color: var(--primary-text-color);
36
+ color: var(--md-sys-color-on-secondary-container);
35
37
  font-size: 0.8em;
36
38
  line-height: 2;
37
39
  text-transform: capitalize;