not-bulma 2.0.8 → 2.0.10
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 +1 -1
- package/src/elements/button/ui.button.svelte +61 -70
- package/src/elements/form/ui.named.numbers.list.svelte +17 -10
- package/src/elements/form/ui.select.svelte +3 -2
- package/src/elements/image/ui.image.svelte +16 -15
- package/src/elements/image/ui.images.svelte +3 -3
- package/src/elements/navigation/item/primitives/ui.navbar.item.wrapper.svelte +1 -4
- package/src/elements/various/ui.loader.svelte +6 -3
- package/src/frame/components/action/action.ui.js +39 -7
- package/src/frame/components/action/ui.action.container.svelte +52 -94
- package/src/frame/components/form/form.svelte +6 -6
- package/src/frame/components/form/form.svelte.js +6 -7
- package/src/frame/components/table/notTable.svelte +107 -87
- package/src/frame/components/table/notTable.svelte.js +1 -1
- package/src/frame/crud/actions/list.js +6 -3
- package/src/frame/ui.adapter.svelte.js +20 -1
- package/src/scss/_navbar.scss +1 -0
package/package.json
CHANGED
|
@@ -1,59 +1,56 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { createEventDispatcher } from "svelte";
|
|
3
|
-
const dispatch = createEventDispatcher();
|
|
4
2
|
import { LOCALE } from "../../locale";
|
|
5
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Props
|
|
6
|
+
* @property {string} [title]
|
|
7
|
+
* @property {boolean} [light]
|
|
8
|
+
* @property {boolean} [loading]
|
|
9
|
+
* @property {boolean} [raised]
|
|
10
|
+
* @property {boolean} [outlined]
|
|
11
|
+
* @property {boolean} [inverted]
|
|
12
|
+
* @property {boolean} [rounded]
|
|
13
|
+
* @property {boolean} [disabled]
|
|
14
|
+
* @property {string} [state]
|
|
15
|
+
* @property {string} [type]
|
|
16
|
+
* @property {string} [color]
|
|
17
|
+
* @property {string} [size]
|
|
18
|
+
* @property {string} [classes]
|
|
19
|
+
* @property {boolean} [icon]
|
|
20
|
+
* @property {string} [iconSide]
|
|
21
|
+
* @property {any} [action]
|
|
22
|
+
* @property {any} value
|
|
23
|
+
* @property {import('svelte').Snippet} [children]
|
|
24
|
+
*/
|
|
6
25
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let {
|
|
32
|
-
title = "",
|
|
33
|
-
light = false,
|
|
34
|
-
loading = false,
|
|
35
|
-
raised = false,
|
|
36
|
-
outlined = false,
|
|
37
|
-
inverted = false,
|
|
38
|
-
rounded = false,
|
|
39
|
-
disabled = false,
|
|
40
|
-
state = "",
|
|
41
|
-
type = "",
|
|
42
|
-
color = "",
|
|
43
|
-
size = "",
|
|
44
|
-
classes = "",
|
|
45
|
-
icon = false,
|
|
46
|
-
iconSide = "right",
|
|
47
|
-
action = () => {
|
|
48
|
-
return true;
|
|
49
|
-
},
|
|
50
|
-
value,
|
|
51
|
-
children
|
|
52
|
-
} = $props();
|
|
26
|
+
/** @type {Props} */
|
|
27
|
+
let {
|
|
28
|
+
title = "",
|
|
29
|
+
light = false,
|
|
30
|
+
loading = false,
|
|
31
|
+
raised = false,
|
|
32
|
+
outlined = false,
|
|
33
|
+
inverted = false,
|
|
34
|
+
rounded = false,
|
|
35
|
+
disabled = false,
|
|
36
|
+
state = "",
|
|
37
|
+
type = "",
|
|
38
|
+
color = "",
|
|
39
|
+
size = "",
|
|
40
|
+
classes = "",
|
|
41
|
+
icon = false,
|
|
42
|
+
iconSide = "right",
|
|
43
|
+
action = () => {
|
|
44
|
+
return true;
|
|
45
|
+
},
|
|
46
|
+
value,
|
|
47
|
+
children,
|
|
48
|
+
onclick = () => {},
|
|
49
|
+
} = $props();
|
|
53
50
|
|
|
54
51
|
function onClick(event) {
|
|
55
52
|
event.stopPropagation();
|
|
56
|
-
|
|
53
|
+
onclick({ event, value });
|
|
57
54
|
return action(event, value);
|
|
58
55
|
}
|
|
59
56
|
</script>
|
|
@@ -76,27 +73,21 @@
|
|
|
76
73
|
{size ? `is-${size}` : ''}
|
|
77
74
|
"
|
|
78
75
|
>
|
|
79
|
-
{#if children}{@render children()}{:else}
|
|
80
|
-
{#if
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<span class="icon"
|
|
93
|
-
><i
|
|
94
|
-
class="fas fa-{icon} {size ? `is-${size}` : ''}"
|
|
95
|
-
></i></span
|
|
96
|
-
>
|
|
97
|
-
{/if}
|
|
98
|
-
{:else}
|
|
99
|
-
{$LOCALE[title]}
|
|
76
|
+
{#if children}{@render children()}{:else if icon}
|
|
77
|
+
{#if iconSide === "left"}
|
|
78
|
+
<span class="icon"
|
|
79
|
+
><i class="fas fa-{icon} {size ? `is-${size}` : ''}"></i></span
|
|
80
|
+
>
|
|
81
|
+
{/if}
|
|
82
|
+
{#if title}
|
|
83
|
+
<span>{$LOCALE[title]}</span>
|
|
84
|
+
{/if}
|
|
85
|
+
{#if iconSide === "right"}
|
|
86
|
+
<span class="icon"
|
|
87
|
+
><i class="fas fa-{icon} {size ? `is-${size}` : ''}"></i></span
|
|
88
|
+
>
|
|
100
89
|
{/if}
|
|
90
|
+
{:else}
|
|
91
|
+
{$LOCALE[title]}
|
|
101
92
|
{/if}
|
|
102
93
|
</button>
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
/** @type {Props} */
|
|
29
29
|
let {
|
|
30
30
|
fieldname = "numbers_list",
|
|
31
|
-
value =
|
|
31
|
+
value = {},
|
|
32
32
|
label = "named numbers list",
|
|
33
33
|
inputStarted = false,
|
|
34
|
-
placeholder =
|
|
34
|
+
placeholder = "new item",
|
|
35
35
|
readonly = false,
|
|
36
36
|
valid = true,
|
|
37
37
|
validated = false,
|
|
@@ -40,15 +40,19 @@
|
|
|
40
40
|
onchange = () => {},
|
|
41
41
|
} = $props();
|
|
42
42
|
|
|
43
|
-
let list = $
|
|
44
|
-
|
|
43
|
+
let list = $state([]);
|
|
44
|
+
|
|
45
|
+
function updateList() {
|
|
46
|
+
list = Object.keys(value).map((name) => {
|
|
45
47
|
return {
|
|
46
48
|
id: name,
|
|
47
49
|
title: name,
|
|
48
50
|
number: value[name],
|
|
49
51
|
};
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
updateList();
|
|
52
56
|
|
|
53
57
|
let allErrors;
|
|
54
58
|
run(() => {
|
|
@@ -73,8 +77,9 @@
|
|
|
73
77
|
if (notCommon.objHas(value, id)) {
|
|
74
78
|
delete value[id];
|
|
75
79
|
value = value;
|
|
76
|
-
onchange({ value, field: fieldname });
|
|
80
|
+
onchange({ value: $state.snapshot(value), field: fieldname });
|
|
77
81
|
}
|
|
82
|
+
updateList();
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
function add() {
|
|
@@ -83,7 +88,9 @@
|
|
|
83
88
|
if (id && id !== "" && !isNaN(number) && !notCommon.objHas(value, id)) {
|
|
84
89
|
value[id] = number;
|
|
85
90
|
}
|
|
86
|
-
|
|
91
|
+
value = value;
|
|
92
|
+
onchange({ value: $state.snapshot(value), field: fieldname });
|
|
93
|
+
updateList();
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
const createNewVal = () => {
|
|
@@ -97,7 +104,7 @@
|
|
|
97
104
|
</script>
|
|
98
105
|
|
|
99
106
|
<UITitle title={label} size={5} />
|
|
100
|
-
{#each list as item (item.id)}
|
|
107
|
+
{#each list as item, index (item.id)}
|
|
101
108
|
<UIColumns>
|
|
102
109
|
<UIColumn classes="is-6">
|
|
103
110
|
{item.title}
|
|
@@ -115,7 +122,7 @@
|
|
|
115
122
|
{#if !readonly}
|
|
116
123
|
<UIColumns>
|
|
117
124
|
<UIColumn classes="is-6">
|
|
118
|
-
<UITextfield bind:value={newVal.id}
|
|
125
|
+
<UITextfield bind:value={newVal.id} {placeholder} />
|
|
119
126
|
</UIColumn>
|
|
120
127
|
<UIColumn classes="is-4">
|
|
121
128
|
<UINumber bind:value={newVal.number} />
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
|
|
30
30
|
/** @type {Props} */
|
|
31
31
|
let {
|
|
32
|
-
inputStarted =
|
|
33
|
-
value =
|
|
32
|
+
inputStarted = false,
|
|
33
|
+
value = "",
|
|
34
34
|
variants = [],
|
|
35
35
|
placeholder = "",
|
|
36
36
|
emptyValueTitle = "",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
formErrors = false,
|
|
47
47
|
formLevelError = false,
|
|
48
48
|
onchange = () => {},
|
|
49
|
+
class: classes = "",
|
|
49
50
|
} = $props();
|
|
50
51
|
|
|
51
52
|
let selectedVariants = $state([]);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { createBubbler } from 'svelte/legacy';
|
|
3
|
-
|
|
4
|
-
const bubble = createBubbler();
|
|
5
2
|
/**
|
|
6
3
|
* @typedef {Object} Props
|
|
7
|
-
* @property {any}
|
|
8
|
-
* @property {any}
|
|
4
|
+
* @property {any} srcFull
|
|
5
|
+
* @property {any} src
|
|
9
6
|
* @property {any} title
|
|
10
7
|
* @property {string} [cors]
|
|
11
8
|
* @property {number} [size]
|
|
@@ -16,37 +13,41 @@
|
|
|
16
13
|
|
|
17
14
|
/** @type {Props} */
|
|
18
15
|
let {
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
srcFull,
|
|
17
|
+
src,
|
|
21
18
|
title,
|
|
22
|
-
cors
|
|
19
|
+
cors,
|
|
23
20
|
size = 64,
|
|
24
21
|
contained = true,
|
|
25
22
|
covered = true,
|
|
26
|
-
classes = ""
|
|
23
|
+
classes = "",
|
|
24
|
+
onclick = () => {},
|
|
25
|
+
onkeyup = () => {},
|
|
27
26
|
} = $props();
|
|
28
27
|
|
|
29
28
|
let sizeStyle = $derived(isNaN(size) ? `is-${size}` : `is-${size}x${size}`);
|
|
30
29
|
let containedStyle = $derived(contained ? "is-contained" : "");
|
|
31
30
|
let coveredStyle = $derived(covered ? "is-covered" : "");
|
|
31
|
+
|
|
32
|
+
let crossOrigin = $derived(cors);
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
|
-
{#if
|
|
35
|
-
<a href={
|
|
35
|
+
{#if srcFull}
|
|
36
|
+
<a href={srcFull} alt={title} {onclick}>
|
|
36
37
|
<figure
|
|
37
38
|
class="image {sizeStyle} {containedStyle} {coveredStyle} {classes}"
|
|
38
39
|
>
|
|
39
|
-
<img class="" alt={title} src
|
|
40
|
+
<img class="" alt={title} {src} {crossOrigin} />
|
|
40
41
|
</figure>
|
|
41
42
|
</a>
|
|
42
43
|
{:else}
|
|
43
44
|
<figure
|
|
44
45
|
class="image {sizeStyle} {containedStyle} {coveredStyle} {classes}"
|
|
45
|
-
onclick
|
|
46
|
-
onkeyup
|
|
46
|
+
{onclick}
|
|
47
|
+
{onkeyup}
|
|
47
48
|
role="button"
|
|
48
49
|
tabindex="0"
|
|
49
50
|
>
|
|
50
|
-
<img class="" alt={title} src
|
|
51
|
+
<img class="" alt={title} {src} {crossOrigin} />
|
|
51
52
|
</figure>
|
|
52
53
|
{/if}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import UIImage from "./ui.image.svelte";
|
|
3
|
-
let { values = [] } = $props();
|
|
3
|
+
let { values = [], onclick = () => {} } = $props();
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
{#each values as item (item.
|
|
7
|
-
<UIImage {...item}
|
|
6
|
+
{#each values as item (item.src)}
|
|
7
|
+
<UIImage {...item} {onclick} />
|
|
8
8
|
{/each}
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
onkeyup,
|
|
28
28
|
...other
|
|
29
29
|
} = $props();
|
|
30
|
-
|
|
31
|
-
const onKeyUp =
|
|
32
|
-
onkeyup ?? (onclick ? UICommon.onlyOnEnter(onclick) : undefined);
|
|
33
30
|
</script>
|
|
34
31
|
|
|
35
32
|
<div
|
|
@@ -38,7 +35,7 @@
|
|
|
38
35
|
" "
|
|
39
36
|
)}
|
|
40
37
|
{onclick}
|
|
41
|
-
onkeyup={
|
|
38
|
+
onkeyup={onkeyup ?? (onclick ? UICommon.onlyOnEnter(onclick) : undefined)}
|
|
42
39
|
{role}
|
|
43
40
|
{tabIndex}
|
|
44
41
|
>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import "bulma-pageloader";
|
|
3
3
|
import { LOCALE } from "../../locale";
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
//hidden - no loader
|
|
6
6
|
//container - parent container of form
|
|
7
|
-
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @typedef {Object} Props
|
|
@@ -14,7 +13,11 @@
|
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
/** @type {Props} */
|
|
17
|
-
let {
|
|
16
|
+
let {
|
|
17
|
+
loading = false,
|
|
18
|
+
size = "container",
|
|
19
|
+
title = "Waiting...",
|
|
20
|
+
} = $props();
|
|
18
21
|
</script>
|
|
19
22
|
|
|
20
23
|
{#if size !== "hidden"}
|
|
@@ -4,6 +4,8 @@ import notBase from "../../base";
|
|
|
4
4
|
import UICommon from "../../../elements/common.js";
|
|
5
5
|
|
|
6
6
|
import UIActionContainer from "./ui.action.container.svelte";
|
|
7
|
+
import UIAdapterSvelte from "../../ui.adapter.svelte";
|
|
8
|
+
|
|
7
9
|
const DEFAULT_CONTAINER_SELECTOR = ".container";
|
|
8
10
|
import { DEFAULT_STATUS_SUCCESS, DEFAULT_STATUS_ERROR } from "../../const";
|
|
9
11
|
|
|
@@ -40,10 +42,10 @@ class notActionUI extends notBase {
|
|
|
40
42
|
const target = this.getTargetEl();
|
|
41
43
|
while (target.children.length)
|
|
42
44
|
target.removeChild(target.firstChild);
|
|
43
|
-
this.#ui = new this.#uiComponent
|
|
45
|
+
this.#ui = new UIAdapterSvelte(this.#uiComponent,
|
|
44
46
|
target,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
this.getOptions(),
|
|
48
|
+
);
|
|
47
49
|
} catch (e) {
|
|
48
50
|
this.error(e);
|
|
49
51
|
}
|
|
@@ -51,12 +53,20 @@ class notActionUI extends notBase {
|
|
|
51
53
|
|
|
52
54
|
setLoading() {
|
|
53
55
|
this.emit("onloading");
|
|
54
|
-
this.#ui.
|
|
56
|
+
this.#ui.set('loaderActive', true);
|
|
57
|
+
this.#ui.set('success', false);
|
|
58
|
+
this.#ui.set('error', false);
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
resetLoading() {
|
|
58
62
|
this.emit("onloaded");
|
|
59
|
-
this.#ui.
|
|
63
|
+
this.#ui.set('loaderActive', false)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
hideAll(){
|
|
67
|
+
this.#ui.set('loaderActive', false);
|
|
68
|
+
this.#ui.set('success', false);
|
|
69
|
+
this.#ui.set('error', false);
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
destroy() {
|
|
@@ -81,11 +91,33 @@ class notActionUI extends notBase {
|
|
|
81
91
|
}
|
|
82
92
|
}
|
|
83
93
|
|
|
94
|
+
showSuccess(title, message) {
|
|
95
|
+
this.#ui.set('success', true);
|
|
96
|
+
this.#ui.set('error', false);
|
|
97
|
+
if (message != undefined) {
|
|
98
|
+
this.#ui.set('successMessage', message);
|
|
99
|
+
}
|
|
100
|
+
if (title != undefined) {
|
|
101
|
+
this.#ui.set('successTitle', title);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
showError(title, message) {
|
|
106
|
+
this.#ui.set('success', false);
|
|
107
|
+
this.#ui.set('error', true);
|
|
108
|
+
if (message != undefined) {
|
|
109
|
+
this.#ui.set('errorMessage', message);
|
|
110
|
+
}
|
|
111
|
+
if (title != undefined) {
|
|
112
|
+
this.#ui.set('errorTitle', title);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
84
116
|
/**
|
|
85
117
|
* Form validation result
|
|
86
118
|
**/
|
|
87
119
|
setFormSuccess() {
|
|
88
|
-
this
|
|
120
|
+
this.showSuccess();
|
|
89
121
|
this.emit("onsuccess");
|
|
90
122
|
}
|
|
91
123
|
|
|
@@ -100,7 +132,7 @@ class notActionUI extends notBase {
|
|
|
100
132
|
if (result.errors && Object.keys(result.errors).length > 0) {
|
|
101
133
|
status.fields = { ...result.errors };
|
|
102
134
|
}
|
|
103
|
-
this
|
|
135
|
+
this.showError(result.message, JSON.stringify(status, null, 4));
|
|
104
136
|
this.emit("onerror", status);
|
|
105
137
|
}
|
|
106
138
|
|
|
@@ -1,99 +1,57 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
loaderActive = $bindable(false),
|
|
38
|
-
loaderSize = $bindable('container'),
|
|
39
|
-
successTitle = $bindable('OK'),
|
|
40
|
-
successMessage = $bindable(''),
|
|
41
|
-
errorTitle = $bindable('Error'),
|
|
42
|
-
errorMessage = $bindable('')
|
|
43
|
-
} = $props();
|
|
44
|
-
|
|
45
|
-
export function showSuccess(title, message) {
|
|
46
|
-
error = false;
|
|
47
|
-
success = true;
|
|
48
|
-
if(message != undefined){
|
|
49
|
-
successMessage = message;
|
|
50
|
-
}
|
|
51
|
-
if(title != undefined){
|
|
52
|
-
successTitle = title;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function showError(title, message) {
|
|
57
|
-
success = false;
|
|
58
|
-
error = true;
|
|
59
|
-
if(message != undefined){
|
|
60
|
-
messageTitle = message;
|
|
61
|
-
}
|
|
62
|
-
if(title != undefined){
|
|
63
|
-
successTitle = title;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function setLoading() {
|
|
68
|
-
loaderActive = true;
|
|
69
|
-
success = false;
|
|
70
|
-
error = false;
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function resetLoading() {
|
|
75
|
-
loaderActive = false;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function hideAll(){
|
|
79
|
-
loaderActive = false;
|
|
80
|
-
success = false;
|
|
81
|
-
error = false;
|
|
82
|
-
}
|
|
83
|
-
|
|
2
|
+
import { LOCALE } from "../../../locale";
|
|
3
|
+
|
|
4
|
+
import UILoader from "../../../elements/various/ui.loader.svelte";
|
|
5
|
+
import UIContainer from "../../../elements/layout/ui.container.svelte";
|
|
6
|
+
import UINotificationError from "../../../elements/notification/ui.error.svelte";
|
|
7
|
+
import UINotificationSuccess from "../../../elements/notification/ui.success.svelte";
|
|
8
|
+
|
|
9
|
+
//hidden - no loader
|
|
10
|
+
//container - parent container of form
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object} Props
|
|
14
|
+
* @property {any} [container]
|
|
15
|
+
* @property {string} [loaderTitle]
|
|
16
|
+
* @property {boolean} [loaderActive] - state if form loading
|
|
17
|
+
* @property {string} [loaderSize] - page - whole page
|
|
18
|
+
* @property {string} [successTitle]
|
|
19
|
+
* @property {string} [successMessage]
|
|
20
|
+
* @property {string} [errorTitle]
|
|
21
|
+
* @property {string} [errorMessage]
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** @type {Props} */
|
|
25
|
+
let {
|
|
26
|
+
success = false,
|
|
27
|
+
error = false,
|
|
28
|
+
container = {},
|
|
29
|
+
loaderTitle = $bindable("Отправка данных на сервер"),
|
|
30
|
+
loaderActive = $bindable(false),
|
|
31
|
+
loaderSize = $bindable("container"),
|
|
32
|
+
successTitle = $bindable("OK"),
|
|
33
|
+
successMessage = $bindable(""),
|
|
34
|
+
errorTitle = $bindable("Error"),
|
|
35
|
+
errorMessage = $bindable(""),
|
|
36
|
+
} = $props();
|
|
84
37
|
</script>
|
|
85
38
|
|
|
86
|
-
|
|
87
39
|
<UILoader
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<UIContainer {...container}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
40
|
+
bind:loading={loaderActive}
|
|
41
|
+
bind:title={loaderTitle}
|
|
42
|
+
bind:size={loaderSize}
|
|
43
|
+
/>
|
|
44
|
+
<UIContainer {...container}>
|
|
45
|
+
{#if error}
|
|
46
|
+
<UINotificationError
|
|
47
|
+
bind:title={errorTitle}
|
|
48
|
+
bind:message={errorMessage}
|
|
49
|
+
/>
|
|
50
|
+
{/if}
|
|
51
|
+
{#if success}
|
|
52
|
+
<UINotificationSuccess
|
|
53
|
+
bind:title={successTitle}
|
|
54
|
+
bind:message={successMessage}
|
|
55
|
+
/>
|
|
56
|
+
{/if}
|
|
99
57
|
</UIContainer>
|
|
@@ -70,6 +70,8 @@ agreed
|
|
|
70
70
|
onchange = () => {},
|
|
71
71
|
onsubmit = () => {},
|
|
72
72
|
onreject = () => {},
|
|
73
|
+
onFieldInvalid = () => {},
|
|
74
|
+
onFieldValid = () => {},
|
|
73
75
|
} = $props();
|
|
74
76
|
|
|
75
77
|
let formInvalid = $derived(formHasErrors || fieldsHasErrors);
|
|
@@ -96,14 +98,14 @@ agreed
|
|
|
96
98
|
|
|
97
99
|
export function setFormFieldInvalid(fieldName, errors) {
|
|
98
100
|
form = FormHelpers.setFormFieldInvalid(form, fieldName, errors);
|
|
99
|
-
|
|
101
|
+
onFieldInvalid({
|
|
100
102
|
fieldName,
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
export function setFormFieldValid(fieldName) {
|
|
105
107
|
form = FormHelpers.setFormFieldValid(form, fieldName);
|
|
106
|
-
|
|
108
|
+
onFieldValid({
|
|
107
109
|
fieldName,
|
|
108
110
|
});
|
|
109
111
|
}
|
|
@@ -159,10 +161,8 @@ agreed
|
|
|
159
161
|
export function setFieldValue(fieldName, value) {
|
|
160
162
|
if (FormHelpers.setFieldValue(form, fieldName, value)) {
|
|
161
163
|
onFieldChange({
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
value,
|
|
165
|
-
},
|
|
164
|
+
field: fieldName,
|
|
165
|
+
value,
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -126,7 +126,7 @@ class notForm extends notBase {
|
|
|
126
126
|
data: this.getFormData(),
|
|
127
127
|
injectedProps: this.getFormInjectedProps(),
|
|
128
128
|
});
|
|
129
|
-
|
|
129
|
+
this.#form.replaceProps(props);
|
|
130
130
|
this.validateForm();
|
|
131
131
|
} catch (e) {
|
|
132
132
|
this.error(e);
|
|
@@ -451,14 +451,13 @@ class notForm extends notBase {
|
|
|
451
451
|
updateField(fieldName, props) {
|
|
452
452
|
if (this.#form.props && this.#form.props.form){
|
|
453
453
|
if( this.#form.props.form[fieldName]){
|
|
454
|
-
this.#form.
|
|
455
|
-
...
|
|
456
|
-
|
|
457
|
-
};
|
|
454
|
+
this.#form.changeProp(`form.${fieldName}`, (val)=>{
|
|
455
|
+
return {...val, ...props}
|
|
456
|
+
});
|
|
458
457
|
}else{
|
|
459
|
-
this.#form.
|
|
458
|
+
this.#form.set(`form.${fieldName}`, {
|
|
460
459
|
...props,
|
|
461
|
-
};
|
|
460
|
+
});
|
|
462
461
|
}
|
|
463
462
|
}
|
|
464
463
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { UILinks } from "../../../elements/link";
|
|
7
7
|
import { UIButtons } from "../../../elements/button";
|
|
8
8
|
import UIIcon from "../../../elements/icon/ui.icon.font.svelte";
|
|
9
|
+
import { UILoader } from "../../../elements/various";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @typedef {Object} Props
|
|
@@ -71,17 +72,17 @@
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
function _onSearchChange(
|
|
75
|
+
function _onSearchChange(event) {
|
|
75
76
|
try {
|
|
76
|
-
onSearchChange(
|
|
77
|
+
onSearchChange(event);
|
|
77
78
|
} catch (e) {
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
function _onFilterChange(
|
|
83
|
+
function _onFilterChange(event) {
|
|
83
84
|
try {
|
|
84
|
-
onFilterChange(
|
|
85
|
+
onFilterChange(event);
|
|
85
86
|
} catch (e) {
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
@@ -121,6 +122,13 @@
|
|
|
121
122
|
selected[event.id] = event.selected;
|
|
122
123
|
onRowSelectChange(event);
|
|
123
124
|
}
|
|
125
|
+
|
|
126
|
+
function preventDefault(call) {
|
|
127
|
+
return (e) => {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
return call(e);
|
|
130
|
+
};
|
|
131
|
+
}
|
|
124
132
|
</script>
|
|
125
133
|
|
|
126
134
|
{#if links.length}
|
|
@@ -155,88 +163,100 @@
|
|
|
155
163
|
</div>
|
|
156
164
|
{/if}
|
|
157
165
|
{/if}
|
|
158
|
-
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
>
|
|
228
|
-
{:else}
|
|
229
|
-
<a
|
|
230
|
-
href
|
|
231
|
-
class="pagination-link"
|
|
232
|
-
aria-label="Страница {page.index}"
|
|
233
|
-
data-page={page.index}
|
|
234
|
-
onclick={_goTo}>{page.index + 1}</a
|
|
235
|
-
>
|
|
236
|
-
{/if}
|
|
237
|
-
</li>
|
|
238
|
-
{/each}
|
|
166
|
+
{#if state.updating}
|
|
167
|
+
<UILoader loading={true} title="Загрузка..." size="container"></UILoader>
|
|
168
|
+
{:else}
|
|
169
|
+
<table class="table">
|
|
170
|
+
<thead>
|
|
171
|
+
{#if showSelect}
|
|
172
|
+
<th
|
|
173
|
+
><input
|
|
174
|
+
type="checkbox"
|
|
175
|
+
id="table-row-select-page"
|
|
176
|
+
bind:checked={selectAll}
|
|
177
|
+
placeholder=""
|
|
178
|
+
name="row_selected_all"
|
|
179
|
+
onchange={_onSelectAllToggle}
|
|
180
|
+
/></th
|
|
181
|
+
>
|
|
182
|
+
{/if}
|
|
183
|
+
{#each fields as field}
|
|
184
|
+
{@const propPath = field.path.substring(1)}
|
|
185
|
+
<th
|
|
186
|
+
class={(field.hideOnMobile ? " is-hidden-touch" : "") +
|
|
187
|
+
(field.sortable ? " is-clickable" : "")}
|
|
188
|
+
onclick={() => _onFieldHeadClick(field)}
|
|
189
|
+
>
|
|
190
|
+
{#if field.sortable && Object.hasOwn(sorter, propPath)}
|
|
191
|
+
<UIIcon
|
|
192
|
+
font={sorter[propPath] > 0
|
|
193
|
+
? "sort-up"
|
|
194
|
+
: "sort-down"}
|
|
195
|
+
title={field.title}
|
|
196
|
+
pointable={true}
|
|
197
|
+
/>
|
|
198
|
+
{:else}
|
|
199
|
+
{$LOCALE[field.title]}
|
|
200
|
+
{/if}
|
|
201
|
+
</th>
|
|
202
|
+
{/each}
|
|
203
|
+
</thead>
|
|
204
|
+
<tbody>
|
|
205
|
+
{#each items as item (item._id)}
|
|
206
|
+
<UITableRow
|
|
207
|
+
{id}
|
|
208
|
+
{item}
|
|
209
|
+
{fields}
|
|
210
|
+
{helpers}
|
|
211
|
+
{showSelect}
|
|
212
|
+
isSelected={selected[getItemId(item)]}
|
|
213
|
+
{getItemId}
|
|
214
|
+
onRowSelectChange={_onRowSelectChange}
|
|
215
|
+
onchange={onRowCellChange}
|
|
216
|
+
/>
|
|
217
|
+
{/each}
|
|
218
|
+
</tbody>
|
|
219
|
+
</table>
|
|
220
|
+
{#if state?.pagination?.pages?.list.length >= 1}
|
|
221
|
+
<nav class="pagination is-centered" aria-label="pagination">
|
|
222
|
+
{#if state?.pagination?.pages?.current > 0}
|
|
223
|
+
<a
|
|
224
|
+
href
|
|
225
|
+
class="pagination-previous"
|
|
226
|
+
onclick={preventDefault(onGoToPrevPage)}>Назад</a
|
|
227
|
+
>
|
|
228
|
+
{/if}
|
|
229
|
+
{#if state?.pagination?.pages?.current < state?.pagination?.pages.to}
|
|
230
|
+
<a
|
|
231
|
+
href
|
|
232
|
+
class="pagination-next"
|
|
233
|
+
onclick={preventDefault(onGoToNextPage)}>Вперед</a
|
|
234
|
+
>
|
|
239
235
|
{/if}
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
<ul class="pagination-list">
|
|
237
|
+
{#if state && state?.pagination && state?.pagination.pages && state?.pagination.pages.list}
|
|
238
|
+
{#each state?.pagination.pages.list as page (page.index)}
|
|
239
|
+
<li>
|
|
240
|
+
{#if page.active}
|
|
241
|
+
<a
|
|
242
|
+
href
|
|
243
|
+
class="pagination-link is-current"
|
|
244
|
+
aria-label="Страница {page.index}"
|
|
245
|
+
aria-current="page">{page.index + 1}</a
|
|
246
|
+
>
|
|
247
|
+
{:else}
|
|
248
|
+
<a
|
|
249
|
+
href
|
|
250
|
+
class="pagination-link"
|
|
251
|
+
aria-label="Страница {page.index}"
|
|
252
|
+
data-page={page.index}
|
|
253
|
+
onclick={_goTo}>{page.index + 1}</a
|
|
254
|
+
>
|
|
255
|
+
{/if}
|
|
256
|
+
</li>
|
|
257
|
+
{/each}
|
|
258
|
+
{/if}
|
|
259
|
+
</ul>
|
|
260
|
+
</nav>
|
|
261
|
+
{/if}
|
|
242
262
|
{/if}
|
|
@@ -680,7 +680,7 @@ class notTable extends EventEmitter {
|
|
|
680
680
|
notCommon.objHas(data, "result");
|
|
681
681
|
this.updateStore('filtered', (val) => {
|
|
682
682
|
if (!this.getOptions("endless", false)) {
|
|
683
|
-
|
|
683
|
+
val.splice(0);
|
|
684
684
|
}
|
|
685
685
|
if (full && data?.result.list) {
|
|
686
686
|
val.push(...(data.result.list || []));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { notTable } from "../../components";
|
|
2
|
+
import UICommon from "../../../elements/common";
|
|
2
3
|
|
|
3
4
|
const ACTION = "list";
|
|
4
5
|
|
|
@@ -65,12 +66,14 @@ export default class CRUDActionList {
|
|
|
65
66
|
};
|
|
66
67
|
const actionsButtons = [...prepend];
|
|
67
68
|
if (Array.isArray(actions)) {
|
|
68
|
-
actions.forEach((actionName) =>
|
|
69
|
-
actionsButtons.push(
|
|
69
|
+
actions.forEach((actionName, index) =>
|
|
70
|
+
actionsButtons.push({
|
|
71
|
+
...ACTIONS[actionName]
|
|
72
|
+
})
|
|
70
73
|
);
|
|
71
74
|
}
|
|
72
75
|
actionsButtons.push(...append);
|
|
73
|
-
return actionsButtons;
|
|
76
|
+
return UICommon.addIds(actionsButtons);
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
static async run(controller, params) {
|
|
@@ -76,6 +76,25 @@ export default class UIAdapterSvelte {
|
|
|
76
76
|
return this;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
replaceProps(props){
|
|
80
|
+
const replaced = [];
|
|
81
|
+
Object.keys(this.#props).forEach(
|
|
82
|
+
(key)=>{
|
|
83
|
+
if (Object.hasOwn(props)) {
|
|
84
|
+
this.#props[key] = props[key];
|
|
85
|
+
}else{
|
|
86
|
+
delete this.#props[key];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
Object.keys(props).forEach(
|
|
90
|
+
(key)=>{
|
|
91
|
+
if (!replaced.includes(key)) {
|
|
92
|
+
this.#props[key] = props[key];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
|
|
79
98
|
$get(propKey){
|
|
80
99
|
return this.get(propKey);
|
|
81
100
|
}
|
|
@@ -85,7 +104,7 @@ export default class UIAdapterSvelte {
|
|
|
85
104
|
}
|
|
86
105
|
|
|
87
106
|
get props(){
|
|
88
|
-
return this.#props;
|
|
107
|
+
return $state.snapshot(this.#props);
|
|
89
108
|
}
|
|
90
109
|
|
|
91
110
|
$destroy(){
|