backend-plus 1.14.15 → 1.15.0
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/lib/backend-plus.d.ts +1 -0
- package/lib/backend-plus.js +36 -0
- package/lib/procedures-table.js +1 -0
- package/package.json +2 -2
package/lib/backend-plus.d.ts
CHANGED
|
@@ -195,6 +195,7 @@ export type FieldDefinition = EditableDbDefinition & {
|
|
|
195
195
|
sortMethod?:string
|
|
196
196
|
generatedAs?:string
|
|
197
197
|
inJoin?:string /* alias from sql.join; implies inTable:false */
|
|
198
|
+
transformer?:string
|
|
198
199
|
} & ({} | {
|
|
199
200
|
sequence:SequenceDefinition
|
|
200
201
|
nullable:true
|
package/lib/backend-plus.js
CHANGED
|
@@ -141,6 +141,9 @@ AppBackend.prototype.configStaticConfig = function configStaticConfig(){
|
|
|
141
141
|
activeClausule: true
|
|
142
142
|
lockedClausule: false
|
|
143
143
|
keepAlive: 1800
|
|
144
|
+
data:
|
|
145
|
+
transformers:
|
|
146
|
+
text: keepAll
|
|
144
147
|
db:
|
|
145
148
|
motor: postgresql
|
|
146
149
|
min-version: 12
|
|
@@ -2903,6 +2906,39 @@ AppBackend.prototype.dumpDb = function dumpDb(opts){
|
|
|
2903
2906
|
]);
|
|
2904
2907
|
};
|
|
2905
2908
|
|
|
2909
|
+
AppBackend.prototype.inputTransformers={
|
|
2910
|
+
keepAll:{},
|
|
2911
|
+
normal:{
|
|
2912
|
+
replaceNewLines:' ',
|
|
2913
|
+
simplificateSpaces:true
|
|
2914
|
+
},
|
|
2915
|
+
upper:{
|
|
2916
|
+
replaceNewLines:' ',
|
|
2917
|
+
simplificateSpaces:true,
|
|
2918
|
+
fun:t=>t.toLocaleUpperCase()
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
AppBackend.prototype.transformInput = function transformInput(fieldDef, value){
|
|
2923
|
+
var be = this;
|
|
2924
|
+
if(fieldDef.typeName == 'text'){
|
|
2925
|
+
var idTransformer = fieldDef.transformer ?? be.config.data.transformers.text;
|
|
2926
|
+
var parameters = be.inputTransformers[idTransformer] ?? idTransformer ?? {}
|
|
2927
|
+
if(value != null){
|
|
2928
|
+
if(parameters.replaceNewLines != null){
|
|
2929
|
+
value = value.replace(/\r|\n/g,' ').trim()
|
|
2930
|
+
}
|
|
2931
|
+
if(parameters.simplificateSpaces){
|
|
2932
|
+
value = value.replace(/(\s|\u00A0)+/g,' ').trim()
|
|
2933
|
+
}
|
|
2934
|
+
if(parameters.fun){
|
|
2935
|
+
value = parameters.fun(value)
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
return value;
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2906
2942
|
backendPlus.AppBackend = AppBackend;
|
|
2907
2943
|
backendPlus.require_resolve = require_resolve;
|
|
2908
2944
|
|
package/lib/procedures-table.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-plus",
|
|
3
3
|
"description": "Backend for typed controls",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.15.0",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"stylus": "^0.56.0",
|
|
71
71
|
"type-store": "^0.2.41",
|
|
72
72
|
"typed-controls": "^0.10.0",
|
|
73
|
-
"xlsx": "^0.18.
|
|
73
|
+
"xlsx": "^0.18.3",
|
|
74
74
|
"xlsx-style": "^0.8.13"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|