not-bulma 2.0.14 → 2.0.15
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
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { run } from
|
|
2
|
+
import { run } from "svelte/legacy";
|
|
3
3
|
|
|
4
4
|
import UIButton from "./ui.button.svelte";
|
|
5
|
-
import { createEventDispatcher } from "svelte";
|
|
6
|
-
|
|
7
|
-
const dispatch = createEventDispatcher();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
5
|
|
|
13
6
|
/**
|
|
14
7
|
* @typedef {Object} Props
|
|
@@ -44,7 +37,7 @@
|
|
|
44
37
|
inverted = false,
|
|
45
38
|
rounded = false,
|
|
46
39
|
disabled = false,
|
|
47
|
-
state = "",
|
|
40
|
+
state: notState = "",
|
|
48
41
|
type = "",
|
|
49
42
|
color = "",
|
|
50
43
|
size = "",
|
|
@@ -52,30 +45,32 @@
|
|
|
52
45
|
icon = false,
|
|
53
46
|
iconSide = "right",
|
|
54
47
|
uiOff = () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
return {
|
|
49
|
+
color: "",
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
onchange = () => {},
|
|
53
|
+
onclick = () => {},
|
|
59
54
|
uiOn = () => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
return {
|
|
56
|
+
color: "success",
|
|
57
|
+
};
|
|
58
|
+
},
|
|
64
59
|
action = () => {
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
return !selected;
|
|
61
|
+
},
|
|
67
62
|
value,
|
|
68
|
-
selected = $bindable(false)
|
|
63
|
+
selected = $bindable(false),
|
|
69
64
|
} = $props();
|
|
70
65
|
|
|
71
66
|
function onClick(event) {
|
|
72
67
|
selected = action(event, value, selected);
|
|
73
|
-
|
|
68
|
+
onclick({ value, selected });
|
|
74
69
|
onChange();
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
function onChange() {
|
|
78
|
-
|
|
73
|
+
onchange({
|
|
79
74
|
value,
|
|
80
75
|
selected,
|
|
81
76
|
});
|
|
@@ -100,7 +95,7 @@
|
|
|
100
95
|
{inverted}
|
|
101
96
|
{rounded}
|
|
102
97
|
{disabled}
|
|
103
|
-
{
|
|
98
|
+
state={notState}
|
|
104
99
|
{type}
|
|
105
100
|
{color}
|
|
106
101
|
{size}
|
|
@@ -108,5 +103,5 @@
|
|
|
108
103
|
{icon}
|
|
109
104
|
{iconSide}
|
|
110
105
|
{value}
|
|
111
|
-
|
|
106
|
+
onclick={onClick}
|
|
112
107
|
></UIButton>
|
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
classes = "",
|
|
15
15
|
left = [],
|
|
16
16
|
center = [],
|
|
17
|
-
right = []
|
|
17
|
+
right = [],
|
|
18
|
+
disabled = false,
|
|
18
19
|
} = $props();
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
22
|
<div class="columns {classes}">
|
|
22
23
|
<div class="column">
|
|
23
|
-
<UIButtons values={left}></UIButtons>
|
|
24
|
+
<UIButtons values={left} {disabled}></UIButtons>
|
|
24
25
|
</div>
|
|
25
26
|
<div class="column">
|
|
26
|
-
<UIButtons values={center} centered={true}></UIButtons>
|
|
27
|
+
<UIButtons values={center} centered={true} {disabled}></UIButtons>
|
|
27
28
|
</div>
|
|
28
29
|
<div class="column">
|
|
29
|
-
<UIButtons values={right} right={true}></UIButtons>
|
|
30
|
+
<UIButtons values={right} right={true} {disabled}></UIButtons>
|
|
30
31
|
</div>
|
|
31
32
|
</div>
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
let {
|
|
18
18
|
values = [],
|
|
19
19
|
centered = false,
|
|
20
|
+
disabled = false,
|
|
20
21
|
right = false,
|
|
21
22
|
classes = "",
|
|
22
23
|
buttonComponent = UIButton,
|
|
@@ -41,6 +42,9 @@
|
|
|
41
42
|
{@const SvelteComponent = buttonComponent}
|
|
42
43
|
<SvelteComponent
|
|
43
44
|
{...item}
|
|
45
|
+
disabled={Object.hasOwn(item, "disabled")
|
|
46
|
+
? item.disabled
|
|
47
|
+
: disabled}
|
|
44
48
|
bind:value={item.value}
|
|
45
49
|
action={item.action ? item.action : action}
|
|
46
50
|
{onclick}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const dispatch = createEventDispatcher();
|
|
4
4
|
import UIButtonSwitch from "./ui.button.switch.svelte";
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
const selectHistory = [];
|
|
8
7
|
|
|
9
8
|
export function selectAll() {
|
|
@@ -84,7 +83,6 @@
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
|
|
88
86
|
/**
|
|
89
87
|
* @typedef {Object} Props
|
|
90
88
|
* @property {any} [values]
|
|
@@ -105,29 +103,31 @@
|
|
|
105
103
|
classes = "",
|
|
106
104
|
buttonComponent = UIButtonSwitch,
|
|
107
105
|
action = (ev, value, selected) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
let newSelected = !selected;
|
|
107
|
+
const indexOfCurrent = values.indexOf((itm) => itm.value === value);
|
|
108
|
+
const cnt = countSelected() + (newSelected ? 1 : -1);
|
|
111
109
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
if (min) {
|
|
111
|
+
if (cnt < min) {
|
|
112
|
+
selectUpToMin(cnt, indexOfCurrent);
|
|
113
|
+
values = values;
|
|
114
|
+
}
|
|
116
115
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
if (max) {
|
|
117
|
+
if (max < cnt) {
|
|
118
|
+
deselectDownToMin(cnt, indexOfCurrent);
|
|
119
|
+
values = values;
|
|
120
|
+
}
|
|
122
121
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
122
|
+
if (newSelected) {
|
|
123
|
+
addToHistory(indexOfCurrent);
|
|
124
|
+
}
|
|
125
|
+
return newSelected;
|
|
126
|
+
},
|
|
129
127
|
min = 0,
|
|
130
|
-
max = 100
|
|
128
|
+
max = 100,
|
|
129
|
+
onclick = () => {},
|
|
130
|
+
onchange = () => {},
|
|
131
131
|
} = $props();
|
|
132
132
|
</script>
|
|
133
133
|
|
|
@@ -143,8 +143,8 @@
|
|
|
143
143
|
bind:value={item.value}
|
|
144
144
|
bind:selected={item.selected}
|
|
145
145
|
action={item.action ? item.action : action}
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
{onclick}
|
|
147
|
+
{onchange}
|
|
148
148
|
/>
|
|
149
149
|
{/each}
|
|
150
150
|
</div>
|