backend-plus 1.16.2 → 1.16.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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @function
3
+ * @template T extends {}
4
+ * @param {T & {name?:string|null|undefined}} obj
5
+ * @param {string} n
6
+ * @return {obj is T}
7
+ */
8
+ function addName(obj, n) {
9
+ obj.name = n;
10
+ }
11
+
12
+ let thing = {size: "medium"};
13
+ addName(thing, "product");
14
+ var other = thing;
15
+ console.log(thing.name);
@@ -75,6 +75,7 @@ myOwn.i18n.messages.en=changing(myOwn.i18n.messages.en, {
75
75
  lessDetails: "hide details",
76
76
  lessEqualThan:'less equal than',
77
77
  loading: "loading",
78
+ newUnsavedRow: "new unsaved row",
78
79
  notEmpty:'not empty',
79
80
  notSimilarTo:'not similar to',
80
81
  numberExportedRows:"Rows exported",
@@ -143,6 +144,7 @@ myOwn.i18n.messages.es=changing(myOwn.i18n.messages.es, {
143
144
  lessDetails: "dejar de mostrar los detalles asocialdos al registro",
144
145
  lessEqualThan:'menor igual que',
145
146
  loading: "cargando",
147
+ newUnsavedRow: "el nuevo registro (aun no grabado)",
146
148
  notEmpty:'no vacío',
147
149
  notSimilarTo:'no contiene',
148
150
  numberExportedRows:"Filas exportadas",
@@ -2008,6 +2010,18 @@ myOwn.TableGrid.prototype.prepareGrid = function prepareGrid(){
2008
2010
  myOwn.specialDefaultValue={
2009
2011
  current_date:function(){ return myOwn.config.currentDate||bestGlobals.date.today(); },
2010
2012
  next_number:function(fieldName, aboveDepot, belowDepot){
2013
+ var manager = aboveDepot.manager ?? belowDepot.manager
2014
+ if(!manager){
2015
+ return 1;
2016
+ }else{
2017
+ var max = 0;
2018
+ for(var depot of manager.depots){
2019
+ if(Number(depot.row[fieldName]) > max){
2020
+ max = Number(depot.row[fieldName])
2021
+ }
2022
+ }
2023
+ return max + 1;
2024
+ }
2011
2025
  return belowDepot.row[fieldName]?belowDepot.row[fieldName]+1:(
2012
2026
  aboveDepot.row[fieldName]?aboveDepot.row[fieldName]-1:1
2013
2027
  );
@@ -2577,7 +2591,7 @@ myOwn.TableGrid.prototype.displayAsDeleted = function displayAsDeleted(depot){
2577
2591
 
2578
2592
  myOwn.confirmDelete=function confirmDelete(depot, opts){
2579
2593
  return depot.my.showQuestion(
2580
- depot.my.messages.Delete+' '+JSON.stringify(depot.primaryKeyValues)+' ?',
2594
+ depot.my.messages.Delete+' '+(depot.primaryKeyValues === false ? depot.my.messages.newUnsavedRow : JSON.stringify(depot.primaryKeyValues))+' ?',
2581
2595
  {askForNoRepeat:depot.my.messages.Delete+', '+depot.def.name}
2582
2596
  );
2583
2597
  }
@@ -750,17 +750,24 @@ myOwn.captureKeys = function captureKeys() {
750
750
  }
751
751
  if(evento.which==115 && evento.shiftKey && !evento.ctrlKey && !evento.altKey && !evento.metaKey){ // F4
752
752
  var info=tableInfo(this.activeElement);
753
+ var getRefCell = function(delta){
754
+ var refPos=info.tr.rowIndex + delta;
755
+ var refRow=info.table.rows[refPos];
756
+ if(refRow){
757
+ var candidateCell = refRow.cells[info.td.cellIndex];
758
+ if(candidateCell.getTypedValue){
759
+ return candidateCell;
760
+ }
761
+ }
762
+ return null;
763
+ }
753
764
  if(info.table){
754
- var abovePos=info.tr.rowIndex-1;
755
- var aboveRow=info.table.rows[abovePos];
756
- if(aboveRow){
757
- var aboveCell = aboveRow.cells[info.td.cellIndex];
758
- if(aboveCell.getTypedValue){
759
- var value=aboveCell.getTypedValue();
760
- if(info.td.setTypedValue){
761
- info.td.setTypedValue(value, true);
762
- goRight();
763
- }
765
+ var refCell = getRefCell(-1) || getRefCell(1);
766
+ if(refCell){
767
+ var value=refCell.getTypedValue();
768
+ if(info.td.setTypedValue){
769
+ info.td.setTypedValue(value, true);
770
+ goRight();
764
771
  }
765
772
  }
766
773
  }
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.2",
4
+ "version": "1.16.3",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -39,10 +39,10 @@
39
39
  "cookie-parser": "^1.4.6",
40
40
  "dialog-promise": "^0.9.15",
41
41
  "discrepances": "^0.2.6",
42
- "express": "^4.17.3",
42
+ "express": "^4.18.1",
43
43
  "express-session": "^1.17.2",
44
44
  "express-useragent": "^1.0.15",
45
- "fs-extra": "^10.0.1",
45
+ "fs-extra": "^10.1.0",
46
46
  "js-to-html": "^1.3.1",
47
47
  "js-yaml": "^4.1.0",
48
48
  "json4all": "^1.1.0",
@@ -52,8 +52,8 @@
52
52
  "login-plus": "^1.6.2",
53
53
  "memorystore": "^1.6.7",
54
54
  "mini-tools": "^1.11.2",
55
- "nodemailer": "^6.7.3",
56
- "moment": "^2.29.2",
55
+ "nodemailer": "^6.7.5",
56
+ "moment": "^2.29.3",
57
57
  "multiparty": "^4.2.3",
58
58
  "numeral": "^2.0.6",
59
59
  "pg-promise-strict": "^1.2.6",
@@ -80,31 +80,31 @@
80
80
  "@types/express-useragent": "^1.0.2",
81
81
  "@types/fs-extra": "^9.0.13",
82
82
  "@types/js-yaml": "^4.0.5",
83
- "@types/mocha": "^9.1.0",
83
+ "@types/mocha": "^9.1.1",
84
84
  "@types/nodemailer": "^6.4.4",
85
85
  "@types/multiparty": "~0.0.33",
86
- "@types/node": "^17.0.23",
86
+ "@types/node": "^17.0.31",
87
87
  "@types/numeral": "~2.0.2",
88
88
  "@types/session-file-store": "^1.2.2",
89
- "@types/stack-trace": "~0.0.29",
89
+ "@types/stack-trace": "~0.0.30",
90
90
  "@types/websql": "~0.0.27",
91
91
  "esprima": "^4.0.1",
92
92
  "expect.js": "~0.3.1",
93
- "karma": "6.3.17",
93
+ "karma": "6.3.19",
94
94
  "karma-chrome-launcher": "^3.1.1",
95
95
  "karma-expect": "^1.1.3",
96
96
  "karma-firefox-launcher": "^2.1.2",
97
97
  "karma-ie-launcher": "^1.0.0",
98
98
  "karma-mocha": "^2.0.1",
99
99
  "kill-9": "~0.4.3",
100
- "mocha": "^9.2.2",
100
+ "mocha": "^10.0.0",
101
101
  "nyc": "^15.1.0",
102
- "puppeteer": "^13.5.2",
103
- "sinon": "^13.0.1",
104
- "supertest": "^6.2.2",
102
+ "puppeteer": "^13.7.0",
103
+ "sinon": "^14.0.0",
104
+ "supertest": "^6.2.3",
105
105
  "types.d.ts": "~0.6.7",
106
- "typescript": "^4.6.3",
107
- "why-is-node-running": "^2.2.1"
106
+ "typescript": "^4.6.4",
107
+ "why-is-node-running": "^2.2.2"
108
108
  },
109
109
  "engines": {
110
110
  "node": ">= 10"