backend-plus 1.16.3 → 1.16.6
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-tables.js +57 -15
- package/for-client/my-things.js +2 -1
- package/lib/backend-plus.d.ts +5 -0
- package/package.json +6 -6
package/for-client/my-tables.js
CHANGED
|
@@ -178,17 +178,41 @@ myOwn.i18n.messages.es=changing(myOwn.i18n.messages.es, {
|
|
|
178
178
|
zoom: "zoom",
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
/** @param {string} text */
|
|
182
|
+
function regex4search(text){
|
|
183
|
+
return new RegExp(
|
|
184
|
+
text.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
185
|
+
// .replace(/"/g,"\\b")
|
|
186
|
+
.replace(/[ñÑ]/g,'(?:gn|nn?i?|[ñÑ])')
|
|
187
|
+
.replace(/[cCçÇ]/g,'[cçÇ]')
|
|
188
|
+
.replace(/[áÁàÀäÄãÃ]/gi,'[AáÁàÀäÄãÃ]')
|
|
189
|
+
.replace(/[éÉèÈëË]/gi,'[EéÉèÈëË]')
|
|
190
|
+
.replace(/[íÍìÌïÏ]/gi,'[IíÍìÌïÏ]')
|
|
191
|
+
.replace(/[óÓòÒöÖõÕ]/gi,'[OóÓòÒöÖõÕ]')
|
|
192
|
+
.replace(/[úÚùÙüÜ]/gi,'[UúÚùÙüÜ]')
|
|
193
|
+
.replace(/a/gi,'[AáÁàÀäÄãÃ]')
|
|
194
|
+
.replace(/e/gi,'[EéÉèÈëË]')
|
|
195
|
+
.replace(/i/gi,'[IíÍìÌïÏ]')
|
|
196
|
+
.replace(/o/gi,'[OóÓòÒöÖõÕ]')
|
|
197
|
+
.replace(/u/gi,'[UúÚùÙüÜ]')
|
|
198
|
+
// .replace(/\s+/g,'.*\\s+.*') mas estricto, exige el espacio
|
|
199
|
+
.replace(/\s+/g,'.*')
|
|
200
|
+
, 'i');
|
|
201
|
+
}
|
|
182
202
|
|
|
183
203
|
myOwn.firstDisplayCount = 20;
|
|
184
204
|
myOwn.firstDisplayOverLimit = 30;
|
|
185
205
|
myOwn.displayCountBreaks = [100,250,1000];
|
|
186
206
|
myOwn.displayCountBreaks = [50,100,500];
|
|
187
207
|
myOwn.comparatorWidth = 16;
|
|
208
|
+
myOwn.comparatorParameterNull={
|
|
209
|
+
'\u2205':true,
|
|
210
|
+
'!=\u2205':true,
|
|
211
|
+
}
|
|
188
212
|
myOwn.comparator={
|
|
189
213
|
'=':function(valueToCheck,condition){return valueToCheck == condition;},
|
|
190
|
-
'~':function(valueToCheck,condition){return condition==null ||
|
|
191
|
-
'!~':function(valueToCheck,condition){return condition==null || !
|
|
214
|
+
'~':function(valueToCheck,condition){return condition==null || regex4search(condition.toString()).test(valueToCheck);},
|
|
215
|
+
'!~':function(valueToCheck,condition){return condition==null || !regex4search(condition.toString()).test(valueToCheck);},
|
|
192
216
|
'/R/i':function(valueToCheck,condition){return condition==null || RegExp(condition,'i').test(valueToCheck);},
|
|
193
217
|
'\u2205':function(valueToCheck,condition){return valueToCheck == null;},//\u2205 = conjunto vacío
|
|
194
218
|
'!=\u2205':function(valueToCheck,condition){return valueToCheck != null;},//\u2205 = conjunto vacío
|
|
@@ -749,12 +773,28 @@ myOwn.ActionColumnGrid.prototype.th = function th(){
|
|
|
749
773
|
};
|
|
750
774
|
|
|
751
775
|
myOwn.ActionColumnGrid.prototype.thFilter = function thFilter(depot){
|
|
752
|
-
var buttonFilter=html.button({id:'button-filter'},myOwn.messages.Filter+"!").create();
|
|
753
776
|
var grid = this.grid;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
777
|
+
if(depot.firstFilter){
|
|
778
|
+
var buttonFilter=html.button({id:'button-filter'},myOwn.messages.Filter+"!").create();
|
|
779
|
+
buttonFilter.addEventListener('click',function(){
|
|
780
|
+
grid.updateFilterInfo(' (F) ');
|
|
781
|
+
grid.displayBody();
|
|
782
|
+
});
|
|
783
|
+
}else{
|
|
784
|
+
var buttonFilter=html.button({class:'table-button', 'when-filter':'yes', "skip-enter":true}, [
|
|
785
|
+
html.img({
|
|
786
|
+
src:my.path.img+'destroy-filter.png',
|
|
787
|
+
alt:'FILTER OFF',
|
|
788
|
+
title:my.messages.filterOff
|
|
789
|
+
})
|
|
790
|
+
]).create();
|
|
791
|
+
buttonFilter.addEventListener('click',function(){
|
|
792
|
+
// HACIENDO
|
|
793
|
+
grid.view.filter = grid.view.filter.filter(d=>d!=depot);
|
|
794
|
+
var info = my.tableInfo(this);
|
|
795
|
+
info.tr.parentNode.removeChild(info.tr);
|
|
796
|
+
});
|
|
797
|
+
}
|
|
758
798
|
return html.th([buttonFilter]);
|
|
759
799
|
};
|
|
760
800
|
|
|
@@ -2400,6 +2440,7 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2400
2440
|
grid.sizesForFilters=Array.prototype.map.call(grid.dom.table.rows[0].cells,function(cell){
|
|
2401
2441
|
return cell.offsetWidth;
|
|
2402
2442
|
});
|
|
2443
|
+
// HACIENDO
|
|
2403
2444
|
var depot = {
|
|
2404
2445
|
special: 'filter',
|
|
2405
2446
|
my: grid.my,
|
|
@@ -2411,7 +2452,8 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2411
2452
|
rowSymbols: {},
|
|
2412
2453
|
isFilterPending:false,
|
|
2413
2454
|
tr: tr,
|
|
2414
|
-
actionButton:{}
|
|
2455
|
+
actionButton:{},
|
|
2456
|
+
firstFilter: !otherRow
|
|
2415
2457
|
};
|
|
2416
2458
|
if(!grid.hasFilterRow){
|
|
2417
2459
|
grid.hasFilterRow=[];
|
|
@@ -2424,11 +2466,8 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2424
2466
|
}
|
|
2425
2467
|
var tr=html.tr({'class':'filter-line'}, grid.columns.map(function(column, iColumn){
|
|
2426
2468
|
return column.thFilter(depot, iColumn);
|
|
2427
|
-
}).filter(function(th,iColumn){
|
|
2428
|
-
return iColumn || !grid.hasFilterRow.length;
|
|
2429
2469
|
})).create();
|
|
2430
2470
|
grid.hasFilterRow.push(tr);
|
|
2431
|
-
grid.hasFilterRow[0].cells[0].rowSpan=grid.hasFilterRow.length;
|
|
2432
2471
|
grid.dom.table.setAttribute('has-filter',1);
|
|
2433
2472
|
if(grid.dom.table.tHead){ //TODO: el filtro para verticales debe organizarse sin tr
|
|
2434
2473
|
grid.dom.table.tHead.appendChild(tr);
|
|
@@ -2445,15 +2484,18 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2445
2484
|
while(iFilter<filterRows.length){
|
|
2446
2485
|
var filterData=filterRows[iFilter];
|
|
2447
2486
|
var partialOk=true;
|
|
2487
|
+
var columnsCompared = 0;
|
|
2448
2488
|
for(var column in depot.row){
|
|
2449
|
-
|
|
2450
|
-
|
|
2489
|
+
var compSymb = filterData.rowSymbols[column];
|
|
2490
|
+
if(compSymb && my.comparator[compSymb] && (my.comparatorParameterNull[compSymb] || filterData.row[column] != null)){
|
|
2491
|
+
var isSatisfied=my.comparator[compSymb](depot.row[column],filterData.row[column]);
|
|
2451
2492
|
if(!isSatisfied){
|
|
2452
2493
|
partialOk=false;
|
|
2453
2494
|
}
|
|
2495
|
+
columnsCompared++;
|
|
2454
2496
|
}
|
|
2455
2497
|
}
|
|
2456
|
-
if(partialOk){
|
|
2498
|
+
if(partialOk && columnsCompared){
|
|
2457
2499
|
return true;
|
|
2458
2500
|
}
|
|
2459
2501
|
iFilter++;
|
package/for-client/my-things.js
CHANGED
|
@@ -602,6 +602,8 @@ function tableInfo(element){
|
|
|
602
602
|
return info;
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
+
myOwn.tableInfo = tableInfo
|
|
606
|
+
|
|
605
607
|
function getCaretPosition(element) {
|
|
606
608
|
// https://stackoverflow.com/questions/4811822/get-a-ranges-start-and-end-offsets-relative-to-its-parent-container/4812022#4812022
|
|
607
609
|
var caretOffset = 0;
|
|
@@ -911,7 +913,6 @@ myOwn.createSmartButton = function createSmartButton(opts){
|
|
|
911
913
|
return button;
|
|
912
914
|
};
|
|
913
915
|
|
|
914
|
-
|
|
915
916
|
return myOwn;
|
|
916
917
|
|
|
917
918
|
});
|
package/lib/backend-plus.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import * as pg from "pg-promise-strict";
|
|
|
8
8
|
export * from "pg-promise-strict";
|
|
9
9
|
export type MotorDb = typeof pg;
|
|
10
10
|
|
|
11
|
+
export type LangId = 'en'|'es'|'etc...';
|
|
12
|
+
|
|
11
13
|
export type Server=net.Server;
|
|
12
14
|
|
|
13
15
|
export interface CoreFunctionParameters{
|
|
@@ -381,6 +383,9 @@ export class AppBackend{
|
|
|
381
383
|
isThisProcedureAllowed<T>(context:Context, procedureDef:ProcedureDef, params:{[key:string]:T}):Promise<boolean>
|
|
382
384
|
checkDatabaseStructure(client:Client):Promise<void>
|
|
383
385
|
getDbFunctions(opts:DumpOptions):Promise<{dumpText:string}[]>
|
|
386
|
+
i18n:{
|
|
387
|
+
messages:Record<LangId,Record<string, string>>
|
|
388
|
+
}
|
|
384
389
|
}
|
|
385
390
|
|
|
386
391
|
}
|
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.16.
|
|
4
|
+
"version": "1.16.6",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
31
32
|
"ajax-best-promise": "^0.3.7",
|
|
32
33
|
"backend-skins": "^0.1.15",
|
|
33
34
|
"best-globals": "^1.0.3",
|
|
@@ -48,13 +49,12 @@
|
|
|
48
49
|
"json4all": "^1.1.0",
|
|
49
50
|
"lazy-some": "^0.1.0",
|
|
50
51
|
"like-ar": "^0.3.6",
|
|
51
|
-
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
52
52
|
"login-plus": "^1.6.2",
|
|
53
53
|
"memorystore": "^1.6.7",
|
|
54
54
|
"mini-tools": "^1.11.2",
|
|
55
|
-
"nodemailer": "^6.7.5",
|
|
56
55
|
"moment": "^2.29.3",
|
|
57
56
|
"multiparty": "^4.2.3",
|
|
57
|
+
"nodemailer": "^6.7.5",
|
|
58
58
|
"numeral": "^2.0.6",
|
|
59
59
|
"pg-promise-strict": "^1.2.6",
|
|
60
60
|
"pikaday": "^1.8.2",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"session-file-store": "^1.5.0",
|
|
68
68
|
"sql-tools": "^0.1.2",
|
|
69
69
|
"stack-trace": "^0.0.10",
|
|
70
|
-
"stylus": "
|
|
70
|
+
"stylus": "0.56.0",
|
|
71
71
|
"type-store": "^0.2.41",
|
|
72
72
|
"typed-controls": "^0.10.0",
|
|
73
73
|
"xlsx": "^0.18.5",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"@types/fs-extra": "^9.0.13",
|
|
82
82
|
"@types/js-yaml": "^4.0.5",
|
|
83
83
|
"@types/mocha": "^9.1.1",
|
|
84
|
-
"@types/nodemailer": "^6.4.4",
|
|
85
84
|
"@types/multiparty": "~0.0.33",
|
|
86
85
|
"@types/node": "^17.0.31",
|
|
86
|
+
"@types/nodemailer": "^6.4.4",
|
|
87
87
|
"@types/numeral": "~2.0.2",
|
|
88
88
|
"@types/session-file-store": "^1.2.2",
|
|
89
89
|
"@types/stack-trace": "~0.0.30",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"test-ci": "(npm run prepublish || echo \"continue w/error\") && mocha --reporter spec --bail test/test*.js",
|
|
117
117
|
"test-good": "mocha --reporter spec --bail --check-leaks test/test*.js",
|
|
118
118
|
"example-pu": "node test/puppeteer/first-step.js",
|
|
119
|
-
"test-pu": "mocha --reporter spec --bail --check-leaks --globals cptable --globals QUOTE --globals __core-js_shared__ test/test-pu.js",
|
|
119
|
+
"test-pu": "node ./test/download_puppeteer && mocha --reporter spec --bail --check-leaks --globals cptable --globals QUOTE --globals __core-js_shared__ test/test-pu.js",
|
|
120
120
|
"test-server": "mocha --reporter spec --single-run --bail test/test.js",
|
|
121
121
|
"server-test": "node test/run-simple-backend.js",
|
|
122
122
|
"example-tables": "node examples/tables/server/server-tables.js --dir-x examples/tables",
|