not-bulma 1.2.21 → 1.2.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/package.json +1 -1
- package/src/elements/form/ui.select.from.model.svelte +14 -1
- package/src/frame/crud/actions/generic/action.js +2 -0
- package/src/frame/crud/actions/generic/read.js +2 -0
- package/src/frame/crud/actions/generic/update.js +2 -0
- package/src/frame/crud/actions/list.js +18 -7
- package/src/frame/crud/controller.crud.js +17 -0
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { DEFAULT_STATUS_SUCCESS } from "../../frame/const";
|
|
7
7
|
|
|
8
8
|
import { onMount, createEventDispatcher } from "svelte";
|
|
9
|
+
const dispatch = createEventDispatcher();
|
|
9
10
|
|
|
10
11
|
export let inputStarted = false;
|
|
11
12
|
export let value;
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
export let errors = false;
|
|
30
31
|
export let formErrors = false;
|
|
31
32
|
export let formLevelError = false;
|
|
33
|
+
export let returnVariant = false;
|
|
32
34
|
|
|
33
35
|
function argumentsSetProvided() {
|
|
34
36
|
return modelName && actionName && actionFilter;
|
|
@@ -62,6 +64,17 @@
|
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
});
|
|
67
|
+
|
|
68
|
+
function onChange(e) {
|
|
69
|
+
if (returnVariant) {
|
|
70
|
+
dispatch("change", {
|
|
71
|
+
...e.detail,
|
|
72
|
+
value: variants.find((itm) => itm.id === e.detail.value),
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
dispatch("change", e.detail);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
65
78
|
</script>
|
|
66
79
|
|
|
67
80
|
<UISelect
|
|
@@ -81,5 +94,5 @@
|
|
|
81
94
|
{errors}
|
|
82
95
|
{formErrors}
|
|
83
96
|
{formLevelError}
|
|
84
|
-
on:change
|
|
97
|
+
on:change={onChange}
|
|
85
98
|
/>
|
|
@@ -305,6 +305,8 @@ class CRUDGenericAction {
|
|
|
305
305
|
if (this.isUIRendered(controller)) {
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
+
//indicating that we are working
|
|
309
|
+
controller.renderLoadingScreen && controller.renderLoadingScreen();
|
|
308
310
|
//preloading form variants
|
|
309
311
|
await controller.preloadVariants(this.ACTION);
|
|
310
312
|
//setting initial state of breadcrumbs tail
|
|
@@ -28,6 +28,8 @@ class CRUDGenericActionRead extends CRUDGenericAction {
|
|
|
28
28
|
if (this.isUIRendered(controller)) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
+
//indicating that we are working
|
|
32
|
+
controller.renderLoadingScreen && controller.renderLoadingScreen();
|
|
31
33
|
//preloading form variants
|
|
32
34
|
await controller.preloadVariants(this.ACTION);
|
|
33
35
|
//setting initial state of breadcrumbs tail
|
|
@@ -125,6 +125,8 @@ class CRUDGenericActionUpdate extends CRUDGenericAction {
|
|
|
125
125
|
if (this.isUIRendered(controller)) {
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
+
//indicating that we are working
|
|
129
|
+
controller.renderLoadingScreen && controller.renderLoadingScreen();
|
|
128
130
|
//preloading form variants
|
|
129
131
|
await controller.preloadVariants(this.ACTION);
|
|
130
132
|
//setting initial state of breadcrumbs tail
|
|
@@ -3,6 +3,16 @@ import { notTable } from "../../components";
|
|
|
3
3
|
const ACTION = "list";
|
|
4
4
|
|
|
5
5
|
export default class CRUDActionList {
|
|
6
|
+
static tweakActionsList(controller, ACTIONS_LIST) {
|
|
7
|
+
if (controller.getOptions(`${ACTION}.createAction`, true)) {
|
|
8
|
+
ACTIONS_LIST.push({
|
|
9
|
+
title: "Создать",
|
|
10
|
+
action: () => controller.goCreate(),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return ACTIONS_LIST;
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
static tweakUIOptions(options) {
|
|
7
17
|
return options;
|
|
8
18
|
}
|
|
@@ -46,6 +56,9 @@ export default class CRUDActionList {
|
|
|
46
56
|
|
|
47
57
|
static async run(controller, params) {
|
|
48
58
|
try {
|
|
59
|
+
//indicating that we are working
|
|
60
|
+
controller.renderLoadingScreen && controller.renderLoadingScreen();
|
|
61
|
+
|
|
49
62
|
await controller.preloadVariants(ACTION);
|
|
50
63
|
|
|
51
64
|
controller.setBreadcrumbs([
|
|
@@ -97,17 +110,15 @@ export default class CRUDActionList {
|
|
|
97
110
|
filter: undefined,
|
|
98
111
|
ui: undefined,
|
|
99
112
|
};
|
|
113
|
+
//forming actions buttons list
|
|
114
|
+
let ACTIONS_LIST = [...controller.getOptions(`${ACTION}.actions`, [])];
|
|
115
|
+
ACTIONS_LIST = this.tweakActionsList(controller, ACTIONS_LIST);
|
|
116
|
+
//
|
|
100
117
|
const TABLE_OPTIONS = {
|
|
101
118
|
options: {
|
|
102
119
|
targetEl: controller.getContainerInnerElement(),
|
|
103
120
|
endless: false,
|
|
104
|
-
actions:
|
|
105
|
-
{
|
|
106
|
-
title: "Создать",
|
|
107
|
-
action: () => controller.goCreate(),
|
|
108
|
-
},
|
|
109
|
-
...controller.getOptions(`${ACTION}.actions`, []),
|
|
110
|
-
],
|
|
121
|
+
actions: ACTIONS_LIST,
|
|
111
122
|
},
|
|
112
123
|
};
|
|
113
124
|
Object.keys(DEFAULT_OPTIONS_TABLE).forEach((key) => {
|
|
@@ -3,6 +3,8 @@ import { say } from "../../locale";
|
|
|
3
3
|
|
|
4
4
|
import notBreadcrumbs from "../components/breadcrumbs";
|
|
5
5
|
|
|
6
|
+
import UILoader from "../../elements/various/ui.loader.svelte";
|
|
7
|
+
|
|
6
8
|
import notController from "../controller";
|
|
7
9
|
import notCommon from "../common";
|
|
8
10
|
|
|
@@ -20,6 +22,7 @@ class notCRUD extends notController {
|
|
|
20
22
|
#preloader = CRUDVariantsPreloader;
|
|
21
23
|
|
|
22
24
|
TITLE_FIELDS_PRIORITY = TITLE_FIELDS_PRIORITY;
|
|
25
|
+
|
|
23
26
|
static ERROR_DEFAULT = UICommon.ERROR_DEFAULT;
|
|
24
27
|
|
|
25
28
|
TOP_CLASS = ["box"];
|
|
@@ -352,6 +355,20 @@ class notCRUD extends notController {
|
|
|
352
355
|
getActionUI() {
|
|
353
356
|
return this.ui[this.getCurrentAction()];
|
|
354
357
|
}
|
|
358
|
+
|
|
359
|
+
renderLoadingScreen() {
|
|
360
|
+
this.setUI("loading_screen", this.createLoaderUI());
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
createLoaderUI() {
|
|
364
|
+
return new UILoader({
|
|
365
|
+
target: this.getContainerInnerElement(),
|
|
366
|
+
props: {
|
|
367
|
+
loading: true,
|
|
368
|
+
title: "",
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
}
|
|
355
372
|
}
|
|
356
373
|
|
|
357
374
|
export default notCRUD;
|