tryton-sao 6.2.3 → 6.2.4
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/CHANGELOG +3 -0
- package/COPYRIGHT +1 -1
- package/dist/tryton-sao.js +63 -35
- package/dist/tryton-sao.min.js +2 -2
- package/package.json +1 -1
- package/src/pyson.js +1 -1
- package/src/view/tree.js +62 -34
- package/tests/sao.js +14 -0
package/package.json
CHANGED
package/src/pyson.js
CHANGED
package/src/view/tree.js
CHANGED
|
@@ -202,6 +202,23 @@
|
|
|
202
202
|
this.table.append(this.tfoot);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
if (this.children_field) {
|
|
206
|
+
this.expander = jQuery('<span/>', {
|
|
207
|
+
'class': 'expander',
|
|
208
|
+
}).append(jQuery('<img/>', {
|
|
209
|
+
'tabindex': 0,
|
|
210
|
+
'class': 'icon',
|
|
211
|
+
}));
|
|
212
|
+
this.update_expander('more');
|
|
213
|
+
this.expander.on('click keypress',
|
|
214
|
+
Sao.common.click_press(this.unfold.bind(this)));
|
|
215
|
+
Sao.common.ICONFACTORY.get_icon_url(
|
|
216
|
+
'tryton-unfold-' + this.expander.action)
|
|
217
|
+
.then(function(url) {
|
|
218
|
+
this.expander.children().attr('src', url);
|
|
219
|
+
}.bind(this));
|
|
220
|
+
}
|
|
221
|
+
|
|
205
222
|
this.columns.forEach(function(column, i) {
|
|
206
223
|
col = jQuery('<col/>', {
|
|
207
224
|
'class': column.attributes.widget,
|
|
@@ -209,23 +226,6 @@
|
|
|
209
226
|
th = jQuery('<th/>', {
|
|
210
227
|
'class': column.attributes.widget,
|
|
211
228
|
});
|
|
212
|
-
if ((i === 0) && this.children_field) {
|
|
213
|
-
this.expander = jQuery('<img/>', {
|
|
214
|
-
'tabindex': 0,
|
|
215
|
-
'class': 'icon',
|
|
216
|
-
});
|
|
217
|
-
this.update_expander('more');
|
|
218
|
-
this.expander.on('click keypress',
|
|
219
|
-
Sao.common.click_press(this.unfold.bind(this)));
|
|
220
|
-
Sao.common.ICONFACTORY.get_icon_url(
|
|
221
|
-
'tryton-unfold-' + this.expander.action)
|
|
222
|
-
.then(function(url) {
|
|
223
|
-
this.expander.attr('src', url);
|
|
224
|
-
}.bind(this));
|
|
225
|
-
th.append(jQuery('<span>', {
|
|
226
|
-
'class': 'expander',
|
|
227
|
-
}).append(this.expander));
|
|
228
|
-
}
|
|
229
229
|
var label = jQuery('<label/>')
|
|
230
230
|
.text(column.attributes.string)
|
|
231
231
|
.attr('title', column.attributes.string);
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
Sao.common.ICONFACTORY.get_icon_url(
|
|
317
317
|
'tryton-unfold-' + this.expander.action)
|
|
318
318
|
.then(function(url) {
|
|
319
|
-
this.expander.attr('src', url);
|
|
319
|
+
this.expander.children().attr('src', url);
|
|
320
320
|
}.bind(this));
|
|
321
321
|
if (jQuery.isEmptyObject(this.selected_records)) {
|
|
322
322
|
this.expander.css('visibility', 'hidden');
|
|
@@ -758,8 +758,8 @@
|
|
|
758
758
|
!column.col.hasClass('selection-state') &&
|
|
759
759
|
!column.col.hasClass('favorite')) {
|
|
760
760
|
var width, c_width;
|
|
761
|
-
if (column.width) {
|
|
762
|
-
width = c_width = column.width;
|
|
761
|
+
if (column.attributes.width) {
|
|
762
|
+
width = c_width = column.attributes.width;
|
|
763
763
|
min_width.push(width + 'px');
|
|
764
764
|
} else {
|
|
765
765
|
width = {
|
|
@@ -786,6 +786,19 @@
|
|
|
786
786
|
column.col.show();
|
|
787
787
|
}
|
|
788
788
|
}.bind(this));
|
|
789
|
+
if (this.children_field) {
|
|
790
|
+
this.columns.every(function(column) {
|
|
791
|
+
if (column.col.hasClass('draggable-handle') ||
|
|
792
|
+
column.header.hasClass('invisible')) {
|
|
793
|
+
return true;
|
|
794
|
+
} else {
|
|
795
|
+
if (this.expander.parent()[0] !== column.header[0]) {
|
|
796
|
+
column.header.prepend(this.expander);
|
|
797
|
+
}
|
|
798
|
+
return false;
|
|
799
|
+
}
|
|
800
|
+
}.bind(this));
|
|
801
|
+
}
|
|
789
802
|
this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
|
|
790
803
|
this.scrollbar.css('min-width', this.table.css('min-width'));
|
|
791
804
|
this.tbody.find('tr.more-row > td').attr(
|
|
@@ -1381,6 +1394,18 @@
|
|
|
1381
1394
|
this.select_column(event_.data.index);
|
|
1382
1395
|
}.bind(this);
|
|
1383
1396
|
|
|
1397
|
+
if (this.children_field) {
|
|
1398
|
+
this.expander = jQuery('<span/>', {
|
|
1399
|
+
'class': 'expander',
|
|
1400
|
+
}).append('<img/>', {
|
|
1401
|
+
'tabindex': 0,
|
|
1402
|
+
'class': 'icon',
|
|
1403
|
+
});
|
|
1404
|
+
this.expander.children().html(' ');
|
|
1405
|
+
this.expander.on('click keypress',
|
|
1406
|
+
Sao.common.click_press(this.toggle_row.bind(this)));
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1384
1409
|
for (var i = 0; i < this.tree.columns.length; i++) {
|
|
1385
1410
|
var column = this.tree.columns[i];
|
|
1386
1411
|
if (column instanceof Sao.View.Tree.ButtonColumn) {
|
|
@@ -1408,18 +1433,6 @@
|
|
|
1408
1433
|
'class': 'cell',
|
|
1409
1434
|
});
|
|
1410
1435
|
td.append(cell);
|
|
1411
|
-
if ((i === 0) && this.children_field) {
|
|
1412
|
-
this.expander = jQuery('<img/>', {
|
|
1413
|
-
'tabindex': 0,
|
|
1414
|
-
'class': 'icon',
|
|
1415
|
-
});
|
|
1416
|
-
this.expander.html(' ');
|
|
1417
|
-
this.expander.on('click keypress',
|
|
1418
|
-
Sao.common.click_press(this.toggle_row.bind(this)));
|
|
1419
|
-
cell.append(jQuery('<span/>', {
|
|
1420
|
-
'class': 'expander'
|
|
1421
|
-
}).append(this.expander));
|
|
1422
|
-
}
|
|
1423
1436
|
var j;
|
|
1424
1437
|
if (column.prefixes) {
|
|
1425
1438
|
for (j = 0; j < column.prefixes.length; j++) {
|
|
@@ -1532,6 +1545,21 @@
|
|
|
1532
1545
|
}
|
|
1533
1546
|
}
|
|
1534
1547
|
}
|
|
1548
|
+
if (this.children_field) {
|
|
1549
|
+
this.tree.columns.every(function(column, i) {
|
|
1550
|
+
if (column.col.hasClass('draggable-handle') ||
|
|
1551
|
+
column.header.hasClass('invisible')) {
|
|
1552
|
+
return true;
|
|
1553
|
+
} else {
|
|
1554
|
+
var td = this._get_column_td(i);
|
|
1555
|
+
var cell = td.find('.cell');
|
|
1556
|
+
if (this.expander.parent()[0] !== cell[0]) {
|
|
1557
|
+
cell.prepend(this.expander);
|
|
1558
|
+
}
|
|
1559
|
+
return false;
|
|
1560
|
+
}
|
|
1561
|
+
}.bind(this));
|
|
1562
|
+
}
|
|
1535
1563
|
this._drawed_record = this.record.identity;
|
|
1536
1564
|
|
|
1537
1565
|
var row_id_path = this.get_id_path();
|
|
@@ -1542,7 +1570,7 @@
|
|
|
1542
1570
|
if (Sao.i18n.rtl) {
|
|
1543
1571
|
margin = 'margin-right';
|
|
1544
1572
|
}
|
|
1545
|
-
this.expander.css(margin, (depth - 1) + 'em');
|
|
1573
|
+
this.expander.children().css(margin, (depth - 1) + 'em');
|
|
1546
1574
|
|
|
1547
1575
|
var update_expander = function() {
|
|
1548
1576
|
var length = this.record.field_get_client(
|
|
@@ -1606,7 +1634,7 @@
|
|
|
1606
1634
|
}
|
|
1607
1635
|
Sao.common.ICONFACTORY.get_icon_url(icon)
|
|
1608
1636
|
.then(function(url) {
|
|
1609
|
-
this.expander.attr('src', url);
|
|
1637
|
+
this.expander.children().attr('src', url);
|
|
1610
1638
|
}.bind(this));
|
|
1611
1639
|
},
|
|
1612
1640
|
collapse_children: function() {
|
package/tests/sao.js
CHANGED
|
@@ -1244,6 +1244,20 @@
|
|
|
1244
1244
|
});
|
|
1245
1245
|
});
|
|
1246
1246
|
|
|
1247
|
+
QUnit.test('PYSON.EVal dot notation in context', function() {
|
|
1248
|
+
var eval_ = new Sao.PYSON.Encoder().encode(
|
|
1249
|
+
new Sao.PYSON.Eval('foo.bar', 0));
|
|
1250
|
+
var ctx = {
|
|
1251
|
+
'foo.bar': 1,
|
|
1252
|
+
'foo': {
|
|
1253
|
+
'bar': 0,
|
|
1254
|
+
},
|
|
1255
|
+
};
|
|
1256
|
+
QUnit.strictEqual(
|
|
1257
|
+
new Sao.PYSON.Decoder(ctx).decode(eval_), 1,
|
|
1258
|
+
"decode(" + JSON.stringify(ctx) + ")");
|
|
1259
|
+
});
|
|
1260
|
+
|
|
1247
1261
|
QUnit.test('PYSON eval', function() {
|
|
1248
1262
|
QUnit.strictEqual(eval_pyson('True'), true, "eval_pyson('True')");
|
|
1249
1263
|
QUnit.strictEqual(eval_pyson('False'), false, "eval_pyson('False')");
|