book-index-ui 0.7.0 → 0.7.3
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/index.cjs +6 -6
- package/dist/index.d.ts +129 -19
- package/dist/index.js +3939 -3725
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -378,11 +378,7 @@ export declare interface BookPageProps {
|
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
export declare function Breadcrumb({ items }: {
|
|
381
|
-
items:
|
|
382
|
-
label: string;
|
|
383
|
-
onClick?: () => void;
|
|
384
|
-
href?: string;
|
|
385
|
-
}[];
|
|
381
|
+
items: CrumbItem[];
|
|
386
382
|
}): JSX.Element;
|
|
387
383
|
|
|
388
384
|
export declare interface BucketedResources {
|
|
@@ -864,6 +860,18 @@ export declare interface CreateEntityParams {
|
|
|
864
860
|
inheritData?: Record<string, unknown>;
|
|
865
861
|
}
|
|
866
862
|
|
|
863
|
+
export declare interface CrumbItem {
|
|
864
|
+
label: string;
|
|
865
|
+
onClick?: () => void;
|
|
866
|
+
href?: string;
|
|
867
|
+
/**
|
|
868
|
+
* 内部条目 ID。给了就用 useBidUrl 生成真实 href,
|
|
869
|
+
* 于是 Ctrl+点击开新标签、右键复制链接都能用——
|
|
870
|
+
* 只挂 onClick 而 href="#" 的话这些浏览器原生操作全废。
|
|
871
|
+
*/
|
|
872
|
+
id?: string;
|
|
873
|
+
}
|
|
874
|
+
|
|
867
875
|
/** 空值占位「—」 */
|
|
868
876
|
export declare function Dash(): JSX.Element;
|
|
869
877
|
|
|
@@ -1034,6 +1042,15 @@ export declare interface EntityOption {
|
|
|
1034
1042
|
dynasty?: string;
|
|
1035
1043
|
}
|
|
1036
1044
|
|
|
1045
|
+
export declare const EntityPage: default_2.FC<EntityPageProps>;
|
|
1046
|
+
|
|
1047
|
+
export declare interface EntityPageProps {
|
|
1048
|
+
data: EntityDetailData;
|
|
1049
|
+
transport?: IndexStorage;
|
|
1050
|
+
onNavigate?: (id: string) => void;
|
|
1051
|
+
renderLink?: RenderLink;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1037
1054
|
export declare const EntityPickerDialog: default_2.FC<EntityPickerDialogProps>;
|
|
1038
1055
|
|
|
1039
1056
|
declare interface EntityPickerDialogProps {
|
|
@@ -1281,6 +1298,14 @@ export declare function FilterChip({ label, active, onClick, dashed }: {
|
|
|
1281
1298
|
dashed?: boolean;
|
|
1282
1299
|
}): JSX.Element;
|
|
1283
1300
|
|
|
1301
|
+
/**
|
|
1302
|
+
* 把 `additional_titles` / `attached_texts` 这类
|
|
1303
|
+
* `(string | { book_title })[]` 摊平成字符串数组。
|
|
1304
|
+
*/
|
|
1305
|
+
export declare function flattenTitles(items?: (string | {
|
|
1306
|
+
book_title: string;
|
|
1307
|
+
})[]): string[];
|
|
1308
|
+
|
|
1284
1309
|
/**
|
|
1285
1310
|
* 简单模板替换
|
|
1286
1311
|
* formatTemplate('共 {n} 册', { n: 100 }) → '共 100 册'
|
|
@@ -2475,6 +2500,12 @@ export declare function normalizeCatalog(raw: unknown): VolumeBookMapping;
|
|
|
2475
2500
|
|
|
2476
2501
|
export declare function normalizeEra(era: string): string;
|
|
2477
2502
|
|
|
2503
|
+
/**
|
|
2504
|
+
* 把原始 role 歸到粗類。
|
|
2505
|
+
* 空值歸「撰」——802 條 null + 121 條空串,絕大多數是錄入時省略的作者本人著作。
|
|
2506
|
+
*/
|
|
2507
|
+
export declare function normalizeRole(role?: string | null): RoleClass;
|
|
2508
|
+
|
|
2478
2509
|
/** volume_index 有 int / number[] / string 三种形态(生产仓实测),统一成 number[] */
|
|
2479
2510
|
export declare function normalizeVolumeIndex(vi: unknown): number[];
|
|
2480
2511
|
|
|
@@ -2749,6 +2780,24 @@ export declare type ResourceImportStatus = 'todo' | 'in_progress' | 'done';
|
|
|
2749
2780
|
/** 资源导入类型 */
|
|
2750
2781
|
export declare type ResourceImportType = 'catalog' | 'collection';
|
|
2751
2782
|
|
|
2783
|
+
/**
|
|
2784
|
+
* 资源行(含分册展开)。
|
|
2785
|
+
*
|
|
2786
|
+
* 三张页面原先各写了一份:作品页 ResourceLine、版本页 BookResourceLine、
|
|
2787
|
+
* 丛编页 CollectionResourceLine —— 名称解析、note 拼接、分册展开按钮、
|
|
2788
|
+
* 缺册划线的样式全都是复制过去的,其中版本页那份连 VolumeLinks 都内联了
|
|
2789
|
+
* 一遍。合成一个,差异用 props 表达。
|
|
2790
|
+
*/
|
|
2791
|
+
export declare function ResourceLine({ item, siblings, showVolumes, fallbackNote, }: {
|
|
2792
|
+
item: ResourceEntry;
|
|
2793
|
+
/** 同组资源,用于给重名条目加区分后缀(史記在 CText 上三条同名) */
|
|
2794
|
+
siblings?: ResourceEntry[];
|
|
2795
|
+
/** 关掉分册展开:册号已在别处逐个列出时(版本页的「收入叢編」) */
|
|
2796
|
+
showVolumes?: boolean;
|
|
2797
|
+
/** note 为空时的兜底(丛编页用 details 补) */
|
|
2798
|
+
fallbackNote?: string;
|
|
2799
|
+
}): JSX.Element;
|
|
2800
|
+
|
|
2752
2801
|
/**
|
|
2753
2802
|
* 只读资源列表
|
|
2754
2803
|
* 用于 kaiyuanguji-web 等场景的资源展示
|
|
@@ -2829,6 +2878,34 @@ export declare interface ResourceVolume {
|
|
|
2829
2878
|
[key: string]: unknown;
|
|
2830
2879
|
}
|
|
2831
2880
|
|
|
2881
|
+
export declare const ROLE_CLASS_ORDER: RoleClass[];
|
|
2882
|
+
|
|
2883
|
+
/**
|
|
2884
|
+
* 職任歸一。
|
|
2885
|
+
*
|
|
2886
|
+
* 生產倉全量 62,068 條人物—作品關聯裡出現了 **307 種不同寫法**:
|
|
2887
|
+
* 撰 51,247(82.6%)· 作 2,440 · 編 2,008 · 注 1,003 · 修 927 · 纂修 876 …
|
|
2888
|
+
* 長尾則是「等奉敕撰」「舊題撰」「集解」「校正並音釋」這類,
|
|
2889
|
+
* 還混著繁簡兩寫(輯/辑、註/注、刪/删、傳/传、贊/赞)與私用區壞字。
|
|
2890
|
+
*
|
|
2891
|
+
* 不歸一的話篩選 chips 會炸出上百個按鈕,且「撰」與「等奉敕撰」分屬兩組。
|
|
2892
|
+
* 這裡只歸「篩選用的粗類」,原始寫法仍原樣顯示在「職任」列裡——
|
|
2893
|
+
* 「等奉敕撰」與「撰」的區別對版本學是有意義的,不能真的抹掉。
|
|
2894
|
+
*/
|
|
2895
|
+
export declare type RoleClass = '撰' | '編' | '注' | '校' | '譯' | '繪' | '其他';
|
|
2896
|
+
|
|
2897
|
+
export declare interface RoleFacet {
|
|
2898
|
+
cls: RoleClass | '全部';
|
|
2899
|
+
label: string;
|
|
2900
|
+
count: number;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
/** 統計各粗類條數,供篩選 chips 用;空類不出現 */
|
|
2904
|
+
export declare function roleFacets(roles: (string | null | undefined)[]): RoleFacet[];
|
|
2905
|
+
|
|
2906
|
+
/** 行号:统一补零到两位 */
|
|
2907
|
+
export declare function rowNo(i: number): string;
|
|
2908
|
+
|
|
2832
2909
|
export declare const SearchInput: default_2.FC<SearchInputProps>;
|
|
2833
2910
|
|
|
2834
2911
|
export declare interface SearchInputProps {
|
|
@@ -2925,29 +3002,57 @@ export declare interface SyncConfig {
|
|
|
2925
3002
|
|
|
2926
3003
|
declare type TabKey = 'recommend' | 'catalog' | 'collection' | 'site' | 'feedback';
|
|
2927
3004
|
|
|
3005
|
+
/** 表头。窄屏由 CSS 隐藏(meta 折到第二行后表头就没意义了)。 */
|
|
3006
|
+
export declare function TableHead({ spec }: {
|
|
3007
|
+
spec: TableSpec;
|
|
3008
|
+
}): JSX.Element;
|
|
3009
|
+
|
|
3010
|
+
/** 表格行:行号 + 主内容 + meta 组合列。宽度取自与表头同一份 spec。 */
|
|
3011
|
+
export declare function TableRow({ no, main, meta, spec }: {
|
|
3012
|
+
no: default_2.ReactNode;
|
|
3013
|
+
main: default_2.ReactNode;
|
|
3014
|
+
meta: default_2.ReactNode;
|
|
3015
|
+
spec: TableSpec;
|
|
3016
|
+
}): JSX.Element;
|
|
3017
|
+
|
|
2928
3018
|
/**
|
|
2929
|
-
*
|
|
2930
|
-
*
|
|
3019
|
+
* 表格列规格。
|
|
3020
|
+
*
|
|
3021
|
+
* 表头与每一行必须用同一份宽度,否则列会错位。原先三张页面各自把
|
|
3022
|
+
* leadWidth / metaWidth / metaColumns 手抄进 TableHead 和 TableRow 两处
|
|
3023
|
+
* (作品页 22/424、丛编页 26/300、人物页 26/300),改一处忘一处就错位。
|
|
3024
|
+
* 现在一处声明、两处消费。
|
|
2931
3025
|
*/
|
|
2932
|
-
export declare
|
|
3026
|
+
export declare interface TableSpec {
|
|
3027
|
+
/** 行号列宽 */
|
|
2933
3028
|
leadWidth: number;
|
|
3029
|
+
/** meta 区总宽 */
|
|
2934
3030
|
metaWidth: number;
|
|
2935
|
-
|
|
3031
|
+
/** meta 区各子列:表头文案 + 宽度 */
|
|
3032
|
+
columns: {
|
|
2936
3033
|
label: string;
|
|
2937
3034
|
width: string;
|
|
2938
3035
|
}[];
|
|
3036
|
+
/** 主列表头文案 */
|
|
2939
3037
|
mainLabel: string;
|
|
2940
|
-
}
|
|
3038
|
+
}
|
|
2941
3039
|
|
|
2942
|
-
/**
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
3040
|
+
/**
|
|
3041
|
+
* 标签 + chip 的一行(别名 / 附载篇目 / 附录)。
|
|
3042
|
+
* 作品页的 TagRows 与版本页的 AliasRow 原是同一段样式的两份拷贝。
|
|
3043
|
+
*/
|
|
3044
|
+
export declare function TagRow({ label, items }: {
|
|
3045
|
+
label: string;
|
|
3046
|
+
items: string[];
|
|
3047
|
+
}): JSX.Element | null;
|
|
3048
|
+
|
|
3049
|
+
/** 若干 TagRow 竖排 */
|
|
3050
|
+
export declare function TagRows({ rows }: {
|
|
3051
|
+
rows: {
|
|
3052
|
+
label: string;
|
|
3053
|
+
items: string[];
|
|
3054
|
+
}[];
|
|
3055
|
+
}): JSX.Element | null;
|
|
2951
3056
|
|
|
2952
3057
|
/** 文字按钮(排序切换等),带下划线 */
|
|
2953
3058
|
export declare function TextButton({ label, onClick }: {
|
|
@@ -3248,6 +3353,11 @@ export declare interface VolumeDetail {
|
|
|
3248
3353
|
file?: string;
|
|
3249
3354
|
}
|
|
3250
3355
|
|
|
3356
|
+
/** 分册链接网格:缺册划线,无链接的册号显示为灰字 */
|
|
3357
|
+
export declare function VolumeLinks({ item }: {
|
|
3358
|
+
item: ResourceEntry;
|
|
3359
|
+
}): JSX.Element;
|
|
3360
|
+
|
|
3251
3361
|
/** 丛编分部 */
|
|
3252
3362
|
export declare interface VolumeSection {
|
|
3253
3363
|
name: string;
|