Files
NapCatQQ/.pnpm-store/v3/files/e3/2cc550bff9e371a52956afed0a0855e7e215231b99eea50ac7a44ae3176b65289b06aedb9bb787e6343340a460497a4037f7f18c6f9fcd61af46d52c85d019
T
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

60 lines
1.9 KiB
Plaintext

/*
* 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.
*/
import {PartialNode} from './types';
import React, {JSX, ReactElement} from 'react';
import {SectionProps} from '@react-types/shared';
function Section<T>(props: SectionProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars
return null;
}
Section.getCollectionNode = function* getCollectionNode<T>(props: SectionProps<T>): Generator<PartialNode<T>> {
let {children, title, items} = props;
yield {
type: 'section',
props: props,
hasChildNodes: true,
rendered: title,
'aria-label': props['aria-label'],
*childNodes() {
if (typeof children === 'function') {
if (!items) {
throw new Error('props.children was a function but props.items is missing');
}
for (let item of items) {
yield {
type: 'item',
value: item,
renderer: children
};
}
} else {
let items: PartialNode<T>[] = [];
React.Children.forEach(children, child => {
items.push({
type: 'item',
element: child
});
});
yield* items;
}
}
};
};
// We don't want getCollectionNode to show up in the type definition
let _Section = Section as <T>(props: SectionProps<T>) => JSX.Element;
export {_Section as Section};