Files
NapCatQQ/.pnpm-store/v3/files/f5/72d5c4f41d75366f8186c6e40def944439e1c2a86584edce5de755344e0c906137ac05bc5ede671ebcb715282e3f9be1b0bd84702ed0966e21cb32fa049e30
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

87 lines
4.1 KiB
Plaintext

var $7f5a58334d8866a5$exports = require("./TableCollection.main.js");
var $hkaUn$reactstatelygrid = require("@react-stately/grid");
var $hkaUn$react = require("react");
var $hkaUn$reactstatelycollections = require("@react-stately/collections");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useTableState", () => $e3f7784147dde23d$export$907bcc6c48325fd6);
$parcel$export(module.exports, "UNSTABLE_useFilteredTableState", () => $e3f7784147dde23d$export$31447e17397b15c2);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION = {
ascending: 'descending',
descending: 'ascending'
};
function $e3f7784147dde23d$export$907bcc6c48325fd6(props) {
let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = (0, $hkaUn$react.useState)(false);
let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons } = props;
let context = (0, $hkaUn$react.useMemo)(()=>({
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none',
showDragButtons: showDragButtons,
selectionMode: selectionMode,
columns: []
}), [
props.children,
showSelectionCheckboxes,
selectionMode,
showDragButtons
]);
let collection = (0, $hkaUn$reactstatelycollections.useCollection)(props, (0, $hkaUn$react.useCallback)((nodes)=>new (0, $7f5a58334d8866a5$exports.TableCollection)(nodes, null, context), [
context
]), context);
let { disabledKeys: disabledKeys, selectionManager: selectionManager } = (0, $hkaUn$reactstatelygrid.useGridState)({
...props,
collection: collection,
disabledBehavior: props.disabledBehavior || 'selection'
});
var _props_sortDescriptor;
return {
collection: collection,
disabledKeys: disabledKeys,
selectionManager: selectionManager,
showSelectionCheckboxes: props.showSelectionCheckboxes || false,
sortDescriptor: (_props_sortDescriptor = props.sortDescriptor) !== null && _props_sortDescriptor !== void 0 ? _props_sortDescriptor : null,
isKeyboardNavigationDisabled: collection.size === 0 || isKeyboardNavigationDisabled,
setKeyboardNavigationDisabled: setKeyboardNavigationDisabled,
sort (columnKey, direction) {
var _props_sortDescriptor, _props_onSortChange;
(_props_onSortChange = props.onSortChange) === null || _props_onSortChange === void 0 ? void 0 : _props_onSortChange.call(props, {
column: columnKey,
direction: direction !== null && direction !== void 0 ? direction : ((_props_sortDescriptor = props.sortDescriptor) === null || _props_sortDescriptor === void 0 ? void 0 : _props_sortDescriptor.column) === columnKey ? $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : 'ascending'
});
}
};
}
function $e3f7784147dde23d$export$31447e17397b15c2(state, filterFn) {
let collection = (0, $hkaUn$react.useMemo)(()=>filterFn ? state.collection.filter(filterFn) : state.collection, [
state.collection,
filterFn
]);
let selectionManager = state.selectionManager.withCollection(collection);
// TODO: handle focus key reset? That logic is in useGridState
return {
...state,
collection: collection,
selectionManager: selectionManager
};
}
//# sourceMappingURL=useTableState.main.js.map