@operato/property-editor 2.0.0-alpha.13 → 2.0.0-alpha.131

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 (33) hide show
  1. package/CHANGELOG.md +630 -0
  2. package/demo/index.html +33 -3
  3. package/dist/src/ox-properties-dynamic-view.d.ts +1 -1
  4. package/dist/src/ox-properties-dynamic-view.js +6 -1
  5. package/dist/src/ox-properties-dynamic-view.js.map +1 -1
  6. package/dist/src/ox-property-editor-action.d.ts +1 -1
  7. package/dist/src/ox-property-editor-action.js +5 -4
  8. package/dist/src/ox-property-editor-action.js.map +1 -1
  9. package/dist/src/ox-property-editor-textarea.d.ts +1 -0
  10. package/dist/src/ox-property-editor-textarea.js +12 -5
  11. package/dist/src/ox-property-editor-textarea.js.map +1 -1
  12. package/dist/src/ox-property-editor.js +1 -1
  13. package/dist/src/ox-property-editor.js.map +1 -1
  14. package/dist/src/types.d.ts +6 -0
  15. package/dist/src/types.js.map +1 -1
  16. package/dist/stories/ox-properties-dynamic-view.stories.d.ts +53 -0
  17. package/dist/stories/ox-properties-dynamic-view.stories.js +274 -0
  18. package/dist/stories/ox-properties-dynamic-view.stories.js.map +1 -0
  19. package/dist/stories/{index.stories.d.ts → ox-properties-editor-textarea.stories.d.ts} +2 -4
  20. package/dist/stories/ox-properties-editor-textarea.stories.js +76 -0
  21. package/dist/stories/ox-properties-editor-textarea.stories.js.map +1 -0
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +19 -19
  24. package/src/ox-properties-dynamic-view.ts +8 -2
  25. package/src/ox-property-editor-action.ts +5 -4
  26. package/src/ox-property-editor-textarea.ts +12 -4
  27. package/src/ox-property-editor.ts +1 -1
  28. package/src/types.ts +7 -0
  29. package/stories/ox-properties-dynamic-view.stories.ts +296 -0
  30. package/stories/ox-properties-editor-textarea.stories.ts +97 -0
  31. package/dist/stories/index.stories.js +0 -33
  32. package/dist/stories/index.stories.js.map +0 -1
  33. package/stories/index.stories.ts +0 -52
@@ -0,0 +1,296 @@
1
+ import { TemplateResult, html } from 'lit'
2
+
3
+ import '../src/ox-property-editor-3axis.js'
4
+ import '../src/ox-property-editor-3dish.js'
5
+ import '../src/ox-property-editor-angle.js'
6
+ import '../src/ox-property-editor-checkbox.js'
7
+ import '../src/ox-property-editor-color.js'
8
+ import '../src/ox-property-editor-date.js'
9
+ import '../src/ox-property-editor-legend.js'
10
+ import '../src/ox-property-editor-number.js'
11
+ import '../src/ox-property-editor-unit-number.js'
12
+ import '../src/ox-property-editor-password.js'
13
+ import '../src/ox-property-editor-range.js'
14
+ import '../src/ox-property-editor-select.js'
15
+ import '../src/ox-property-editor-string.js'
16
+ import '../src/ox-property-editor-image.js'
17
+ import '../src/ox-property-editor-file.js'
18
+ import '../src/ox-property-editor-multiple-colors.js'
19
+ import '../src/ox-property-editor-crontab.js'
20
+ import '../src/ox-property-editor-work-shift.js'
21
+ import '../src/ox-property-editor-partition-keys.js'
22
+ import '../src/ox-property-editor-key-values.js'
23
+ import '../src/ox-property-editor-textarea.js'
24
+ import '../src/ox-property-editor-options.js'
25
+ import '../src/ox-property-editor-hashtags.js'
26
+
27
+ import '../src/ox-properties-dynamic-view.js'
28
+
29
+ import { OxPropertyEditor } from '../src/ox-property-editor.js'
30
+ import { PropertySpec } from '../src/types.js'
31
+
32
+ export default {
33
+ title: 'Properties Dynamic View',
34
+ component: 'ox-properties-dynamic-view',
35
+ argTypes: {
36
+ title: { control: 'text' },
37
+ counter: { control: 'number' },
38
+ textColor: { control: 'color' }
39
+ }
40
+ }
41
+
42
+ interface Story<T> {
43
+ (args: T): TemplateResult
44
+ args?: Partial<T>
45
+ argTypes?: Record<string, unknown>
46
+ }
47
+
48
+ interface ArgTypes {
49
+ title?: string
50
+ counter?: number
51
+ textColor?: string
52
+ slot?: TemplateResult
53
+ }
54
+
55
+ OxPropertyEditor.register({
56
+ legend: 'ox-property-editor-legend',
57
+ number: 'ox-property-editor-number',
58
+ 'unit-number': 'ox-property-editor-unit-number',
59
+ slider: 'ox-property-editor-range',
60
+ password: 'ox-property-editor-password',
61
+ angle: 'ox-property-editor-angle',
62
+ string: 'ox-property-editor-string',
63
+ textarea: 'ox-property-editor-textarea',
64
+ javascript: 'ox-property-editor-textarea',
65
+ checkbox: 'ox-property-editor-checkbox',
66
+ boolean: 'ox-property-editor-checkbox',
67
+ select: 'ox-property-editor-select',
68
+ date: 'ox-property-editor-date',
69
+ options: 'ox-property-editor-options',
70
+ data: 'ox-property-editor-data',
71
+ file: 'ox-property-editor-file',
72
+ image: 'ox-property-editor-image',
73
+ 'range-input': 'ox-property-editor-range',
74
+ 'attachment-selector': 'ox-property-editor-attachment-selector',
75
+ 'gltf-selector': 'ox-property-editor-attachment-selector',
76
+ 'image-selector': 'ox-property-editor-image-selector',
77
+ color: 'ox-property-editor-color',
78
+ 'solid-color-stops': 'ox-property-editor-solid-colorstops',
79
+ 'gradient-color-stops': 'ox-property-editor-gradient-colorstops',
80
+ 'multiple-color': 'ox-property-editor-multiple-colors',
81
+ map: 'ox-property-editor-value-map',
82
+ range: 'ox-property-editor-value-ranges',
83
+ graphql: 'ox-property-editor-graphql',
84
+ 'editor-table': 'ox-property-editor-table',
85
+ 'id-input': 'ox-property-editor-scene-component-id',
86
+ 'font-selector': 'ox-property-editor-font-selector',
87
+ crontab: 'ox-property-editor-crontab',
88
+ shift: 'ox-property-editor-work-shift',
89
+ 'partition-keys': 'ox-property-editor-partition-keys',
90
+ 'key-values': 'ox-property-editor-key-values',
91
+ hashtags: 'ox-property-editor-hashtags',
92
+ '3axis': 'ox-property-editor-3axis',
93
+ '3dish': 'ox-property-editor-3dish'
94
+ })
95
+
96
+ const properties = [
97
+ {
98
+ type: 'string',
99
+ label: 'ABC',
100
+ name: 'ABC',
101
+ quantifier: [1, 20]
102
+ },
103
+ {
104
+ type: 'password',
105
+ label: 'PWD',
106
+ name: 'PWD'
107
+ },
108
+ {
109
+ type: 'select',
110
+ label: 'SLT',
111
+ name: 'SLT',
112
+ property: {
113
+ options: [
114
+ { display: '', value: '' },
115
+ { display: 'AAA', value: 'aaa' },
116
+ { display: 'BBB', value: 'bbb' }
117
+ ]
118
+ }
119
+ },
120
+ {
121
+ type: 'number',
122
+ label: 'N#',
123
+ name: 'N#'
124
+ },
125
+ {
126
+ type: 'unit-number',
127
+ label: 'NU',
128
+ name: 'NU',
129
+ property: {
130
+ unit: 'K'
131
+ }
132
+ },
133
+ {
134
+ type: 'checkbox',
135
+ label: 'XV',
136
+ name: 'XV'
137
+ },
138
+ {
139
+ type: 'angle',
140
+ label: 'Degree',
141
+ name: 'Degree'
142
+ },
143
+ {
144
+ type: 'date',
145
+ label: 'DD',
146
+ name: 'DD'
147
+ },
148
+ {
149
+ type: 'legend',
150
+ label: '',
151
+ name: 'NEW-GROUP',
152
+ property: {
153
+ label: 'NEW-GROUP'
154
+ }
155
+ },
156
+ {
157
+ type: 'slider',
158
+ label: 'S',
159
+ name: 'S',
160
+ property: {
161
+ min: 30,
162
+ max: 300,
163
+ step: 10
164
+ }
165
+ },
166
+ {
167
+ type: 'textarea',
168
+ label: 'TA',
169
+ name: 'TA',
170
+ styles: {
171
+ flex: '1'
172
+ }
173
+ },
174
+ {
175
+ type: 'options',
176
+ label: 'OT',
177
+ name: 'OT',
178
+ editor: {
179
+ fullwidth: true
180
+ }
181
+ },
182
+ {
183
+ type: 'data',
184
+ label: 'DT',
185
+ name: 'DT'
186
+ },
187
+ {
188
+ type: 'color',
189
+ label: 'CL',
190
+ name: 'CL'
191
+ },
192
+ {
193
+ type: 'multiple-color',
194
+ label: 'CLS',
195
+ name: 'CLS'
196
+ },
197
+ {
198
+ type: 'image',
199
+ label: 'IM',
200
+ name: 'IM'
201
+ },
202
+ {
203
+ type: 'file',
204
+ label: 'FL',
205
+ name: 'FL',
206
+ property: {
207
+ multiple: true
208
+ }
209
+ },
210
+ {
211
+ type: 'crontab',
212
+ label: 'schedule',
213
+ name: 'schedule'
214
+ },
215
+ {
216
+ type: 'shift',
217
+ label: 'shift',
218
+ name: 'shift'
219
+ },
220
+ {
221
+ type: 'key-values',
222
+ label: 'key-values',
223
+ name: 'key-values'
224
+ },
225
+ {
226
+ type: 'hashtags',
227
+ label: 'hashtags',
228
+ name: 'hashtags'
229
+ },
230
+ {
231
+ type: '3dish',
232
+ label: '3dish',
233
+ name: '3dish'
234
+ }
235
+ ] as PropertySpec[]
236
+
237
+ const value = {
238
+ ABC: [4, 3, 2, 1],
239
+ S: 290,
240
+ SLT: 'bbb',
241
+ NU: 1000,
242
+ IM: 'https://www.hatiolab.com/assets/img/arch-thingsboard.png',
243
+ CLS: ['yello', 'green'],
244
+ schedule: '* * * * * *',
245
+ shift: [
246
+ {
247
+ name: 'DAY',
248
+ fromDate: -1,
249
+ fromTime: '22:00',
250
+ toDate: 0,
251
+ toTime: '06:00'
252
+ },
253
+ {
254
+ name: 'SWING',
255
+ fromDate: 0,
256
+ fromTime: '06:00',
257
+ toDate: 0,
258
+ toTime: '14:00'
259
+ },
260
+ {
261
+ name: 'NIGHT',
262
+ fromDate: 0,
263
+ fromTime: '14:00',
264
+ toDate: 0,
265
+ toTime: '22:00'
266
+ }
267
+ ],
268
+ hashtags: ['abc', 'def'],
269
+ '3dish': {
270
+ dimension: { x: 1, y: 1, z: 1 },
271
+ position: { x: 1, y: 1, z: 1 },
272
+ rotate: { x: 1, y: 1, z: 1 },
273
+ scale: { x: 1, y: 1, z: 1 }
274
+ }
275
+ }
276
+
277
+ const Template: Story<ArgTypes> = () => html`
278
+ <link href="/themes/app-theme.css" rel="stylesheet" />
279
+
280
+ <link
281
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
282
+ rel="stylesheet"
283
+ />
284
+ <link
285
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
286
+ rel="stylesheet"
287
+ />
288
+ <link
289
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
290
+ rel="stylesheet"
291
+ />
292
+
293
+ <ox-properties-dynamic-view .props=${properties} .value=${value}></ox-properties-dynamic-view>
294
+ `
295
+
296
+ export const Regular = Template.bind({})
@@ -0,0 +1,97 @@
1
+ import { TemplateResult, html } from 'lit'
2
+
3
+ import '../src/ox-property-editor-textarea.js'
4
+ import '../src/ox-properties-dynamic-view.js'
5
+
6
+ import { OxPropertyEditor } from '../src/ox-property-editor.js'
7
+ import { PropertySpec } from '../src/types.js'
8
+
9
+ export default {
10
+ title: 'TextArea',
11
+ component: 'ox-property-editor-textarea',
12
+ argTypes: {
13
+ title: { control: 'text' },
14
+ counter: { control: 'number' },
15
+ textColor: { control: 'color' }
16
+ }
17
+ }
18
+
19
+ interface Story<T> {
20
+ (args: T): TemplateResult
21
+ args?: Partial<T>
22
+ argTypes?: Record<string, unknown>
23
+ }
24
+
25
+ interface ArgTypes {
26
+ title?: string
27
+ counter?: number
28
+ textColor?: string
29
+ slot?: TemplateResult
30
+ }
31
+
32
+ OxPropertyEditor.register({
33
+ string: 'ox-property-editor-string',
34
+ textarea: 'ox-property-editor-textarea',
35
+ javascript: 'ox-property-editor-textarea'
36
+ })
37
+
38
+ const properties = [
39
+ {
40
+ type: 'string',
41
+ label: 'ABC',
42
+ name: 'ABC'
43
+ },
44
+ {
45
+ type: 'textarea',
46
+ label: 'TA',
47
+ name: 'TA',
48
+ styles: {
49
+ flex: '1'
50
+ }
51
+ }
52
+ ] as PropertySpec[]
53
+
54
+ const value = {
55
+ ABC: [4, 3, 2, 1],
56
+ TA: 'QWERTYUIOASDFGHJKZXCVBNM'
57
+ }
58
+
59
+ const Template: Story<ArgTypes> = () => html`
60
+ <link href="/themes/app-theme.css" rel="stylesheet" />
61
+
62
+ <link
63
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
64
+ rel="stylesheet"
65
+ />
66
+ <link
67
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
68
+ rel="stylesheet"
69
+ />
70
+ <link
71
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
72
+ rel="stylesheet"
73
+ />
74
+
75
+ <style>
76
+ #container {
77
+ height: 600px;
78
+ background-color: cyan;
79
+
80
+ display: flex;
81
+ flex-direction: column;
82
+ }
83
+
84
+ ox-properties-dynamic-view {
85
+ flex: 1;
86
+
87
+ display: flex;
88
+ flex-direction: column;
89
+ }
90
+ </style>
91
+
92
+ <div id="container">
93
+ <ox-properties-dynamic-view .props=${properties} .value=${value}></ox-properties-dynamic-view>
94
+ </div>
95
+ `
96
+
97
+ export const Regular = Template.bind({})
@@ -1,33 +0,0 @@
1
- import '../index.js';
2
- import { html } from 'lit';
3
- export default {
4
- title: 'PropertyEditor',
5
- component: 'ox-property-editor',
6
- argTypes: {
7
- title: { control: 'text' },
8
- counter: { control: 'number' },
9
- textColor: { control: 'color' }
10
- }
11
- };
12
- const Template = ({ title = 'Hello world', counter = 5, textColor, slot }) => html `
13
- <ox-board-viewer style="--board-viewer-text-color: ${textColor || 'black'}" .title=${title} .counter=${counter}>
14
- ${slot}
15
- </ox-board-viewer>
16
- `;
17
- export const Regular = Template.bind({});
18
- export const CustomTitle = Template.bind({});
19
- CustomTitle.args = {
20
- title: 'My title'
21
- };
22
- export const CustomCounter = Template.bind({});
23
- CustomCounter.args = {
24
- counter: 123456
25
- };
26
- export const SlottedContent = Template.bind({});
27
- SlottedContent.args = {
28
- slot: html `<p>Slotted content</p>`
29
- };
30
- SlottedContent.argTypes = {
31
- slot: { table: { disable: true } }
32
- };
33
- //# sourceMappingURL=index.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../stories/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC9B,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;KAChC;CACF,CAAA;AAeD,MAAM,QAAQ,GAAoB,CAAC,EAAE,KAAK,GAAG,aAAa,EAAE,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;uDACtD,SAAS,IAAI,OAAO,YAAY,KAAK,aAAa,OAAO;MAC1G,IAAI;;CAET,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAExC,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC5C,WAAW,CAAC,IAAI,GAAG;IACjB,KAAK,EAAE,UAAU;CAClB,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC9C,aAAa,CAAC,IAAI,GAAG;IACnB,OAAO,EAAE,MAAM;CAChB,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC/C,cAAc,CAAC,IAAI,GAAG;IACpB,IAAI,EAAE,IAAI,CAAA,wBAAwB;CACnC,CAAA;AACD,cAAc,CAAC,QAAQ,GAAG;IACxB,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CACnC,CAAA","sourcesContent":["import '../index.js'\n\nimport { TemplateResult, html } from 'lit'\n\nexport default {\n title: 'PropertyEditor',\n component: 'ox-property-editor',\n argTypes: {\n title: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n title?: string\n counter?: number\n textColor?: string\n slot?: TemplateResult\n}\n\nconst Template: Story<ArgTypes> = ({ title = 'Hello world', counter = 5, textColor, slot }: ArgTypes) => html`\n <ox-board-viewer style=\"--board-viewer-text-color: ${textColor || 'black'}\" .title=${title} .counter=${counter}>\n ${slot}\n </ox-board-viewer>\n`\n\nexport const Regular = Template.bind({})\n\nexport const CustomTitle = Template.bind({})\nCustomTitle.args = {\n title: 'My title'\n}\n\nexport const CustomCounter = Template.bind({})\nCustomCounter.args = {\n counter: 123456\n}\n\nexport const SlottedContent = Template.bind({})\nSlottedContent.args = {\n slot: html`<p>Slotted content</p>`\n}\nSlottedContent.argTypes = {\n slot: { table: { disable: true } }\n}\n"]}
@@ -1,52 +0,0 @@
1
- import '../index.js'
2
-
3
- import { TemplateResult, html } from 'lit'
4
-
5
- export default {
6
- title: 'PropertyEditor',
7
- component: 'ox-property-editor',
8
- argTypes: {
9
- title: { control: 'text' },
10
- counter: { control: 'number' },
11
- textColor: { control: 'color' }
12
- }
13
- }
14
-
15
- interface Story<T> {
16
- (args: T): TemplateResult
17
- args?: Partial<T>
18
- argTypes?: Record<string, unknown>
19
- }
20
-
21
- interface ArgTypes {
22
- title?: string
23
- counter?: number
24
- textColor?: string
25
- slot?: TemplateResult
26
- }
27
-
28
- const Template: Story<ArgTypes> = ({ title = 'Hello world', counter = 5, textColor, slot }: ArgTypes) => html`
29
- <ox-board-viewer style="--board-viewer-text-color: ${textColor || 'black'}" .title=${title} .counter=${counter}>
30
- ${slot}
31
- </ox-board-viewer>
32
- `
33
-
34
- export const Regular = Template.bind({})
35
-
36
- export const CustomTitle = Template.bind({})
37
- CustomTitle.args = {
38
- title: 'My title'
39
- }
40
-
41
- export const CustomCounter = Template.bind({})
42
- CustomCounter.args = {
43
- counter: 123456
44
- }
45
-
46
- export const SlottedContent = Template.bind({})
47
- SlottedContent.args = {
48
- slot: html`<p>Slotted content</p>`
49
- }
50
- SlottedContent.argTypes = {
51
- slot: { table: { disable: true } }
52
- }