@web-mods/articles 1.1.4 → 1.1.5
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/README.md +13 -1
- package/dist/components/ArticleGuidesSettings.d.ts +12 -0
- package/dist/components/ItemOrderEditor.d.ts +12 -0
- package/dist/components/ParentNavigationOrder.d.ts +9 -0
- package/dist/components/ui/SettingsDialog.d.ts +9 -0
- package/dist/index.cjs +54 -39
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1923 -1467
- package/dist/server.cjs +3 -3
- package/dist/server.d.ts +2 -1
- package/dist/server.js +58 -35
- package/dist/style.css +1 -1
- package/dist/types.d.ts +40 -0
- package/dist/utils/resolveGuidesDisplay.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,10 +10,18 @@ pnpm add @web-mods/articles
|
|
|
10
10
|
|
|
11
11
|
## 导航设置
|
|
12
12
|
|
|
13
|
+
本次新增功能的后端统一交接文档:[文章展示、分类与导航对接](docs/backend-integration-handoff.md),包含已确认规则、建议接口、示例及联调验收。
|
|
14
|
+
|
|
15
|
+
已核对 API 仓库 `main@8f0eb08`,具体文件、数据模型、迁移及复用方案见 [API 源码修改分析](docs/backend-source-analysis.md)。
|
|
16
|
+
|
|
13
17
|
文章保存时提交 `navEnabled`、`navname`、`navPlacements`,编辑时回显接口配置。启用导航需填写名称并选择至少一个展示位置,网站地址必填。
|
|
14
18
|
|
|
15
19
|
父导航从 `GET /navigation/groups?host=...&position=...` 读取,通过 `POST /navigation/groups` 创建并选中真实 ID,不提供前端示例选项。切换网站地址会清空父导航选择并重新加载;关闭导航会保留名称和位置。页眉暂时仅支持顶级导航,已有父导航只读保留;页尾可选父导航。
|
|
16
20
|
|
|
21
|
+
页尾父导航下拉框旁提供「调整顺序」,通过拖动左侧手柄或点击上移、下移调整同站点父导航分组的展示顺序;Guides 分类排序使用相同操作。手柄支持鼠标、触摸及键盘上下方向键,拖动时按 Escape 可撤销本次拖动。「保存顺序」独立于文章保存,取消文章编辑不会撤销已保存的排序;排序不改变文章所属父导航。自定义 service 实现可选的 `reorderNavigationGroups` 后显示排序入口。
|
|
22
|
+
|
|
23
|
+
默认 service 已接入 `PUT /navigation/groups/order`,将组件中的 `groupIds` 映射为 HTTP 请求的 `ids`,提交同站点、同位置的完整父导航顺序。收到 409 时提示取消并重新打开排序,以重新加载最新列表。
|
|
24
|
+
|
|
17
25
|
自定义 `ArticleService` 可实现 `getNavigationGroups`、`createNavigationGroup`;未实现查询方法时禁用导航编辑,文章保存省略导航字段,兼容旧宿主。
|
|
18
26
|
|
|
19
27
|
写操作需要 Bearer Token。默认 service 每次请求会读取当前页面的 `localStorage.accessToken`,并加入 `Authorization: Bearer ...`。自定义 service 可复用宿主凭证:
|
|
@@ -24,7 +32,11 @@ const articleService = createArticleService('https://api-blog.aisee.live', {
|
|
|
24
32
|
})
|
|
25
33
|
```
|
|
26
34
|
|
|
27
|
-
本地调试运行 `pnpm dev`(或 `pnpm playground`),访问 `http://localhost:5173/articles`。页面使用默认 service
|
|
35
|
+
本地调试运行 `pnpm dev`(或 `pnpm playground`),访问 `http://localhost:5173/articles`。页面使用默认 service,请求正式 API 地址 `https://api-blog.aisee.live`;也可通过 `createArticleService(baseURL)` 显式指定地址。仅监听组件库构建请运行 `pnpm build:watch`。
|
|
36
|
+
|
|
37
|
+
默认 service 已接入 Guides 分类查询、新增、编辑及排序。排序将 `categoryIds` 映射为 `ids`;编辑分类只提交 `name`、`description`,不发送 `host`、`id`。文章保存支持 `guidesDisplay`:省略时保留配置,`null` 清除配置,对象设置配置。
|
|
38
|
+
|
|
39
|
+
预览新功能运行 `pnpm dev --mode mock --port 5187`,访问 `http://localhost:5187/articles/guide-preview/edit`。使用现有 `ArticleEdit`、列表和详情组件,只替换注入的 service 为内存模拟数据;可体验 Guides 展示字段、分类编辑、分类排序与父导航排序,刷新后重置。不另做预览表单。`docs` 中相关设计草案保留历史方案,实际 HTTP 契约以默认 service 和本次后端接口文档(提交 `8230164`)为准。
|
|
28
40
|
|
|
29
41
|
接口约定见 [技术交接文档](docs/article-navigation-implementation.md)。
|
|
30
42
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ArticleGuidesDisplay, GuidesCategory } from '../types';
|
|
2
|
+
export declare function ArticleGuidesSettings({ value, categories, categoriesDisabled, onChange, onSaveCategory, onLoadCategories, onReorderCategories }: {
|
|
3
|
+
value: ArticleGuidesDisplay;
|
|
4
|
+
categories: GuidesCategory[];
|
|
5
|
+
categoriesDisabled?: boolean;
|
|
6
|
+
onChange: (value: ArticleGuidesDisplay) => void;
|
|
7
|
+
onSaveCategory?: (category: Pick<GuidesCategory, 'name' | 'description'> & {
|
|
8
|
+
id?: string;
|
|
9
|
+
}) => Promise<GuidesCategory>;
|
|
10
|
+
onLoadCategories?: () => Promise<GuidesCategory[]>;
|
|
11
|
+
onReorderCategories?: (categoryIds: string[]) => Promise<GuidesCategory[]>;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function ItemOrderEditor<T extends {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}>({ items, label, description, presentation, saveOrder, onSaved, onCancel }: {
|
|
5
|
+
items: T[];
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
presentation?: 'inline' | 'dialog';
|
|
9
|
+
saveOrder: (ids: string[]) => Promise<T[]>;
|
|
10
|
+
onSaved: (items: T[]) => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArticleService, NavigationGroup, NavPosition } from '../types';
|
|
2
|
+
export declare function ParentNavigationOrder({ host, position, groups, reorder, onSaved, onCancel }: {
|
|
3
|
+
host: string;
|
|
4
|
+
position: NavPosition;
|
|
5
|
+
groups: NavigationGroup[];
|
|
6
|
+
reorder: NonNullable<ArticleService['reorderNavigationGroups']>;
|
|
7
|
+
onSaved: (groups: NavigationGroup[]) => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare function SettingsDialog({ id, open, busy, label, onDismiss, children }: {
|
|
3
|
+
id: string;
|
|
4
|
+
open: boolean;
|
|
5
|
+
busy: boolean;
|
|
6
|
+
label?: string;
|
|
7
|
+
onDismiss: () => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|