backend-plus 1.12.2 → 1.13.3
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/for-client/my-menu.js +13 -0
- package/for-client/my-tables.js +2 -2
- package/lib/backend-plus.d.ts +6 -2
- package/lib/backend-plus.js +2 -2
- package/lib/table-def-adapt.js +6 -3
- package/package.json +10 -10
- package/unlogged/my-ajax.js +3 -1
package/for-client/my-menu.js
CHANGED
|
@@ -13,6 +13,7 @@ myOwn.i18n.messages.en=changing(myOwn.i18n.messages.en, {
|
|
|
13
13
|
onLine:'on line',
|
|
14
14
|
proceed:'proceed',
|
|
15
15
|
processing:'processing',
|
|
16
|
+
readyToDownload:'ready to download',
|
|
16
17
|
signIn:'sign in',
|
|
17
18
|
speed1:'speed $1',
|
|
18
19
|
user:'user',
|
|
@@ -28,6 +29,7 @@ myOwn.i18n.messages.es=changing(myOwn.i18n.messages.es, {
|
|
|
28
29
|
onLine:'en línea',
|
|
29
30
|
proceed:'proceder',
|
|
30
31
|
processing:'procesando',
|
|
32
|
+
readyToDownload:'listo para descargar',
|
|
31
33
|
signIn:'login',
|
|
32
34
|
speed1:'velocidad $1',
|
|
33
35
|
user:'usuario',
|
|
@@ -88,6 +90,10 @@ myOwn.wScreens.procAux = {
|
|
|
88
90
|
)
|
|
89
91
|
)
|
|
90
92
|
)
|
|
93
|
+
if(parameterDef.references || parameterDef.options){
|
|
94
|
+
setTimeout(()=>control.ponerLupa(true), 500)
|
|
95
|
+
|
|
96
|
+
}
|
|
91
97
|
if(value!==undefined){
|
|
92
98
|
params[parameterDef.name] = value;
|
|
93
99
|
control.setTypedValue(value);
|
|
@@ -177,6 +183,13 @@ myOwn.wScreens.proc.result={
|
|
|
177
183
|
showError:function(err, divResult){
|
|
178
184
|
divResult.textContent = err.message;
|
|
179
185
|
divResult.style.backgroundColor = 'orange';
|
|
186
|
+
},
|
|
187
|
+
showDownloadUrl:function(result, divResult){
|
|
188
|
+
divResult.innerHTML='';
|
|
189
|
+
divResult.appendChild(html.div([
|
|
190
|
+
html.div([my.messages.readyToDownload]),
|
|
191
|
+
...result.map(r=>html.div([html.a({href:r.url}, r.label || r.url)]))
|
|
192
|
+
]).create())
|
|
180
193
|
}
|
|
181
194
|
}
|
|
182
195
|
|
package/for-client/my-tables.js
CHANGED
|
@@ -567,7 +567,7 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
567
567
|
//chequeo que exista depot por las dudas
|
|
568
568
|
if(depot && !sameValue(JSON.stringify(row),JSON.stringify(depot.row))){
|
|
569
569
|
//grid.retrieveRowAndRefresh(depot);
|
|
570
|
-
grid.depotRefresh(depot,{updatedRow:row, sendedForUpdate:{}});
|
|
570
|
+
grid.depotRefresh(depot,{updatedRow:row, sendedForUpdate:{}},{noDispatchEvents:true});
|
|
571
571
|
}
|
|
572
572
|
})
|
|
573
573
|
})
|
|
@@ -1057,7 +1057,7 @@ myOwn.DetailColumnGrid.prototype.td = function td(depot, iColumn, tr){
|
|
|
1057
1057
|
var menuRef={w:'table', table:detailTableDef.table};
|
|
1058
1058
|
var calculateFixedFields = function(){
|
|
1059
1059
|
return detailTableDef.fields.map(function(pair){
|
|
1060
|
-
var fieldCondition={fieldName: pair.target, value:depot.row[pair.source]}
|
|
1060
|
+
var fieldCondition={fieldName: pair.target, value:'value' in pair ? pair.value : depot.row[pair.source]}
|
|
1061
1061
|
if(pair.range){
|
|
1062
1062
|
fieldCondition.range=pair.range;
|
|
1063
1063
|
}
|
package/lib/backend-plus.d.ts
CHANGED
|
@@ -194,6 +194,7 @@ export type FieldDefinition = EditableDbDefinition & {
|
|
|
194
194
|
inView?:boolean
|
|
195
195
|
sortMethod?:string
|
|
196
196
|
generatedAs?:string
|
|
197
|
+
inJoin?:string /* alias from sql.join; implies inTable:false */
|
|
197
198
|
} & ({} | {
|
|
198
199
|
sequence:SequenceDefinition
|
|
199
200
|
nullable:true
|
|
@@ -213,6 +214,8 @@ export type EditableDbDefinition = {
|
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
export type FieldsForConnect = (string | {source:string, target:string})[]
|
|
217
|
+
export type FieldsForConnectDetailTable = (string | {source:string, target:string} | {value:any, target:string})[]
|
|
218
|
+
|
|
216
219
|
export type FkActions = 'no action'|'restrict'|'cascade'|'set null'|'set default';
|
|
217
220
|
export type ForeignKey = {
|
|
218
221
|
references:string,
|
|
@@ -266,6 +269,7 @@ export type TableDefinition = EditableDbDefinition & {
|
|
|
266
269
|
update?:{using?:string, check?:string}
|
|
267
270
|
delete?:{using?:string}
|
|
268
271
|
}
|
|
272
|
+
join?:string
|
|
269
273
|
}
|
|
270
274
|
foreignKeys?:ForeignKey[]
|
|
271
275
|
softForeignKeys?:ForeignKey[]
|
|
@@ -288,7 +292,7 @@ export type TableDefinition = EditableDbDefinition & {
|
|
|
288
292
|
description?:MarkdownDoc
|
|
289
293
|
exportJsonFieldAsColumns?:string
|
|
290
294
|
}
|
|
291
|
-
export interface DetailTable { table?: string, fields:
|
|
295
|
+
export interface DetailTable { table?: string, fields: FieldsForConnectDetailTable, abr: string, label?: string, refreshParent?:boolean, refreshFromParent?:boolean, wScreen?:string, condition?:string }
|
|
292
296
|
export type TableDefinitionFunction = (context: ContextForDump, opts?:any) => TableDefinition;
|
|
293
297
|
export type TableItemDef=string|{name:string, path?:string, tableGenerator?:(context:TableContext)=>TableDefinition}
|
|
294
298
|
// {{name: string; path?:string; fileName?: string; source?: string; tableGenerator?:()=>void; title?:string; mixin?:any[]}} TableItem
|
|
@@ -336,7 +340,7 @@ export class AppBackend{
|
|
|
336
340
|
procedures:{[k:string]:{timestamp:number, result:any}}
|
|
337
341
|
}
|
|
338
342
|
fieldDomain:{[k:string]:Partial<FieldDefinition>}
|
|
339
|
-
exts:{img
|
|
343
|
+
exts:{img:string[], normal:string[]}
|
|
340
344
|
optsGenericForAll:{allowedExts?:string[]}
|
|
341
345
|
sqls:{[k:string]:string}
|
|
342
346
|
messages:{[k:string]:string}
|
package/lib/backend-plus.js
CHANGED
|
@@ -2515,7 +2515,7 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
|
|
|
2515
2515
|
lines.push('create table '+cualQuoteTableName+' (');
|
|
2516
2516
|
var fields=[];
|
|
2517
2517
|
tableDef.fields.forEach(function(fieldDef){
|
|
2518
|
-
if(!fieldDef.clientSide && fieldDef.inTable!==false && !(tableDef.sql.fields[fieldDef.name]||{}).expr || fieldDef.inTable){
|
|
2518
|
+
if(!fieldDef.clientSide && fieldDef.inTable!==false && !fieldDef.inJoin && !(tableDef.sql.fields[fieldDef.name]||{}).expr || fieldDef.inTable){
|
|
2519
2519
|
var fieldType=typeDb[fieldDef.typeName]||'"'+fieldDef.typeName+'"';
|
|
2520
2520
|
if(fieldDef.sizeByte==4){
|
|
2521
2521
|
fieldType = 'integer';
|
|
@@ -2726,7 +2726,7 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
|
|
|
2726
2726
|
if(!defField && !fieldName.startsWith('!')){
|
|
2727
2727
|
throw new Error('field '+fieldName+' does no exists in .tab for '+tableName+' in '+path);
|
|
2728
2728
|
}
|
|
2729
|
-
return !fieldName.startsWith('!') && defField.inTable!==false && (!defField.clientSide || defField.serverSide) && !defField.generatedAs;
|
|
2729
|
+
return !fieldName.startsWith('!') && defField.inTable!==false && !defField.inJoin && (!defField.clientSide || defField.serverSide) && !defField.generatedAs;
|
|
2730
2730
|
}
|
|
2731
2731
|
if(/[-[]/.test(content[0])){
|
|
2732
2732
|
var filterField2=function(_value,fieldName){
|
package/lib/table-def-adapt.js
CHANGED
|
@@ -195,7 +195,7 @@ function tableDefAdapt(tableDef, context){
|
|
|
195
195
|
}
|
|
196
196
|
exprAs=resultTableDef.sql.fields[fieldDef.name].expr+' as ';
|
|
197
197
|
}else{
|
|
198
|
-
resultName=be.db.quoteIdent(resultTableDef.alias)+'.'+resultName;
|
|
198
|
+
resultName=be.db.quoteIdent(fieldDef.inJoin ?? resultTableDef.alias)+'.'+resultName;
|
|
199
199
|
}
|
|
200
200
|
return exprAs+resultName;
|
|
201
201
|
}
|
|
@@ -241,6 +241,9 @@ function tableDefAdapt(tableDef, context){
|
|
|
241
241
|
}
|
|
242
242
|
resultTableDef.sql.from = `( select *, ${otherColumns} from ${resultTableDef.sql.from}) as ${be.db.quoteIdent(resultTableDef.alias)}`
|
|
243
243
|
}
|
|
244
|
+
if(resultTableDef.sql.join){
|
|
245
|
+
resultTableDef.sql.from += '\n'+resultTableDef.sql.join;
|
|
246
|
+
}
|
|
244
247
|
if(resultTableDef.sql.logicalDeletes){
|
|
245
248
|
resultTableDef.sql.where=(resultTableDef.sql.where?'('+resultTableDef.sql.where+') and ':'')+
|
|
246
249
|
be.db.quoteIdent(resultTableDef.sql.logicalDeletes.fieldName)+
|
|
@@ -259,7 +262,7 @@ function tableDefAdapt(tableDef, context){
|
|
|
259
262
|
var lastSourceField=null;
|
|
260
263
|
fkDef.alias = fkDef.alias || fkDef.label || fkTableDef.alias;
|
|
261
264
|
fkDef.displayFields = fkDef.displayAllFields?
|
|
262
|
-
(fkTableDef.fields.filter(fd=>fd.visible && !fd.clientSide && !resultTableDef.field[fd.name]
|
|
265
|
+
(fkTableDef.fields.filter(fd=>fd.visible && !fd.clientSide && !resultTableDef.field[fd.name] && !fd.inJoin && !fkTableDef.sql.fields[fd.name]).map(fd=>fd.name)): //EVALUAR SI ESTÁ BIEN COMENTARLO
|
|
263
266
|
fkDef.displayFields || fkTableDef.nameFields;
|
|
264
267
|
resultTableDef.sql.from += '\n left join ' + fkTableDef.sql.fromWoAs + ' as ' + fkDef.alias + ' on ' +
|
|
265
268
|
fkDef.fields.map(function(pair){
|
|
@@ -342,7 +345,7 @@ tableDefAdapt.forInsertOnly = function forInsertOnly(tableDef){
|
|
|
342
345
|
tableDef.fields.sort(bestGlobals.compareForOrder([{column:'orderForInsertOnly'}]))
|
|
343
346
|
tableDef.sql.select = tableDef.fields.map(function(fieldDef){
|
|
344
347
|
var typer=TypeStore.typerFrom(fieldDef);
|
|
345
|
-
return fieldDef.inTable===false && tableDef.sql.fields[fieldDef.name] ?"null::"+typer.typeDbPg+" as "+JSON.stringify(fieldDef.name):(
|
|
348
|
+
return (fieldDef.inTable===false || fieldDef.inJoin) && tableDef.sql.fields[fieldDef.name] ?"null::"+typer.typeDbPg+" as "+JSON.stringify(fieldDef.name):(
|
|
346
349
|
fieldDef.referencedName?(
|
|
347
350
|
JSON.stringify(fieldDef.referencedAlias)+"."+JSON.stringify(fieldDef.referencedName)+" as "+JSON.stringify(fieldDef.name)
|
|
348
351
|
):(
|
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.13.3",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"best-globals": "~1.0.0",
|
|
34
34
|
"big.js": "^6.1.1",
|
|
35
35
|
"body-parser": "^1.19.0",
|
|
36
|
-
"cast-error": "^0.0
|
|
36
|
+
"cast-error": "^0.1.0",
|
|
37
37
|
"castellano": "~0.1.3",
|
|
38
38
|
"connect-pg-simple": "^7.0.0",
|
|
39
|
-
"cookie-parser": "^1.4.
|
|
39
|
+
"cookie-parser": "^1.4.6",
|
|
40
40
|
"dialog-promise": "~0.9.14",
|
|
41
41
|
"discrepances": "~0.2.6",
|
|
42
42
|
"express": "^4.17.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"login-plus": "^1.6.2",
|
|
53
53
|
"memorystore": "^1.6.6",
|
|
54
54
|
"mini-tools": "^1.11.1",
|
|
55
|
-
"nodemailer": "^6.7.
|
|
55
|
+
"nodemailer": "^6.7.1",
|
|
56
56
|
"moment": "^2.29.1",
|
|
57
57
|
"multiparty": "^4.2.2",
|
|
58
58
|
"numeral": "^2.0.6",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"stack-trace": "~0.0.10",
|
|
70
70
|
"stylus": "~0.55.0",
|
|
71
71
|
"type-store": "~0.2.41",
|
|
72
|
-
"typed-controls": "~0.9.
|
|
73
|
-
"xlsx": "^0.17.
|
|
72
|
+
"typed-controls": "~0.9.1",
|
|
73
|
+
"xlsx": "^0.17.4",
|
|
74
74
|
"xlsx-style": "^0.8.13"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
@@ -79,18 +79,18 @@
|
|
|
79
79
|
"@types/express": "^4.17.13",
|
|
80
80
|
"@types/express-useragent": "^1.0.1",
|
|
81
81
|
"@types/fs-extra": "^9.0.13",
|
|
82
|
-
"@types/js-yaml": "^4.0.
|
|
82
|
+
"@types/js-yaml": "^4.0.5",
|
|
83
83
|
"@types/mocha": "^9.0.0",
|
|
84
84
|
"@types/nodemailer": "^6.4.4",
|
|
85
85
|
"@types/multiparty": "~0.0.33",
|
|
86
|
-
"@types/node": "^16.11.
|
|
86
|
+
"@types/node": "^16.11.9",
|
|
87
87
|
"@types/numeral": "~2.0.2",
|
|
88
88
|
"@types/session-file-store": "^1.2.2",
|
|
89
89
|
"@types/stack-trace": "~0.0.29",
|
|
90
90
|
"@types/websql": "~0.0.27",
|
|
91
91
|
"esprima": "^4.0.1",
|
|
92
92
|
"expect.js": "~0.3.1",
|
|
93
|
-
"karma": "6.3.
|
|
93
|
+
"karma": "6.3.9",
|
|
94
94
|
"karma-chrome-launcher": "^3.1.0",
|
|
95
95
|
"karma-expect": "^1.1.3",
|
|
96
96
|
"karma-firefox-launcher": "^2.1.2",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"sinon": "^12.0.1",
|
|
104
104
|
"supertest": "^6.1.6",
|
|
105
105
|
"types.d.ts": "~0.6.4",
|
|
106
|
-
"typescript": "^4.
|
|
106
|
+
"typescript": "^4.5.2",
|
|
107
107
|
"why-is-node-running": "^2.2.0"
|
|
108
108
|
},
|
|
109
109
|
"engines": {
|
package/unlogged/my-ajax.js
CHANGED
|
@@ -493,7 +493,7 @@ function agregar_json(div, o, ubicaciones=agregar_json_default_ubicaciones){
|
|
|
493
493
|
if(o == null){
|
|
494
494
|
return ;
|
|
495
495
|
}
|
|
496
|
-
if(typeof o == "object" && !(o instanceof Date) &&
|
|
496
|
+
if(typeof o == "object" && !(o instanceof Date) && !o.isRealDateTime){
|
|
497
497
|
if(o instanceof Array && o[0] && o[0] instanceof Object && !(o[0] instanceof Array) && !(o[0].isRealDateTime)){
|
|
498
498
|
var table = document.createElement('table');
|
|
499
499
|
div.appendChild(table);
|
|
@@ -550,6 +550,8 @@ function agregar_json(div, o, ubicaciones=agregar_json_default_ubicaciones){
|
|
|
550
550
|
div.className='plain-content';
|
|
551
551
|
if(typeof o == "boolean"){
|
|
552
552
|
div.textContent = o?'Sí':'No'
|
|
553
|
+
}else if(o && o instanceof Date && o.isRealDate){
|
|
554
|
+
div.textContent = o.toDmy();
|
|
553
555
|
}else{
|
|
554
556
|
div.textContent = o.toLocaleString();
|
|
555
557
|
}
|