@gtkx/react 0.1.50 → 0.1.52
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/dist/batch.js +8 -3
- package/dist/codegen/jsx-generator.js +92 -5
- package/dist/container-interfaces.d.ts +21 -0
- package/dist/container-interfaces.js +1 -0
- package/dist/factory.js +13 -1
- package/dist/generated/jsx.d.ts +42 -6
- package/dist/generated/jsx.js +56 -3
- package/dist/node.d.ts +11 -2
- package/dist/node.js +23 -4
- package/dist/nodes/column-view.d.ts +36 -26
- package/dist/nodes/column-view.js +122 -125
- package/dist/nodes/dropdown.d.ts +2 -2
- package/dist/nodes/dropdown.js +4 -4
- package/dist/nodes/grid.d.ts +1 -1
- package/dist/nodes/grid.js +6 -6
- package/dist/nodes/list.d.ts +19 -10
- package/dist/nodes/list.js +45 -40
- package/dist/nodes/menu.d.ts +84 -0
- package/dist/nodes/menu.js +279 -0
- package/dist/nodes/notebook.d.ts +1 -1
- package/dist/nodes/notebook.js +3 -3
- package/dist/nodes/root.js +1 -1
- package/dist/nodes/slot.d.ts +1 -2
- package/dist/nodes/slot.js +2 -2
- package/dist/nodes/stack.d.ts +35 -0
- package/dist/nodes/stack.js +178 -0
- package/dist/nodes/text-view.d.ts +0 -1
- package/dist/nodes/text-view.js +0 -7
- package/dist/types.d.ts +76 -0
- package/package.json +3 -3
|
@@ -10,44 +10,45 @@ export class ColumnViewNode extends Node {
|
|
|
10
10
|
static matches(type) {
|
|
11
11
|
return type === "ColumnView.Root";
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.widget.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
|
|
13
|
+
initialize(props) {
|
|
14
|
+
// Initialize state before super.initialize() since updateProps accesses this.state
|
|
15
|
+
this.state = {
|
|
16
|
+
stringList: null,
|
|
17
|
+
selectionModel: null,
|
|
18
|
+
sortListModel: null,
|
|
19
|
+
items: [],
|
|
20
|
+
columns: [],
|
|
21
|
+
committedLength: 0,
|
|
22
|
+
sortColumn: props.sortColumn ?? null,
|
|
23
|
+
sortOrder: props.sortOrder ?? Gtk.SortType.ASCENDING,
|
|
24
|
+
sortFn: props.sortFn ?? null,
|
|
25
|
+
isSorting: false,
|
|
26
|
+
onSortChange: props.onSortChange ?? null,
|
|
27
|
+
sorterChangedHandlerId: null,
|
|
28
|
+
lastNotifiedColumn: null,
|
|
29
|
+
lastNotifiedOrder: Gtk.SortType.ASCENDING,
|
|
30
|
+
};
|
|
31
|
+
super.initialize(props);
|
|
32
|
+
const stringList = new Gtk.StringList([]);
|
|
33
|
+
const sortListModel = new Gtk.SortListModel(stringList, this.widget.getSorter());
|
|
34
|
+
sortListModel.setIncremental(true);
|
|
35
|
+
const selectionModel = new Gtk.SingleSelection(sortListModel);
|
|
36
|
+
this.widget.setModel(selectionModel);
|
|
37
|
+
this.state.stringList = stringList;
|
|
38
|
+
this.state.sortListModel = sortListModel;
|
|
39
|
+
this.state.selectionModel = selectionModel;
|
|
39
40
|
this.connectSorterChangedSignal();
|
|
40
41
|
}
|
|
41
42
|
connectSorterChangedSignal() {
|
|
42
43
|
const sorter = this.widget.getSorter();
|
|
43
|
-
if (!sorter || !this.onSortChange)
|
|
44
|
+
if (!sorter || !this.state.onSortChange)
|
|
44
45
|
return;
|
|
45
|
-
this.sorterChangedHandlerId = sorter.connect("changed", () => {
|
|
46
|
+
this.state.sorterChangedHandlerId = sorter.connect("changed", () => {
|
|
46
47
|
this.waitForSortComplete(() => this.notifySortChange());
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
waitForSortComplete(callback) {
|
|
50
|
-
const sortingInProgress = this.sortListModel.getPending() > 0;
|
|
51
|
+
const sortingInProgress = this.state.sortListModel.getPending() > 0;
|
|
51
52
|
if (sortingInProgress) {
|
|
52
53
|
setTimeout(() => this.waitForSortComplete(callback), 0);
|
|
53
54
|
}
|
|
@@ -56,16 +57,16 @@ export class ColumnViewNode extends Node {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
disconnectSorterChangedSignal() {
|
|
59
|
-
if (this.sorterChangedHandlerId === null)
|
|
60
|
+
if (this.state.sorterChangedHandlerId === null)
|
|
60
61
|
return;
|
|
61
62
|
const sorter = this.widget.getSorter();
|
|
62
63
|
if (sorter) {
|
|
63
|
-
GObject.signalHandlerDisconnect(sorter, this.sorterChangedHandlerId);
|
|
64
|
+
GObject.signalHandlerDisconnect(sorter, this.state.sorterChangedHandlerId);
|
|
64
65
|
}
|
|
65
|
-
this.sorterChangedHandlerId = null;
|
|
66
|
+
this.state.sorterChangedHandlerId = null;
|
|
66
67
|
}
|
|
67
68
|
notifySortChange() {
|
|
68
|
-
if (!this.onSortChange)
|
|
69
|
+
if (!this.state.onSortChange)
|
|
69
70
|
return;
|
|
70
71
|
const baseSorter = this.widget.getSorter();
|
|
71
72
|
if (!baseSorter)
|
|
@@ -74,99 +75,97 @@ export class ColumnViewNode extends Node {
|
|
|
74
75
|
const column = sorter.getPrimarySortColumn();
|
|
75
76
|
const order = sorter.getPrimarySortOrder();
|
|
76
77
|
const columnId = column?.getId() ?? null;
|
|
77
|
-
const sortStateUnchanged = columnId === this.lastNotifiedColumn && order === this.lastNotifiedOrder;
|
|
78
|
+
const sortStateUnchanged = columnId === this.state.lastNotifiedColumn && order === this.state.lastNotifiedOrder;
|
|
78
79
|
if (sortStateUnchanged) {
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
|
-
this.lastNotifiedColumn = columnId;
|
|
82
|
-
this.lastNotifiedOrder = order;
|
|
83
|
-
this.onSortChange(columnId, order);
|
|
82
|
+
this.state.lastNotifiedColumn = columnId;
|
|
83
|
+
this.state.lastNotifiedOrder = order;
|
|
84
|
+
this.state.onSortChange(columnId, order);
|
|
84
85
|
}
|
|
85
86
|
getItems() {
|
|
86
|
-
return this.items;
|
|
87
|
+
return this.state.items;
|
|
87
88
|
}
|
|
88
89
|
getSortFn() {
|
|
89
|
-
return this.sortFn;
|
|
90
|
+
return this.state.sortFn;
|
|
90
91
|
}
|
|
91
92
|
compareItems(a, b, columnId) {
|
|
92
|
-
if (this.isSorting || !this.sortFn)
|
|
93
|
+
if (this.state.isSorting || !this.state.sortFn)
|
|
93
94
|
return 0;
|
|
94
|
-
this.isSorting = true;
|
|
95
|
+
this.state.isSorting = true;
|
|
95
96
|
try {
|
|
96
|
-
return this.sortFn(a, b, columnId);
|
|
97
|
+
return this.state.sortFn(a, b, columnId);
|
|
97
98
|
}
|
|
98
99
|
finally {
|
|
99
|
-
this.isSorting = false;
|
|
100
|
+
this.state.isSorting = false;
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
addColumn(columnNode) {
|
|
103
|
-
this.columns.push(columnNode);
|
|
104
|
+
this.state.columns.push(columnNode);
|
|
104
105
|
const column = columnNode.getColumn();
|
|
105
106
|
this.widget.appendColumn(column);
|
|
106
107
|
columnNode.setColumnView(this);
|
|
107
|
-
if (columnNode.getId() === this.sortColumn && this.sortColumn !== null) {
|
|
108
|
+
if (columnNode.getId() === this.state.sortColumn && this.state.sortColumn !== null) {
|
|
108
109
|
this.applySortByColumn();
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
applySortByColumn() {
|
|
112
|
-
if (this.sortColumn === null) {
|
|
113
|
-
this.widget.sortByColumn(this.sortOrder, null);
|
|
113
|
+
if (this.state.sortColumn === null) {
|
|
114
|
+
this.widget.sortByColumn(this.state.sortOrder, null);
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
-
return;
|
|
118
|
-
const column = this.columns.find((c) => c.getId() === this.sortColumn);
|
|
117
|
+
const column = this.state.columns.find((c) => c.getId() === this.state.sortColumn);
|
|
119
118
|
if (column) {
|
|
120
|
-
this.widget.sortByColumn(this.sortOrder, column.getColumn());
|
|
119
|
+
this.widget.sortByColumn(this.state.sortOrder, column.getColumn());
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
findColumnById(id) {
|
|
124
|
-
return this.columns.find((c) => c.getId() === id);
|
|
123
|
+
return this.state.columns.find((c) => c.getId() === id);
|
|
125
124
|
}
|
|
126
125
|
removeColumn(column) {
|
|
127
|
-
const index = this.columns.indexOf(column);
|
|
126
|
+
const index = this.state.columns.indexOf(column);
|
|
128
127
|
if (index !== -1) {
|
|
129
|
-
this.columns.splice(index, 1);
|
|
128
|
+
this.state.columns.splice(index, 1);
|
|
130
129
|
this.widget.removeColumn(column.getColumn());
|
|
131
130
|
column.setColumnView(null);
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
insertColumnBefore(column, before) {
|
|
135
|
-
const beforeIndex = this.columns.indexOf(before);
|
|
134
|
+
const beforeIndex = this.state.columns.indexOf(before);
|
|
136
135
|
if (beforeIndex === -1) {
|
|
137
136
|
this.addColumn(column);
|
|
138
137
|
return;
|
|
139
138
|
}
|
|
140
|
-
this.columns.splice(beforeIndex, 0, column);
|
|
139
|
+
this.state.columns.splice(beforeIndex, 0, column);
|
|
141
140
|
this.widget.insertColumn(beforeIndex, column.getColumn());
|
|
142
141
|
column.setColumnView(this);
|
|
143
142
|
}
|
|
144
143
|
syncStringList = () => {
|
|
145
|
-
const newLength = this.items.length;
|
|
146
|
-
if (newLength === this.committedLength)
|
|
144
|
+
const newLength = this.state.items.length;
|
|
145
|
+
if (newLength === this.state.committedLength)
|
|
147
146
|
return;
|
|
148
147
|
const itemIndicesForSorter = Array.from({ length: newLength }, (_, i) => String(i));
|
|
149
|
-
this.stringList.splice(0, this.committedLength, itemIndicesForSorter);
|
|
150
|
-
this.committedLength = newLength;
|
|
148
|
+
this.state.stringList.splice(0, this.state.committedLength, itemIndicesForSorter);
|
|
149
|
+
this.state.committedLength = newLength;
|
|
151
150
|
};
|
|
152
151
|
addItem(item) {
|
|
153
|
-
this.items.push(item);
|
|
152
|
+
this.state.items.push(item);
|
|
154
153
|
scheduleFlush(this.syncStringList);
|
|
155
154
|
}
|
|
156
155
|
insertItemBefore(item, beforeItem) {
|
|
157
|
-
const beforeIndex = this.items.indexOf(beforeItem);
|
|
156
|
+
const beforeIndex = this.state.items.indexOf(beforeItem);
|
|
158
157
|
if (beforeIndex === -1) {
|
|
159
|
-
this.items.push(item);
|
|
158
|
+
this.state.items.push(item);
|
|
160
159
|
}
|
|
161
160
|
else {
|
|
162
|
-
this.items.splice(beforeIndex, 0, item);
|
|
161
|
+
this.state.items.splice(beforeIndex, 0, item);
|
|
163
162
|
}
|
|
164
163
|
scheduleFlush(this.syncStringList);
|
|
165
164
|
}
|
|
166
165
|
removeItem(item) {
|
|
167
|
-
const index = this.items.indexOf(item);
|
|
166
|
+
const index = this.state.items.indexOf(item);
|
|
168
167
|
if (index !== -1) {
|
|
169
|
-
this.items.splice(index, 1);
|
|
168
|
+
this.state.items.splice(index, 1);
|
|
170
169
|
scheduleFlush(this.syncStringList);
|
|
171
170
|
}
|
|
172
171
|
}
|
|
@@ -185,9 +184,9 @@ export class ColumnViewNode extends Node {
|
|
|
185
184
|
const newSortFn = newProps.sortFn ?? null;
|
|
186
185
|
const newOnSortChange = newProps.onSortChange ?? null;
|
|
187
186
|
if (oldProps.onSortChange !== newProps.onSortChange) {
|
|
188
|
-
const hadCallback = this.onSortChange !== null;
|
|
189
|
-
this.onSortChange = newOnSortChange;
|
|
190
|
-
const hasCallback = this.onSortChange !== null;
|
|
187
|
+
const hadCallback = this.state.onSortChange !== null;
|
|
188
|
+
this.state.onSortChange = newOnSortChange;
|
|
189
|
+
const hasCallback = this.state.onSortChange !== null;
|
|
191
190
|
const callbackAdded = !hadCallback && hasCallback;
|
|
192
191
|
const callbackRemoved = hadCallback && !hasCallback;
|
|
193
192
|
if (callbackAdded) {
|
|
@@ -198,16 +197,14 @@ export class ColumnViewNode extends Node {
|
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
if (oldProps.sortFn !== newProps.sortFn) {
|
|
201
|
-
this.sortFn = newSortFn;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
column.updateSorterFromRoot();
|
|
205
|
-
}
|
|
200
|
+
this.state.sortFn = newSortFn;
|
|
201
|
+
for (const column of this.state.columns) {
|
|
202
|
+
column.updateSorterFromRoot();
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
205
|
if (oldProps.sortColumn !== newProps.sortColumn || oldProps.sortOrder !== newProps.sortOrder) {
|
|
209
|
-
this.sortColumn = newSortColumn;
|
|
210
|
-
this.sortOrder = newSortOrder;
|
|
206
|
+
this.state.sortColumn = newSortColumn;
|
|
207
|
+
this.state.sortOrder = newSortOrder;
|
|
211
208
|
this.applySortByColumn();
|
|
212
209
|
}
|
|
213
210
|
}
|
|
@@ -219,94 +216,96 @@ export class ColumnViewColumnNode extends Node {
|
|
|
219
216
|
isVirtual() {
|
|
220
217
|
return true;
|
|
221
218
|
}
|
|
222
|
-
column;
|
|
223
|
-
factory;
|
|
224
|
-
renderCell;
|
|
225
219
|
columnView = null;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
this.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
220
|
+
initialize(props) {
|
|
221
|
+
// Initialize state before super.initialize() since updateProps accesses this.state
|
|
222
|
+
const factory = new Gtk.SignalListItemFactory();
|
|
223
|
+
const column = new Gtk.ColumnViewColumn(props.title, factory);
|
|
224
|
+
const columnId = props.id ?? null;
|
|
225
|
+
this.state = {
|
|
226
|
+
column,
|
|
227
|
+
factory,
|
|
228
|
+
renderCell: props.renderCell,
|
|
229
|
+
columnId,
|
|
230
|
+
sorter: null,
|
|
231
|
+
listItemCache: new Map(),
|
|
232
|
+
};
|
|
233
|
+
super.initialize(props);
|
|
234
|
+
if (columnId !== null) {
|
|
235
|
+
column.setId(columnId);
|
|
237
236
|
}
|
|
238
237
|
if (props.expand !== undefined) {
|
|
239
|
-
|
|
238
|
+
column.setExpand(props.expand);
|
|
240
239
|
}
|
|
241
240
|
if (props.resizable !== undefined) {
|
|
242
|
-
|
|
241
|
+
column.setResizable(props.resizable);
|
|
243
242
|
}
|
|
244
243
|
if (props.fixedWidth !== undefined) {
|
|
245
|
-
|
|
244
|
+
column.setFixedWidth(props.fixedWidth);
|
|
246
245
|
}
|
|
247
|
-
|
|
246
|
+
factory.connect("setup", (_self, listItemObj) => {
|
|
248
247
|
const listItem = getObject(listItemObj.ptr, Gtk.ListItem);
|
|
249
248
|
const id = getObjectId(listItemObj.ptr);
|
|
250
249
|
const box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
|
|
251
250
|
listItem.setChild(box);
|
|
252
251
|
const fiberRoot = createFiberRoot(box);
|
|
253
|
-
this.listItemCache.set(id, { box, fiberRoot });
|
|
254
|
-
const element = this.renderCell(null);
|
|
252
|
+
this.state.listItemCache.set(id, { box, fiberRoot });
|
|
253
|
+
const element = this.state.renderCell(null);
|
|
255
254
|
reconciler.getInstance().updateContainer(element, fiberRoot, null, () => { });
|
|
256
255
|
});
|
|
257
|
-
|
|
256
|
+
factory.connect("bind", (_self, listItemObj) => {
|
|
258
257
|
const listItem = getObject(listItemObj.ptr, Gtk.ListItem);
|
|
259
258
|
const id = getObjectId(listItemObj.ptr);
|
|
260
|
-
const info = this.listItemCache.get(id);
|
|
259
|
+
const info = this.state.listItemCache.get(id);
|
|
261
260
|
if (!info)
|
|
262
261
|
return;
|
|
263
262
|
const position = listItem.getPosition();
|
|
264
263
|
if (this.columnView) {
|
|
265
264
|
const items = this.columnView.getItems();
|
|
266
265
|
const item = items[position];
|
|
267
|
-
const element = this.renderCell(item ?? null);
|
|
266
|
+
const element = this.state.renderCell(item ?? null);
|
|
268
267
|
reconciler.getInstance().updateContainer(element, info.fiberRoot, null, () => { });
|
|
269
268
|
}
|
|
270
269
|
});
|
|
271
|
-
|
|
270
|
+
factory.connect("unbind", (_self, listItemObj) => {
|
|
272
271
|
const id = getObjectId(listItemObj.ptr);
|
|
273
|
-
const info = this.listItemCache.get(id);
|
|
272
|
+
const info = this.state.listItemCache.get(id);
|
|
274
273
|
if (!info)
|
|
275
274
|
return;
|
|
276
275
|
reconciler.getInstance().updateContainer(null, info.fiberRoot, null, () => { });
|
|
277
276
|
});
|
|
278
|
-
|
|
277
|
+
factory.connect("teardown", (_self, listItemObj) => {
|
|
279
278
|
const id = getObjectId(listItemObj.ptr);
|
|
280
|
-
const info = this.listItemCache.get(id);
|
|
279
|
+
const info = this.state.listItemCache.get(id);
|
|
281
280
|
if (info) {
|
|
282
281
|
reconciler.getInstance().updateContainer(null, info.fiberRoot, null, () => { });
|
|
283
|
-
this.listItemCache.delete(id);
|
|
282
|
+
this.state.listItemCache.delete(id);
|
|
284
283
|
}
|
|
285
284
|
});
|
|
286
285
|
}
|
|
287
286
|
getColumn() {
|
|
288
|
-
return this.column;
|
|
287
|
+
return this.state.column;
|
|
289
288
|
}
|
|
290
289
|
getId() {
|
|
291
|
-
return this.columnId;
|
|
290
|
+
return this.state.columnId;
|
|
292
291
|
}
|
|
293
292
|
setColumnView(columnView) {
|
|
294
293
|
this.columnView = columnView;
|
|
295
294
|
this.updateSorterFromRoot();
|
|
296
295
|
}
|
|
297
296
|
updateSorterFromRoot() {
|
|
298
|
-
if (!this.columnView || this.columnId === null) {
|
|
299
|
-
this.column.setSorter(null);
|
|
300
|
-
this.sorter = null;
|
|
297
|
+
if (!this.columnView || this.state.columnId === null) {
|
|
298
|
+
this.state.column.setSorter(null);
|
|
299
|
+
this.state.sorter = null;
|
|
301
300
|
return;
|
|
302
301
|
}
|
|
303
302
|
const rootSortFn = this.columnView.getSortFn();
|
|
304
303
|
if (rootSortFn === null) {
|
|
305
|
-
this.column.setSorter(null);
|
|
306
|
-
this.sorter = null;
|
|
304
|
+
this.state.column.setSorter(null);
|
|
305
|
+
this.state.sorter = null;
|
|
307
306
|
return;
|
|
308
307
|
}
|
|
309
|
-
const columnId = this.columnId;
|
|
308
|
+
const columnId = this.state.columnId;
|
|
310
309
|
const columnView = this.columnView;
|
|
311
310
|
const wrappedSortFn = (stringObjPtrA, stringObjPtrB) => {
|
|
312
311
|
const items = columnView.getItems();
|
|
@@ -323,8 +322,8 @@ export class ColumnViewColumnNode extends Node {
|
|
|
323
322
|
const result = columnView.compareItems(itemA, itemB, columnId);
|
|
324
323
|
return typeof result === "number" ? result : 0;
|
|
325
324
|
};
|
|
326
|
-
this.sorter = new Gtk.CustomSorter(wrappedSortFn);
|
|
327
|
-
this.column.setSorter(this.sorter);
|
|
325
|
+
this.state.sorter = new Gtk.CustomSorter(wrappedSortFn);
|
|
326
|
+
this.state.column.setSorter(this.state.sorter);
|
|
328
327
|
}
|
|
329
328
|
attachToParent(parent) {
|
|
330
329
|
if (isColumnContainer(parent)) {
|
|
@@ -356,25 +355,23 @@ export class ColumnViewColumnNode extends Node {
|
|
|
356
355
|
}
|
|
357
356
|
updateProps(oldProps, newProps) {
|
|
358
357
|
if (oldProps.renderCell !== newProps.renderCell) {
|
|
359
|
-
this.renderCell = newProps.renderCell;
|
|
358
|
+
this.state.renderCell = newProps.renderCell;
|
|
360
359
|
}
|
|
361
|
-
if (!this.column)
|
|
362
|
-
return;
|
|
363
360
|
if (oldProps.title !== newProps.title) {
|
|
364
|
-
this.column.setTitle(newProps.title);
|
|
361
|
+
this.state.column.setTitle(newProps.title);
|
|
365
362
|
}
|
|
366
363
|
if (oldProps.expand !== newProps.expand) {
|
|
367
|
-
this.column.setExpand(newProps.expand);
|
|
364
|
+
this.state.column.setExpand(newProps.expand);
|
|
368
365
|
}
|
|
369
366
|
if (oldProps.resizable !== newProps.resizable) {
|
|
370
|
-
this.column.setResizable(newProps.resizable);
|
|
367
|
+
this.state.column.setResizable(newProps.resizable);
|
|
371
368
|
}
|
|
372
369
|
if (oldProps.fixedWidth !== newProps.fixedWidth) {
|
|
373
|
-
this.column.setFixedWidth(newProps.fixedWidth);
|
|
370
|
+
this.state.column.setFixedWidth(newProps.fixedWidth);
|
|
374
371
|
}
|
|
375
372
|
if (oldProps.id !== newProps.id) {
|
|
376
|
-
this.columnId = newProps.id ?? null;
|
|
377
|
-
this.column.setId(this.columnId);
|
|
373
|
+
this.state.columnId = newProps.id ?? null;
|
|
374
|
+
this.state.column.setId(this.state.columnId);
|
|
378
375
|
}
|
|
379
376
|
}
|
|
380
377
|
}
|
|
@@ -386,9 +383,9 @@ export class ColumnViewItemNode extends Node {
|
|
|
386
383
|
return true;
|
|
387
384
|
}
|
|
388
385
|
item;
|
|
389
|
-
|
|
390
|
-
super(type, props);
|
|
386
|
+
initialize(props) {
|
|
391
387
|
this.item = props.item;
|
|
388
|
+
super.initialize(props);
|
|
392
389
|
}
|
|
393
390
|
getItem() {
|
|
394
391
|
return this.item;
|
package/dist/nodes/dropdown.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class DropDownNode extends Node<Gtk.DropDown> implements ItemCont
|
|
|
6
6
|
static matches(type: string): boolean;
|
|
7
7
|
private store;
|
|
8
8
|
private onSelectionChanged?;
|
|
9
|
-
|
|
9
|
+
initialize(props: Props): void;
|
|
10
10
|
addItem(item: unknown): void;
|
|
11
11
|
insertItemBefore(item: unknown, _beforeItem: unknown): void;
|
|
12
12
|
removeItem(item: unknown): void;
|
|
@@ -17,7 +17,7 @@ export declare class DropDownItemNode extends Node<never> {
|
|
|
17
17
|
static matches(type: string): boolean;
|
|
18
18
|
protected isVirtual(): boolean;
|
|
19
19
|
private item;
|
|
20
|
-
|
|
20
|
+
initialize(props: Props): void;
|
|
21
21
|
getItem(): unknown;
|
|
22
22
|
attachToParent(parent: Node): void;
|
|
23
23
|
detachFromParent(parent: Node): void;
|
package/dist/nodes/dropdown.js
CHANGED
|
@@ -37,8 +37,8 @@ export class DropDownNode extends Node {
|
|
|
37
37
|
}
|
|
38
38
|
store;
|
|
39
39
|
onSelectionChanged;
|
|
40
|
-
|
|
41
|
-
super(
|
|
40
|
+
initialize(props) {
|
|
41
|
+
super.initialize(props);
|
|
42
42
|
const labelFn = props.itemLabel ?? ((item) => String(item));
|
|
43
43
|
this.onSelectionChanged = props.onSelectionChanged;
|
|
44
44
|
this.store = new DropDownStore(labelFn);
|
|
@@ -82,8 +82,8 @@ export class DropDownItemNode extends Node {
|
|
|
82
82
|
return true;
|
|
83
83
|
}
|
|
84
84
|
item;
|
|
85
|
-
|
|
86
|
-
super(
|
|
85
|
+
initialize(props) {
|
|
86
|
+
super.initialize(props);
|
|
87
87
|
this.item = props.item;
|
|
88
88
|
}
|
|
89
89
|
getItem() {
|
package/dist/nodes/grid.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class GridChildNode extends Node<never> {
|
|
|
16
16
|
private rowSpan;
|
|
17
17
|
private childWidget;
|
|
18
18
|
private parentContainer;
|
|
19
|
-
|
|
19
|
+
initialize(props: Props): void;
|
|
20
20
|
appendChild(child: Node): void;
|
|
21
21
|
removeChild(child: Node): void;
|
|
22
22
|
private attachChildToGrid;
|
package/dist/nodes/grid.js
CHANGED
|
@@ -19,18 +19,18 @@ export class GridChildNode extends Node {
|
|
|
19
19
|
isVirtual() {
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
|
-
column;
|
|
23
|
-
row;
|
|
24
|
-
columnSpan;
|
|
25
|
-
rowSpan;
|
|
22
|
+
column = 0;
|
|
23
|
+
row = 0;
|
|
24
|
+
columnSpan = 1;
|
|
25
|
+
rowSpan = 1;
|
|
26
26
|
childWidget = null;
|
|
27
27
|
parentContainer = null;
|
|
28
|
-
|
|
29
|
-
super(type, props);
|
|
28
|
+
initialize(props) {
|
|
30
29
|
this.column = getNumberProp(props, "column", 0);
|
|
31
30
|
this.row = getNumberProp(props, "row", 0);
|
|
32
31
|
this.columnSpan = getNumberProp(props, "columnSpan", 1);
|
|
33
32
|
this.rowSpan = getNumberProp(props, "rowSpan", 1);
|
|
33
|
+
super.initialize(props);
|
|
34
34
|
}
|
|
35
35
|
appendChild(child) {
|
|
36
36
|
const widget = child.getWidget();
|
package/dist/nodes/list.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
+
import type Reconciler from "react-reconciler";
|
|
2
3
|
import { type ItemContainer } from "../container-interfaces.js";
|
|
3
4
|
import type { Props } from "../factory.js";
|
|
4
5
|
import { Node } from "../node.js";
|
|
5
|
-
|
|
6
|
+
import type { RenderItemFn } from "../types.js";
|
|
7
|
+
interface ListItemInfo {
|
|
8
|
+
box: Gtk.Box;
|
|
9
|
+
fiberRoot: Reconciler.FiberRoot;
|
|
10
|
+
}
|
|
11
|
+
interface ListViewState {
|
|
12
|
+
stringList: Gtk.StringList;
|
|
13
|
+
selectionModel: Gtk.SingleSelection;
|
|
14
|
+
factory: Gtk.SignalListItemFactory;
|
|
15
|
+
renderItem: RenderItemFn<unknown>;
|
|
16
|
+
listItemCache: Map<number, ListItemInfo>;
|
|
17
|
+
items: unknown[];
|
|
18
|
+
committedLength: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class ListViewNode extends Node<Gtk.ListView | Gtk.GridView, ListViewState> implements ItemContainer<unknown> {
|
|
6
21
|
static matches(type: string): boolean;
|
|
7
|
-
|
|
8
|
-
private selectionModel;
|
|
9
|
-
private factory;
|
|
10
|
-
private items;
|
|
11
|
-
private renderItem;
|
|
12
|
-
private listItemCache;
|
|
13
|
-
private committedLength;
|
|
14
|
-
constructor(type: string, props: Props);
|
|
22
|
+
initialize(props: Props): void;
|
|
15
23
|
private syncStringList;
|
|
16
24
|
addItem(item: unknown): void;
|
|
17
25
|
insertItemBefore(item: unknown, beforeItem: unknown): void;
|
|
@@ -23,9 +31,10 @@ export declare class ListItemNode extends Node {
|
|
|
23
31
|
static matches(type: string): boolean;
|
|
24
32
|
protected isVirtual(): boolean;
|
|
25
33
|
private item;
|
|
26
|
-
|
|
34
|
+
initialize(props: Props): void;
|
|
27
35
|
getItem(): unknown;
|
|
28
36
|
attachToParent(parent: Node): void;
|
|
29
37
|
attachToParentBefore(parent: Node, before: Node): void;
|
|
30
38
|
detachFromParent(parent: Node): void;
|
|
31
39
|
}
|
|
40
|
+
export {};
|