@rettangoli/ui 0.1.21 → 0.1.23
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/dist/rettangoli-iife-layout.min.js +178 -47
- package/dist/rettangoli-iife-ui.min.js +1 -1
- package/package.json +1 -1
- package/src/components/form/form.handlers.js +0 -21
- package/src/components/form/form.store.js +6 -0
- package/src/components/form/form.view.yaml +10 -7
- package/src/components/select/select.store.js +1 -1
- package/src/components/select/select.view.yaml +2 -0
- package/src/entry-iife-layout.js +6 -0
- package/src/index.js +4 -0
package/package.json
CHANGED
|
@@ -26,27 +26,6 @@ const updateAttributes = ({ form, defaultValues = {}, refs }) => {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
if (field.inputType === 'select' && field.placeholder) {
|
|
30
|
-
if (ref.placeholder !== field.placeholder) {
|
|
31
|
-
ref.placeholder = field.placeholder;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (field.inputType === 'select') {
|
|
35
|
-
if (field.placeholder !== ref.getAttribute('placeholder')) {
|
|
36
|
-
if (field.placeholder !== undefined) {
|
|
37
|
-
ref.setAttribute('placeholder', field.placeholder)
|
|
38
|
-
} else {
|
|
39
|
-
ref.removeAttribute('placeholder');
|
|
40
|
-
}
|
|
41
|
-
ref.render();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const defaultValue = defaultValues[field.name]
|
|
45
|
-
if (defaultValue !== ref.selectedValue) {
|
|
46
|
-
ref.selectedValue = defaultValue;
|
|
47
|
-
ref.render();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
29
|
})
|
|
51
30
|
}
|
|
52
31
|
|
|
@@ -113,6 +113,12 @@ export const selectViewData = ({ state, props, attrs }) => {
|
|
|
113
113
|
if (["read-only-text"].includes(field.inputType)) {
|
|
114
114
|
field.defaultValue = defaultValue
|
|
115
115
|
}
|
|
116
|
+
if (["select"].includes(field.inputType)) {
|
|
117
|
+
const defaultValues = props?.defaultValues;
|
|
118
|
+
if (defaultValues && defaultValues[field.name] !== undefined) {
|
|
119
|
+
field.selectedValue = defaultValues[field.name];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
116
122
|
if (field.inputType === "image") {
|
|
117
123
|
const src = field.src;
|
|
118
124
|
// Only set imageSrc if src exists and is not empty
|
|
@@ -310,12 +310,15 @@ template:
|
|
|
310
310
|
- rtgl-view g=lg w=f:
|
|
311
311
|
- $for field, i in fields:
|
|
312
312
|
- rtgl-view g=md w=f:
|
|
313
|
-
-
|
|
314
|
-
- rtgl-view
|
|
315
|
-
- rtgl-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
313
|
+
- $if field.label || field.description:
|
|
314
|
+
- rtgl-view g=sm:
|
|
315
|
+
- rtgl-view d=h g=md av=c:
|
|
316
|
+
- $if field.label:
|
|
317
|
+
- rtgl-text: ${field.label}
|
|
318
|
+
- $if field.label && field.tooltip:
|
|
319
|
+
- rtgl-svg#tooltip-icon-${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs:
|
|
320
|
+
- $if field.description:
|
|
321
|
+
- rtgl-text s=sm c=mu-fg: ${field.description}
|
|
319
322
|
- $if field.inputType == "read-only-text":
|
|
320
323
|
- rtgl-text s=sm: ${field.defaultValue}
|
|
321
324
|
- $if field.inputType == "inputText" || field.inputType == 'input-text':
|
|
@@ -327,7 +330,7 @@ template:
|
|
|
327
330
|
- $if field.inputType == "popover-input":
|
|
328
331
|
- rtgl-popover-input#field-${field.name} label="${field.label}":
|
|
329
332
|
- $if field.inputType == "select":
|
|
330
|
-
- rtgl-select#field-${field.name} key=${key} w=f .options=fields[${i}].options ?no-clear=fields[${i}].noClear .addOption=fields[${i}].addOption:
|
|
333
|
+
- rtgl-select#field-${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}:
|
|
331
334
|
- $if field.inputType == "colorPicker":
|
|
332
335
|
- rtgl-color-picker#field-${field.name} key=${key}:
|
|
333
336
|
- $if field.inputType == "slider":
|
|
@@ -42,7 +42,7 @@ export const selectViewData = ({ state, props, attrs }) => {
|
|
|
42
42
|
const currentValue = state.selectedValue !== null ? state.selectedValue : props.selectedValue;
|
|
43
43
|
|
|
44
44
|
// Calculate display label from value
|
|
45
|
-
let displayLabel = attrs.placeholder || 'Select an option';
|
|
45
|
+
let displayLabel = props.placeholder || attrs.placeholder || 'Select an option';
|
|
46
46
|
let isPlaceholderLabel = true;
|
|
47
47
|
|
|
48
48
|
const options = props.options || [];
|
package/src/entry-iife-layout.js
CHANGED
|
@@ -6,7 +6,10 @@ import RettangoliSvg from './primitives/svg.js';
|
|
|
6
6
|
import RettangoliInput from './primitives/input.js';
|
|
7
7
|
import RettangoliInputNumber from './primitives/input-number.js';
|
|
8
8
|
import RettangoliTextArea from './primitives/textarea.js';
|
|
9
|
+
import RettangoliColorPicker from './primitives/colorPicker.js';
|
|
10
|
+
import RettangoliSlider from './primitives/slider.js';
|
|
9
11
|
import RettangoliDialog from './primitives/dialog.js';
|
|
12
|
+
import RettangoliPopover from './primitives/popover.js';
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
customElements.define("rtgl-button", RettangoliButton({}));
|
|
@@ -17,4 +20,7 @@ customElements.define("rtgl-svg", RettangoliSvg({}));
|
|
|
17
20
|
customElements.define("rtgl-input", RettangoliInput({}));
|
|
18
21
|
customElements.define("rtgl-input-number", RettangoliInputNumber({}));
|
|
19
22
|
customElements.define("rtgl-textarea", RettangoliTextArea({}));
|
|
23
|
+
customElements.define("rtgl-color-picker", RettangoliColorPicker({}));
|
|
24
|
+
customElements.define("rtgl-slider", RettangoliSlider({}));
|
|
20
25
|
customElements.define("rtgl-dialog", RettangoliDialog({}));
|
|
26
|
+
customElements.define("rtgl-popover", RettangoliPopover({}));
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,8 @@ import RettangoliInputNumber from './primitives/input-number.js';
|
|
|
8
8
|
import RettangoliTextArea from './primitives/textarea.js';
|
|
9
9
|
import RettangoliDialog from './primitives/dialog.js';
|
|
10
10
|
import RettangoliPopover from './primitives/popover.js';
|
|
11
|
+
import RettangoliColorPicker from './primitives/colorPicker.js';
|
|
12
|
+
import RettangoliSlider from './primitives/slider.js';
|
|
11
13
|
import createGlobalUI from './deps/createGlobalUI.js';
|
|
12
14
|
|
|
13
15
|
export {
|
|
@@ -21,5 +23,7 @@ export {
|
|
|
21
23
|
RettangoliTextArea,
|
|
22
24
|
RettangoliDialog,
|
|
23
25
|
RettangoliPopover,
|
|
26
|
+
RettangoliColorPicker,
|
|
27
|
+
RettangoliSlider,
|
|
24
28
|
createGlobalUI,
|
|
25
29
|
}
|