openxiangda-skill-kit 2.0.10 → 2.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openxiangda-skill-kit",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "OpenXiangda 2.0 中文 AI 技能的校验、分发与安装。",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,6 +41,28 @@ DataQuery 使用有界 where 条件树,支持 and/or/not。标准列表的筛
41
41
 
42
42
  ## 标准后台扩展
43
43
 
44
+ ### 未保存内容的离开保护
45
+
46
+ 自定义表单可在 `OpenXiangdaApplication` 内调用
47
+ `useUnsavedChangesGuard({ when, message? })`。`when` 包含未保存表单、正在提交或
48
+ 结果尚不确定的状态;成功后清除,组件卸载时自动注销。多个表单由应用入口统一汇总,
49
+ 不需要应用创建路由或拦截 document 点击。
50
+
51
+ ```tsx
52
+ useUnsavedChangesGuard({
53
+ when: !result && (hasDraft || pending || hasUnresolvedIntent),
54
+ message: '会议尚未提交完成,离开将丢失当前填写内容。',
55
+ });
56
+ ```
57
+
58
+ 站内使用 React Router 的 `Link` 或 `navigate`,前进/后退与程序跳转使用同一确认框。
59
+ 确认框打开时保留第一次目标,取消后继续原地编辑。刷新、关闭和文档跳转使用浏览器
60
+ 原生提示,其文案和是否展示受浏览器限制。保存成功可在状态清除后的 effect 中跳转。
61
+ 该 hook 只保护导航,不持久化草稿或恢复提交回执;业务数据仍由各自既有能力负责。
62
+ 不要直接调用 `history.pushState` 或修改路由内部状态。
63
+
64
+ ### 应用时区
65
+
44
66
  如业务采用固定时区,在现有 `OpenXiangdaApplication` 传可选 `timeZone`,例如
45
67
  `Asia/Shanghai`。标准表单、审批摘要和各中心时间随同一 UI Provider 展示,应用无需
46
68
  修改设备时区或保存第二份时间。具体控件参数见[字段组件](field-components.md)。