not-bulma 1.0.87 → 1.0.89
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
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import ErrorsList from "../various/ui.errors.list.svelte";
|
|
3
|
+
import { createEventDispatcher } from "svelte";
|
|
4
|
+
let dispatch = createEventDispatcher();
|
|
5
|
+
|
|
6
|
+
import { UIColumns, UIColumn } from "../layout";
|
|
7
|
+
import { UIButton } from "../button";
|
|
8
|
+
import UINumber from "../form/ui.number.svelte";
|
|
9
|
+
import UITextfield from "../form/ui.textfield.svelte";
|
|
10
|
+
import { UITitle } from "../various";
|
|
11
|
+
|
|
12
|
+
export let fieldname = "numbers_list";
|
|
13
|
+
export let value = {};
|
|
14
|
+
export let label = "named numbers list";
|
|
15
|
+
|
|
16
|
+
export let inputStarted = false;
|
|
17
|
+
export let placeholder = "new item";
|
|
18
|
+
export let readonly = false;
|
|
19
|
+
export let valid = true;
|
|
20
|
+
export let validated = false;
|
|
21
|
+
export let errors = false;
|
|
22
|
+
export let formErrors = false;
|
|
23
|
+
|
|
24
|
+
$: list = Object.keys(value).map((name) => {
|
|
25
|
+
return {
|
|
26
|
+
id: name,
|
|
27
|
+
title: name,
|
|
28
|
+
number: value[name],
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
$: allErrors = [].concat(
|
|
33
|
+
errors ? errors : [],
|
|
34
|
+
formErrors ? formErrors : []
|
|
35
|
+
);
|
|
36
|
+
$: showErrors = !(validated && valid) && inputStarted;
|
|
37
|
+
$: validationClasses =
|
|
38
|
+
valid === true || !inputStarted
|
|
39
|
+
? UICommon.CLASS_OK
|
|
40
|
+
: UICommon.CLASS_ERR;
|
|
41
|
+
|
|
42
|
+
function remove(id) {
|
|
43
|
+
if (Object.hasOwn(value, id)) {
|
|
44
|
+
delete value[id];
|
|
45
|
+
value = value;
|
|
46
|
+
dispatch('change', {value: field: fieldname});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function add() {
|
|
51
|
+
const id = newVal.id.trim();
|
|
52
|
+
const number = parseInt(newVal.number);
|
|
53
|
+
if (id && id !== "" && !isNaN(number) && !Object.hasOwn(value, id)) {
|
|
54
|
+
value[id] = number;
|
|
55
|
+
}
|
|
56
|
+
dispatch('change', {value: field: fieldname});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const createNewVal = () => {
|
|
60
|
+
return {
|
|
61
|
+
id: placeholder,
|
|
62
|
+
number: 0,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
let newVal = createNewVal();
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<UITitle title={label} size={5} />
|
|
70
|
+
{#each list as item (item.id)}
|
|
71
|
+
<UIColumns>
|
|
72
|
+
<UIColumn classes="is-6">
|
|
73
|
+
{item.title}
|
|
74
|
+
</UIColumn>
|
|
75
|
+
<UIColumn classes="is-4">
|
|
76
|
+
{item.number}
|
|
77
|
+
</UIColumn>
|
|
78
|
+
{#if !readonly}
|
|
79
|
+
<UIColumn classes="is-2">
|
|
80
|
+
<UIButton icon={"minus"} action={() => remove(item.id)} />
|
|
81
|
+
</UIColumn>
|
|
82
|
+
{/if}
|
|
83
|
+
</UIColumns>
|
|
84
|
+
{/each}
|
|
85
|
+
{#if !readonly}
|
|
86
|
+
<UIColumns>
|
|
87
|
+
<UIColumn classes="is-6">
|
|
88
|
+
<UITextfield bind:value={newVal.id} />
|
|
89
|
+
</UIColumn>
|
|
90
|
+
<UIColumn classes="is-4">
|
|
91
|
+
<UINumber bind:value={newVal.number} />
|
|
92
|
+
</UIColumn>
|
|
93
|
+
<UIColumn classes="is-2">
|
|
94
|
+
<UIButton icon={"plus"} action={() => add()} />
|
|
95
|
+
</UIColumn>
|
|
96
|
+
</UIColumns>
|
|
97
|
+
{/if}
|
|
98
|
+
<ErrorsList
|
|
99
|
+
bind:errors={allErrors}
|
|
100
|
+
bind:show={showErrors}
|
|
101
|
+
bind:classes={validationClasses}
|
|
102
|
+
id="input-field-helper-{fieldname}"
|
|
103
|
+
/>
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
UIEndlessList,
|
|
5
5
|
} from "./endless";
|
|
6
6
|
|
|
7
|
+
import FUINamedNumbersList from "./field.ui.named.numbers.list.svelte";
|
|
8
|
+
|
|
7
9
|
import UIList from "./ui.list.svelte";
|
|
8
10
|
import UIListItem from "./ui.list.item.svelte";
|
|
9
11
|
import UIListEmptyPlaceholder from "./ui.list.empty.placeholder.svelte";
|
|
@@ -20,4 +22,5 @@ export {
|
|
|
20
22
|
UIListItem,
|
|
21
23
|
UIListEmptyPlaceholder,
|
|
22
24
|
UIListSelect,
|
|
25
|
+
FUINamedNumbersList,
|
|
23
26
|
};
|
|
@@ -163,6 +163,7 @@ class notForm extends notBase {
|
|
|
163
163
|
this.on(`change.${master}`, (value) => {
|
|
164
164
|
this.#execSlaveRule(rule, master, slaves, value);
|
|
165
165
|
});
|
|
166
|
+
this.emit(`change.${master}`, this.getFormData()[master]);
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
#execSlaveRule(rule, master, slaves, value) {
|
package/src/frame/index.js
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
UIForm,
|
|
37
37
|
notForm,
|
|
38
38
|
notFormSet,
|
|
39
|
+
notFormRules,
|
|
39
40
|
notFormUtils,
|
|
40
41
|
notFormHelpers,
|
|
41
42
|
notBreadcrumbs,
|
|
@@ -69,6 +70,7 @@ export {
|
|
|
69
70
|
notFormSet,
|
|
70
71
|
notFormUtils,
|
|
71
72
|
notFormHelpers,
|
|
73
|
+
notFormRules,
|
|
72
74
|
notInterface,
|
|
73
75
|
notPath,
|
|
74
76
|
notRecord,
|