@rettangoli/ui 0.1.31 → 1.0.0-rc1
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.
- package/README.md +20 -85
- package/dist/rettangoli-iife-layout.min.js +113 -173
- package/dist/rettangoli-iife-ui.min.js +123 -183
- package/package.json +5 -4
- package/src/common/dimensions.js +72 -0
- package/src/common/link.js +111 -0
- package/src/common/responsive.js +8 -0
- package/src/common.js +43 -8
- package/src/components/accordionItem/accordionItem.handlers.js +1 -1
- package/src/components/accordionItem/accordionItem.schema.yaml +14 -0
- package/src/components/accordionItem/accordionItem.store.js +8 -8
- package/src/components/accordionItem/accordionItem.view.yaml +5 -35
- package/src/components/breadcrumb/breadcrumb.handlers.js +24 -3
- package/src/components/breadcrumb/breadcrumb.schema.yaml +51 -0
- package/src/components/breadcrumb/breadcrumb.store.js +66 -10
- package/src/components/breadcrumb/breadcrumb.view.yaml +18 -58
- package/src/components/dropdownMenu/dropdownMenu.handlers.js +17 -3
- package/src/components/dropdownMenu/dropdownMenu.schema.yaml +64 -0
- package/src/components/dropdownMenu/dropdownMenu.store.js +48 -6
- package/src/components/dropdownMenu/dropdownMenu.view.yaml +24 -46
- package/src/components/form/form.handlers.js +25 -108
- package/src/components/form/form.schema.yaml +283 -0
- package/src/components/form/form.store.js +19 -14
- package/src/components/form/form.view.yaml +28 -319
- package/src/components/globalUi/globalUi.handlers.js +2 -2
- package/src/components/globalUi/globalUi.schema.yaml +8 -0
- package/src/components/globalUi/globalUi.store.js +8 -8
- package/src/components/globalUi/globalUi.view.yaml +9 -46
- package/src/components/navbar/navbar.handlers.js +1 -1
- package/src/components/navbar/navbar.schema.yaml +25 -0
- package/src/components/navbar/navbar.store.js +28 -14
- package/src/components/navbar/navbar.view.yaml +21 -65
- package/src/components/pageOutline/pageOutline.handlers.js +17 -11
- package/src/components/pageOutline/pageOutline.schema.yaml +16 -0
- package/src/components/pageOutline/pageOutline.store.js +6 -7
- package/src/components/pageOutline/pageOutline.view.yaml +1 -29
- package/src/components/popoverInput/popoverInput.handlers.js +31 -31
- package/src/components/popoverInput/popoverInput.schema.yaml +18 -0
- package/src/components/popoverInput/popoverInput.store.js +9 -9
- package/src/components/popoverInput/popoverInput.view.yaml +5 -22
- package/src/components/select/select.handlers.js +31 -35
- package/src/components/select/select.schema.yaml +36 -0
- package/src/components/select/select.store.js +34 -35
- package/src/components/select/select.view.yaml +13 -56
- package/src/components/sidebar/sidebar.handlers.js +5 -5
- package/src/components/sidebar/sidebar.schema.yaml +57 -0
- package/src/components/sidebar/sidebar.store.js +45 -23
- package/src/components/sidebar/sidebar.view.yaml +79 -174
- package/src/components/sliderInput/sliderInput.handlers.js +28 -8
- package/src/components/sliderInput/sliderInput.schema.yaml +27 -0
- package/src/components/sliderInput/sliderInput.store.js +9 -9
- package/src/components/sliderInput/sliderInput.view.yaml +8 -33
- package/src/components/table/table.handlers.js +3 -3
- package/src/components/table/table.schema.yaml +27 -0
- package/src/components/table/table.store.js +8 -8
- package/src/components/table/table.view.yaml +16 -62
- package/src/components/tabs/tabs.schema.yaml +26 -0
- package/src/components/tabs/tabs.store.js +12 -9
- package/src/components/tabs/tabs.view.yaml +4 -60
- package/src/components/tooltip/tooltip.schema.yaml +18 -0
- package/src/components/tooltip/tooltip.store.js +7 -7
- package/src/components/tooltip/tooltip.view.yaml +4 -22
- package/src/components/waveform/waveform.handlers.js +6 -6
- package/src/components/waveform/waveform.schema.yaml +25 -0
- package/src/components/waveform/waveform.store.js +6 -6
- package/src/components/waveform/waveform.view.yaml +6 -34
- package/src/deps/createGlobalUI.js +2 -2
- package/src/primitives/button.js +200 -114
- package/src/primitives/colorPicker.js +56 -50
- package/src/primitives/dialog.js +2 -1
- package/src/primitives/image.js +73 -103
- package/src/primitives/input-number.js +139 -93
- package/src/primitives/input.js +87 -64
- package/src/primitives/popover.js +36 -28
- package/src/primitives/slider.js +6 -4
- package/src/primitives/svg.js +9 -10
- package/src/primitives/text.js +26 -47
- package/src/primitives/textarea.js +25 -9
- package/src/primitives/view.js +49 -90
- package/src/setup.js +1 -7
- package/src/styles/buttonMarginStyles.js +1 -13
- package/src/styles/cursorStyles.js +1 -5
- package/src/styles/flexDirectionStyles.js +4 -4
- package/src/styles/marginStylesForTarget.js +13 -0
- package/src/styles/textColorStyles.js +14 -6
- package/src/styles/textStyles.js +4 -4
- package/src/styles/viewStyles.js +6 -6
- package/src/styles/viewStylesForTarget.js +58 -0
- package/src/styles/flexChildStyles.js +0 -43
|
@@ -1,331 +1,40 @@
|
|
|
1
|
-
elementName: rtgl-form
|
|
2
|
-
|
|
3
|
-
viewDataSchema:
|
|
4
|
-
type: object
|
|
5
|
-
|
|
6
|
-
propsSchema:
|
|
7
|
-
type: object
|
|
8
|
-
properties:
|
|
9
|
-
defaultValues:
|
|
10
|
-
type: object
|
|
11
|
-
context:
|
|
12
|
-
type: object
|
|
13
|
-
form:
|
|
14
|
-
type: object
|
|
15
|
-
properties:
|
|
16
|
-
title:
|
|
17
|
-
type: string
|
|
18
|
-
description:
|
|
19
|
-
type: string
|
|
20
|
-
fields:
|
|
21
|
-
type: array
|
|
22
|
-
items:
|
|
23
|
-
anyOf:
|
|
24
|
-
- type: object
|
|
25
|
-
properties:
|
|
26
|
-
name:
|
|
27
|
-
type: string
|
|
28
|
-
label:
|
|
29
|
-
type: string
|
|
30
|
-
description:
|
|
31
|
-
type: string
|
|
32
|
-
inputType:
|
|
33
|
-
const: inputText
|
|
34
|
-
placeholder:
|
|
35
|
-
type: string
|
|
36
|
-
testId:
|
|
37
|
-
type: string
|
|
38
|
-
tooltip:
|
|
39
|
-
type: object
|
|
40
|
-
properties:
|
|
41
|
-
content:
|
|
42
|
-
type: string
|
|
43
|
-
required:
|
|
44
|
-
- name
|
|
45
|
-
- label
|
|
46
|
-
- inputType
|
|
47
|
-
additionalProperties: false
|
|
48
|
-
- type: object
|
|
49
|
-
properties:
|
|
50
|
-
name:
|
|
51
|
-
type: string
|
|
52
|
-
label:
|
|
53
|
-
type: string
|
|
54
|
-
description:
|
|
55
|
-
type: string
|
|
56
|
-
inputType:
|
|
57
|
-
const: select
|
|
58
|
-
placeholder:
|
|
59
|
-
type: string
|
|
60
|
-
noClear:
|
|
61
|
-
type: boolean
|
|
62
|
-
addOption:
|
|
63
|
-
type: object
|
|
64
|
-
properties:
|
|
65
|
-
label:
|
|
66
|
-
type: string
|
|
67
|
-
options:
|
|
68
|
-
type: array
|
|
69
|
-
items:
|
|
70
|
-
type: object
|
|
71
|
-
properties:
|
|
72
|
-
label:
|
|
73
|
-
type: string
|
|
74
|
-
value:
|
|
75
|
-
type: any
|
|
76
|
-
required:
|
|
77
|
-
- label
|
|
78
|
-
- value
|
|
79
|
-
testId:
|
|
80
|
-
type: string
|
|
81
|
-
tooltip:
|
|
82
|
-
type: object
|
|
83
|
-
properties:
|
|
84
|
-
content:
|
|
85
|
-
type: string
|
|
86
|
-
required:
|
|
87
|
-
- name
|
|
88
|
-
- label
|
|
89
|
-
- inputType
|
|
90
|
-
- options
|
|
91
|
-
additionalProperties: false
|
|
92
|
-
- type: object
|
|
93
|
-
properties:
|
|
94
|
-
name:
|
|
95
|
-
type: string
|
|
96
|
-
label:
|
|
97
|
-
type: string
|
|
98
|
-
description:
|
|
99
|
-
type: string
|
|
100
|
-
inputType:
|
|
101
|
-
const: colorPicker
|
|
102
|
-
value:
|
|
103
|
-
type: string
|
|
104
|
-
testId:
|
|
105
|
-
type: string
|
|
106
|
-
tooltip:
|
|
107
|
-
type: object
|
|
108
|
-
properties:
|
|
109
|
-
content:
|
|
110
|
-
type: string
|
|
111
|
-
required:
|
|
112
|
-
- name
|
|
113
|
-
- label
|
|
114
|
-
- inputType
|
|
115
|
-
additionalProperties: false
|
|
116
|
-
- type: object
|
|
117
|
-
properties:
|
|
118
|
-
name:
|
|
119
|
-
type: string
|
|
120
|
-
label:
|
|
121
|
-
type: string
|
|
122
|
-
description:
|
|
123
|
-
type: string
|
|
124
|
-
inputType:
|
|
125
|
-
const: slider
|
|
126
|
-
min:
|
|
127
|
-
type: number
|
|
128
|
-
max:
|
|
129
|
-
type: number
|
|
130
|
-
step:
|
|
131
|
-
type: number
|
|
132
|
-
value:
|
|
133
|
-
type: number
|
|
134
|
-
testId:
|
|
135
|
-
type: string
|
|
136
|
-
tooltip:
|
|
137
|
-
type: object
|
|
138
|
-
properties:
|
|
139
|
-
content:
|
|
140
|
-
type: string
|
|
141
|
-
required:
|
|
142
|
-
- name
|
|
143
|
-
- label
|
|
144
|
-
- inputType
|
|
145
|
-
additionalProperties: false
|
|
146
|
-
- type: object
|
|
147
|
-
properties:
|
|
148
|
-
name:
|
|
149
|
-
type: string
|
|
150
|
-
label:
|
|
151
|
-
type: string
|
|
152
|
-
description:
|
|
153
|
-
type: string
|
|
154
|
-
inputType:
|
|
155
|
-
const: slider-input
|
|
156
|
-
min:
|
|
157
|
-
type: number
|
|
158
|
-
max:
|
|
159
|
-
type: number
|
|
160
|
-
step:
|
|
161
|
-
type: number
|
|
162
|
-
value:
|
|
163
|
-
type: number
|
|
164
|
-
testId:
|
|
165
|
-
type: string
|
|
166
|
-
tooltip:
|
|
167
|
-
type: object
|
|
168
|
-
properties:
|
|
169
|
-
content:
|
|
170
|
-
type: string
|
|
171
|
-
required:
|
|
172
|
-
- name
|
|
173
|
-
- label
|
|
174
|
-
- inputType
|
|
175
|
-
additionalProperties: false
|
|
176
|
-
- type: object
|
|
177
|
-
properties:
|
|
178
|
-
name:
|
|
179
|
-
type: string
|
|
180
|
-
label:
|
|
181
|
-
type: string
|
|
182
|
-
description:
|
|
183
|
-
type: string
|
|
184
|
-
inputType:
|
|
185
|
-
const: image
|
|
186
|
-
width:
|
|
187
|
-
type: number
|
|
188
|
-
height:
|
|
189
|
-
type: number
|
|
190
|
-
placeholder:
|
|
191
|
-
type: string
|
|
192
|
-
testId:
|
|
193
|
-
type: string
|
|
194
|
-
tooltip:
|
|
195
|
-
type: object
|
|
196
|
-
properties:
|
|
197
|
-
content:
|
|
198
|
-
type: string
|
|
199
|
-
required:
|
|
200
|
-
- name
|
|
201
|
-
- label
|
|
202
|
-
- inputType
|
|
203
|
-
additionalProperties: false
|
|
204
|
-
- type: object
|
|
205
|
-
properties:
|
|
206
|
-
name:
|
|
207
|
-
type: string
|
|
208
|
-
label:
|
|
209
|
-
type: string
|
|
210
|
-
description:
|
|
211
|
-
type: string
|
|
212
|
-
inputType:
|
|
213
|
-
const: waveform
|
|
214
|
-
width:
|
|
215
|
-
type: number
|
|
216
|
-
height:
|
|
217
|
-
type: number
|
|
218
|
-
placeholder:
|
|
219
|
-
type: string
|
|
220
|
-
defaultValue:
|
|
221
|
-
type: object
|
|
222
|
-
waveformData:
|
|
223
|
-
type: object
|
|
224
|
-
testId:
|
|
225
|
-
type: string
|
|
226
|
-
tooltip:
|
|
227
|
-
type: object
|
|
228
|
-
properties:
|
|
229
|
-
content:
|
|
230
|
-
type: string
|
|
231
|
-
required:
|
|
232
|
-
- name
|
|
233
|
-
- label
|
|
234
|
-
- inputType
|
|
235
|
-
additionalProperties: false
|
|
236
|
-
- type: object
|
|
237
|
-
properties:
|
|
238
|
-
name:
|
|
239
|
-
type: string
|
|
240
|
-
label:
|
|
241
|
-
type: string
|
|
242
|
-
description:
|
|
243
|
-
type: string
|
|
244
|
-
inputType:
|
|
245
|
-
const: popover-input
|
|
246
|
-
placeholder:
|
|
247
|
-
type: string
|
|
248
|
-
testId:
|
|
249
|
-
type: string
|
|
250
|
-
tooltip:
|
|
251
|
-
type: object
|
|
252
|
-
properties:
|
|
253
|
-
content:
|
|
254
|
-
type: string
|
|
255
|
-
required:
|
|
256
|
-
- name
|
|
257
|
-
- label
|
|
258
|
-
- inputType
|
|
259
|
-
additionalProperties: false
|
|
260
|
-
actions:
|
|
261
|
-
type: object
|
|
262
|
-
properties:
|
|
263
|
-
buttons:
|
|
264
|
-
type: array
|
|
265
|
-
items:
|
|
266
|
-
type: object
|
|
267
|
-
properties:
|
|
268
|
-
id:
|
|
269
|
-
type: string
|
|
270
|
-
content:
|
|
271
|
-
type: string
|
|
272
|
-
testId:
|
|
273
|
-
type: string
|
|
274
|
-
required:
|
|
275
|
-
- id
|
|
276
|
-
- content
|
|
277
|
-
|
|
278
1
|
refs:
|
|
279
|
-
|
|
2
|
+
formContainer:
|
|
280
3
|
eventListeners:
|
|
281
4
|
keydown:
|
|
282
5
|
handler: handleKeyDown
|
|
283
|
-
action
|
|
6
|
+
action*:
|
|
284
7
|
eventListeners:
|
|
285
8
|
click:
|
|
286
9
|
handler: handleActionClick
|
|
287
|
-
|
|
10
|
+
tooltipIcon*:
|
|
288
11
|
eventListeners:
|
|
289
12
|
mouseenter:
|
|
290
13
|
handler: handleTooltipMouseEnter
|
|
291
14
|
mouseleave:
|
|
292
15
|
handler: handleTooltipMouseLeave
|
|
293
|
-
field
|
|
16
|
+
field*:
|
|
294
17
|
eventListeners:
|
|
295
|
-
input
|
|
18
|
+
value-input:
|
|
296
19
|
handler: handleInputChange
|
|
297
|
-
|
|
20
|
+
value-change:
|
|
298
21
|
handler: handleInputChange
|
|
299
|
-
|
|
300
|
-
handler: handleSelectChange
|
|
301
|
-
add-option-selected:
|
|
22
|
+
add-option-click:
|
|
302
23
|
handler: handleSelectAddOption
|
|
303
|
-
|
|
304
|
-
handler: handleColorPickerChange
|
|
305
|
-
slider-change:
|
|
306
|
-
handler: handleSliderChange
|
|
307
|
-
slider-input-value-change:
|
|
308
|
-
handler: handleSliderInputChange
|
|
309
|
-
image-*:
|
|
24
|
+
image*:
|
|
310
25
|
eventListeners:
|
|
311
26
|
click:
|
|
312
27
|
handler: handleImageClick
|
|
313
28
|
contextmenu:
|
|
314
29
|
handler: handleImageClick
|
|
315
|
-
waveform
|
|
30
|
+
waveform*:
|
|
316
31
|
eventListeners:
|
|
317
32
|
click:
|
|
318
33
|
handler: handleWaveformClick
|
|
319
34
|
contextmenu:
|
|
320
35
|
handler: handleWaveformClick
|
|
321
|
-
|
|
322
|
-
events:
|
|
323
|
-
form-change: {}
|
|
324
|
-
extra-event: {}
|
|
325
|
-
action-click: {}
|
|
326
|
-
|
|
327
36
|
template:
|
|
328
|
-
- rtgl-view#
|
|
37
|
+
- rtgl-view#formContainer w=f p=md g=lg ${containerAttrString}:
|
|
329
38
|
- rtgl-view g=sm w=f:
|
|
330
39
|
- $if title:
|
|
331
40
|
- rtgl-text s=lg: ${title}
|
|
@@ -340,41 +49,41 @@ template:
|
|
|
340
49
|
- $if field.label:
|
|
341
50
|
- rtgl-text: ${field.label}
|
|
342
51
|
- $if field.label && field.tooltip:
|
|
343
|
-
- rtgl-svg#
|
|
52
|
+
- rtgl-svg#tooltipIcon${i} data-field-name=${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs: null
|
|
344
53
|
- $if field.description:
|
|
345
54
|
- rtgl-text s=sm c=mu-fg: ${field.description}
|
|
346
55
|
- $if field.inputType == "read-only-text":
|
|
347
56
|
- rtgl-text s=sm: ${field.defaultValue}
|
|
348
|
-
- $if field.inputType == "
|
|
349
|
-
- rtgl-input#field
|
|
57
|
+
- $if field.inputType == "input-text":
|
|
58
|
+
- rtgl-input#field${i} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} data-testid=${field.testId}: null
|
|
350
59
|
- $if field.inputType == "input-number":
|
|
351
|
-
- rtgl-input-number#field
|
|
60
|
+
- rtgl-input-number#field${i} data-field-name=${field.name} w=f data-testid=${field.testId}: null
|
|
352
61
|
- $if field.inputType == "input-textarea":
|
|
353
|
-
- rtgl-textarea#field
|
|
62
|
+
- rtgl-textarea#field${i} data-field-name=${field.name} w=f rows=${field.rows} data-testid=${field.testId}: null
|
|
354
63
|
- $if field.inputType == "popover-input":
|
|
355
|
-
- rtgl-popover-input#field
|
|
64
|
+
- rtgl-popover-input#field${i} data-field-name=${field.name} label="${field.label}" data-testid=${field.testId}: null
|
|
356
65
|
- $if field.inputType == "select":
|
|
357
|
-
- rtgl-select#field
|
|
358
|
-
- $if field.inputType == "
|
|
359
|
-
- rtgl-color-picker#field
|
|
66
|
+
- rtgl-select#field${i} data-field-name=${field.name} key=${key} w=f :options=fields[${i}].options ?no-clear=fields[${i}].noClear :addOption=fields[${i}].addOption :selectedValue=#{field.selectedValue} :placeholder=#{field.placeholder} data-testid=${field.testId}: null
|
|
67
|
+
- $if field.inputType == "color-picker":
|
|
68
|
+
- rtgl-color-picker#field${i} data-field-name=${field.name} key=${key} data-testid=${field.testId}: null
|
|
360
69
|
- $if field.inputType == "slider":
|
|
361
|
-
- rtgl-slider#field
|
|
70
|
+
- rtgl-slider#field${i} data-field-name=${field.name} key=${key} w=f min=${field.min} max=${field.max} step=${field.step} data-testid=${field.testId}: null
|
|
362
71
|
- $if field.inputType == "slider-input":
|
|
363
|
-
- rtgl-slider-input#field
|
|
72
|
+
- rtgl-slider-input#field${i} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} data-testid=${field.testId}: null
|
|
364
73
|
- $if field.inputType == "image" && field.imageSrc:
|
|
365
|
-
- rtgl-image#image
|
|
74
|
+
- rtgl-image#image${i} data-field-name=${field.name} src=${field.imageSrc} w=${field.width} h=${field.height} cur=pointer data-testid=${field.testId}: null
|
|
366
75
|
- $if field.inputType == "image" && !field.imageSrc:
|
|
367
|
-
- rtgl-view#field
|
|
76
|
+
- rtgl-view#image${i} data-field-name=${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=pointer p=md data-testid=${field.testId}:
|
|
368
77
|
- rtgl-text c=mu-fg ta=c: ${field.placeholderText}
|
|
369
78
|
- $if field.inputType == "waveform" && field.waveformData:
|
|
370
|
-
- rtgl-waveform#field
|
|
79
|
+
- rtgl-waveform#waveform${i} data-field-name=${field.name} :waveformData=fields[${i}].waveformData w=${field.width} h=${field.height} cur=pointer data-testid=${field.testId}: null
|
|
371
80
|
- $if field.inputType == "waveform" && !field.waveformData:
|
|
372
|
-
- rtgl-view#field
|
|
81
|
+
- rtgl-view#waveform${i} data-field-name=${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=pointer p=md data-testid=${field.testId}:
|
|
373
82
|
- rtgl-text c=mu-fg ta=c: ${field.placeholder}
|
|
374
83
|
- $if field.inputType == "slot":
|
|
375
|
-
- 'slot#field
|
|
84
|
+
- 'slot#fieldSlot${i} data-field-name=${field.name} name=${field.slot} style="display: contents;"': null
|
|
376
85
|
- rtgl-view g=sm w=f:
|
|
377
86
|
- rtgl-view d=h ah=e g=sm w=f:
|
|
378
87
|
- $for button, i in actions.buttons:
|
|
379
|
-
- rtgl-button#action
|
|
380
|
-
- rtgl-tooltip ?open=${tooltipState.open} x=${tooltipState.x} y=${tooltipState.y}
|
|
88
|
+
- rtgl-button#action${i} data-action-id=${button.id} data-testid=${button.testId}: ${button.content}
|
|
89
|
+
- rtgl-tooltip ?open=${tooltipState.open} x=${tooltipState.x} y=${tooltipState.y} place="t" content="${tooltipState.content}": null
|
|
@@ -102,7 +102,7 @@ export const showConfirm = async (deps, payload) => {
|
|
|
102
102
|
* @param {Array<Object>} payload.items - Array of dropdown menu items (required)
|
|
103
103
|
* @param {number} payload.x - X coordinate position (required)
|
|
104
104
|
* @param {number} payload.y - Y coordinate position (required)
|
|
105
|
-
* @param {string} [payload.
|
|
105
|
+
* @param {string} [payload.place] - Dropdown menu place token (default: "bs")
|
|
106
106
|
* @returns {Promise<Object|null>} Promise that resolves with clicked item info or null if closed without selection
|
|
107
107
|
* @returns {Object} [result.index] - Index of the clicked item
|
|
108
108
|
* @returns {Object} [result.item] - The clicked item object
|
|
@@ -148,4 +148,4 @@ export const closeAll = (deps) => {
|
|
|
148
148
|
store.closeAll();
|
|
149
149
|
render();
|
|
150
150
|
}
|
|
151
|
-
};
|
|
151
|
+
};
|
|
@@ -13,11 +13,11 @@ export const createInitialState = () => Object.freeze({
|
|
|
13
13
|
items: [],
|
|
14
14
|
x: 0,
|
|
15
15
|
y: 0,
|
|
16
|
-
|
|
16
|
+
place: "bs",
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
export const setAlertConfig = (state, options) => {
|
|
20
|
+
export const setAlertConfig = ({ state }, options = {}) => {
|
|
21
21
|
if (!options.message) {
|
|
22
22
|
throw new Error("message is required for showAlert");
|
|
23
23
|
}
|
|
@@ -34,7 +34,7 @@ export const setAlertConfig = (state, options) => {
|
|
|
34
34
|
state.isOpen = true;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export const setConfirmConfig = (state, options) => {
|
|
37
|
+
export const setConfirmConfig = ({ state }, options = {}) => {
|
|
38
38
|
if (!options.message) {
|
|
39
39
|
throw new Error("message is required for showConfirm");
|
|
40
40
|
}
|
|
@@ -51,7 +51,7 @@ export const setConfirmConfig = (state, options) => {
|
|
|
51
51
|
state.isOpen = true;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
export const setDropdownConfig = (state, options) => {
|
|
54
|
+
export const setDropdownConfig = ({ state }, options = {}) => {
|
|
55
55
|
if (!options.items || !Array.isArray(options.items)) {
|
|
56
56
|
throw new Error("items array is required for showDropdown");
|
|
57
57
|
}
|
|
@@ -60,13 +60,13 @@ export const setDropdownConfig = (state, options) => {
|
|
|
60
60
|
items: options.items,
|
|
61
61
|
x: options.x || 0,
|
|
62
62
|
y: options.y || 0,
|
|
63
|
-
|
|
63
|
+
place: options.place || "bs",
|
|
64
64
|
};
|
|
65
65
|
state.uiType = "dropdown";
|
|
66
66
|
state.isOpen = true;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
export const closeAll = (state) => {
|
|
69
|
+
export const closeAll = ({ state }) => {
|
|
70
70
|
state.isOpen = false;
|
|
71
71
|
state.uiType = "dialog"; // Reset to default type
|
|
72
72
|
};
|
|
@@ -85,9 +85,9 @@ export const selectViewData = ({ state }) => {
|
|
|
85
85
|
items: state.dropdownConfig?.items || [],
|
|
86
86
|
x: state.dropdownConfig?.x || 0,
|
|
87
87
|
y: state.dropdownConfig?.y || 0,
|
|
88
|
-
|
|
88
|
+
place: state.dropdownConfig?.place || 'bs',
|
|
89
89
|
},
|
|
90
90
|
isDialogOpen: state.isOpen && state.uiType === 'dialog',
|
|
91
91
|
isDropdownOpen: state.isOpen && state.uiType === 'dropdown',
|
|
92
92
|
};
|
|
93
|
-
};
|
|
93
|
+
};
|
|
@@ -1,70 +1,33 @@
|
|
|
1
|
-
elementName: rtgl-global-ui
|
|
2
|
-
|
|
3
|
-
viewDataSchema:
|
|
4
|
-
type: object
|
|
5
|
-
properties:
|
|
6
|
-
isOpen:
|
|
7
|
-
type: boolean
|
|
8
|
-
uiType:
|
|
9
|
-
type: string
|
|
10
|
-
config:
|
|
11
|
-
type: object
|
|
12
|
-
properties:
|
|
13
|
-
status:
|
|
14
|
-
type: string
|
|
15
|
-
title:
|
|
16
|
-
type: string
|
|
17
|
-
message:
|
|
18
|
-
type: string
|
|
19
|
-
confirmText:
|
|
20
|
-
type: string
|
|
21
|
-
cancelText:
|
|
22
|
-
type: string
|
|
23
|
-
mode:
|
|
24
|
-
type: string
|
|
25
|
-
dropdownConfig:
|
|
26
|
-
type: object
|
|
27
|
-
properties:
|
|
28
|
-
items:
|
|
29
|
-
type: array
|
|
30
|
-
x:
|
|
31
|
-
type: number
|
|
32
|
-
y:
|
|
33
|
-
type: number
|
|
34
|
-
placement:
|
|
35
|
-
type: string
|
|
36
|
-
|
|
37
1
|
refs:
|
|
38
2
|
dialog:
|
|
39
3
|
eventListeners:
|
|
40
4
|
close:
|
|
41
5
|
handler: handleDialogClose
|
|
42
|
-
|
|
6
|
+
confirmButton:
|
|
43
7
|
eventListeners:
|
|
44
8
|
click:
|
|
45
9
|
handler: handleConfirm
|
|
46
|
-
|
|
10
|
+
cancelButton:
|
|
47
11
|
eventListeners:
|
|
48
12
|
click:
|
|
49
13
|
handler: handleCancel
|
|
50
|
-
|
|
14
|
+
dropdownMenu:
|
|
51
15
|
eventListeners:
|
|
52
16
|
close:
|
|
53
17
|
handler: handleDropdownClose
|
|
54
|
-
click
|
|
18
|
+
item-click:
|
|
55
19
|
handler: handleDropdownItemClick
|
|
56
|
-
|
|
57
20
|
template:
|
|
58
21
|
- rtgl-dialog#dialog ?open=${isDialogOpen} s=sm:
|
|
59
22
|
- rtgl-view slot=content g=lg p=lg:
|
|
60
23
|
- rtgl-view d=h g=md:
|
|
61
24
|
- rtgl-view d=h ah=c av=c g=md:
|
|
62
|
-
|
|
25
|
+
- rtgl-view g=md: null
|
|
63
26
|
- rtgl-view h=24 av=c:
|
|
64
|
-
- rtgl-text
|
|
27
|
+
- rtgl-text s=lg: ${config.title}
|
|
65
28
|
- rtgl-text: ${config.message}
|
|
66
29
|
- rtgl-view d=h g=md mt=lg w=f ah=e:
|
|
67
30
|
- $if config.mode == 'confirm':
|
|
68
|
-
- rtgl-button#
|
|
69
|
-
- rtgl-button#
|
|
70
|
-
- rtgl-dropdown-menu#
|
|
31
|
+
- rtgl-button#cancelButton v=se: ${config.cancelText}
|
|
32
|
+
- rtgl-button#confirmButton v=pr: ${config.confirmText}
|
|
33
|
+
- rtgl-dropdown-menu#dropdownMenu ?open=${isDropdownOpen} x=${dropdownConfig.x} y=${dropdownConfig.y} place=${dropdownConfig.place} :items=dropdownConfig.items key=dropdown-${isDropdownOpen}: null
|
|
@@ -3,7 +3,7 @@ export const handleClickStart = (deps, payload) => {
|
|
|
3
3
|
const { dispatchEvent, store } = deps;
|
|
4
4
|
const event = payload._event;
|
|
5
5
|
console.log('handle click start', store.selectPath());
|
|
6
|
-
dispatchEvent(new CustomEvent('
|
|
6
|
+
dispatchEvent(new CustomEvent('start-click', {
|
|
7
7
|
detail: {
|
|
8
8
|
path: store.selectPath(),
|
|
9
9
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
componentName: rtgl-navbar
|
|
2
|
+
propsSchema:
|
|
3
|
+
type: object
|
|
4
|
+
properties:
|
|
5
|
+
start:
|
|
6
|
+
type: object
|
|
7
|
+
properties:
|
|
8
|
+
label:
|
|
9
|
+
type: string
|
|
10
|
+
href:
|
|
11
|
+
type: string
|
|
12
|
+
image:
|
|
13
|
+
type: object
|
|
14
|
+
properties:
|
|
15
|
+
src:
|
|
16
|
+
type: string
|
|
17
|
+
events:
|
|
18
|
+
start-click:
|
|
19
|
+
type: object
|
|
20
|
+
properties:
|
|
21
|
+
path:
|
|
22
|
+
type: string
|
|
23
|
+
methods:
|
|
24
|
+
type: object
|
|
25
|
+
properties: {}
|
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
export const createInitialState = () => Object.freeze({});
|
|
2
2
|
|
|
3
|
-
const blacklistedAttrs = ['id', 'class', 'style', 'slot'];
|
|
3
|
+
const blacklistedAttrs = ['id', 'class', 'style', 'slot', 'start'];
|
|
4
4
|
|
|
5
|
-
const stringifyAttrs = (
|
|
6
|
-
return Object.entries(
|
|
5
|
+
const stringifyAttrs = (props = {}) => {
|
|
6
|
+
return Object.entries(props).filter(([key]) => !blacklistedAttrs.includes(key)).map(([key, value]) => `${key}=${value}`).join(' ');
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const parseMaybeEncodedJson = (value) => {
|
|
10
|
+
if (value === undefined || value === null) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
if (typeof value === "object") {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (typeof value !== "string") {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(decodeURIComponent(value));
|
|
21
|
+
} catch {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(value);
|
|
24
|
+
} catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
14
29
|
|
|
15
|
-
|
|
30
|
+
export const selectViewData = ({ props }) => {
|
|
31
|
+
const attrsStart = parseMaybeEncodedJson(props.start) || props.start;
|
|
16
32
|
|
|
17
|
-
const containerAttrString = stringifyAttrs(
|
|
33
|
+
const containerAttrString = stringifyAttrs(props);
|
|
18
34
|
const start = attrsStart || {
|
|
19
35
|
label: '',
|
|
20
36
|
// href: undefined,
|
|
@@ -35,12 +51,10 @@ export const selectViewData = ({ state, props, attrs }) => {
|
|
|
35
51
|
}
|
|
36
52
|
|
|
37
53
|
export const selectPath = ({ props }) => {
|
|
38
|
-
return props.start
|
|
54
|
+
return props.start?.path;
|
|
39
55
|
}
|
|
40
56
|
|
|
41
|
-
export const setState = (state) => {
|
|
57
|
+
export const setState = ({ state }) => {
|
|
42
58
|
// do doSomething
|
|
43
59
|
}
|
|
44
60
|
|
|
45
|
-
|
|
46
|
-
|