not-bulma 1.2.42 → 1.2.44
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
|
@@ -44,11 +44,23 @@ class notController extends notBase {
|
|
|
44
44
|
/**
|
|
45
45
|
* @static {string} MODULE_NAME name of module
|
|
46
46
|
*/
|
|
47
|
-
static MODULE_NAME
|
|
47
|
+
static get MODULE_NAME() {
|
|
48
|
+
return OPT_DEFAULT_MODULE_NAME;
|
|
49
|
+
}
|
|
48
50
|
/**
|
|
49
51
|
* @static {string} MODEL_NAME name of model
|
|
50
52
|
*/
|
|
51
|
-
static MODEL_NAME
|
|
53
|
+
static get MODEL_NAME() {
|
|
54
|
+
return "ModelName";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static get LABELS() {
|
|
58
|
+
return {
|
|
59
|
+
plural: `${OPT_DEFAULT_MODULE_NAME}:model_label_plural`,
|
|
60
|
+
single: `${OPT_DEFAULT_MODULE_NAME}:model_label_single`,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
52
64
|
/**
|
|
53
65
|
*
|
|
54
66
|
* @type {object|null}
|
|
@@ -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.getModuleName().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")) {
|