@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.
Files changed (156) hide show
  1. package/.editorconfig +29 -0
  2. package/.storybook/main.js +5 -0
  3. package/.storybook/preview.js +52 -0
  4. package/.storybook/server.mjs +8 -0
  5. package/CHANGELOG.md +11 -0
  6. package/LICENSE +21 -0
  7. package/README.md +76 -0
  8. package/demo/index.html +30 -0
  9. package/dist/src/graphql/board.d.ts +6 -0
  10. package/dist/src/graphql/board.js +130 -0
  11. package/dist/src/graphql/board.js.map +1 -0
  12. package/dist/src/graphql/data-subscription.d.ts +5 -0
  13. package/dist/src/graphql/data-subscription.js +24 -0
  14. package/dist/src/graphql/data-subscription.js.map +1 -0
  15. package/dist/src/graphql/favorite-board.d.ts +1 -0
  16. package/dist/src/graphql/favorite-board.js +23 -0
  17. package/dist/src/graphql/favorite-board.js.map +1 -0
  18. package/dist/src/graphql/group.d.ts +7 -0
  19. package/dist/src/graphql/group.js +125 -0
  20. package/dist/src/graphql/group.js.map +1 -0
  21. package/dist/src/graphql/index.d.ts +4 -0
  22. package/dist/src/graphql/index.js +5 -0
  23. package/dist/src/graphql/index.js.map +1 -0
  24. package/dist/src/graphql/play-group.d.ts +13 -0
  25. package/dist/src/graphql/play-group.js +205 -0
  26. package/dist/src/graphql/play-group.js.map +1 -0
  27. package/dist/src/graphql/scenario.d.ts +6 -0
  28. package/dist/src/graphql/scenario.js +69 -0
  29. package/dist/src/graphql/scenario.js.map +1 -0
  30. package/dist/src/index.d.ts +7 -0
  31. package/dist/src/index.js +8 -0
  32. package/dist/src/index.js.map +1 -0
  33. package/dist/src/ox-property-panel.d.ts +46 -0
  34. package/dist/src/ox-property-panel.js +346 -0
  35. package/dist/src/ox-property-panel.js.map +1 -0
  36. package/dist/src/property-panel/abstract-property.d.ts +10 -0
  37. package/dist/src/property-panel/abstract-property.js +53 -0
  38. package/dist/src/property-panel/abstract-property.js.map +1 -0
  39. package/dist/src/property-panel/data-binding/data-binding-mapper.d.ts +58 -0
  40. package/dist/src/property-panel/data-binding/data-binding-mapper.js +380 -0
  41. package/dist/src/property-panel/data-binding/data-binding-mapper.js.map +1 -0
  42. package/dist/src/property-panel/data-binding/data-binding-value-map.d.ts +6 -0
  43. package/dist/src/property-panel/data-binding/data-binding-value-map.js +20 -0
  44. package/dist/src/property-panel/data-binding/data-binding-value-map.js.map +1 -0
  45. package/dist/src/property-panel/data-binding/data-binding-value-range.d.ts +6 -0
  46. package/dist/src/property-panel/data-binding/data-binding-value-range.js +20 -0
  47. package/dist/src/property-panel/data-binding/data-binding-value-range.js.map +1 -0
  48. package/dist/src/property-panel/data-binding/data-binding.d.ts +44 -0
  49. package/dist/src/property-panel/data-binding/data-binding.js +442 -0
  50. package/dist/src/property-panel/data-binding/data-binding.js.map +1 -0
  51. package/dist/src/property-panel/effects/effects.d.ts +24 -0
  52. package/dist/src/property-panel/effects/effects.js +72 -0
  53. package/dist/src/property-panel/effects/effects.js.map +1 -0
  54. package/dist/src/property-panel/effects/property-animation.d.ts +23 -0
  55. package/dist/src/property-panel/effects/property-animation.js +147 -0
  56. package/dist/src/property-panel/effects/property-animation.js.map +1 -0
  57. package/dist/src/property-panel/effects/property-animations.d.ts +22 -0
  58. package/dist/src/property-panel/effects/property-animations.js +70 -0
  59. package/dist/src/property-panel/effects/property-animations.js.map +1 -0
  60. package/dist/src/property-panel/effects/property-event-hover.d.ts +21 -0
  61. package/dist/src/property-panel/effects/property-event-hover.js +193 -0
  62. package/dist/src/property-panel/effects/property-event-hover.js.map +1 -0
  63. package/dist/src/property-panel/effects/property-event-tap.d.ts +36 -0
  64. package/dist/src/property-panel/effects/property-event-tap.js +262 -0
  65. package/dist/src/property-panel/effects/property-event-tap.js.map +1 -0
  66. package/dist/src/property-panel/effects/property-event.d.ts +22 -0
  67. package/dist/src/property-panel/effects/property-event.js +64 -0
  68. package/dist/src/property-panel/effects/property-event.js.map +1 -0
  69. package/dist/src/property-panel/effects/property-shadow.d.ts +23 -0
  70. package/dist/src/property-panel/effects/property-shadow.js +66 -0
  71. package/dist/src/property-panel/effects/property-shadow.js.map +1 -0
  72. package/dist/src/property-panel/effects/value-converter.d.ts +1 -0
  73. package/dist/src/property-panel/effects/value-converter.js +17 -0
  74. package/dist/src/property-panel/effects/value-converter.js.map +1 -0
  75. package/dist/src/property-panel/inspector/inspector.d.ts +27 -0
  76. package/dist/src/property-panel/inspector/inspector.js +357 -0
  77. package/dist/src/property-panel/inspector/inspector.js.map +1 -0
  78. package/dist/src/property-panel/shapes/shapes.d.ts +26 -0
  79. package/dist/src/property-panel/shapes/shapes.js +312 -0
  80. package/dist/src/property-panel/shapes/shapes.js.map +1 -0
  81. package/dist/src/property-panel/specifics/specific-properties-builder.d.ts +16 -0
  82. package/dist/src/property-panel/specifics/specific-properties-builder.js +138 -0
  83. package/dist/src/property-panel/specifics/specific-properties-builder.js.map +1 -0
  84. package/dist/src/property-panel/specifics/specifics.d.ts +25 -0
  85. package/dist/src/property-panel/specifics/specifics.js +84 -0
  86. package/dist/src/property-panel/specifics/specifics.js.map +1 -0
  87. package/dist/src/property-panel/styles/styles.d.ts +23 -0
  88. package/dist/src/property-panel/styles/styles.js +269 -0
  89. package/dist/src/property-panel/styles/styles.js.map +1 -0
  90. package/dist/src/types.d.ts +43 -0
  91. package/dist/src/types.js +2 -0
  92. package/dist/src/types.js.map +1 -0
  93. package/dist/stories/index.stories.d.ts +22 -0
  94. package/dist/stories/index.stories.js +121 -0
  95. package/dist/stories/index.stories.js.map +1 -0
  96. package/dist/stories/input-table-property.stories.d.ts +21 -0
  97. package/dist/stories/input-table-property.stories.js +84 -0
  98. package/dist/stories/input-table-property.stories.js.map +1 -0
  99. package/dist/test/ox-property-panel.test.d.ts +1 -0
  100. package/dist/test/ox-property-panel.test.js +24 -0
  101. package/dist/test/ox-property-panel.test.js.map +1 -0
  102. package/dist/tsconfig.tsbuildinfo +1 -0
  103. package/package.json +108 -0
  104. package/src/graphql/board.ts +144 -0
  105. package/src/graphql/data-subscription.ts +30 -0
  106. package/src/graphql/favorite-board.ts +25 -0
  107. package/src/graphql/group.ts +138 -0
  108. package/src/graphql/index.ts +4 -0
  109. package/src/graphql/play-group.ts +225 -0
  110. package/src/graphql/scenario.ts +79 -0
  111. package/src/index.ts +8 -0
  112. package/src/ox-property-panel.ts +347 -0
  113. package/src/property-panel/abstract-property.ts +67 -0
  114. package/src/property-panel/data-binding/data-binding-mapper.ts +412 -0
  115. package/src/property-panel/data-binding/data-binding-value-map.ts +19 -0
  116. package/src/property-panel/data-binding/data-binding-value-range.ts +19 -0
  117. package/src/property-panel/data-binding/data-binding.ts +464 -0
  118. package/src/property-panel/effects/effects.ts +77 -0
  119. package/src/property-panel/effects/property-animation.ts +155 -0
  120. package/src/property-panel/effects/property-animations.ts +74 -0
  121. package/src/property-panel/effects/property-event-hover.ts +212 -0
  122. package/src/property-panel/effects/property-event-tap.ts +269 -0
  123. package/src/property-panel/effects/property-event.ts +73 -0
  124. package/src/property-panel/effects/property-shadow.ts +77 -0
  125. package/src/property-panel/effects/value-converter.ts +17 -0
  126. package/src/property-panel/inspector/inspector.ts +407 -0
  127. package/src/property-panel/shapes/shapes.ts +321 -0
  128. package/src/property-panel/specifics/specific-properties-builder.ts +152 -0
  129. package/src/property-panel/specifics/specifics.ts +81 -0
  130. package/src/property-panel/styles/styles.ts +287 -0
  131. package/src/types.ts +63 -0
  132. package/stories/index.stories.ts +134 -0
  133. package/stories/input-table-property.stories.ts +96 -0
  134. package/test/ox-property-panel.test.ts +32 -0
  135. package/themes/app-theme.css +138 -0
  136. package/themes/calendar-theme.css +61 -0
  137. package/themes/dark.css +51 -0
  138. package/themes/grist-theme.css +175 -0
  139. package/themes/help-theme.css +57 -0
  140. package/themes/layout-theme.css +94 -0
  141. package/themes/light.css +51 -0
  142. package/themes/material-theme.css +23 -0
  143. package/themes/md-typescale-styles.css +100 -0
  144. package/themes/oops-theme.css +22 -0
  145. package/themes/report-theme.css +47 -0
  146. package/themes/spacing.css +23 -0
  147. package/themes/state-color.css +6 -0
  148. package/themes/tooltip-theme.css +11 -0
  149. package/translations/en.json +723 -0
  150. package/translations/ja.json +727 -0
  151. package/translations/ko.json +727 -0
  152. package/translations/ms.json +609 -0
  153. package/translations/zh.json +726 -0
  154. package/tsconfig.json +25 -0
  155. package/web-dev-server.config.mjs +27 -0
  156. package/web-test-runner.config.mjs +41 -0
@@ -0,0 +1,287 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@operato/help/ox-title-with-help.js'
6
+ import '@operato/popup/ox-popup-list.js'
7
+ import '@operato/input/ox-input-range.js'
8
+ import '@operato/input/ox-input-color.js'
9
+ import '@operato/input/ox-select.js'
10
+ import '@operato/font/ox-font-selector.js'
11
+ import '@operato/i18n/ox-i18n.js'
12
+ import '../../input/ox-input-fill-style.js'
13
+
14
+ import { css, html, nothing } from 'lit'
15
+ import { property } from 'lit/decorators.js'
16
+
17
+ import { Component } from '@hatiolab/things-scene'
18
+ import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'
19
+ import { LineStyles } from '@operato/styles/line-styles.js'
20
+
21
+ import { AbstractProperty } from '../abstract-property.js'
22
+
23
+ export class PropertyStyles extends AbstractProperty {
24
+ static styles = [
25
+ PropertyGridStyles,
26
+ LineStyles,
27
+ css`
28
+ ox-input-range {
29
+ width: 100%;
30
+ }
31
+
32
+ .btn-group {
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ gap: 4px;
37
+ }
38
+
39
+ .btn-group * {
40
+ width: 30px;
41
+ height: 24px;
42
+ min-width: initial;
43
+ border-radius: 0;
44
+ border-bottom: 2px solid #fff;
45
+ }
46
+
47
+ .btn-group [active] {
48
+ border-bottom: 2px solid #f2471c;
49
+ }
50
+ `
51
+ ]
52
+
53
+ @property({ type: Object }) value: any = {}
54
+ @property({ type: Array }) selected: Component[] = []
55
+ @property({ type: Array }) fonts: any[] = []
56
+ @property({ type: Boolean }) isLine: boolean = false
57
+
58
+ connectedCallback() {
59
+ super.connectedCallback()
60
+
61
+ this.renderRoot.addEventListener('change', this.onValueChange.bind(this))
62
+ }
63
+
64
+ onButtonGroupClick(e: Event) {
65
+ const target = e.target as HTMLElement
66
+
67
+ if (target.hasAttribute('value-key')) {
68
+ target.toggleAttribute('active')
69
+
70
+ target.dispatchEvent(
71
+ new CustomEvent('change', {
72
+ bubbles: true,
73
+ composed: true
74
+ })
75
+ )
76
+ }
77
+ }
78
+
79
+ render() {
80
+ var {
81
+ alpha = 1,
82
+ fontFamily,
83
+ fontSize,
84
+ lineHeight,
85
+ fontColor,
86
+ letterSpacing,
87
+ bold,
88
+ italic,
89
+ fillStyle,
90
+ lineWidth,
91
+ strokeStyle,
92
+ lineDash = 'solid',
93
+ lineCap,
94
+ lineJoin,
95
+ begin = 'none',
96
+ beginSize = 'size1',
97
+ end = 'none',
98
+ endSize = 'size1'
99
+ } = this.value || {}
100
+
101
+ return html`
102
+ <fieldset>
103
+ <legend>
104
+ <ox-title-with-help topic="board-modeller/styles/opacity" msgid="label.opacity">opacity</ox-title-with-help>
105
+ </legend>
106
+ <ox-input-range min="0" max="1" step="0.1" value-key="alpha" .value=${alpha} editable> </ox-input-range>
107
+ </fieldset>
108
+
109
+ <fieldset>
110
+ <legend>
111
+ <ox-title-with-help topic="board-modeller/styles/text-style" msgid="label.text-style"
112
+ >text style</ox-title-with-help
113
+ >
114
+ </legend>
115
+
116
+ <div class="property-grid">
117
+ <label>
118
+ <ox-i18n msgid="label.font-family">Font Family</ox-i18n>
119
+ </label>
120
+
121
+ <ox-font-selector class="custom-editor" value-key="fontFamily" .value=${fontFamily}></ox-font-selector>
122
+
123
+ <label class="property-onethird-label icon-only-label"><md-icon>format_size</md-icon></label>
124
+ <input type="number" value-key="fontSize" .value=${fontSize} class="property-onethird-input" />
125
+
126
+ <label class="property-onethird-label icon-only-label"><md-icon>format_line_spacing</md-icon></label>
127
+ <input type="number" value-key="lineHeight" .value=${lineHeight} class="property-onethird-input" />
128
+
129
+ <label class="property-onethird-label icon-only-label"><md-icon>format_letter_spacing</md-icon></label>
130
+ <input type="number" value-key="letterSpacing" .value=${letterSpacing} class="property-onethird-input" />
131
+
132
+ <label class="property-half-label icon-only-label"><md-icon>format_color_text</md-icon></label>
133
+ <ox-input-color value-key="fontColor" .value=${fontColor} class="property-half-input"> </ox-input-color>
134
+
135
+ <label class="property-half-label"><md-icon>format_shapes</md-icon></label>
136
+ <div class="property-half-input btn-group" @click=${this.onButtonGroupClick}>
137
+ <md-icon value-key="bold" ?active=${bold}>format_bold</md-icon>
138
+ <md-icon value-key="italic" ?active=${italic}>format_italic</md-icon>
139
+ </div>
140
+ </div>
141
+ </fieldset>
142
+
143
+ <fieldset>
144
+ <legend>
145
+ <ox-title-with-help topic="board-modeller/styles/fill-style" msgid="label.fill-style"
146
+ >fill style</ox-title-with-help
147
+ >
148
+ </legend>
149
+
150
+ <ox-input-fill-style value-key="fillStyle" .value=${fillStyle}> </ox-input-fill-style>
151
+ </fieldset>
152
+
153
+ <fieldset>
154
+ <legend>
155
+ <ox-title-with-help msgid="label.line-style" topic="board-modeller/styles/line-style"></ox-title-with-help>
156
+ </legend>
157
+
158
+ <div class="property-grid">
159
+ <label class="property-half-label icon-only-label"><md-icon>line_weight</md-icon></label>
160
+ <input type="number" value-key="lineWidth" .value=${lineWidth} class="property-half-input" />
161
+
162
+ <label class="property-half-label icon-only-label"><md-icon>border_color</md-icon></label>
163
+ <ox-input-color value-key="strokeStyle" .value=${strokeStyle} class="property-half-input"> </ox-input-color>
164
+
165
+ <label>
166
+ <ox-i18n msgid="label.line-type">line type</ox-i18n>
167
+ </label>
168
+ <ox-select value-key="lineDash" .value=${lineDash} class="custom-editor">
169
+ <div class="line-type ${lineDash}" slot="label"></div>
170
+ <ox-popup-list align-left nowrap>
171
+ <style>
172
+ ${LineStyles.cssText}
173
+ </style>
174
+ <div class="line-type solid" value="solid" option></div>
175
+ <div class="line-type round-dot" value="round-dot" option></div>
176
+ <div class="line-type square-dot" value="square-dot" option></div>
177
+ <div class="line-type dash" value="dash" option></div>
178
+ <div class="line-type dash-dot" value="dash-dot" option></div>
179
+ <div class="line-type long-dash" value="long-dash" option></div>
180
+ <div class="line-type long-dash-dot" value="long-dash-dot" option></div>
181
+ <div class="line-type long-dash-dot-dot" value="long-dash-dot-dot" option></div>
182
+ </ox-popup-list>
183
+ </ox-select>
184
+
185
+ <label>
186
+ <ox-i18n msgid="label.cap-type">cap type</ox-i18n>
187
+ </label>
188
+ <select value-key="lineCap" .value=${lineCap}>
189
+ <option value="butt"><ox-i18n msgid="label.square">square</ox-i18n></option>
190
+ <option value="round"><ox-i18n msgid="label.round">round</ox-i18n></option>
191
+ </select>
192
+
193
+ <label>
194
+ <ox-i18n msgid="label.join-type">join type</ox-i18n>
195
+ </label>
196
+ <select value-key="lineJoin" .value=${lineJoin}>
197
+ <option value="miter"><ox-i18n msgid="label.miter">miter</ox-i18n></option>
198
+ <option value="round"><ox-i18n msgid="label.round">round</ox-i18n></option>
199
+ <option value="bevel"><ox-i18n msgid="label.bevel">bevel</ox-i18n></option>
200
+ </select>
201
+
202
+ ${this.isLine
203
+ ? html`
204
+ <label>
205
+ <ox-i18n msgid="label.begin-type">begin type</ox-i18n>
206
+ </label>
207
+ <ox-select value-key="begin" .value=${begin} class="custom-editor">
208
+ <div class="arrow-type ${begin ? `begin-${begin}` : nothing}" slot="label"></div>
209
+ <ox-popup-list align-left nowrap>
210
+ <style>
211
+ ${LineStyles.cssText}
212
+ </style>
213
+ <div class="arrow-type begin-none" value="none" option></div>
214
+ <div class="arrow-type begin-arrow" value="arrow" option></div>
215
+ <div class="arrow-type begin-open-arrow" value="open-arrow" option></div>
216
+ <div class="arrow-type begin-sharp-arrow" value="sharp-arrow" option></div>
217
+ <div class="arrow-type begin-diamond" value="diamond" option></div>
218
+ <div class="arrow-type begin-oval" value="oval" option></div>
219
+ </ox-popup-list>
220
+ </ox-select>
221
+
222
+ <label>
223
+ <ox-i18n msgid="label.begin-size">begin size</ox-i18n>
224
+ </label>
225
+ <ox-select value-key="beginSize" .value=${beginSize} class="custom-editor">
226
+ <div class="arrow-type ${beginSize ? `begin-${beginSize}` : nothing}" slot="label"></div>
227
+ <ox-popup-list align-left nowrap>
228
+ <style>
229
+ ${LineStyles.cssText}
230
+ </style>
231
+ <div class="arrow-type begin-size1" value="size1" option></div>
232
+ <div class="arrow-type begin-size2" value="size2" option></div>
233
+ <div class="arrow-type begin-size3" value="size3" option></div>
234
+ <div class="arrow-type begin-size4" value="size4" option></div>
235
+ <div class="arrow-type begin-size5" value="size5" option></div>
236
+ <div class="arrow-type begin-size6" value="size6" option></div>
237
+ <div class="arrow-type begin-size7" value="size7" option></div>
238
+ <div class="arrow-type begin-size8" value="size8" option></div>
239
+ <div class="arrow-type begin-size9" value="size9" option></div>
240
+ </ox-popup-list>
241
+ </ox-select>
242
+
243
+ <label>
244
+ <ox-i18n msgid="label.end-type">end type</ox-i18n>
245
+ </label>
246
+ <ox-select value-key="end" .value=${end} class="custom-editor">
247
+ <div class="arrow-type ${end ? `end-${end}` : nothing}" slot="label"></div>
248
+ <ox-popup-list align-left nowrap>
249
+ <style>
250
+ ${LineStyles.cssText}
251
+ </style>
252
+ <div class="arrow-type end-none" value="none" option></div>
253
+ <div class="arrow-type end-arrow" value="arrow" option></div>
254
+ <div class="arrow-type end-open-arrow" value="open-arrow" option></div>
255
+ <div class="arrow-type end-sharp-arrow" value="sharp-arrow" option></div>
256
+ <div class="arrow-type end-diamond" value="diamond" option></div>
257
+ <div class="arrow-type end-oval" value="oval" option></div>
258
+ </ox-popup-list>
259
+ </ox-select>
260
+
261
+ <label>
262
+ <ox-i18n msgid="label.end-size">end size</ox-i18n>
263
+ </label>
264
+ <ox-select value-key="endSize" .value=${endSize} class="custom-editor">
265
+ <div class="arrow-type ${endSize ? `end-${endSize}` : nothing}" slot="label"></div>
266
+ <ox-popup-list align-left nowrap>
267
+ <style>
268
+ ${LineStyles.cssText}
269
+ </style>
270
+ <div class="arrow-type end-size1" value="size1" option></div>
271
+ <div class="arrow-type end-size2" value="size2" option></div>
272
+ <div class="arrow-type end-size3" value="size3" option></div>
273
+ <div class="arrow-type end-size4" value="size4" option></div>
274
+ <div class="arrow-type end-size5" value="size5" option></div>
275
+ <div class="arrow-type end-size6" value="size6" option></div>
276
+ <div class="arrow-type end-size7" value="size7" option></div>
277
+ <div class="arrow-type end-size8" value="size8" option></div>
278
+ <div class="arrow-type end-size9" value="size9" option></div>
279
+ </ox-popup-list>
280
+ </ox-select>
281
+ `
282
+ : html``}
283
+ </div>
284
+ </fieldset>
285
+ `
286
+ }
287
+ }
package/src/types.ts ADDED
@@ -0,0 +1,63 @@
1
+ import { Model } from '@hatiolab/things-scene'
2
+
3
+ export interface PalletItem {
4
+ type: string
5
+ description: string
6
+ icon: HTMLImageElement
7
+ group: string | string[]
8
+ model: Model
9
+ }
10
+
11
+ export interface Pallet {
12
+ name: string
13
+ templates: PalletItem[]
14
+ }
15
+
16
+ export type ComponentTemplate = {
17
+ type: string
18
+ description: string
19
+ group:
20
+ | 'line'
21
+ | 'shape'
22
+ | 'textAndMedia'
23
+ | 'chartAndGauge'
24
+ | 'table'
25
+ | 'container'
26
+ | 'dataSource'
27
+ | 'IoT'
28
+ | '3D'
29
+ | 'warehouse'
30
+ | 'form'
31
+ | 'etc'
32
+ | string
33
+ icon: any
34
+ model: Model
35
+ }
36
+
37
+ export type ComponentGroup = {
38
+ name: string
39
+ description: string
40
+ icon: string
41
+ templates: ComponentTemplate[]
42
+ }
43
+
44
+ export type Board = {
45
+ id?: string
46
+ name?: string
47
+ description?: string
48
+ model?: any
49
+ groupId?: string
50
+ thumbnail?: string
51
+ }
52
+
53
+ export type BoardGroup = {
54
+ id?: string
55
+ name?: string
56
+ description?: string
57
+ }
58
+
59
+ export type PlayGroup = {
60
+ id?: string
61
+ name?: string
62
+ description?: string
63
+ }
@@ -0,0 +1,134 @@
1
+ import { html, TemplateResult } from 'lit'
2
+ import '../src/ox-property-panel.js'
3
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js'
4
+
5
+ export default {
6
+ title: 'OxPropertyPanel',
7
+ component: 'ox-property-panel',
8
+ argTypes: {
9
+ model: { control: 'object' }
10
+ }
11
+ }
12
+
13
+ interface Story<T> {
14
+ (args: T): TemplateResult
15
+ args?: Partial<T>
16
+ argTypes?: Record<string, unknown>
17
+ }
18
+
19
+ interface ArgTypes {
20
+ model?: any
21
+ }
22
+
23
+ const Template: Story<ArgTypes> = ({ model }: ArgTypes) => html`
24
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
25
+
26
+ <link href="/themes/light.css" rel="stylesheet" />
27
+ <link href="/themes/dark.css" rel="stylesheet" />
28
+ <link href="/themes/spacing.css" rel="stylesheet" />
29
+ <link href="/themes/help-theme.css" rel="stylesheet" />
30
+
31
+ <link
32
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
33
+ rel="stylesheet"
34
+ />
35
+ <link
36
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
37
+ rel="stylesheet"
38
+ />
39
+ <link
40
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
41
+ rel="stylesheet"
42
+ />
43
+
44
+ <style>
45
+ ${MDTypeScaleStyles.cssText}
46
+ </style>
47
+
48
+ <style>
49
+ #place {
50
+ width: 100%;
51
+ height: 500px;
52
+ text-align: center;
53
+
54
+ background-color: var(--md-sys-color-primary-container);
55
+ color: var(--md-sys-color-on-primary-container);
56
+ }
57
+ </style>
58
+
59
+ <ox-property-panel .model=${model}> </ox-property-panel>
60
+ `
61
+
62
+ export const Regular = Template.bind({})
63
+ Regular.args = {
64
+ model: {
65
+ type: 'progress-circle',
66
+ cy: 100,
67
+ cx: 100,
68
+ rx: 100,
69
+ ry: 100,
70
+ value: '#{data}',
71
+ startAngle: 0,
72
+ endAngle: 360,
73
+ fontSize: 70,
74
+ strokeStyle: 'rgb(82, 199, 255)',
75
+ blankStrokeStyle: 'rgba(0,0,0,.2)',
76
+ fontFamily: 'digital',
77
+ fontColor: '#fff',
78
+ text: '#{data}',
79
+ alpha: 1,
80
+ hidden: false,
81
+ lineWidth: 20,
82
+ lineDash: 'solid',
83
+ lineCap: 'butt',
84
+ rotation: 0,
85
+ paddingTop: 50,
86
+ shadow: {
87
+ left: 4,
88
+ top: 4,
89
+ blurSize: 4,
90
+ color: 'rgba(0,0,0,.3)'
91
+ },
92
+ paddingRight: 15,
93
+ textAlign: 'center',
94
+ textFormat: '#,##0.0',
95
+ data: 99,
96
+ mappings: [],
97
+ locked: false,
98
+ fillStyle: 'rgba(76, 187, 250, 0.2)',
99
+ paddingLeft: 0,
100
+ textBaseline: null,
101
+ packmanStyle: true,
102
+ animFromBase: true,
103
+ bold: true,
104
+ refid: 45
105
+ }
106
+ }
107
+
108
+ export const Custom = Template.bind({})
109
+ Custom.args = {
110
+ model: {
111
+ type: 'rect',
112
+ left: 95.56740614334475,
113
+ top: 30.973680756104017,
114
+ width: 239.5904436860068,
115
+ height: 47.098976109215045,
116
+ fillStyle: 'red',
117
+ strokeStyle: '#000',
118
+ alpha: 1,
119
+ hidden: false,
120
+ lineWidth: 1,
121
+ lineDash: 'solid',
122
+ lineCap: 'butt',
123
+ refid: 8,
124
+ rotation: 0,
125
+ id: 'a',
126
+ mappings: [
127
+ {
128
+ rule: 'value',
129
+ target: '(self)',
130
+ property: 'text'
131
+ }
132
+ ]
133
+ }
134
+ }
@@ -0,0 +1,96 @@
1
+ import { html, TemplateResult } from 'lit'
2
+ import '../src/input/ox-input-table.js'
3
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js'
4
+
5
+ export default {
6
+ title: 'OxInputTableProperty',
7
+ component: 'ox-input-table',
8
+ argTypes: {
9
+ value: { control: 'object' }
10
+ }
11
+ }
12
+
13
+ interface Story<T> {
14
+ (args: T): TemplateResult
15
+ args?: Partial<T>
16
+ argTypes?: Record<string, unknown>
17
+ }
18
+
19
+ interface ArgTypes {
20
+ value?: any
21
+ }
22
+
23
+ const Template: Story<ArgTypes> = ({ value }: ArgTypes) => html`
24
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
25
+
26
+ <link href="/themes/light.css" rel="stylesheet" />
27
+ <link href="/themes/dark.css" rel="stylesheet" />
28
+ <link href="/themes/spacing.css" rel="stylesheet" />
29
+ <link href="/themes/help-theme.css" rel="stylesheet" />
30
+
31
+ <link
32
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
33
+ rel="stylesheet"
34
+ />
35
+ <link
36
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
37
+ rel="stylesheet"
38
+ />
39
+ <link
40
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
41
+ rel="stylesheet"
42
+ />
43
+
44
+ <style>
45
+ ${MDTypeScaleStyles.cssText}
46
+ </style>
47
+
48
+ <style>
49
+ #place {
50
+ width: 100%;
51
+ height: 500px;
52
+ text-align: center;
53
+
54
+ background-color: var(--md-sys-color-primary-container);
55
+ color: var(--md-sys-color-on-primary-container);
56
+ }
57
+ </style>
58
+
59
+ <ox-input-table .value=${value}> </ox-input-table>
60
+ `
61
+
62
+ export const Regular = Template.bind({})
63
+ Regular.args = {
64
+ value: {
65
+ type: 'table-cell',
66
+ left: 290.42944785276075,
67
+ top: 0,
68
+ width: 96.80981595092024,
69
+ height: 62.02453987730057,
70
+ textWrap: true,
71
+ border: {
72
+ top: {
73
+ strokeStyle: '#999',
74
+ lineDash: 'solid',
75
+ lineWidth: 1
76
+ },
77
+ left: {
78
+ strokeStyle: '#999',
79
+ lineDash: 'solid',
80
+ lineWidth: 1
81
+ },
82
+ bottom: {
83
+ strokeStyle: '#999',
84
+ lineDash: 'solid',
85
+ lineWidth: 1
86
+ },
87
+ right: {
88
+ strokeStyle: '#999',
89
+ lineDash: 'solid',
90
+ lineWidth: 1
91
+ }
92
+ },
93
+ refid: 12,
94
+ dataIndex: 0
95
+ }
96
+ }
@@ -0,0 +1,32 @@
1
+ import { html } from 'lit'
2
+ import { fixture, expect } from '@open-wc/testing'
3
+ import { OxPropertyPanel } from '../src/ox-property-panel.js'
4
+ import '../src/ox-property-panel.js'
5
+
6
+ describe('OxPropertyPanel', () => {
7
+ it('has a default header "Hey there" and counter 5', async () => {
8
+ const el = await fixture<OxPropertyPanel>(html`<ox-property-panel></ox-property-panel>`)
9
+
10
+ // expect(el.header).to.equal('Hey there')
11
+ // expect(el.counter).to.equal(5)
12
+ })
13
+
14
+ it('increases the counter on button click', async () => {
15
+ const el = await fixture<OxPropertyPanel>(html`<ox-property-panel></ox-property-panel>`)
16
+ el.shadowRoot!.querySelector('button')!.click()
17
+
18
+ // expect(el.counter).to.equal(6)
19
+ })
20
+
21
+ it('can override the header via attribute', async () => {
22
+ const el = await fixture<OxPropertyPanel>(html`<ox-property-panel header="attribute header"></ox-property-panel>`)
23
+
24
+ // expect(el.header).to.equal('attribute header')
25
+ })
26
+
27
+ it('passes the a11y audit', async () => {
28
+ const el = await fixture<OxPropertyPanel>(html`<ox-property-panel></ox-property-panel>`)
29
+
30
+ await expect(el).shadowDom.to.be.accessible()
31
+ })
32
+ })