@breakside/jskit 2026.9.0 → 2026.11.0
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/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSColor.js +5 -0
- package/Frameworks/Foundation.jsframework/JS/JSNodeHTTPClient.js +34 -14
- package/Frameworks/Foundation.jsframework/JS/JSNodeURLSessionDataTask.js +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSPath.js +482 -49
- package/Frameworks/Foundation.jsframework/JS/JSSpec.js +5 -1
- package/Frameworks/Foundation.jsframework/JS/JSURLRequest.js +3 -0
- package/Frameworks/Foundation.jsframework/JS/JSZip.js +155 -1
- package/Frameworks/Foundation.jsframework/JS/String+JS.js +78 -2
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/DocCommand.js +5 -2
- package/Node/Docs/DocClass.js +40 -3
- package/Node/Docs/DocComponent.js +32 -5
- package/Node/Docs/DocDictionaryProperty.js +10 -2
- package/Node/Docs/DocEnum.js +35 -2
- package/Node/Docs/DocEnumOption.js +5 -2
- package/Node/Docs/DocExtension.js +130 -0
- package/Node/Docs/DocFunction.js +10 -2
- package/Node/Docs/DocMethod.js +3 -0
- package/Node/Docs/DocProperty.js +13 -2
- package/Node/Docs/DocProtocol.js +5 -1
- package/Node/Docs/DocSpec.js +5 -1
- package/Node/Docs/DocSpecProperty.js +10 -2
- package/Node/Docs/DocTopicBasedComponent.js +75 -65
- package/Node/Documentation.js +83 -6
- package/Node/HTMLBuilder.js +3 -1
- package/Node/HTMLProjectServer.js +40 -2
- package/Node/Markdown.js +2 -2
- package/Node/io.breakside.jskit-bundle.js +4 -4
- package/Node/jskit +1 -0
- package/Resources/doc-default.css +3 -11
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSColor.js +5 -0
- package/Root/Frameworks/Foundation/JSNodeHTTPClient.js +34 -14
- package/Root/Frameworks/Foundation/JSNodeURLSessionDataTask.js +2 -2
- package/Root/Frameworks/Foundation/JSPath.js +482 -49
- package/Root/Frameworks/Foundation/JSSpec.js +5 -1
- package/Root/Frameworks/Foundation/JSURLRequest.js +3 -0
- package/Root/Frameworks/Foundation/JSZip.js +155 -1
- package/Root/Frameworks/Foundation/String+JS.js +78 -2
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UIListView.js +11 -3
- package/Root/Frameworks/UIKit/UIOutlineView.js +65 -5
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -11,9 +11,160 @@ JSClass("JSZip", JSObject, {
|
|
|
11
11
|
init: function(){
|
|
12
12
|
this.chunks = [];
|
|
13
13
|
this.directory = [];
|
|
14
|
+
this.directoryIndexByFilename = {};
|
|
14
15
|
this.offset = 0;
|
|
15
16
|
},
|
|
16
17
|
|
|
18
|
+
initWithData: function(data){
|
|
19
|
+
if (data === null || data === undefined){
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (data.length < 22){
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
this._data = data;
|
|
26
|
+
this.directory = [];
|
|
27
|
+
this.directoryIndexByFilename = {};
|
|
28
|
+
var offset = this._data.length - 22;
|
|
29
|
+
var minOffset = Math.max(0, offset - 0xFFFF);
|
|
30
|
+
while (offset >= minOffset && !(this._data[offset] === 0x50 && this._data[offset+1] === 0x4b && this._data[offset+2] === 0x05 && this._data[offset+3] === 0x06)){
|
|
31
|
+
offset -= 1;
|
|
32
|
+
}
|
|
33
|
+
if (offset < minOffset){
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
var end = this._data.subdataInRange(JSRange(offset, this._data.length - offset));
|
|
37
|
+
var dataView = end.dataView();
|
|
38
|
+
// End of Central Directory Record (APPNOTE.txt 4.3.16)
|
|
39
|
+
// everything is little-endian
|
|
40
|
+
var signature = dataView.getUint32(0, true);
|
|
41
|
+
if (signature !== 0x06054b50){
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
var diskNumber = dataView.getUint16(4, true);
|
|
45
|
+
var diskNumberWithDirectoryStart = dataView.getUint16(6, true);
|
|
46
|
+
var numberOfItemsOnDisk = dataView.getUint16(8, true);
|
|
47
|
+
var numberOfItemsTotal = dataView.getUint16(10, true);
|
|
48
|
+
var sizeOfDirectory = dataView.getUint32(12, true);
|
|
49
|
+
var offsetOfDirectoryStart = dataView.getUint32(16, true);
|
|
50
|
+
var commentLength = dataView.getUint16(20, true);
|
|
51
|
+
if (diskNumber !== 0 || diskNumberWithDirectoryStart !== 0){
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (offsetOfDirectoryStart + sizeOfDirectory > this._data.length){
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
var directory = this._data.subdataInRange(JSRange(offsetOfDirectoryStart, sizeOfDirectory));
|
|
58
|
+
dataView = directory.dataView();
|
|
59
|
+
var crc;
|
|
60
|
+
var compressedLength;
|
|
61
|
+
var uncompressedLength;
|
|
62
|
+
var nameLength;
|
|
63
|
+
var extraFieldLength;
|
|
64
|
+
var name;
|
|
65
|
+
var headerOffset;
|
|
66
|
+
var offset = 0;
|
|
67
|
+
for (var i = 0; i < numberOfItemsTotal; ++i){
|
|
68
|
+
// Central Directory File Header (APPNOTE.txt 4.3.12)
|
|
69
|
+
// Everything is little-endian
|
|
70
|
+
if (offset + 46 > sizeOfDirectory){
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
signature = dataView.getUint32(offset + 0, true);
|
|
74
|
+
if (signature !== 0x02014b50){
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
crc = dataView.getUint32(offset + 16, true);
|
|
78
|
+
compressedLength = dataView.getUint32(offset + 20, true);
|
|
79
|
+
uncompressedLength = dataView.getUint32(offset + 24, true);
|
|
80
|
+
nameLength = dataView.getUint16(offset + 28, true);
|
|
81
|
+
extraFieldLength = dataView.getUint16(offset + 30, true);
|
|
82
|
+
commentLength = dataView.getUint16(offset + 32, true);
|
|
83
|
+
headerOffset = dataView.getUint32(offset + 42, true);
|
|
84
|
+
if (offset + 46 + nameLength > sizeOfDirectory){
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
name = directory.subdataInRange(JSRange(offset + 46, nameLength)).stringByDecodingUTF8();
|
|
88
|
+
this.directory.push({
|
|
89
|
+
name: name,
|
|
90
|
+
offset: headerOffset,
|
|
91
|
+
header: this.data.subdataInRange(JSRange(headerOffset, 30 + nameLength + extraFieldLength)),
|
|
92
|
+
crc: crc,
|
|
93
|
+
compressedLength: compressedLength,
|
|
94
|
+
uncompressedLength: uncompressedLength
|
|
95
|
+
});
|
|
96
|
+
this.directoryIndexByFilename[name] = i;
|
|
97
|
+
offset += 46 + nameLength + extraFieldLength + commentLength;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
directoryIndexByFilename: null,
|
|
103
|
+
filenames: JSReadOnlyProperty(),
|
|
104
|
+
|
|
105
|
+
getFilenames: function(){
|
|
106
|
+
var filenames = [];
|
|
107
|
+
for (var i = 0, l = this.directory.length; i < l; ++i){
|
|
108
|
+
filenames.push(this.directory[i].name);
|
|
109
|
+
}
|
|
110
|
+
return filenames;
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
dataForFilename: function(filename){
|
|
114
|
+
var index = this.directoryIndexByFilename[filename];
|
|
115
|
+
if (index === undefined){
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
var file = this.directory[index];
|
|
119
|
+
var dataView = file.header.dataView();
|
|
120
|
+
var signature = dataView.getUint32(0, true);
|
|
121
|
+
if (signature !== 0x04034b50){
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
var version = dataView.getUint16(4, true);
|
|
125
|
+
var flags = dataView.getUint16(6, true);
|
|
126
|
+
var method = dataView.getUint16(8, true);
|
|
127
|
+
var crc = dataView.getUint32(14, true);
|
|
128
|
+
var compressedLength = dataView.getUint32(18, true);
|
|
129
|
+
var uncompressedLength = dataView.getUint32(22, true);
|
|
130
|
+
var nameLength = dataView.getUint16(26, true);
|
|
131
|
+
var extraFieldLength = dataView.getUint16(28, true);
|
|
132
|
+
var offset = file.offset + 30 + nameLength + extraFieldLength;
|
|
133
|
+
if (version > 20){
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (method !== 8){
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if ((flags & 0x8) !== 0){
|
|
140
|
+
crc = file.crc;
|
|
141
|
+
compressedLength = file.compressedLength;
|
|
142
|
+
uncompressedLength = file.uncompressedLength;
|
|
143
|
+
}
|
|
144
|
+
if (offset + compressedLength > this.data.length){
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
if (compressedLength === 0 || uncompressedLength === 0){
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
var compressedData = this.data.subdataInRange(JSRange(offset, compressedLength));
|
|
151
|
+
var data = JSData.initWithLength(uncompressedLength);
|
|
152
|
+
var stream = DeflateStream();
|
|
153
|
+
stream.input = compressedData;
|
|
154
|
+
stream.output = data;
|
|
155
|
+
stream.inflate(true);
|
|
156
|
+
if (stream.state !== DeflateStream.State.done){
|
|
157
|
+
data = null;
|
|
158
|
+
}
|
|
159
|
+
if (data === null){
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (JSCRC32(data) !== crc){
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return data;
|
|
166
|
+
},
|
|
167
|
+
|
|
17
168
|
offset: 0,
|
|
18
169
|
|
|
19
170
|
addFile: function(file, completion, target){
|
|
@@ -83,7 +234,10 @@ JSClass("JSZip", JSObject, {
|
|
|
83
234
|
this.directory.push({
|
|
84
235
|
name: name,
|
|
85
236
|
offset: this.offset,
|
|
86
|
-
header: header
|
|
237
|
+
header: header,
|
|
238
|
+
crc: crc,
|
|
239
|
+
compressedLength: storedData.length,
|
|
240
|
+
uncompressedLength: data.length
|
|
87
241
|
});
|
|
88
242
|
this.chunks.push(header);
|
|
89
243
|
this.chunks.push(storedData);
|
|
@@ -1592,7 +1592,7 @@ String.printf_formatter = {
|
|
|
1592
1592
|
|
|
1593
1593
|
x: function(arg, options){
|
|
1594
1594
|
// TODO: obey any other options
|
|
1595
|
-
var str = arg.toString(16);
|
|
1595
|
+
var str = Math.floor(arg).toString(16);
|
|
1596
1596
|
if (options.width){
|
|
1597
1597
|
if (options.zero){
|
|
1598
1598
|
str = str.leftPaddedString('0', options.width);
|
|
@@ -1633,7 +1633,83 @@ String.printf_formatter = {
|
|
|
1633
1633
|
if (Math.abs(arg) < 0.000001){
|
|
1634
1634
|
arg = 0;
|
|
1635
1635
|
}
|
|
1636
|
-
|
|
1636
|
+
var n = arg;
|
|
1637
|
+
if (n === null){
|
|
1638
|
+
return "null";
|
|
1639
|
+
}
|
|
1640
|
+
if (n === undefined){
|
|
1641
|
+
return "undefined";
|
|
1642
|
+
}
|
|
1643
|
+
if (isNaN(n)){
|
|
1644
|
+
return "NaN";
|
|
1645
|
+
}
|
|
1646
|
+
if (!isFinite(n)){
|
|
1647
|
+
if (n < 0){
|
|
1648
|
+
return "-Inf";
|
|
1649
|
+
}
|
|
1650
|
+
return "Inf";
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
// Prefix & Suffix
|
|
1654
|
+
var negative = n < 0;
|
|
1655
|
+
var prefix = "";
|
|
1656
|
+
if (negative){
|
|
1657
|
+
n = -n;
|
|
1658
|
+
prefix = "-";
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
// Integer
|
|
1662
|
+
var maximumFractionDigits = options.precision || 6;
|
|
1663
|
+
var minimumFractionDigits = options.precision || 0;
|
|
1664
|
+
var minimumIntegerDigits = options.zero ? 1 : 0;
|
|
1665
|
+
var integer = Math.floor(n);
|
|
1666
|
+
var fraction = n - integer;
|
|
1667
|
+
var maximumFraction = Math.pow(10, maximumFractionDigits);
|
|
1668
|
+
fraction = Math.round(fraction * maximumFraction);
|
|
1669
|
+
if (fraction >= maximumFraction){
|
|
1670
|
+
integer += 1;
|
|
1671
|
+
fraction = 0;
|
|
1672
|
+
}
|
|
1673
|
+
var str = (integer !== 0 || (minimumIntegerDigits === 0 && minimumFractionDigits === 0)) ? integer.toString() : "";
|
|
1674
|
+
var zeroFillCount = minimumIntegerDigits - str.length;
|
|
1675
|
+
var i, l;
|
|
1676
|
+
if (zeroFillCount > 0){
|
|
1677
|
+
var fill = "";
|
|
1678
|
+
for (i = 0; i < zeroFillCount; ++i){
|
|
1679
|
+
fill += "0";
|
|
1680
|
+
}
|
|
1681
|
+
str = fill + str;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
// Decimal
|
|
1685
|
+
if (maximumFraction > 0){
|
|
1686
|
+
if (minimumFractionDigits > 0 || fraction !== 0){
|
|
1687
|
+
if (minimumFractionDigits > 0 || fraction !== 0){
|
|
1688
|
+
str += ".";
|
|
1689
|
+
var fractionString = fraction.toString();
|
|
1690
|
+
while (fractionString.length < maximumFractionDigits){
|
|
1691
|
+
fractionString = "0" + fractionString;
|
|
1692
|
+
}
|
|
1693
|
+
while (fractionString.length > minimumFractionDigits && fractionString[fractionString.length - 1] === "0"){
|
|
1694
|
+
fractionString = fractionString.substr(0, fractionString.length - 1);
|
|
1695
|
+
}
|
|
1696
|
+
str += fractionString;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
str = prefix + str;
|
|
1701
|
+
if (options.width){
|
|
1702
|
+
if (options.zero){
|
|
1703
|
+
str = str.leftPaddedString('0', options.width);
|
|
1704
|
+
}else if (options.left_justified){
|
|
1705
|
+
str = str.rightPaddedString(' ', options.width);
|
|
1706
|
+
}else{
|
|
1707
|
+
str = str.leftPaddedString(' ', options.width);
|
|
1708
|
+
}
|
|
1709
|
+
}else if (str === ""){
|
|
1710
|
+
str = "0";
|
|
1711
|
+
}
|
|
1712
|
+
return str;
|
|
1637
1713
|
},
|
|
1638
1714
|
|
|
1639
1715
|
b: function(arg, options){
|
|
@@ -175,6 +175,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
175
175
|
|
|
176
176
|
delegate: null,
|
|
177
177
|
dataSource: null,
|
|
178
|
+
_dataSourceIsValid: false,
|
|
178
179
|
|
|
179
180
|
// --------------------------------------------------------------------
|
|
180
181
|
// MARK: - Styling
|
|
@@ -325,6 +326,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
325
326
|
return;
|
|
326
327
|
}
|
|
327
328
|
this._needsReload = true;
|
|
329
|
+
this._dataSourceIsValid = false;
|
|
328
330
|
this.setNeedsLayout();
|
|
329
331
|
},
|
|
330
332
|
|
|
@@ -579,6 +581,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
579
581
|
selectionChanged: false,
|
|
580
582
|
};
|
|
581
583
|
this._needsUpdate = true;
|
|
584
|
+
this._dataSourceIsValid = false;
|
|
582
585
|
this.setNeedsLayout();
|
|
583
586
|
}
|
|
584
587
|
if (animation != UIListView.RowAnimation.none && this._edit.animator === null){
|
|
@@ -655,6 +658,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
655
658
|
|
|
656
659
|
layoutSubviews: function(){
|
|
657
660
|
UIListView.$super.layoutSubviews.call(this);
|
|
661
|
+
this._dataSourceIsValid = true;
|
|
658
662
|
var origin = JSPoint.Zero;
|
|
659
663
|
var fitSize = JSSize(this.bounds.size.width, Number.MAX_VALUE);
|
|
660
664
|
// We have to size the header and footer first, so a reloadDuringLayout
|
|
@@ -1121,6 +1125,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1121
1125
|
this.__numberOfSections = this.__numberOfSections + edit.insertedSections.length - edit.deletedSections.length;
|
|
1122
1126
|
this._updateVisibleIndexPathsForEdit(edit);
|
|
1123
1127
|
this._updateSelectedIndexPathsForEdit(edit);
|
|
1128
|
+
this._updateOtherIndexPathsForEdit(edit);
|
|
1124
1129
|
if (edit.didDeleteSelectedItem){
|
|
1125
1130
|
this._updateSelectedIndexPaths({notifyDelegate: true});
|
|
1126
1131
|
}
|
|
@@ -1466,6 +1471,9 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1466
1471
|
}
|
|
1467
1472
|
},
|
|
1468
1473
|
|
|
1474
|
+
_updateOtherIndexPathsForEdit: function(edit){
|
|
1475
|
+
},
|
|
1476
|
+
|
|
1469
1477
|
_createViewsForEdit: function(edit, anchorIndex, anchorY, rect){
|
|
1470
1478
|
var diff = {offset: 0, height: 0};
|
|
1471
1479
|
var items = this._visibleItems;
|
|
@@ -1597,7 +1605,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1597
1605
|
cell.position = JSPoint(rect.origin.x + cell.bounds.size.width * cell.anchorPoint.x, rect.origin.y + cell.bounds.size.height * cell.anchorPoint.y);
|
|
1598
1606
|
cell.active = false;
|
|
1599
1607
|
cell.over = false;
|
|
1600
|
-
this._updateCellState(cell);
|
|
1608
|
+
this._updateCellState(cell, true);
|
|
1601
1609
|
cell.update();
|
|
1602
1610
|
cell.setNeedsLayout();
|
|
1603
1611
|
return cell;
|
|
@@ -2002,12 +2010,12 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2002
2010
|
for (var i = 0, l = this._visibleItems.length; i < l; ++i){
|
|
2003
2011
|
item = this._visibleItems[i];
|
|
2004
2012
|
if (item.kind === VisibleItem.Kind.cell){
|
|
2005
|
-
this._updateCellState(item.view);
|
|
2013
|
+
this._updateCellState(item.view, this._dataSourceIsValid && item.indexPath !== null);
|
|
2006
2014
|
}
|
|
2007
2015
|
}
|
|
2008
2016
|
},
|
|
2009
2017
|
|
|
2010
|
-
_updateCellState: function(cell){
|
|
2018
|
+
_updateCellState: function(cell, dataSourceIsValid){
|
|
2011
2019
|
cell.selected = this._selectionContainsIndexPath(cell.indexPath);
|
|
2012
2020
|
cell.contextSelected = this._contextSelectionContainsIndexPath(cell.indexPath);
|
|
2013
2021
|
},
|
|
@@ -102,7 +102,7 @@ JSClass("UIOutlineView", UIListView, {
|
|
|
102
102
|
this._edit.insertedIndexPaths.push({indexPath: JSIndexPath(iterator.indexPath), animation:this.expandRowAnimation});
|
|
103
103
|
}
|
|
104
104
|
if (visibleCell){
|
|
105
|
-
this._updateCellState(visibleCell);
|
|
105
|
+
this._updateCellState(visibleCell, true);
|
|
106
106
|
visibleCell.postAccessibilityNotification(UIAccessibility.Notification.rowExpanded);
|
|
107
107
|
}
|
|
108
108
|
this.postAccessibilityNotification(UIAccessibility.Notification.rowCountChanged);
|
|
@@ -139,7 +139,7 @@ JSClass("UIOutlineView", UIListView, {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
if (visibleCell){
|
|
142
|
-
this._updateCellState(visibleCell);
|
|
142
|
+
this._updateCellState(visibleCell, true);
|
|
143
143
|
visibleCell.postAccessibilityNotification(UIAccessibility.Notification.rowCollapsed);
|
|
144
144
|
}
|
|
145
145
|
this.postAccessibilityNotification(UIAccessibility.Notification.rowCountChanged);
|
|
@@ -220,9 +220,11 @@ JSClass("UIOutlineView", UIListView, {
|
|
|
220
220
|
UIOutlineView.$super.keyUp.call(this, event);
|
|
221
221
|
},
|
|
222
222
|
|
|
223
|
-
_updateCellState: function(cell){
|
|
224
|
-
UIOutlineView.$super._updateCellState.call(this, cell);
|
|
225
|
-
|
|
223
|
+
_updateCellState: function(cell, dataSourceIsValid){
|
|
224
|
+
UIOutlineView.$super._updateCellState.call(this, cell, dataSourceIsValid);
|
|
225
|
+
if (dataSourceIsValid){
|
|
226
|
+
cell.expandable = this.dataSource.outlineViewIsExandableAtIndexPath(this, cell.indexPath);
|
|
227
|
+
}
|
|
226
228
|
cell.expanded = cell.expandable && this._isIndexPathExpanded(cell.indexPath);
|
|
227
229
|
},
|
|
228
230
|
|
|
@@ -252,6 +254,64 @@ JSClass("UIOutlineView", UIListView, {
|
|
|
252
254
|
return row;
|
|
253
255
|
},
|
|
254
256
|
|
|
257
|
+
_updateOtherIndexPathsForEdit: function(edit){
|
|
258
|
+
UIOutlineView.$super._updateOtherIndexPathsForEdit.call(this, edit);
|
|
259
|
+
var expandedIndexPaths = Array.from(this._expandedIndexPaths).map(function(indexPathString){
|
|
260
|
+
var indexes = indexPathString.split(".").map(function(indexString){
|
|
261
|
+
return parseInt(indexString);
|
|
262
|
+
});
|
|
263
|
+
return JSIndexPath(indexes);
|
|
264
|
+
});
|
|
265
|
+
expandedIndexPaths.sort(JSIndexPath.compare);
|
|
266
|
+
var i, l;
|
|
267
|
+
var section, indexPath;
|
|
268
|
+
var index;
|
|
269
|
+
var searcher = JSBinarySearcher(expandedIndexPaths, JSIndexPath.compare);
|
|
270
|
+
var parent;
|
|
271
|
+
var selectedLength = expandedIndexPaths.length;
|
|
272
|
+
for (i = edit.deletedIndexPaths.length - 1; i >= 0; --i){
|
|
273
|
+
indexPath = edit.deletedIndexPaths[i].indexPath;
|
|
274
|
+
parent = indexPath.removingLastIndex();
|
|
275
|
+
index = searcher.insertionIndexForValue(indexPath);
|
|
276
|
+
if (index < selectedLength && expandedIndexPaths[index].isEqual(indexPath)){
|
|
277
|
+
expandedIndexPaths.splice(index, 1);
|
|
278
|
+
--selectedLength;
|
|
279
|
+
}
|
|
280
|
+
for (; index < selectedLength && expandedIndexPaths[index].startsWith(parent); ++index){
|
|
281
|
+
expandedIndexPaths[index][parent.length]--;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
for (i = edit.deletedSections.length - 1; i >= 0; --i){
|
|
285
|
+
section = edit.deletedSections[i].section;
|
|
286
|
+
index = searcher.insertionIndexForValue(JSIndexPath(section, 0));
|
|
287
|
+
for (; index < selectedLength && expandedIndexPaths[index].section == section; --selectedLength){
|
|
288
|
+
expandedIndexPaths.splice(index, 1);
|
|
289
|
+
}
|
|
290
|
+
for (; index < selectedLength; ++index){
|
|
291
|
+
expandedIndexPaths[index].section--;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
for (i = 0, l = edit.insertedSections.length; i < l; ++i){
|
|
295
|
+
section = edit.insertedSections[i].section;
|
|
296
|
+
index = searcher.insertionIndexForValue(JSIndexPath(section, 0));
|
|
297
|
+
for (; index < selectedLength && expandedIndexPaths[index].section >= section; ++index){
|
|
298
|
+
expandedIndexPaths[index].section++;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
for (i = 0, l = edit.insertedIndexPaths.length; i < l; ++i){
|
|
302
|
+
indexPath = edit.insertedIndexPaths[i].indexPath;
|
|
303
|
+
parent = indexPath.removingLastIndex();
|
|
304
|
+
index = searcher.insertionIndexForValue(indexPath);
|
|
305
|
+
for (; index < selectedLength && expandedIndexPaths[index].startsWith(parent); ++index){
|
|
306
|
+
expandedIndexPaths[index][parent.length]++;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
this._expandedIndexPaths = new Set();
|
|
310
|
+
for (i = 0, l = expandedIndexPaths.length; i < l; ++i){
|
|
311
|
+
this._expandedIndexPaths.add(expandedIndexPaths[i].toString());
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
|
|
255
315
|
// --------------------------------------------------------------------
|
|
256
316
|
// MARK: - Acessibility
|
|
257
317
|
|