Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

oak-frontend-base 更新日志

当前 package6.0.4
最新 tag6.0.3
覆盖区间6.0.1..6.0.3 / 6.0.3..HEAD

6.0.4 未发布(区间:6.0.3..HEAD

未发布web 初始化、route access、主题、OakIcon、小程序路由和基础组件是主要变化面。
  • 增加 Desktop web runtime、离线 locale 与桌面外观支持,并把 web platform 与具体 renderer 分开表达;浏览器、Tauri、Electron 不再依赖同一个模糊环境分支。
  • 导出 OakComponent template types 并恢复组件类型推导,配合 oak-cli 生成传统 render 的注入声明;平台 render props 的实验性扩展已回退,业务合同仍以组件定义推导为准。
  • console route access 会等待权限上下文就绪再判定,避免初始化阶段把“尚未加载”误判成无权;旧 pull-to-refresh 实现也已替换并恢复正确 web platform 语义。
  • Web 初始化入口保留旧 positional signature,同时支持 options object:namespaceConfigsrenderErrorrenderLoadingrenderProvideroakThemeiconLibrariesantdConfigProviderPropsantdMobileConfigProviderProps 都进入标准初始化流程。
  • 标准 web app tree 和初始化错误 tree 都会挂载 RouteAccessProviderNamespaceConfigProvider、AntD ConfigProvider、AntD Mobile ConfigProviderStyleProvider 和 Oak theme shell,应用侧可以通过 useNamespaceConfig(...) 读取 CLI 生成的 namespace 配置。
  • 新增 RouteAccessBoundaryresolveRouteAccess(...)route.access 支持 publicdenyrootloginrefrelationoperationanyOfallOf 和数组简写;operation 会调用 features.cache.checkOperation(...),并可通过 $context.entity / $context.entityId 引用当前 console 上下文。
  • namespace 配置支持 access.unconfiguredAccessfeatures.console.contextEntities。当前 console context 不在 namespace 允许范围内时,relation access 和依赖 $context.*operation access 会返回 contextMismatch
  • oak-frontend-base/config 导出 CreatePageConfigCreateComponentConfigCreateNamespaceConfig,内置组件的小程序 JSON 从 index.json 迁移到 index.config.ts,配合 oak-cli 生成虚拟页面 / 组件 JSON。
  • OakIcon 图标库能力扩展:OakIcon 支持旧内置名、显式 oak:*、自定义 font 图标库和 web-only React 图标库。registerOakIconLibraries(...) 会注册编译期、初始化 options 和 namespace config 中的图标库,font 图标支持运行时注入 styleText,React 图标支持同步 icons / resolveIcon(...) 和异步 loadIcon(...)
  • 新增 Oak theme runtime:OakThemeOakThemeProvidermergeOakThemeoakThemeToCssVarsoakCssVarsToCssTextoakTokenVars 成为共享 token / CSS 变量契约;features.theme 可以持久化 theme-mode、主色和 oakTheme,并兼容迁移旧的 ogb:feature-theme-state;Web 初始化会把 Oak token 同步成 AntD ConfigProvider.theme.token 默认值,应用显式传入的 AntD token 优先级更高。
  • 新增 components/theme/setting 主题设置组件,支持浅色、深色、跟随系统和主色切换,读取初始化主题和运行时 features.theme 合并后的有效 OakTheme
  • cache.callSSEEndpoint(name, props, options) 对齐 connector-backed SSE endpoint,默认透传当前前端上下文,ignoreContext: true 时不传上下文;DebugConnector.callSSEEndpoint() 仍明确不可用。
  • 前端 socket / subscriber 会从 socketPoint.get() 读取 scope,并在 socket.io auth.oakSocketScope 中透传给后端,保持多 scope 场景下的连接身份一致。
  • FrontendRuntimeContext 增加 locale 序列化语义,前端运行现场可以携带当前语言信息。
  • 小程序 route map 改为构建期注入的运行时模块,支持 canonical Oak route 到 WeChat 产物路径的双向映射、namespace route、subpackage route mapping 和 tabBar 判断;显式 route map 存在时,缺失路由不再回退猜测。
  • 小程序 navigator 统一使用 setNamespacePath(...) / getNamespacePath() 语义,旧 setNamespace(...) / getNamespace() / namespace 仍兼容但开发态会警告;switchTab 会丢弃 query / state 并输出 warning。
  • 小程序 polyfill 改用 oak-domain 的 URL / fetch 标准导出,补充 DOMExceptiongetRandomValues 等运行能力;socket.io 小程序端改为 ESM repack,减少体积并修复导出。
  • 新增轻量 / 专项 ECharts 小程序 canvas 组件:ec-canvas-basiclinebarpiegaugemap 等,避免所有页面都引入完整 chart runtime。
  • pageHeader 成为唯一维护的页面头部实现,pageHeader2 被移除;web 端返回按钮判断会优先读取 namespace menu,再回退到 contextMenuFactory.menus,支持相对 menu path 和 namespace-prefixed path 匹配。
  • ListPro 使用 runningTree loading 作为默认 loading / reload 状态,继续渲染 Oak 自有 Pagination,并断言不接受 tablePagination;列表行操作按钮修复“执行后仍显示无权限动作”的问题,并增加紧凑操作按钮配置。
  • Pagination 组件重写布局和文案,补充中英文 locale、右对齐样式、showSizeChangershowQuickJumper、自定义 showTotal 和函数式分页选项。
  • 新增 searchPanel 共享筛选面板组件,补齐 web / pc / 小程序入口,用于列表页的命名过滤器 UI;近期同步修复了 PC 端折叠控制、FilterPanel 展开按钮栅格布局和展开后收起按钮裁剪问题。
  • runningTree 增加静态 selection / fresh value / composed operations 缓存和失效逻辑,selectOption 可从组件配置透传到节点;修复 zombie 虚拟节点复用、createNode 行为和带点字面量 key 被 unset 误删导致的缓存异常。
  • Web 错误边界和初始化错误页重构,支持自定义初始化错误 UI;Loading 默认仍走 NProgress,传入 renderLoading 时由应用完全接管 route lazy fallback;网络异常、断网和 server proxy 错误文案统一由 getErrorPageCopy(...) / locale 解析。
  • 依赖和构建同步升级 React 19、AntD 6、AntD Mobile、React Native、peer dependencies、TypeScript 参数兼容和 optimizeDeps.include,并在 package.json.oak.runtime.server 标记前端包不参与 server runtime。
主要 diff 文件:src/platforms/web/initialize/*src/platforms/web/RouteAccessBoundary.tsxsrc/platforms/web/NamespaceConfigProvider.tsxsrc/features/routeAccess.tssrc/config/index.tssrc/theme.tssrc/features/theme.tssrc/features/cache.tssrc/features/socket/*src/features/mpRouteMap.tssrc/features/navigator.mp.tssrc/features/runningTree.tssrc/types/Icon.tssrc/utils/iconLibrary.tssrc/components/icon/*src/components/pageHeader/*src/components/listPro/*src/components/pagination/*src/components/searchPanel/*src/components/filterPanel/*src/utils/errorPage.tssrc/miniprogram_npm/ec-canvas-*test/routeAccess.test.tstest/mpRouteMap.test.tstest/cacheSSEEndpoint.test.tstest/iconLibrary.test.ts

6.0.3(tag:6.0.3,区间:6.0.1..6.0.3

已发布该区间主要是版本发布、构建和依赖对齐,未发现独立的大行为变化。

升级注意

Web 初始化:新项目应使用 options object 传递 namespaceConfigsoakThemerenderLoading、AntD provider props 等配置。不要在应用侧重复包一层全局 RouteAccess / NamespaceConfig / AntD provider,除非确实要隔离一个子树。
route access:operation.target.checkerTypes 是前端合法性探测的 checker 范围字段;依赖 console 上下文的规则应声明 $context.entity / $context.entityId,并确认 namespace 的 features.console.contextEntities 范围。
小程序路由:历史小程序代码如果直接拼生成产物路径,或把 namespace 路由和业务 canonical route 混用,需要回到 Oak navigator 或当前 route map 能识别的静态调用方式。显式 route map 存在时缺失路由不会自动猜测,switchTab 也不会保留 query / state。
组件迁移:pageHeader2 已移除,改用 pageHeaderListPro 不接受 tablePagination,共享分页样式应改 Oak 自有 components/pagination
OakIcon:菜单、页面和 namespace 配置中的图标应继续写字符串,推荐显式使用 oak:*<library>:*。Web React 图标库只在 web 运行时可用,小程序侧需要使用 font 图标库;使用 fontUrl 的库仍需要配套 icons glyph 映射。
主题:Oak 自有组件主题应走 oakTheme / features.theme / --oak-* CSS 变量;AntD / AntD Mobile 的 provider props 只用于三方 UI 库配置。