not-bulma 1.2.41 → 1.2.43
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
package/src/frame/controller.js
CHANGED
|
@@ -665,6 +665,7 @@ class notController extends notBase {
|
|
|
665
665
|
static getCommonMenu(childConstructor) {
|
|
666
666
|
return [
|
|
667
667
|
{
|
|
668
|
+
section: childConstructor.MODULE_NAME,
|
|
668
669
|
title: childConstructor.LABELS.plural,
|
|
669
670
|
url: `/${notCommon.lowerFirstLetter(
|
|
670
671
|
childConstructor.MODULE_NAME
|
|
@@ -166,6 +166,13 @@ class CRUDGenericAction {
|
|
|
166
166
|
return !response || response.status !== "ok";
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
static getValidators(controller) {
|
|
170
|
+
return (
|
|
171
|
+
(controller.getValidators && controller.getValidators()) ||
|
|
172
|
+
controller.getOptions("Validators")
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
169
176
|
/**
|
|
170
177
|
* Creates object with all options needed to initialize UI component
|
|
171
178
|
* @param {object} controller instance of controller
|
|
@@ -183,7 +190,7 @@ class CRUDGenericAction {
|
|
|
183
190
|
fields: {
|
|
184
191
|
readonly: true,
|
|
185
192
|
},
|
|
186
|
-
validators:
|
|
193
|
+
validators: this.getValidators(controller),
|
|
187
194
|
variants: controller.getOptions(`variants.${this.ACTION}`, {}),
|
|
188
195
|
masters: controller.getOptions(`${this.ACTION}.masters`, {}),
|
|
189
196
|
injected: controller.getOptions(`${this.ACTION}.injected`, {}),
|
|
@@ -58,7 +58,7 @@ class CRUDGenericActionCreate extends CRUDGenericAction {
|
|
|
58
58
|
model: controller.getModelName(),
|
|
59
59
|
action: actionName,
|
|
60
60
|
name: `${controller.getName()}.${this.ACTION}Form`,
|
|
61
|
-
validators:
|
|
61
|
+
validators: this.getValidators(controller),
|
|
62
62
|
variants: controller.getOptions(`variants.${this.ACTION}`, {}),
|
|
63
63
|
masters: controller.getOptions(`${this.ACTION}.masters`, {}),
|
|
64
64
|
},
|
|
@@ -61,7 +61,7 @@ class CRUDGenericActionUpdate extends CRUDGenericAction {
|
|
|
61
61
|
model: controller.getModelName(),
|
|
62
62
|
action: this.MODEL_ACTION_PUT, //will be used to get form fields information from manifest
|
|
63
63
|
name: `${controller.getName()}.${this.ACTION}Form`,
|
|
64
|
-
validators:
|
|
64
|
+
validators: this.getValidators(controller),
|
|
65
65
|
variants: controller.getOptions(`variants.${this.ACTION}`, {}),
|
|
66
66
|
ui: controller.getOptions(`${this.ACTION}.ui`, {}),
|
|
67
67
|
fields: controller.getOptions(`${this.ACTION}.fields`, {}),
|
|
@@ -66,6 +66,29 @@ class notCRUD extends notController {
|
|
|
66
66
|
return this;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
setValidators(validators) {
|
|
70
|
+
//not-module-name -> [not,module,name]
|
|
71
|
+
const ModuleNameParts = this.MODULE_NAME.split("-");
|
|
72
|
+
//[not,module,name] -> ModuleName
|
|
73
|
+
const ModuleName = (
|
|
74
|
+
ModuleNameParts[0] === "not"
|
|
75
|
+
? ModuleNameParts.splice(1)
|
|
76
|
+
: ModuleNameParts
|
|
77
|
+
)
|
|
78
|
+
.map(notCommon.capitalizeFirstLetter)
|
|
79
|
+
.join("");
|
|
80
|
+
const serviceName = `ns${ModuleName}Common`;
|
|
81
|
+
const CommonModuleService = this.app?.getService(serviceName);
|
|
82
|
+
this.setWorking(
|
|
83
|
+
"validators",
|
|
84
|
+
CommonModuleService.augmentValidators(validators)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getValidators() {
|
|
89
|
+
return this.getWorking("validators");
|
|
90
|
+
}
|
|
91
|
+
|
|
69
92
|
start() {
|
|
70
93
|
let newHead = [];
|
|
71
94
|
if (this.getModuleName() && this.getOptions("names.module")) {
|