backend-plus 2.0.0-beta.14 → 2.0.0-beta.16
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 +3 -0
- package/for-client/my-tables.js +11 -5
- package/lib/backend-plus.d.ts +2 -1
- package/lib/procedures-table.js +17 -2
- package/package.json +3 -3
- package/unlogged/my-ajax.js +1 -0
package/for-client/my-menu.js
CHANGED
|
@@ -56,6 +56,9 @@ myOwn.wScreens.table = function(addrParams){
|
|
|
56
56
|
if(addrParams.detailing){
|
|
57
57
|
opts.detailing=addrParams.detailing;
|
|
58
58
|
}
|
|
59
|
+
if(addrParams.pick){
|
|
60
|
+
opts.pick=addrParams.pick;
|
|
61
|
+
}
|
|
59
62
|
opts.detailingForUrl=opts.detailing||{};
|
|
60
63
|
opts.detailingPath = [];
|
|
61
64
|
var pageTitle = addrParams.label || addrParams.name || addrParams.table || my.config.config.title;
|
package/for-client/my-tables.js
CHANGED
|
@@ -294,6 +294,7 @@ myOwn.TableConnector = function(context, opts){
|
|
|
294
294
|
connector.opts = opts||{};
|
|
295
295
|
connector.fixedFields = connector.opts.fixedFields || [];
|
|
296
296
|
connector.fixedField = {};
|
|
297
|
+
connector.pick = connector.opts.pick;
|
|
297
298
|
connector.hideBecauseRelated = {};
|
|
298
299
|
connector.fixedFields.forEach(function(pair){
|
|
299
300
|
if(!pair.range && pair.value != myOwn.skipInFixedFields){
|
|
@@ -360,7 +361,8 @@ myOwn.TableConnector.prototype.getData = function getData(){
|
|
|
360
361
|
return connector.my.ajax.table_data({
|
|
361
362
|
table:connector.tableName,
|
|
362
363
|
fixedFields:connector.fixedFields,
|
|
363
|
-
paramfun:connector.parameterFunctions||{}
|
|
364
|
+
paramfun:connector.parameterFunctions||{},
|
|
365
|
+
pick:connector.pick
|
|
364
366
|
}).then(function(rows){
|
|
365
367
|
return connector.whenStructureReady.then(function(){
|
|
366
368
|
if(connector.getElementToDisplayCount){
|
|
@@ -447,6 +449,7 @@ myOwn.TableConnectorLocal = function(context, opts){
|
|
|
447
449
|
connector.opts = opts||{};
|
|
448
450
|
connector.fixedFields = connector.opts.fixedFields || [];
|
|
449
451
|
connector.fixedField = {};
|
|
452
|
+
connector.pick = connector.opts.pick;
|
|
450
453
|
connector.hideBecauseRelated = {};
|
|
451
454
|
connector.fixedFields.forEach(function(pair){
|
|
452
455
|
if(!pair.range && pair.value != myOwn.skipInFixedFields){
|
|
@@ -615,7 +618,8 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
615
618
|
await grid.connector.my.ajax.table_data({
|
|
616
619
|
table:grid.connector.tableName,
|
|
617
620
|
fixedFields:grid.connector.fixedFields,
|
|
618
|
-
paramfun:grid.connector.parameterFunctions||{}
|
|
621
|
+
paramfun:grid.connector.parameterFunctions||{},
|
|
622
|
+
pick:grid.connector.pick
|
|
619
623
|
}).then(function(rows){
|
|
620
624
|
var primaryKey = grid.def.primaryKey;
|
|
621
625
|
var getPrimaryKeyValues=function getPrimaryKeyValues(primaryKey, row){
|
|
@@ -695,10 +699,11 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
695
699
|
}
|
|
696
700
|
})
|
|
697
701
|
}
|
|
698
|
-
if(grid.def.refrescable){
|
|
702
|
+
if(grid.def.refrescable && !grid.def.forInsertOnlyMode){
|
|
703
|
+
if (window.currentAutofrefresh) clearInterval(window.currentAutofrefresh);
|
|
699
704
|
window.currentAutofrefresh = setInterval(grid.refreshAllRows,8000);
|
|
700
705
|
}
|
|
701
|
-
if (grid.def.selfRefresh) {
|
|
706
|
+
if (grid.def.selfRefresh && !grid.def.forInsertOnlyMode) {
|
|
702
707
|
var refresh = function refresh(){
|
|
703
708
|
grid.refreshAllRows();
|
|
704
709
|
}
|
|
@@ -2379,7 +2384,8 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2379
2384
|
table:depot.def.name,
|
|
2380
2385
|
fixedFields:grid.def.primaryKey.map(function(fieldName, i){
|
|
2381
2386
|
return {fieldName:fieldName, value:depot.primaryKeyValues[i]};
|
|
2382
|
-
})
|
|
2387
|
+
}),
|
|
2388
|
+
pick:grid.def.pick
|
|
2383
2389
|
}).then(function(result){
|
|
2384
2390
|
grid.depotRefresh(depot,{updatedRow:result[0], sendedForUpdate:{}}, opts);
|
|
2385
2391
|
})
|
package/lib/backend-plus.d.ts
CHANGED
|
@@ -319,7 +319,8 @@ export type TableDefinition = EditableDbDefinition & {
|
|
|
319
319
|
specialValidator?:string
|
|
320
320
|
saveAfter?:boolean
|
|
321
321
|
selfRefresh?:boolean
|
|
322
|
-
filterColumns?:{column:string, operator:string, value:any}[]
|
|
322
|
+
filterColumns?:{column:string, operator:string, value:any}[],
|
|
323
|
+
gridAlias?:string /* front-end css my-table = gridAlias */
|
|
323
324
|
}
|
|
324
325
|
export type OtherTableDefs = TableDefinition['sql']['otherTableDefs']
|
|
325
326
|
export interface DetailTable { table?: string, fields: FieldsForConnectDetailTable, abr: string, label?: string, refreshParent?:boolean, refreshFromParent?:boolean, wScreen?:string, condition?:string }
|
package/lib/procedures-table.js
CHANGED
|
@@ -9,6 +9,7 @@ var typeStore=require('type-store');
|
|
|
9
9
|
var likeAr=require('like-ar');
|
|
10
10
|
const f = require('session-file-store');
|
|
11
11
|
const { expected } = require('cast-error');
|
|
12
|
+
const bestGlobals = require('best-globals');
|
|
12
13
|
|
|
13
14
|
const PANIC_IMPORT = true;
|
|
14
15
|
|
|
@@ -76,13 +77,14 @@ ProcedureTables = [
|
|
|
76
77
|
parameters:[
|
|
77
78
|
{name: 'table', encoding:'plain'},
|
|
78
79
|
{name: 'fixedFields', defaultValue:[]},
|
|
79
|
-
{name: 'paramfun', defaultValue:[]}
|
|
80
|
+
{name: 'paramfun', defaultValue:[]},
|
|
81
|
+
{name: 'pick', defaultValue:'', encoding:'plain'}
|
|
80
82
|
],
|
|
81
83
|
coreFunction:
|
|
82
84
|
/**
|
|
83
85
|
*
|
|
84
86
|
* @param {*} context
|
|
85
|
-
* @param {{table:string, fixedFields:{fieldName:string, value:any, range:string}[], paramfun:string[]}} parameters
|
|
87
|
+
* @param {{table:string, fixedFields:{fieldName:string, value:any, range:string}[], paramfun:string[], pick:string}} parameters
|
|
86
88
|
*/
|
|
87
89
|
async function tableDatum(context, parameters){
|
|
88
90
|
var be=context.be;
|
|
@@ -155,6 +157,19 @@ ProcedureTables = [
|
|
|
155
157
|
return context.client.query(sql,
|
|
156
158
|
queryValues
|
|
157
159
|
).fetchAll().then(function(result){
|
|
160
|
+
if (parameters.pick) {
|
|
161
|
+
var pickParts = bestGlobals.hyperSimplifyText(parameters.pick).split(/\s+/).filter(p => p);
|
|
162
|
+
return result.rows.filter(row => {
|
|
163
|
+
var line = likeAr(row).join(' ').trim().split(/\s+/);
|
|
164
|
+
return pickParts.every(palabraBuscada =>
|
|
165
|
+
line.map(p => bestGlobals.hyperSimplifyText(p)).filter(palabra =>
|
|
166
|
+
palabraBuscada.length <= 3
|
|
167
|
+
? palabra == palabraBuscada
|
|
168
|
+
: palabra.includes(palabraBuscada)
|
|
169
|
+
).length
|
|
170
|
+
)
|
|
171
|
+
});
|
|
172
|
+
}
|
|
158
173
|
return result.rows;
|
|
159
174
|
}).catch(function(err){
|
|
160
175
|
throw err;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-plus",
|
|
3
3
|
"description": "Backend for the anti Pareto rule",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.16",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@types/js-yaml": "^4.0.9",
|
|
82
82
|
"@types/mocha": "^10.0.6",
|
|
83
83
|
"@types/multiparty": "~0.0.36",
|
|
84
|
-
"@types/node": "^20.
|
|
84
|
+
"@types/node": "^20.11.0",
|
|
85
85
|
"@types/nodemailer": "^6.4.14",
|
|
86
86
|
"@types/numeral": "~2.0.5",
|
|
87
87
|
"@types/session-file-store": "^1.2.5",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"kill-9": "~0.4.3",
|
|
99
99
|
"mocha": "^10.2.0",
|
|
100
100
|
"nyc": "^15.1.0",
|
|
101
|
-
"puppeteer": "^21.
|
|
101
|
+
"puppeteer": "^21.7.0",
|
|
102
102
|
"sinon": "^17.0.1",
|
|
103
103
|
"supertest": "^6.3.3",
|
|
104
104
|
"types.d.ts": "~0.6.21",
|
package/unlogged/my-ajax.js
CHANGED
|
@@ -593,6 +593,7 @@ myAjax.UriSearchToObjectParams={
|
|
|
593
593
|
td :{ encode:function(x){ return json4all.toUrl(x); }, decode:function(x){ return json4all.parse(x)} },
|
|
594
594
|
today :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return bestGlobals.date.iso((x+'').substr(0,10))} },
|
|
595
595
|
section :{ showInMenu:true , encode:noChange , decode:noChange },
|
|
596
|
+
pick :{ encode:noChange , decode:noChange },
|
|
596
597
|
directUrl :{ hide:true },
|
|
597
598
|
selectedByDefault:{ hide:true },
|
|
598
599
|
showParams :{ hide:true },
|