not-bulma 1.0.48 → 1.0.49
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/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
export let inputStarted = false;
|
|
11
11
|
export let value = false;
|
|
12
12
|
export let label = "";
|
|
13
|
+
export let hideLabel = false;
|
|
13
14
|
export let placeholder = "input some text here, please";
|
|
14
15
|
export let fieldname = "textfield";
|
|
15
16
|
export let icon = false;
|
|
@@ -90,10 +91,12 @@
|
|
|
90
91
|
aria-describedby="input-field-helper-{fieldname}"
|
|
91
92
|
/>
|
|
92
93
|
<label class="label" for="form-field-switch-{fieldname}">
|
|
93
|
-
{#if
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
{#if !hideLabel}
|
|
95
|
+
{#if label}
|
|
96
|
+
{$LOCALE[label]}
|
|
97
|
+
{:else}
|
|
98
|
+
<UIBooleans values={[{ value: true }]} />
|
|
99
|
+
{/if}
|
|
97
100
|
{/if}
|
|
98
101
|
</label>
|
|
99
102
|
{/if}
|
|
@@ -1,90 +1,99 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import UILabel from "../../../elements/form/ui.label.svelte";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
COMPONENTS
|
|
6
|
-
} from '../../LIB.js';
|
|
4
|
+
import { COMPONENTS } from "../../LIB.js";
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
createEventDispatcher
|
|
10
|
-
onMount
|
|
11
|
-
} from 'svelte';
|
|
12
|
-
let dispatch = createEventDispatcher();
|
|
6
|
+
import { createEventDispatcher, onMount } from "svelte";
|
|
7
|
+
let dispatch = createEventDispatcher();
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
export let label = "";
|
|
10
|
+
export let name = "generic field";
|
|
11
|
+
export let readonly = false;
|
|
12
|
+
export let horizontal = false;
|
|
13
|
+
export let controls = [];
|
|
14
|
+
//field style modification
|
|
15
|
+
export let classes = "";
|
|
16
|
+
////addons
|
|
17
|
+
export let addons = false;
|
|
18
|
+
export let addonsCentered = false;
|
|
19
|
+
export let addonsRight = false;
|
|
20
|
+
////gorup
|
|
21
|
+
export let grouped = false;
|
|
22
|
+
export let groupedMultiline = false;
|
|
23
|
+
export let groupedRight = false;
|
|
24
|
+
export let groupedCentered = false;
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
let fieldClasses = "";
|
|
27
|
+
let hidden = false;
|
|
28
|
+
let fieldId;
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
onMount(() => {
|
|
31
|
+
fieldClasses += " " + classes;
|
|
32
|
+
fieldClasses += addons ? " has-addons " : "";
|
|
33
|
+
fieldClasses += addonsCentered ? " has-addons-centered " : "";
|
|
34
|
+
fieldClasses += addonsRight ? " has-addons-right " : "";
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
fieldClasses += grouped ? " is-grouped " : "";
|
|
37
|
+
fieldClasses += groupedMultiline ? " is-grouped-multiline " : "";
|
|
38
|
+
fieldClasses += groupedRight ? " is-grouped-right " : "";
|
|
39
|
+
fieldClasses += groupedCentered ? " is-grouped-centered " : "";
|
|
40
|
+
if (readonly) {
|
|
41
|
+
controls.forEach((control) => {
|
|
42
|
+
control.readonly = true;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
let notHidden = controls.filter(
|
|
46
|
+
(control) => control.component !== "UIHidden"
|
|
47
|
+
);
|
|
48
|
+
hidden = notHidden.length === 0;
|
|
49
|
+
let tmp = controls.map((itm) => itm.component).join("_");
|
|
50
|
+
fieldId = `form-field-${tmp}-${name}`;
|
|
51
|
+
});
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
function onControlChange(ev) {
|
|
54
|
+
let data = ev.detail;
|
|
55
|
+
dispatch("change", data);
|
|
56
|
+
}
|
|
60
57
|
</script>
|
|
61
58
|
|
|
62
|
-
{#if hidden
|
|
63
|
-
|
|
64
|
-
{#each controls as control}
|
|
65
|
-
<svelte:component this={COMPONENTS.get(control.component)} {...control} on:change={onControlChange} fieldname={name} />
|
|
66
|
-
{/each}
|
|
67
|
-
|
|
68
|
-
{:else }
|
|
69
|
-
|
|
70
|
-
{#if horizontal}
|
|
71
|
-
<div class="field is-horizontal {fieldClasses} {fieldId}">
|
|
72
|
-
<div class="field-label is-normal">
|
|
73
|
-
<UILabel id={fieldId} label={label || controls[0].label} />
|
|
74
|
-
</div>
|
|
75
|
-
<div class="field-body" id={fieldId}>
|
|
59
|
+
{#if hidden}
|
|
76
60
|
{#each controls as control}
|
|
77
|
-
|
|
61
|
+
<svelte:component
|
|
62
|
+
this={COMPONENTS.get(control.component)}
|
|
63
|
+
{...control}
|
|
64
|
+
on:change={onControlChange}
|
|
65
|
+
fieldname={name}
|
|
66
|
+
/>
|
|
78
67
|
{/each}
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
{:else if horizontal}
|
|
69
|
+
<div class="field is-horizontal {fieldClasses} {fieldId}">
|
|
70
|
+
<div class="field-label is-normal">
|
|
71
|
+
<UILabel id={fieldId} label={label || controls[0].label} />
|
|
72
|
+
</div>
|
|
73
|
+
<div class="field-body" id={fieldId}>
|
|
74
|
+
{#each controls as control}
|
|
75
|
+
<svelte:component
|
|
76
|
+
this={COMPONENTS.get(control.component)}
|
|
77
|
+
{...control}
|
|
78
|
+
on:change={onControlChange}
|
|
79
|
+
fieldname={name}
|
|
80
|
+
/>
|
|
81
|
+
{/each}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
81
84
|
{:else}
|
|
82
|
-
<div class="field {fieldClasses} {fieldId}">
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
<div class="field {fieldClasses} {fieldId}">
|
|
86
|
+
{#each controls as control}
|
|
87
|
+
<UILabel
|
|
88
|
+
id="form-field-{control.component}-{name}"
|
|
89
|
+
label={control.label}
|
|
90
|
+
/>
|
|
91
|
+
<svelte:component
|
|
92
|
+
this={COMPONENTS.get(control.component)}
|
|
93
|
+
{...control}
|
|
94
|
+
on:change={onControlChange}
|
|
95
|
+
fieldname={name}
|
|
96
|
+
/>
|
|
97
|
+
{/each}
|
|
98
|
+
</div>
|
|
90
99
|
{/if}
|