@origen-ui/admin-cli 2.0.2 → 3.0.1

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.
Files changed (888) hide show
  1. package/README.md +20 -9
  2. package/bin/contract-sync.mjs +112 -0
  3. package/bin/lib/errors.mjs +8 -0
  4. package/bin/lib/fs-json.mjs +18 -0
  5. package/bin/lib/hash.mjs +9 -0
  6. package/bin/og-admin.mjs +165 -35
  7. package/bin/sync-project.mjs +717 -0
  8. package/package.json +20 -17
  9. package/templates/current/clean/.agents/skills/admin-component-usage/SKILL.md +28 -0
  10. package/templates/current/clean/.agents/skills/admin-component-usage/references/component-directory.md +270 -0
  11. package/templates/current/clean/.agents/skills/build-admin-feature/SKILL.md +20 -0
  12. package/templates/current/clean/.agents/skills/build-admin-feature/references/component-selection.md +38 -0
  13. package/templates/current/{examples/.codex → clean/.agents}/skills/use-og-form/SKILL.md +1 -1
  14. package/templates/current/{examples/.codex → clean/.agents}/skills/use-og-form-table/SKILL.md +4 -3
  15. package/templates/current/clean/{.codex → .agents}/skills/use-og-search/SKILL.md +3 -3
  16. package/templates/current/clean/.agents/skills/use-og-table/SKILL.md +22 -0
  17. package/templates/current/{examples/.codex → clean/.agents}/skills/use-og-upload/SKILL.md +6 -5
  18. package/templates/current/clean/.api-client-e2e.config.ts +13 -0
  19. package/templates/current/clean/.claude/rules/01-feature-architecture.md +10 -0
  20. package/templates/current/clean/.claude/rules/02-vue-typescript.md +10 -0
  21. package/templates/current/clean/.claude/rules/03-component-policy.md +31 -0
  22. package/templates/current/clean/.claude/rules/04-api-auth-router.md +10 -0
  23. package/templates/current/clean/.claude/rules/05-style.md +10 -0
  24. package/templates/current/clean/.claude/rules/06-quality.md +10 -0
  25. package/templates/current/clean/.claude/skills/admin-component-usage/SKILL.md +28 -0
  26. package/templates/current/clean/.claude/skills/admin-component-usage/references/component-directory.md +270 -0
  27. package/templates/current/clean/.claude/skills/build-admin-feature/SKILL.md +20 -0
  28. package/templates/current/clean/.claude/skills/build-admin-feature/references/component-selection.md +38 -0
  29. package/templates/current/clean/{.codex → .claude}/skills/use-og-form/SKILL.md +1 -1
  30. package/templates/current/clean/{.codex → .claude}/skills/use-og-form-table/SKILL.md +4 -3
  31. package/templates/current/{examples/.codex → clean/.claude}/skills/use-og-search/SKILL.md +3 -3
  32. package/templates/current/clean/.claude/skills/use-og-table/SKILL.md +22 -0
  33. package/templates/current/clean/{.codex → .claude}/skills/use-og-upload/SKILL.md +6 -5
  34. package/templates/current/clean/.codebuddy/rules/01-feature-architecture.md +2 -2
  35. package/templates/current/clean/.codebuddy/rules/03-component-policy.md +4 -1
  36. package/templates/current/clean/.codebuddy/skills/admin-component-usage/SKILL.md +31 -0
  37. package/templates/current/clean/.codebuddy/skills/admin-component-usage/references/component-directory.md +270 -0
  38. package/templates/current/clean/.codebuddy/skills/build-admin-feature/SKILL.md +11 -5
  39. package/templates/current/clean/.codebuddy/skills/build-admin-feature/references/component-selection.md +38 -0
  40. package/templates/current/clean/.codebuddy/skills/use-og-form/SKILL.md +1 -1
  41. package/templates/current/clean/.codebuddy/skills/use-og-form-table/SKILL.md +4 -3
  42. package/templates/current/clean/.codebuddy/skills/use-og-search/SKILL.md +3 -3
  43. package/templates/current/clean/.codebuddy/skills/use-og-table/SKILL.md +16 -10
  44. package/templates/current/clean/.codebuddy/skills/use-og-upload/SKILL.md +6 -5
  45. package/templates/current/clean/.codex/AGENTS.md +55 -8
  46. package/templates/current/clean/.codex/rules/01-feature-architecture.md +2 -2
  47. package/templates/current/clean/.codex/rules/03-component-policy.md +4 -1
  48. package/templates/current/clean/.cursor/rules/.generated +5 -0
  49. package/templates/current/clean/.cursor/rules/01-feature-architecture.mdc +2 -2
  50. package/templates/current/clean/.cursor/rules/03-component-policy.mdc +4 -1
  51. package/templates/current/clean/.cursor/skills/admin-component-usage/SKILL.md +28 -0
  52. package/templates/current/clean/.cursor/skills/admin-component-usage/references/component-directory.md +270 -0
  53. package/templates/current/clean/.cursor/skills/build-admin-feature/SKILL.md +11 -5
  54. package/templates/current/clean/.cursor/skills/build-admin-feature/references/component-selection.md +38 -0
  55. package/templates/current/clean/.cursor/skills/use-og-form/SKILL.md +1 -1
  56. package/templates/current/clean/.cursor/skills/use-og-form-table/SKILL.md +4 -3
  57. package/templates/current/clean/.cursor/skills/use-og-search/SKILL.md +3 -3
  58. package/templates/current/clean/.cursor/skills/use-og-table/SKILL.md +16 -10
  59. package/templates/current/clean/.cursor/skills/use-og-upload/SKILL.md +6 -5
  60. package/templates/current/clean/{.env.example → .env.dev} +3 -2
  61. package/templates/current/clean/.env.mock +4 -0
  62. package/templates/current/clean/.env.production +5 -0
  63. package/templates/current/clean/.env.test +4 -0
  64. package/templates/current/clean/.prettierignore +17 -0
  65. package/templates/current/clean/.prettierrc +8 -0
  66. package/templates/current/clean/.qoder/rules/01-feature-architecture.md +3 -4
  67. package/templates/current/clean/.qoder/rules/02-vue-typescript.md +1 -2
  68. package/templates/current/clean/.qoder/rules/03-component-policy.md +5 -3
  69. package/templates/current/clean/.qoder/rules/04-api-auth-router.md +1 -2
  70. package/templates/current/clean/.qoder/rules/05-style.md +1 -2
  71. package/templates/current/clean/.qoder/rules/06-quality.md +1 -2
  72. package/templates/current/clean/.qoder/skills/admin-component-usage/SKILL.md +28 -0
  73. package/templates/current/clean/.qoder/skills/admin-component-usage/references/component-directory.md +270 -0
  74. package/templates/current/clean/.qoder/skills/build-admin-feature/SKILL.md +11 -5
  75. package/templates/current/clean/.qoder/skills/build-admin-feature/references/component-selection.md +38 -0
  76. package/templates/current/clean/.qoder/skills/use-og-form/SKILL.md +1 -1
  77. package/templates/current/clean/.qoder/skills/use-og-form-table/SKILL.md +4 -3
  78. package/templates/current/clean/.qoder/skills/use-og-search/SKILL.md +3 -3
  79. package/templates/current/clean/.qoder/skills/use-og-table/SKILL.md +16 -10
  80. package/templates/current/clean/.qoder/skills/use-og-upload/SKILL.md +6 -5
  81. package/templates/current/clean/.zcode/skills/admin-component-usage/SKILL.md +28 -0
  82. package/templates/current/clean/.zcode/skills/admin-component-usage/references/component-directory.md +270 -0
  83. package/templates/current/clean/.zcode/skills/build-admin-feature/SKILL.md +20 -0
  84. package/templates/current/clean/.zcode/skills/build-admin-feature/references/component-selection.md +38 -0
  85. package/templates/current/clean/.zcode/skills/style-og-origen-ui/SKILL.md +11 -0
  86. package/templates/current/clean/.zcode/skills/use-og-dialog/SKILL.md +12 -0
  87. package/templates/current/clean/.zcode/skills/use-og-editor/SKILL.md +25 -0
  88. package/templates/current/clean/.zcode/skills/use-og-form/SKILL.md +12 -0
  89. package/templates/current/clean/.zcode/skills/use-og-form-table/SKILL.md +26 -0
  90. package/templates/current/clean/.zcode/skills/use-og-http/SKILL.md +13 -0
  91. package/templates/current/clean/.zcode/skills/use-og-router-tabs/SKILL.md +11 -0
  92. package/templates/current/clean/.zcode/skills/use-og-search/SKILL.md +14 -0
  93. package/templates/current/clean/.zcode/skills/use-og-table/SKILL.md +22 -0
  94. package/templates/current/clean/.zcode/skills/use-og-upload/SKILL.md +26 -0
  95. package/templates/current/clean/AGENTS.md +55 -9
  96. package/templates/current/clean/CHANGELOG.md +107 -0
  97. package/templates/current/clean/CLAUDE.md +3 -0
  98. package/templates/current/clean/README.md +58 -88
  99. package/templates/current/clean/component-catalog.json +766 -348
  100. package/templates/current/clean/component-catalog.v2.json +2040 -0
  101. package/templates/current/clean/docs/components/dialog.md +405 -0
  102. package/templates/current/clean/docs/components/editor-viewer.md +87 -0
  103. package/templates/current/clean/docs/components/editor.md +275 -0
  104. package/templates/current/clean/docs/components/form-table.md +222 -0
  105. package/templates/current/clean/docs/components/form.md +750 -0
  106. package/templates/current/clean/docs/components/index.md +44 -0
  107. package/templates/current/clean/docs/components/router.md +452 -0
  108. package/templates/current/clean/docs/components/search.md +1205 -0
  109. package/templates/current/clean/docs/components/svg-icon.md +124 -0
  110. package/templates/current/clean/docs/components/table-local.md +176 -0
  111. package/templates/current/clean/docs/components/table-with-search.md +207 -0
  112. package/templates/current/clean/docs/components/table.md +813 -0
  113. package/templates/current/clean/docs/components/tabs.md +440 -0
  114. package/templates/current/clean/docs/components/upload.md +349 -0
  115. package/templates/current/clean/eslint.config.js +89 -0
  116. package/templates/current/clean/index.html +1 -1
  117. package/templates/current/clean/openapi.json +10048 -999
  118. package/templates/current/clean/package.json +45 -33
  119. package/templates/current/clean/playwright.config.ts +20 -6
  120. package/templates/current/clean/playwright.mock.config.ts +42 -0
  121. package/templates/current/clean/pnpm-workspace.yaml +19 -3
  122. package/templates/current/clean/recipes/remote-crud-dialog-form.vue +15 -13
  123. package/templates/current/clean/scaffold.lock.json +164 -4
  124. package/templates/current/clean/scripts/api-codegen.config.ts +35 -0
  125. package/templates/current/clean/scripts/api-codegen.ts +2015 -0
  126. package/templates/current/clean/scripts/api-templates/http-client.ejs +359 -0
  127. package/templates/current/clean/scripts/check-admin-scaffold.mjs +311 -17
  128. package/templates/current/clean/scripts/generate-api.ts +290 -85
  129. package/templates/current/clean/scripts/lib/admin-component-catalog.mjs +515 -0
  130. package/templates/current/clean/scripts/lib/repository-root.mjs +9 -0
  131. package/templates/current/clean/scripts/mock-api.ts +1356 -0
  132. package/templates/current/clean/scripts/remove-examples.mjs +9 -34
  133. package/templates/current/clean/src/App.vue +9 -18
  134. package/templates/current/clean/src/api/generated/data-contracts.ts +23 -265
  135. package/templates/current/clean/src/api/generated/http-client.ts +351 -180
  136. package/templates/current/clean/src/api/generated/index.ts +22 -0
  137. package/templates/current/clean/src/api/generated/services/auth.ts +123 -0
  138. package/templates/current/clean/src/api/generated/services/common/files.ts +111 -0
  139. package/templates/current/clean/src/api/generated/services/monitor/cache.ts +164 -0
  140. package/templates/current/clean/src/api/generated/services/monitor/job.ts +195 -0
  141. package/templates/current/clean/src/api/generated/services/monitor/jobLog.ts +126 -0
  142. package/templates/current/clean/src/api/generated/services/monitor/logininfor.ts +126 -0
  143. package/templates/current/clean/src/api/generated/services/monitor/online.ts +66 -0
  144. package/templates/current/clean/src/api/generated/services/monitor/operlog.ts +106 -0
  145. package/templates/current/clean/src/api/generated/services/monitor/server.ts +41 -0
  146. package/templates/current/clean/src/api/generated/services/system/configs.ts +190 -0
  147. package/templates/current/clean/src/api/generated/services/system/departments.ts +173 -0
  148. package/templates/current/clean/src/api/generated/services/system/dictionaries/data.ts +169 -0
  149. package/templates/current/clean/src/api/generated/services/system/dictionaries/types.ts +187 -0
  150. package/templates/current/clean/src/api/generated/services/system/index.ts +158 -0
  151. package/templates/current/clean/src/api/generated/services/system/menus.ts +193 -0
  152. package/templates/current/clean/src/api/generated/services/system/notices.ts +221 -0
  153. package/templates/current/clean/src/api/generated/services/system/posts.ts +168 -0
  154. package/templates/current/clean/src/api/generated/services/system/roles.ts +354 -0
  155. package/templates/current/clean/src/api/generated/services/system/users.ts +425 -0
  156. package/templates/current/clean/src/api/generated/services/tool/code-generator.ts +304 -0
  157. package/templates/current/clean/src/api/generated/types/auth.types.ts +132 -0
  158. package/templates/current/clean/src/api/generated/types/common/files.types.ts +57 -0
  159. package/templates/current/clean/src/api/generated/types/common.ts +174 -0
  160. package/templates/current/clean/src/api/generated/types/enum-dict.ts +94 -0
  161. package/templates/current/clean/src/api/generated/types/enums.ts +155 -0
  162. package/templates/current/clean/src/api/generated/types/monitor/cache.types.ts +149 -0
  163. package/templates/current/clean/src/api/generated/types/monitor/job.types.ts +207 -0
  164. package/templates/current/clean/src/api/generated/types/monitor/jobLog.types.ts +134 -0
  165. package/templates/current/clean/src/api/generated/types/monitor/logininfor.types.ts +135 -0
  166. package/templates/current/clean/src/api/generated/types/monitor/online.types.ts +80 -0
  167. package/templates/current/clean/src/api/generated/types/monitor/operlog.types.ts +126 -0
  168. package/templates/current/clean/src/api/generated/types/monitor/server.types.ts +205 -0
  169. package/templates/current/clean/src/api/generated/types/system/configs.types.ts +200 -0
  170. package/templates/current/clean/src/api/generated/types/system/departments.types.ts +145 -0
  171. package/templates/current/clean/src/api/generated/types/system/dictionaries/data.types.ts +210 -0
  172. package/templates/current/clean/src/api/generated/types/system/dictionaries/types.types.ts +221 -0
  173. package/templates/current/clean/src/api/generated/types/system/index.types.ts +19 -0
  174. package/templates/current/clean/src/api/generated/types/system/menus.types.ts +234 -0
  175. package/templates/current/clean/src/api/generated/types/system/notices.types.ts +270 -0
  176. package/templates/current/clean/src/api/generated/types/system/posts.types.ts +198 -0
  177. package/templates/current/clean/src/api/generated/types/system/roles.types.ts +410 -0
  178. package/templates/current/clean/src/api/generated/types/system/users.types.ts +413 -0
  179. package/templates/current/clean/src/api/generated/types/tool/code-generator.types.ts +388 -0
  180. package/templates/current/clean/src/api/index.ts +44 -39
  181. package/templates/current/clean/src/app/__tests__/api-generated.types.ts +24 -0
  182. package/templates/current/clean/src/app/api.ts +6 -0
  183. package/templates/current/clean/src/app/authorization/permission.ts +9 -0
  184. package/templates/current/{examples/src/app → clean/src/app/config}/runtimeConfig.ts +44 -12
  185. package/templates/current/clean/src/app/errors/errorMessage.ts +80 -0
  186. package/templates/current/clean/src/app/http/client.ts +141 -0
  187. package/templates/current/clean/src/app/http/http-adapter.ts +71 -0
  188. package/templates/current/{examples/src/app → clean/src/app/i18n}/adminLocale.ts +25 -19
  189. package/templates/current/clean/src/app/{localeFormat.ts → i18n/localeFormat.ts} +29 -6
  190. package/templates/current/clean/src/app/i18n/origenUiLocale.ts +15 -0
  191. package/templates/current/clean/src/app/menu/menu.ts +175 -0
  192. package/templates/current/clean/src/app/menu/menuTypes.ts +20 -0
  193. package/templates/current/clean/src/{features → app}/security/devtoolsProtection.ts +8 -7
  194. package/templates/current/clean/src/app/ui/createAdminUi.ts +31 -0
  195. package/templates/current/clean/src/app/ui/iconCatalog.ts +71 -0
  196. package/templates/current/clean/src/assets/icons/appearance.svg +1 -0
  197. package/templates/current/clean/src/assets/icons/arrow-right.svg +1 -0
  198. package/templates/current/clean/src/assets/icons/check.svg +1 -0
  199. package/templates/current/clean/src/assets/icons/circle-check.svg +1 -0
  200. package/templates/current/clean/src/assets/icons/default.svg +4 -0
  201. package/templates/current/clean/src/assets/icons/directory/setting.svg +1 -0
  202. package/templates/current/clean/src/assets/icons/expand.svg +1 -0
  203. package/templates/current/clean/src/assets/icons/fold.svg +1 -0
  204. package/templates/current/clean/src/assets/icons/key.svg +1 -0
  205. package/templates/current/clean/src/assets/icons/lock.svg +1 -0
  206. package/templates/current/clean/src/assets/icons/monitor.svg +1 -0
  207. package/templates/current/clean/src/assets/icons/moon.svg +11 -0
  208. package/templates/current/clean/src/assets/icons/page/department.svg +1 -0
  209. package/templates/current/clean/src/assets/icons/page/dictionary.svg +1 -0
  210. package/templates/current/clean/src/assets/icons/page/menus.svg +1 -0
  211. package/templates/current/clean/src/assets/icons/page/user.svg +1 -0
  212. package/templates/current/clean/src/assets/icons/page/users.svg +1 -0
  213. package/templates/current/clean/src/assets/icons/plus.svg +1 -0
  214. package/templates/current/clean/src/assets/icons/profile.svg +1 -0
  215. package/templates/current/clean/src/assets/icons/refresh.svg +1 -0
  216. package/templates/current/clean/src/assets/icons/roles.svg +1 -0
  217. package/templates/current/clean/src/assets/icons/search.svg +1 -0
  218. package/templates/current/clean/src/assets/icons/sunny.svg +1 -0
  219. package/templates/current/clean/src/assets/icons/system.svg +1 -0
  220. package/templates/current/clean/src/assets/icons/theme-auto.svg +14 -0
  221. package/templates/current/clean/src/assets/icons/tune.svg +13 -0
  222. package/templates/current/clean/src/{features/shell/components → components}/RouteProgress.vue +2 -2
  223. package/templates/current/{examples/src/features/system/access → clean/src}/composables/useAuthorizationRefresh.ts +6 -1
  224. package/templates/current/clean/src/composables/useSystemTableSearchVisibility.ts +33 -0
  225. package/templates/current/clean/src/{features/appearance/composables → composables}/useTheme.ts +1 -1
  226. package/templates/current/clean/src/env.d.ts +6 -19
  227. package/templates/current/clean/src/layouts/AdminLayout.vue +7 -9
  228. package/templates/current/clean/src/{features/shell/components → layouts}/AdminWatermark.vue +2 -2
  229. package/templates/current/clean/src/layouts/BreadcrumbBar.vue +9 -1
  230. package/templates/current/clean/src/layouts/SideMenu.vue +7 -15
  231. package/templates/current/clean/src/{features/appearance/components → layouts}/ThemePanel.vue +39 -11
  232. package/templates/current/clean/src/layouts/TopBar.vue +60 -28
  233. package/templates/current/clean/src/layouts/WorkspaceTabs.vue +10 -1
  234. package/templates/current/clean/src/layouts/topBarMenuSearch.ts +25 -4
  235. package/templates/current/clean/src/locales/en-US.json +227 -219
  236. package/templates/current/clean/src/locales/index.ts +72 -32
  237. package/templates/current/clean/src/locales/messages-types.ts +15 -10
  238. package/templates/current/clean/src/locales/vue-i18n.d.ts +1 -1
  239. package/templates/current/clean/src/locales/zh-CN.json +226 -218
  240. package/templates/current/clean/src/locales/zh-TW.json +222 -214
  241. package/templates/current/clean/src/main.ts +59 -30
  242. package/templates/current/clean/src/router/bootstrap.ts +69 -24
  243. package/templates/current/clean/src/router/dynamic/componentLoader.ts +150 -0
  244. package/templates/current/clean/src/router/{dynamicMenuRefresh.ts → dynamic/dynamicMenuRefresh.ts} +6 -2
  245. package/templates/current/clean/src/router/dynamic/dynamicRoutes.ts +247 -0
  246. package/templates/current/clean/src/router/navigation/guards.ts +12 -0
  247. package/templates/current/clean/src/router/navigation/paths.ts +28 -0
  248. package/templates/current/clean/src/router/navigation/staticRoutes.ts +109 -0
  249. package/templates/current/clean/src/router/{queryEncryption.ts → query/queryEncryption.ts} +29 -12
  250. package/templates/current/clean/src/router/query/routeQuery.ts +29 -0
  251. package/templates/current/clean/src/router/{useRouteQueryDefaults.ts → query/useRouteQueryDefaults.ts} +9 -8
  252. package/templates/current/clean/src/router/query/useRouteQueryDefaults.types.ts +28 -0
  253. package/templates/current/clean/src/router/{runtimeErrorRecovery.ts → recovery/runtimeErrorRecovery.ts} +21 -3
  254. package/templates/current/clean/src/{features/auth/store → store}/auth.ts +96 -61
  255. package/templates/current/clean/src/store/dictionaries.ts +86 -0
  256. package/templates/current/clean/src/{features/shell/store → store}/sidebar.ts +9 -2
  257. package/templates/current/{examples/src/features/appearance → clean/src}/store/theme.ts +8 -4
  258. package/templates/current/clean/src/styles/layout.css +51 -0
  259. package/templates/current/clean/src/templates/og-form.ts +7 -2
  260. package/templates/current/clean/src/templates/og-table.ts +88 -20
  261. package/templates/current/clean/src/templates/router.ts +11 -2
  262. package/templates/current/clean/src/utils/color-mix.ts +6 -2
  263. package/templates/current/clean/src/utils/download.ts +11 -0
  264. package/templates/current/clean/src/utils/permissions.ts +1 -1
  265. package/templates/current/clean/src/utils/retryableDialog.ts +46 -0
  266. package/templates/current/clean/src/{features → views}/errors/pages/Forbidden.vue +6 -2
  267. package/templates/current/clean/src/views/errors/pages/MethodNotAllowed.vue +34 -0
  268. package/templates/current/clean/src/{features → views}/errors/pages/NotFound.vue +6 -2
  269. package/templates/current/clean/src/{features → views}/errors/pages/ServerError.vue +6 -2
  270. package/templates/current/clean/src/{features/auth/pages/Login.vue → views/login/pages/index.vue} +99 -10
  271. package/templates/current/clean/src/views/system/access/services/admin-repository.ts +489 -0
  272. package/templates/current/clean/src/views/system/access/services/rbac.ts +317 -0
  273. package/templates/current/clean/src/views/system/dept/components/DepartmentEditorForm.vue +87 -0
  274. package/templates/current/clean/src/views/system/dept/composables/useDepartmentManagement.ts +314 -0
  275. package/templates/current/clean/src/views/system/dept/pages/index.vue +44 -0
  276. package/templates/current/clean/src/views/system/dept/services/departments.ts +168 -0
  277. package/templates/current/clean/src/views/system/dict/components/DictionaryDataEditorForm.vue +98 -0
  278. package/templates/current/clean/src/views/system/dict/components/DictionaryDataPreview.vue +233 -0
  279. package/templates/current/clean/src/views/system/dict/components/DictionaryTypeEditorForm.vue +66 -0
  280. package/templates/current/clean/src/views/system/dict/composables/useDictionaryDataManagement.ts +406 -0
  281. package/templates/current/clean/src/views/system/dict/composables/useDictionaryTypeManagement.ts +329 -0
  282. package/templates/current/clean/src/views/system/dict/data/pages/index.vue +134 -0
  283. package/templates/current/clean/src/views/system/dict/pages/index.vue +113 -0
  284. package/templates/current/clean/src/views/system/dict/services/dictionaries.ts +239 -0
  285. package/templates/current/clean/src/views/system/menu/components/MenuEditorForm.vue +252 -0
  286. package/templates/current/clean/src/views/system/menu/composables/useMenuManagement.ts +357 -0
  287. package/templates/current/clean/src/views/system/menu/menuDraft.ts +45 -0
  288. package/templates/current/clean/src/views/system/menu/pages/ExternalLink.vue +37 -0
  289. package/templates/current/clean/src/views/system/menu/pages/index.vue +75 -0
  290. package/templates/current/clean/src/views/system/post/components/PostEditorForm.vue +69 -0
  291. package/templates/current/clean/src/views/system/post/composables/usePostManagement.ts +245 -0
  292. package/templates/current/clean/src/views/system/post/pages/index.vue +92 -0
  293. package/templates/current/clean/src/views/system/post/services/posts.ts +100 -0
  294. package/templates/current/clean/src/views/system/role/auth-users/pages/index.vue +100 -0
  295. package/templates/current/clean/src/views/system/role/components/RoleDataScopeForm.vue +167 -0
  296. package/templates/current/clean/src/views/system/role/components/RoleEditorForm.vue +165 -0
  297. package/templates/current/clean/src/views/system/role/components/RoleUserSelectForm.vue +129 -0
  298. package/templates/current/clean/src/views/system/role/composables/useRoleManagement.ts +422 -0
  299. package/templates/current/clean/src/views/system/role/composables/useRoleUserManagement.ts +233 -0
  300. package/templates/current/clean/src/views/system/role/pages/index.vue +110 -0
  301. package/templates/current/clean/src/views/system/role/services/roleAccess.ts +162 -0
  302. package/templates/current/clean/src/views/system/user/auth-roles/pages/index.vue +209 -0
  303. package/templates/current/clean/src/views/system/user/components/UserDetailsForm.vue +108 -0
  304. package/templates/current/clean/src/views/system/user/components/UserEditorForm.vue +207 -0
  305. package/templates/current/clean/src/views/system/user/components/UserImportDialog.vue +80 -0
  306. package/templates/current/clean/src/views/system/user/components/UserResetPasswordForm.vue +56 -0
  307. package/templates/current/clean/src/views/system/user/composables/useUserManagement.ts +502 -0
  308. package/templates/current/clean/src/views/system/user/pages/index.vue +459 -0
  309. package/templates/current/clean/tests/e2e/admin-access-business.spec.ts +33 -0
  310. package/templates/current/clean/tests/e2e/admin-shell.spec.ts +50 -0
  311. package/templates/current/clean/tests/e2e/fixtures/adminMockBackend.ts +95 -0
  312. package/templates/current/clean/tests/e2e/fixtures/labelGeometry.ts +52 -0
  313. package/templates/current/clean/tests/e2e/mock-api-generation.spec.ts +27 -0
  314. package/templates/current/clean/tests/e2e/mock-business.spec.ts +555 -0
  315. package/templates/current/clean/tests/e2e/mock-menu-retry-form-label.spec.ts +100 -0
  316. package/templates/current/clean/tests/e2e/mock-shell.spec.ts +25 -0
  317. package/templates/current/clean/tests/e2e/mock-tree-selection-layout.spec.ts +113 -0
  318. package/templates/current/clean/tests/unit/api/api-codegen.spec.ts +893 -0
  319. package/templates/current/clean/tests/unit/api/client.spec.ts +145 -0
  320. package/templates/current/clean/tests/unit/api/generated-http-client.spec.ts +290 -0
  321. package/templates/current/{examples/src → clean/tests/unit}/api/http-adapter.spec.ts +3 -3
  322. package/templates/current/clean/tests/unit/api/system-apis.spec.ts +118 -0
  323. package/templates/current/clean/tests/unit/app/createAdminUi.spec.ts +79 -0
  324. package/templates/current/clean/{src → tests/unit}/app/errorMessage.spec.ts +1 -1
  325. package/templates/current/clean/tests/unit/app/iconCatalog.spec.ts +12 -0
  326. package/templates/current/clean/tests/unit/app/menu.spec.ts +215 -0
  327. package/templates/current/{examples/src → clean/tests/unit}/app/origenUiLocale.spec.ts +1 -1
  328. package/templates/current/{examples/src → clean/tests/unit}/app/permission.spec.ts +4 -5
  329. package/templates/current/clean/tests/unit/app/runtimeConfig.spec.ts +36 -0
  330. package/templates/current/{examples/src/features → clean/tests/unit/app}/security/devtoolsProtection.spec.ts +17 -7
  331. package/templates/current/{examples/src/features/shell → clean/tests/unit}/composables/useRouteProgress.spec.ts +1 -1
  332. package/templates/current/{examples/src/features/shell/components → clean/tests/unit/layouts}/AdminWatermark.spec.ts +5 -7
  333. package/templates/current/{examples/src → clean/tests/unit}/layouts/topBarMenuSearch.spec.ts +25 -8
  334. package/templates/current/clean/{src → tests/unit}/locales/messages.spec.ts +43 -17
  335. package/templates/current/clean/tests/unit/router/dynamicMenuRefresh.spec.ts +151 -0
  336. package/templates/current/clean/tests/unit/router/dynamicRoutes.spec.ts +374 -0
  337. package/templates/current/clean/tests/unit/router/paths.spec.ts +103 -0
  338. package/templates/current/clean/{src → tests/unit}/router/queryEncryption.spec.ts +49 -12
  339. package/templates/current/{examples/src → clean/tests/unit}/router/routeQuery.spec.ts +8 -1
  340. package/templates/current/clean/{src → tests/unit}/router/runtimeErrorRecovery.spec.ts +11 -6
  341. package/templates/current/{examples/src → clean/tests/unit}/router/useRouteQueryDefaults.spec.ts +46 -12
  342. package/templates/current/clean/tests/unit/scripts/mock-api.spec.ts +440 -0
  343. package/templates/current/clean/{scripts → tests/unit/scripts}/vite-build-policy.spec.ts +35 -6
  344. package/templates/current/clean/{src/features/auth → tests/unit}/store/auth.spec.ts +68 -15
  345. package/templates/current/clean/tests/unit/store/dictionaries.spec.ts +106 -0
  346. package/templates/current/{examples/src → clean/tests/unit}/templates/templates.spec.ts +60 -16
  347. package/templates/current/clean/{src/utils/__tests__ → tests/unit/utils}/color-mix.spec.ts +1 -1
  348. package/templates/current/clean/tests/unit/utils/retryableDialog.spec.ts +61 -0
  349. package/templates/current/{examples/src/features/errors/pages → clean/tests/unit/views/errors}/error-pages.spec.ts +11 -7
  350. package/templates/current/clean/tests/unit/views/feature-composables.spec.ts +233 -0
  351. package/templates/current/clean/tests/unit/views/system/access/admin-repository.spec.ts +353 -0
  352. package/templates/current/clean/tests/unit/views/system/access/rbac.spec.ts +329 -0
  353. package/templates/current/clean/tests/unit/views/system/dept/departments.spec.ts +104 -0
  354. package/templates/current/clean/tests/unit/views/system/dict/dictionaries.spec.ts +234 -0
  355. package/templates/current/clean/tests/unit/views/system/menu/menuDraft.spec.ts +77 -0
  356. package/templates/current/clean/tests/unit/views/system/menu/useMenuManagement.spec.ts +339 -0
  357. package/templates/current/clean/tests/unit/views/system/user/searchControl.spec.ts +128 -0
  358. package/templates/current/clean/tsconfig.json +4 -19
  359. package/templates/current/clean/vite.build-policy.ts +97 -22
  360. package/templates/current/clean/vite.config.ts +50 -7
  361. package/templates/current/examples/.agents/skills/admin-component-usage/SKILL.md +28 -0
  362. package/templates/current/examples/.agents/skills/admin-component-usage/references/component-directory.md +270 -0
  363. package/templates/current/examples/.agents/skills/build-admin-feature/SKILL.md +20 -0
  364. package/templates/current/examples/.agents/skills/build-admin-feature/references/component-selection.md +38 -0
  365. package/templates/current/examples/.agents/skills/style-og-origen-ui/SKILL.md +11 -0
  366. package/templates/current/examples/.agents/skills/use-og-dialog/SKILL.md +12 -0
  367. package/templates/current/examples/.agents/skills/use-og-editor/SKILL.md +25 -0
  368. package/templates/current/examples/.agents/skills/use-og-form/SKILL.md +12 -0
  369. package/templates/current/examples/.agents/skills/use-og-form-table/SKILL.md +26 -0
  370. package/templates/current/examples/.agents/skills/use-og-http/SKILL.md +13 -0
  371. package/templates/current/examples/.agents/skills/use-og-router-tabs/SKILL.md +11 -0
  372. package/templates/current/examples/.agents/skills/use-og-search/SKILL.md +14 -0
  373. package/templates/current/examples/.agents/skills/use-og-table/SKILL.md +22 -0
  374. package/templates/current/examples/.agents/skills/use-og-upload/SKILL.md +26 -0
  375. package/templates/current/examples/.api-client-e2e.config.ts +13 -0
  376. package/templates/current/examples/.claude/rules/01-feature-architecture.md +10 -0
  377. package/templates/current/examples/.claude/rules/02-vue-typescript.md +10 -0
  378. package/templates/current/examples/.claude/rules/03-component-policy.md +31 -0
  379. package/templates/current/examples/.claude/rules/04-api-auth-router.md +10 -0
  380. package/templates/current/examples/.claude/rules/05-style.md +10 -0
  381. package/templates/current/examples/.claude/rules/06-quality.md +10 -0
  382. package/templates/current/examples/.claude/skills/admin-component-usage/SKILL.md +28 -0
  383. package/templates/current/examples/.claude/skills/admin-component-usage/references/component-directory.md +270 -0
  384. package/templates/current/examples/.claude/skills/build-admin-feature/SKILL.md +20 -0
  385. package/templates/current/examples/.claude/skills/build-admin-feature/references/component-selection.md +38 -0
  386. package/templates/current/examples/.claude/skills/style-og-origen-ui/SKILL.md +11 -0
  387. package/templates/current/examples/.claude/skills/use-og-dialog/SKILL.md +12 -0
  388. package/templates/current/examples/.claude/skills/use-og-editor/SKILL.md +25 -0
  389. package/templates/current/examples/.claude/skills/use-og-form/SKILL.md +12 -0
  390. package/templates/current/examples/.claude/skills/use-og-form-table/SKILL.md +26 -0
  391. package/templates/current/examples/.claude/skills/use-og-http/SKILL.md +13 -0
  392. package/templates/current/examples/.claude/skills/use-og-router-tabs/SKILL.md +11 -0
  393. package/templates/current/examples/.claude/skills/use-og-search/SKILL.md +14 -0
  394. package/templates/current/examples/.claude/skills/use-og-table/SKILL.md +22 -0
  395. package/templates/current/examples/.claude/skills/use-og-upload/SKILL.md +26 -0
  396. package/templates/current/examples/.codebuddy/rules/01-feature-architecture.md +2 -2
  397. package/templates/current/examples/.codebuddy/rules/03-component-policy.md +4 -1
  398. package/templates/current/examples/.codebuddy/skills/admin-component-usage/SKILL.md +31 -0
  399. package/templates/current/examples/.codebuddy/skills/admin-component-usage/references/component-directory.md +270 -0
  400. package/templates/current/examples/.codebuddy/skills/build-admin-feature/SKILL.md +11 -5
  401. package/templates/current/examples/.codebuddy/skills/build-admin-feature/references/component-selection.md +38 -0
  402. package/templates/current/examples/.codebuddy/skills/use-og-form/SKILL.md +1 -1
  403. package/templates/current/examples/.codebuddy/skills/use-og-form-table/SKILL.md +4 -3
  404. package/templates/current/examples/.codebuddy/skills/use-og-search/SKILL.md +3 -3
  405. package/templates/current/examples/.codebuddy/skills/use-og-table/SKILL.md +16 -10
  406. package/templates/current/examples/.codebuddy/skills/use-og-upload/SKILL.md +6 -5
  407. package/templates/current/examples/.codex/AGENTS.md +55 -8
  408. package/templates/current/examples/.codex/rules/01-feature-architecture.md +2 -2
  409. package/templates/current/examples/.codex/rules/03-component-policy.md +4 -1
  410. package/templates/current/examples/.cursor/rules/.generated +5 -0
  411. package/templates/current/examples/.cursor/rules/01-feature-architecture.mdc +2 -2
  412. package/templates/current/examples/.cursor/rules/03-component-policy.mdc +4 -1
  413. package/templates/current/examples/.cursor/skills/admin-component-usage/SKILL.md +28 -0
  414. package/templates/current/examples/.cursor/skills/admin-component-usage/references/component-directory.md +270 -0
  415. package/templates/current/examples/.cursor/skills/build-admin-feature/SKILL.md +11 -5
  416. package/templates/current/examples/.cursor/skills/build-admin-feature/references/component-selection.md +38 -0
  417. package/templates/current/examples/.cursor/skills/use-og-form/SKILL.md +1 -1
  418. package/templates/current/examples/.cursor/skills/use-og-form-table/SKILL.md +4 -3
  419. package/templates/current/examples/.cursor/skills/use-og-search/SKILL.md +3 -3
  420. package/templates/current/examples/.cursor/skills/use-og-table/SKILL.md +16 -10
  421. package/templates/current/examples/.cursor/skills/use-og-upload/SKILL.md +6 -5
  422. package/templates/current/examples/{.env.example → .env.dev} +3 -2
  423. package/templates/current/examples/.env.mock +4 -0
  424. package/templates/current/examples/.env.production +5 -0
  425. package/templates/current/examples/.env.test +4 -0
  426. package/templates/current/examples/.prettierignore +17 -0
  427. package/templates/current/examples/.prettierrc +8 -0
  428. package/templates/current/examples/.qoder/rules/01-feature-architecture.md +3 -4
  429. package/templates/current/examples/.qoder/rules/02-vue-typescript.md +1 -2
  430. package/templates/current/examples/.qoder/rules/03-component-policy.md +5 -3
  431. package/templates/current/examples/.qoder/rules/04-api-auth-router.md +1 -2
  432. package/templates/current/examples/.qoder/rules/05-style.md +1 -2
  433. package/templates/current/examples/.qoder/rules/06-quality.md +1 -2
  434. package/templates/current/examples/.qoder/skills/admin-component-usage/SKILL.md +28 -0
  435. package/templates/current/examples/.qoder/skills/admin-component-usage/references/component-directory.md +270 -0
  436. package/templates/current/examples/.qoder/skills/build-admin-feature/SKILL.md +11 -5
  437. package/templates/current/examples/.qoder/skills/build-admin-feature/references/component-selection.md +38 -0
  438. package/templates/current/examples/.qoder/skills/use-og-form/SKILL.md +1 -1
  439. package/templates/current/examples/.qoder/skills/use-og-form-table/SKILL.md +4 -3
  440. package/templates/current/examples/.qoder/skills/use-og-search/SKILL.md +3 -3
  441. package/templates/current/examples/.qoder/skills/use-og-table/SKILL.md +16 -10
  442. package/templates/current/examples/.qoder/skills/use-og-upload/SKILL.md +6 -5
  443. package/templates/current/examples/.zcode/skills/admin-component-usage/SKILL.md +28 -0
  444. package/templates/current/examples/.zcode/skills/admin-component-usage/references/component-directory.md +270 -0
  445. package/templates/current/examples/.zcode/skills/build-admin-feature/SKILL.md +20 -0
  446. package/templates/current/examples/.zcode/skills/build-admin-feature/references/component-selection.md +38 -0
  447. package/templates/current/examples/.zcode/skills/style-og-origen-ui/SKILL.md +11 -0
  448. package/templates/current/examples/.zcode/skills/use-og-dialog/SKILL.md +12 -0
  449. package/templates/current/examples/.zcode/skills/use-og-editor/SKILL.md +25 -0
  450. package/templates/current/examples/.zcode/skills/use-og-form/SKILL.md +12 -0
  451. package/templates/current/examples/.zcode/skills/use-og-form-table/SKILL.md +26 -0
  452. package/templates/current/examples/.zcode/skills/use-og-http/SKILL.md +13 -0
  453. package/templates/current/examples/.zcode/skills/use-og-router-tabs/SKILL.md +11 -0
  454. package/templates/current/examples/.zcode/skills/use-og-search/SKILL.md +14 -0
  455. package/templates/current/examples/.zcode/skills/use-og-table/SKILL.md +22 -0
  456. package/templates/current/examples/.zcode/skills/use-og-upload/SKILL.md +26 -0
  457. package/templates/current/examples/AGENTS.md +55 -9
  458. package/templates/current/examples/CHANGELOG.md +107 -0
  459. package/templates/current/examples/CLAUDE.md +3 -0
  460. package/templates/current/examples/README.md +58 -88
  461. package/templates/current/examples/component-catalog.json +766 -348
  462. package/templates/current/examples/component-catalog.v2.json +2040 -0
  463. package/templates/current/examples/docs/components/dialog.md +405 -0
  464. package/templates/current/examples/docs/components/editor-viewer.md +87 -0
  465. package/templates/current/examples/docs/components/editor.md +275 -0
  466. package/templates/current/examples/docs/components/form-table.md +222 -0
  467. package/templates/current/examples/docs/components/form.md +750 -0
  468. package/templates/current/examples/docs/components/index.md +44 -0
  469. package/templates/current/examples/docs/components/router.md +452 -0
  470. package/templates/current/examples/docs/components/search.md +1205 -0
  471. package/templates/current/examples/docs/components/svg-icon.md +124 -0
  472. package/templates/current/examples/docs/components/table-local.md +176 -0
  473. package/templates/current/examples/docs/components/table-with-search.md +207 -0
  474. package/templates/current/examples/docs/components/table.md +813 -0
  475. package/templates/current/examples/docs/components/tabs.md +440 -0
  476. package/templates/current/examples/docs/components/upload.md +349 -0
  477. package/templates/current/examples/eslint.config.js +89 -0
  478. package/templates/current/examples/index.html +1 -1
  479. package/templates/current/examples/openapi.json +10048 -999
  480. package/templates/current/examples/package.json +45 -33
  481. package/templates/current/examples/playwright.config.ts +20 -6
  482. package/templates/current/examples/playwright.mock.config.ts +42 -0
  483. package/templates/current/examples/pnpm-workspace.yaml +19 -3
  484. package/templates/current/examples/recipes/remote-crud-dialog-form.vue +15 -13
  485. package/templates/current/examples/scaffold.lock.json +164 -4
  486. package/templates/current/examples/scripts/api-codegen.config.ts +35 -0
  487. package/templates/current/examples/scripts/api-codegen.ts +2015 -0
  488. package/templates/current/examples/scripts/api-templates/http-client.ejs +359 -0
  489. package/templates/current/examples/scripts/check-admin-scaffold.mjs +311 -17
  490. package/templates/current/examples/scripts/generate-api.ts +290 -85
  491. package/templates/current/examples/scripts/lib/admin-component-catalog.mjs +515 -0
  492. package/templates/current/examples/scripts/lib/repository-root.mjs +9 -0
  493. package/templates/current/examples/scripts/mock-api.ts +1356 -0
  494. package/templates/current/examples/scripts/remove-examples.mjs +9 -34
  495. package/templates/current/examples/src/App.vue +9 -18
  496. package/templates/current/examples/src/api/generated/data-contracts.ts +23 -265
  497. package/templates/current/examples/src/api/generated/http-client.ts +351 -180
  498. package/templates/current/examples/src/api/generated/index.ts +22 -0
  499. package/templates/current/examples/src/api/generated/services/auth.ts +123 -0
  500. package/templates/current/examples/src/api/generated/services/common/files.ts +111 -0
  501. package/templates/current/examples/src/api/generated/services/monitor/cache.ts +164 -0
  502. package/templates/current/examples/src/api/generated/services/monitor/job.ts +195 -0
  503. package/templates/current/examples/src/api/generated/services/monitor/jobLog.ts +126 -0
  504. package/templates/current/examples/src/api/generated/services/monitor/logininfor.ts +126 -0
  505. package/templates/current/examples/src/api/generated/services/monitor/online.ts +66 -0
  506. package/templates/current/examples/src/api/generated/services/monitor/operlog.ts +106 -0
  507. package/templates/current/examples/src/api/generated/services/monitor/server.ts +41 -0
  508. package/templates/current/examples/src/api/generated/services/system/configs.ts +190 -0
  509. package/templates/current/examples/src/api/generated/services/system/departments.ts +173 -0
  510. package/templates/current/examples/src/api/generated/services/system/dictionaries/data.ts +169 -0
  511. package/templates/current/examples/src/api/generated/services/system/dictionaries/types.ts +187 -0
  512. package/templates/current/examples/src/api/generated/services/system/index.ts +158 -0
  513. package/templates/current/examples/src/api/generated/services/system/menus.ts +193 -0
  514. package/templates/current/examples/src/api/generated/services/system/notices.ts +221 -0
  515. package/templates/current/examples/src/api/generated/services/system/posts.ts +168 -0
  516. package/templates/current/examples/src/api/generated/services/system/roles.ts +354 -0
  517. package/templates/current/examples/src/api/generated/services/system/users.ts +425 -0
  518. package/templates/current/examples/src/api/generated/services/tool/code-generator.ts +304 -0
  519. package/templates/current/examples/src/api/generated/types/auth.types.ts +132 -0
  520. package/templates/current/examples/src/api/generated/types/common/files.types.ts +57 -0
  521. package/templates/current/examples/src/api/generated/types/common.ts +174 -0
  522. package/templates/current/examples/src/api/generated/types/enum-dict.ts +94 -0
  523. package/templates/current/examples/src/api/generated/types/enums.ts +155 -0
  524. package/templates/current/examples/src/api/generated/types/monitor/cache.types.ts +149 -0
  525. package/templates/current/examples/src/api/generated/types/monitor/job.types.ts +207 -0
  526. package/templates/current/examples/src/api/generated/types/monitor/jobLog.types.ts +134 -0
  527. package/templates/current/examples/src/api/generated/types/monitor/logininfor.types.ts +135 -0
  528. package/templates/current/examples/src/api/generated/types/monitor/online.types.ts +80 -0
  529. package/templates/current/examples/src/api/generated/types/monitor/operlog.types.ts +126 -0
  530. package/templates/current/examples/src/api/generated/types/monitor/server.types.ts +205 -0
  531. package/templates/current/examples/src/api/generated/types/system/configs.types.ts +200 -0
  532. package/templates/current/examples/src/api/generated/types/system/departments.types.ts +145 -0
  533. package/templates/current/examples/src/api/generated/types/system/dictionaries/data.types.ts +210 -0
  534. package/templates/current/examples/src/api/generated/types/system/dictionaries/types.types.ts +221 -0
  535. package/templates/current/examples/src/api/generated/types/system/index.types.ts +19 -0
  536. package/templates/current/examples/src/api/generated/types/system/menus.types.ts +234 -0
  537. package/templates/current/examples/src/api/generated/types/system/notices.types.ts +270 -0
  538. package/templates/current/examples/src/api/generated/types/system/posts.types.ts +198 -0
  539. package/templates/current/examples/src/api/generated/types/system/roles.types.ts +410 -0
  540. package/templates/current/examples/src/api/generated/types/system/users.types.ts +413 -0
  541. package/templates/current/examples/src/api/generated/types/tool/code-generator.types.ts +388 -0
  542. package/templates/current/examples/src/api/index.ts +44 -39
  543. package/templates/current/examples/src/app/__tests__/api-generated.types.ts +24 -0
  544. package/templates/current/examples/src/app/api.ts +6 -0
  545. package/templates/current/examples/src/app/authorization/permission.ts +9 -0
  546. package/templates/current/{clean/src/app → examples/src/app/config}/runtimeConfig.ts +44 -12
  547. package/templates/current/examples/src/app/errors/errorMessage.ts +80 -0
  548. package/templates/current/examples/src/app/http/client.ts +141 -0
  549. package/templates/current/examples/src/app/http/http-adapter.ts +71 -0
  550. package/templates/current/{clean/src/app → examples/src/app/i18n}/adminLocale.ts +25 -19
  551. package/templates/current/examples/src/app/{localeFormat.ts → i18n/localeFormat.ts} +29 -6
  552. package/templates/current/examples/src/app/i18n/origenUiLocale.ts +15 -0
  553. package/templates/current/examples/src/app/menu/menu.ts +175 -0
  554. package/templates/current/examples/src/app/menu/menuTypes.ts +20 -0
  555. package/templates/current/examples/src/{features → app}/security/devtoolsProtection.ts +8 -7
  556. package/templates/current/examples/src/app/ui/createAdminUi.ts +31 -0
  557. package/templates/current/examples/src/app/ui/iconCatalog.ts +71 -0
  558. package/templates/current/examples/src/assets/icons/appearance.svg +1 -0
  559. package/templates/current/examples/src/assets/icons/arrow-right.svg +1 -0
  560. package/templates/current/examples/src/assets/icons/check.svg +1 -0
  561. package/templates/current/examples/src/assets/icons/circle-check.svg +1 -0
  562. package/templates/current/examples/src/assets/icons/default.svg +4 -0
  563. package/templates/current/examples/src/assets/icons/directory/setting.svg +1 -0
  564. package/templates/current/examples/src/assets/icons/expand.svg +1 -0
  565. package/templates/current/examples/src/assets/icons/fold.svg +1 -0
  566. package/templates/current/examples/src/assets/icons/key.svg +1 -0
  567. package/templates/current/examples/src/assets/icons/lock.svg +1 -0
  568. package/templates/current/examples/src/assets/icons/monitor.svg +1 -0
  569. package/templates/current/examples/src/assets/icons/moon.svg +11 -0
  570. package/templates/current/examples/src/assets/icons/page/department.svg +1 -0
  571. package/templates/current/examples/src/assets/icons/page/dictionary.svg +1 -0
  572. package/templates/current/examples/src/assets/icons/page/menus.svg +1 -0
  573. package/templates/current/examples/src/assets/icons/page/user.svg +1 -0
  574. package/templates/current/examples/src/assets/icons/page/users.svg +1 -0
  575. package/templates/current/examples/src/assets/icons/plus.svg +1 -0
  576. package/templates/current/examples/src/assets/icons/profile.svg +1 -0
  577. package/templates/current/examples/src/assets/icons/refresh.svg +1 -0
  578. package/templates/current/examples/src/assets/icons/roles.svg +1 -0
  579. package/templates/current/examples/src/assets/icons/search.svg +1 -0
  580. package/templates/current/examples/src/assets/icons/sunny.svg +1 -0
  581. package/templates/current/examples/src/assets/icons/system.svg +1 -0
  582. package/templates/current/examples/src/assets/icons/theme-auto.svg +14 -0
  583. package/templates/current/examples/src/assets/icons/tune.svg +13 -0
  584. package/templates/current/examples/src/{features/shell/components → components}/RouteProgress.vue +2 -2
  585. package/templates/current/{clean/src/features/system/access → examples/src}/composables/useAuthorizationRefresh.ts +6 -1
  586. package/templates/current/examples/src/composables/useSystemTableSearchVisibility.ts +33 -0
  587. package/templates/current/examples/src/{features/appearance/composables → composables}/useTheme.ts +1 -1
  588. package/templates/current/examples/src/env.d.ts +6 -19
  589. package/templates/current/examples/src/layouts/AdminLayout.vue +7 -9
  590. package/templates/current/examples/src/{features/shell/components → layouts}/AdminWatermark.vue +2 -2
  591. package/templates/current/examples/src/layouts/BreadcrumbBar.vue +9 -1
  592. package/templates/current/examples/src/layouts/SideMenu.vue +7 -15
  593. package/templates/current/examples/src/{features/appearance/components → layouts}/ThemePanel.vue +39 -11
  594. package/templates/current/examples/src/layouts/TopBar.vue +60 -28
  595. package/templates/current/examples/src/layouts/WorkspaceTabs.vue +10 -1
  596. package/templates/current/examples/src/layouts/topBarMenuSearch.ts +25 -4
  597. package/templates/current/examples/src/locales/en-US.json +227 -219
  598. package/templates/current/examples/src/locales/index.ts +72 -32
  599. package/templates/current/examples/src/locales/messages-types.ts +15 -10
  600. package/templates/current/examples/src/locales/vue-i18n.d.ts +1 -1
  601. package/templates/current/examples/src/locales/zh-CN.json +226 -218
  602. package/templates/current/examples/src/locales/zh-TW.json +222 -214
  603. package/templates/current/examples/src/main.ts +50 -40
  604. package/templates/current/examples/src/router/bootstrap.ts +69 -24
  605. package/templates/current/examples/src/router/dynamic/componentLoader.ts +150 -0
  606. package/templates/current/examples/src/router/{dynamicMenuRefresh.ts → dynamic/dynamicMenuRefresh.ts} +6 -2
  607. package/templates/current/examples/src/router/dynamic/dynamicRoutes.ts +247 -0
  608. package/templates/current/examples/src/router/navigation/guards.ts +12 -0
  609. package/templates/current/examples/src/router/navigation/paths.ts +28 -0
  610. package/templates/current/examples/src/router/navigation/staticRoutes.ts +109 -0
  611. package/templates/current/examples/src/router/{queryEncryption.ts → query/queryEncryption.ts} +29 -12
  612. package/templates/current/examples/src/router/query/routeQuery.ts +29 -0
  613. package/templates/current/examples/src/router/{useRouteQueryDefaults.ts → query/useRouteQueryDefaults.ts} +9 -8
  614. package/templates/current/examples/src/router/query/useRouteQueryDefaults.types.ts +28 -0
  615. package/templates/current/examples/src/router/{runtimeErrorRecovery.ts → recovery/runtimeErrorRecovery.ts} +21 -3
  616. package/templates/current/examples/src/{features/auth/store → store}/auth.ts +96 -61
  617. package/templates/current/examples/src/store/dictionaries.ts +86 -0
  618. package/templates/current/examples/src/{features/shell/store → store}/sidebar.ts +9 -2
  619. package/templates/current/{clean/src/features/appearance → examples/src}/store/theme.ts +8 -4
  620. package/templates/current/examples/src/styles/layout.css +51 -0
  621. package/templates/current/examples/src/templates/og-form.ts +7 -2
  622. package/templates/current/examples/src/templates/og-table.ts +88 -20
  623. package/templates/current/examples/src/templates/router.ts +11 -2
  624. package/templates/current/examples/src/utils/color-mix.ts +6 -2
  625. package/templates/current/examples/src/utils/download.ts +11 -0
  626. package/templates/current/examples/src/utils/permissions.ts +1 -1
  627. package/templates/current/examples/src/utils/retryableDialog.ts +46 -0
  628. package/templates/current/{clean/scripts/clean-overlay/src/features → examples/src/views}/errors/pages/Forbidden.vue +6 -2
  629. package/templates/current/examples/src/views/errors/pages/MethodNotAllowed.vue +34 -0
  630. package/templates/current/examples/{scripts/clean-overlay/src/features → src/views}/errors/pages/NotFound.vue +6 -2
  631. package/templates/current/examples/{scripts/clean-overlay/src/features → src/views}/errors/pages/ServerError.vue +6 -2
  632. package/templates/current/examples/src/{features/auth/pages/Login.vue → views/login/pages/index.vue} +99 -10
  633. package/templates/current/examples/src/views/system/access/services/admin-repository.ts +489 -0
  634. package/templates/current/examples/src/views/system/access/services/rbac.ts +317 -0
  635. package/templates/current/examples/src/views/system/dept/components/DepartmentEditorForm.vue +87 -0
  636. package/templates/current/examples/src/views/system/dept/composables/useDepartmentManagement.ts +314 -0
  637. package/templates/current/examples/src/views/system/dept/pages/index.vue +44 -0
  638. package/templates/current/examples/src/views/system/dept/services/departments.ts +168 -0
  639. package/templates/current/examples/src/views/system/dict/components/DictionaryDataEditorForm.vue +98 -0
  640. package/templates/current/examples/src/views/system/dict/components/DictionaryDataPreview.vue +233 -0
  641. package/templates/current/examples/src/views/system/dict/components/DictionaryTypeEditorForm.vue +66 -0
  642. package/templates/current/examples/src/views/system/dict/composables/useDictionaryDataManagement.ts +406 -0
  643. package/templates/current/examples/src/views/system/dict/composables/useDictionaryTypeManagement.ts +329 -0
  644. package/templates/current/examples/src/views/system/dict/data/pages/index.vue +134 -0
  645. package/templates/current/examples/src/views/system/dict/pages/index.vue +113 -0
  646. package/templates/current/examples/src/views/system/dict/services/dictionaries.ts +239 -0
  647. package/templates/current/examples/src/views/system/menu/components/MenuEditorForm.vue +252 -0
  648. package/templates/current/examples/src/views/system/menu/composables/useMenuManagement.ts +357 -0
  649. package/templates/current/examples/src/views/system/menu/menuDraft.ts +45 -0
  650. package/templates/current/examples/src/views/system/menu/pages/ExternalLink.vue +37 -0
  651. package/templates/current/examples/src/views/system/menu/pages/index.vue +75 -0
  652. package/templates/current/examples/src/views/system/post/components/PostEditorForm.vue +69 -0
  653. package/templates/current/examples/src/views/system/post/composables/usePostManagement.ts +245 -0
  654. package/templates/current/examples/src/views/system/post/pages/index.vue +92 -0
  655. package/templates/current/examples/src/views/system/post/services/posts.ts +100 -0
  656. package/templates/current/examples/src/views/system/role/auth-users/pages/index.vue +100 -0
  657. package/templates/current/examples/src/views/system/role/components/RoleDataScopeForm.vue +167 -0
  658. package/templates/current/examples/src/views/system/role/components/RoleEditorForm.vue +165 -0
  659. package/templates/current/examples/src/views/system/role/components/RoleUserSelectForm.vue +129 -0
  660. package/templates/current/examples/src/views/system/role/composables/useRoleManagement.ts +422 -0
  661. package/templates/current/examples/src/views/system/role/composables/useRoleUserManagement.ts +233 -0
  662. package/templates/current/examples/src/views/system/role/pages/index.vue +110 -0
  663. package/templates/current/examples/src/views/system/role/services/roleAccess.ts +162 -0
  664. package/templates/current/examples/src/views/system/user/auth-roles/pages/index.vue +209 -0
  665. package/templates/current/examples/src/views/system/user/components/UserDetailsForm.vue +108 -0
  666. package/templates/current/examples/src/views/system/user/components/UserEditorForm.vue +207 -0
  667. package/templates/current/examples/src/views/system/user/components/UserImportDialog.vue +80 -0
  668. package/templates/current/examples/src/views/system/user/components/UserResetPasswordForm.vue +56 -0
  669. package/templates/current/examples/src/views/system/user/composables/useUserManagement.ts +502 -0
  670. package/templates/current/examples/src/views/system/user/pages/index.vue +459 -0
  671. package/templates/current/examples/tests/e2e/admin-access-business.spec.ts +33 -0
  672. package/templates/current/examples/tests/e2e/admin-shell.spec.ts +50 -0
  673. package/templates/current/examples/tests/e2e/fixtures/adminMockBackend.ts +95 -0
  674. package/templates/current/examples/tests/e2e/fixtures/labelGeometry.ts +52 -0
  675. package/templates/current/examples/tests/e2e/mock-api-generation.spec.ts +27 -0
  676. package/templates/current/examples/tests/e2e/mock-business.spec.ts +555 -0
  677. package/templates/current/examples/tests/e2e/mock-menu-retry-form-label.spec.ts +100 -0
  678. package/templates/current/examples/tests/e2e/mock-shell.spec.ts +25 -0
  679. package/templates/current/examples/tests/e2e/mock-tree-selection-layout.spec.ts +113 -0
  680. package/templates/current/examples/tests/unit/api/api-codegen.spec.ts +893 -0
  681. package/templates/current/examples/tests/unit/api/client.spec.ts +145 -0
  682. package/templates/current/examples/tests/unit/api/generated-http-client.spec.ts +290 -0
  683. package/templates/current/{clean/src → examples/tests/unit}/api/http-adapter.spec.ts +3 -3
  684. package/templates/current/examples/tests/unit/api/system-apis.spec.ts +118 -0
  685. package/templates/current/examples/tests/unit/app/createAdminUi.spec.ts +79 -0
  686. package/templates/current/examples/{src → tests/unit}/app/errorMessage.spec.ts +1 -1
  687. package/templates/current/examples/tests/unit/app/iconCatalog.spec.ts +12 -0
  688. package/templates/current/examples/tests/unit/app/menu.spec.ts +215 -0
  689. package/templates/current/{clean/src → examples/tests/unit}/app/origenUiLocale.spec.ts +1 -1
  690. package/templates/current/{clean/src → examples/tests/unit}/app/permission.spec.ts +4 -5
  691. package/templates/current/examples/tests/unit/app/runtimeConfig.spec.ts +36 -0
  692. package/templates/current/{clean/src/features → examples/tests/unit/app}/security/devtoolsProtection.spec.ts +17 -7
  693. package/templates/current/{clean/src/features/shell → examples/tests/unit}/composables/useRouteProgress.spec.ts +1 -1
  694. package/templates/current/{clean/src/features/shell/components → examples/tests/unit/layouts}/AdminWatermark.spec.ts +5 -7
  695. package/templates/current/{clean/src → examples/tests/unit}/layouts/topBarMenuSearch.spec.ts +25 -8
  696. package/templates/current/examples/{src → tests/unit}/locales/messages.spec.ts +43 -17
  697. package/templates/current/examples/tests/unit/router/dynamicMenuRefresh.spec.ts +151 -0
  698. package/templates/current/examples/tests/unit/router/dynamicRoutes.spec.ts +374 -0
  699. package/templates/current/examples/tests/unit/router/paths.spec.ts +103 -0
  700. package/templates/current/examples/{src → tests/unit}/router/queryEncryption.spec.ts +49 -12
  701. package/templates/current/{clean/src → examples/tests/unit}/router/routeQuery.spec.ts +8 -1
  702. package/templates/current/examples/{src → tests/unit}/router/runtimeErrorRecovery.spec.ts +11 -6
  703. package/templates/current/{clean/src → examples/tests/unit}/router/useRouteQueryDefaults.spec.ts +46 -12
  704. package/templates/current/examples/tests/unit/scripts/mock-api.spec.ts +440 -0
  705. package/templates/current/examples/{scripts → tests/unit/scripts}/vite-build-policy.spec.ts +35 -6
  706. package/templates/current/examples/{src/features/auth → tests/unit}/store/auth.spec.ts +68 -15
  707. package/templates/current/examples/tests/unit/store/dictionaries.spec.ts +106 -0
  708. package/templates/current/{clean/src → examples/tests/unit}/templates/templates.spec.ts +60 -16
  709. package/templates/current/examples/{src/utils/__tests__ → tests/unit/utils}/color-mix.spec.ts +1 -1
  710. package/templates/current/examples/tests/unit/utils/retryableDialog.spec.ts +61 -0
  711. package/templates/current/examples/{scripts/clean-overlay/src/features/errors/pages → tests/unit/views/errors}/error-pages.spec.ts +12 -9
  712. package/templates/current/examples/tests/unit/views/feature-composables.spec.ts +233 -0
  713. package/templates/current/examples/tests/unit/views/system/access/admin-repository.spec.ts +353 -0
  714. package/templates/current/examples/tests/unit/views/system/access/rbac.spec.ts +329 -0
  715. package/templates/current/examples/tests/unit/views/system/dept/departments.spec.ts +104 -0
  716. package/templates/current/examples/tests/unit/views/system/dict/dictionaries.spec.ts +234 -0
  717. package/templates/current/examples/tests/unit/views/system/menu/menuDraft.spec.ts +77 -0
  718. package/templates/current/examples/tests/unit/views/system/menu/useMenuManagement.spec.ts +339 -0
  719. package/templates/current/examples/tests/unit/views/system/user/searchControl.spec.ts +128 -0
  720. package/templates/current/examples/tsconfig.json +4 -19
  721. package/templates/current/examples/vite.build-policy.ts +97 -22
  722. package/templates/current/examples/vite.config.ts +50 -7
  723. package/templates/current/clean/.codebuddy/AGENTS.md +0 -18
  724. package/templates/current/clean/.codex/skills/build-admin-feature/SKILL.md +0 -14
  725. package/templates/current/clean/.codex/skills/build-admin-feature/references/component-selection.md +0 -25
  726. package/templates/current/clean/.codex/skills/use-og-table/SKILL.md +0 -16
  727. package/templates/current/clean/.cursor/AGENTS.md +0 -18
  728. package/templates/current/clean/.env.production.example +0 -31
  729. package/templates/current/clean/.qoder/AGENTS.md +0 -15
  730. package/templates/current/clean/e2e/admin-shell.spec.ts +0 -156
  731. package/templates/current/clean/e2e/demo-shell.spec.ts +0 -372
  732. package/templates/current/clean/playwright.demo.config.ts +0 -25
  733. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +0 -31
  734. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +0 -31
  735. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +0 -41
  736. package/templates/current/clean/scripts/clean-overlay/src/main.ts +0 -100
  737. package/templates/current/clean/scripts/clean-overlay/src/router/componentCache.ts +0 -12
  738. package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +0 -14
  739. package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +0 -77
  740. package/templates/current/clean/scripts/clean-overlay/src/router/paths.ts +0 -21
  741. package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +0 -63
  742. package/templates/current/clean/scripts/demo-api.ts +0 -873
  743. package/templates/current/clean/src/api/client.spec.ts +0 -66
  744. package/templates/current/clean/src/api/client.ts +0 -152
  745. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +0 -144
  746. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +0 -50
  747. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +0 -63
  748. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +0 -169
  749. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +0 -180
  750. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +0 -167
  751. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +0 -168
  752. package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +0 -95
  753. package/templates/current/clean/src/api/http-adapter.ts +0 -83
  754. package/templates/current/clean/src/app/createAdminUi.spec.ts +0 -166
  755. package/templates/current/clean/src/app/createAdminUi.ts +0 -63
  756. package/templates/current/clean/src/app/embedded-token.spec.ts +0 -40
  757. package/templates/current/clean/src/app/embedded.spec.ts +0 -135
  758. package/templates/current/clean/src/app/embedded.ts +0 -255
  759. package/templates/current/clean/src/app/errorMessage.ts +0 -53
  760. package/templates/current/clean/src/app/menu-host.spec.ts +0 -77
  761. package/templates/current/clean/src/app/menu.spec.ts +0 -320
  762. package/templates/current/clean/src/app/menu.ts +0 -308
  763. package/templates/current/clean/src/app/menuTypes.ts +0 -18
  764. package/templates/current/clean/src/app/origenUiLocale.ts +0 -10
  765. package/templates/current/clean/src/app/permission.ts +0 -9
  766. package/templates/current/clean/src/demo-api.spec.ts +0 -478
  767. package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +0 -41
  768. package/templates/current/clean/src/features/system/access/api/admin-repository.spec.ts +0 -14
  769. package/templates/current/clean/src/features/system/access/api/admin-repository.ts +0 -298
  770. package/templates/current/clean/src/features/system/access/api/rbac.spec.ts +0 -72
  771. package/templates/current/clean/src/features/system/access/api/rbac.ts +0 -292
  772. package/templates/current/clean/src/features/system/access/composables/useAuthorizationPolling.spec.ts +0 -134
  773. package/templates/current/clean/src/features/system/access/composables/useAuthorizationPolling.ts +0 -96
  774. package/templates/current/clean/src/features/workspace/pages/Profile.vue +0 -185
  775. package/templates/current/clean/src/router/componentCache.ts +0 -12
  776. package/templates/current/clean/src/router/componentRegistry.ts +0 -14
  777. package/templates/current/clean/src/router/dynamicMenuRefresh.spec.ts +0 -101
  778. package/templates/current/clean/src/router/dynamicRoutes.spec.ts +0 -77
  779. package/templates/current/clean/src/router/dynamicRoutes.ts +0 -177
  780. package/templates/current/clean/src/router/guards.ts +0 -5
  781. package/templates/current/clean/src/router/paths.spec.ts +0 -50
  782. package/templates/current/clean/src/router/paths.ts +0 -21
  783. package/templates/current/clean/src/router/routeQuery.ts +0 -6
  784. package/templates/current/clean/src/router/staticRoutes.ts +0 -63
  785. package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +0 -20
  786. package/templates/current/examples/.codebuddy/AGENTS.md +0 -18
  787. package/templates/current/examples/.codex/skills/build-admin-feature/SKILL.md +0 -14
  788. package/templates/current/examples/.codex/skills/build-admin-feature/references/component-selection.md +0 -25
  789. package/templates/current/examples/.codex/skills/use-og-table/SKILL.md +0 -16
  790. package/templates/current/examples/.cursor/AGENTS.md +0 -18
  791. package/templates/current/examples/.env.production.example +0 -31
  792. package/templates/current/examples/.qoder/AGENTS.md +0 -15
  793. package/templates/current/examples/e2e/admin-shell.spec.ts +0 -156
  794. package/templates/current/examples/e2e/demo-shell.spec.ts +0 -372
  795. package/templates/current/examples/playwright.demo.config.ts +0 -25
  796. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +0 -31
  797. package/templates/current/examples/scripts/clean-overlay/src/main.ts +0 -100
  798. package/templates/current/examples/scripts/clean-overlay/src/router/componentCache.ts +0 -12
  799. package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +0 -14
  800. package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +0 -77
  801. package/templates/current/examples/scripts/clean-overlay/src/router/paths.ts +0 -21
  802. package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +0 -63
  803. package/templates/current/examples/scripts/demo-api.ts +0 -873
  804. package/templates/current/examples/src/api/client.spec.ts +0 -66
  805. package/templates/current/examples/src/api/client.ts +0 -152
  806. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +0 -144
  807. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +0 -50
  808. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +0 -63
  809. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +0 -169
  810. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +0 -180
  811. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +0 -167
  812. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +0 -168
  813. package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +0 -95
  814. package/templates/current/examples/src/api/http-adapter.ts +0 -83
  815. package/templates/current/examples/src/app/createAdminUi.spec.ts +0 -166
  816. package/templates/current/examples/src/app/createAdminUi.ts +0 -63
  817. package/templates/current/examples/src/app/embedded-token.spec.ts +0 -40
  818. package/templates/current/examples/src/app/embedded.spec.ts +0 -135
  819. package/templates/current/examples/src/app/embedded.ts +0 -255
  820. package/templates/current/examples/src/app/errorMessage.ts +0 -53
  821. package/templates/current/examples/src/app/menu-host.spec.ts +0 -77
  822. package/templates/current/examples/src/app/menu.spec.ts +0 -320
  823. package/templates/current/examples/src/app/menu.ts +0 -308
  824. package/templates/current/examples/src/app/menuTypes.ts +0 -18
  825. package/templates/current/examples/src/app/origenUiLocale.ts +0 -10
  826. package/templates/current/examples/src/app/permission.ts +0 -9
  827. package/templates/current/examples/src/demo-api.spec.ts +0 -478
  828. package/templates/current/examples/src/features/errors/pages/Forbidden.vue +0 -31
  829. package/templates/current/examples/src/features/errors/pages/NotFound.vue +0 -31
  830. package/templates/current/examples/src/features/errors/pages/ServerError.vue +0 -31
  831. package/templates/current/examples/src/features/feature-composables.spec.ts +0 -245
  832. package/templates/current/examples/src/features/system/access/api/admin-repository.spec.ts +0 -14
  833. package/templates/current/examples/src/features/system/access/api/admin-repository.ts +0 -298
  834. package/templates/current/examples/src/features/system/access/api/rbac.spec.ts +0 -72
  835. package/templates/current/examples/src/features/system/access/api/rbac.ts +0 -292
  836. package/templates/current/examples/src/features/system/access/composables/useAuthorizationPolling.spec.ts +0 -134
  837. package/templates/current/examples/src/features/system/access/composables/useAuthorizationPolling.ts +0 -96
  838. package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +0 -122
  839. package/templates/current/examples/src/features/system/audit/pages/AuditList.vue +0 -20
  840. package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +0 -279
  841. package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +0 -435
  842. package/templates/current/examples/src/features/system/menus/menuDraft.spec.ts +0 -204
  843. package/templates/current/examples/src/features/system/menus/menuDraft.ts +0 -116
  844. package/templates/current/examples/src/features/system/menus/menuTreePrecheck.spec.ts +0 -268
  845. package/templates/current/examples/src/features/system/menus/menuTreePrecheck.ts +0 -317
  846. package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +0 -51
  847. package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +0 -116
  848. package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +0 -194
  849. package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +0 -47
  850. package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +0 -104
  851. package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +0 -228
  852. package/templates/current/examples/src/features/system/users/pages/UserList.vue +0 -51
  853. package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +0 -41
  854. package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +0 -325
  855. package/templates/current/examples/src/features/workspace/pages/Profile.vue +0 -185
  856. package/templates/current/examples/src/router/componentCache.ts +0 -18
  857. package/templates/current/examples/src/router/componentRegistry.ts +0 -66
  858. package/templates/current/examples/src/router/dynamicMenuRefresh.spec.ts +0 -101
  859. package/templates/current/examples/src/router/dynamicRoutes.spec.ts +0 -144
  860. package/templates/current/examples/src/router/dynamicRoutes.ts +0 -177
  861. package/templates/current/examples/src/router/guards.ts +0 -5
  862. package/templates/current/examples/src/router/paths.spec.ts +0 -50
  863. package/templates/current/examples/src/router/paths.ts +0 -21
  864. package/templates/current/examples/src/router/routeQuery.ts +0 -6
  865. package/templates/current/examples/src/router/staticRoutes.ts +0 -63
  866. package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +0 -20
  867. /package/templates/current/clean/{.codex → .agents}/skills/style-og-origen-ui/SKILL.md +0 -0
  868. /package/templates/current/clean/{.codex → .agents}/skills/style-og-origen-ui/agents/openai.yaml +0 -0
  869. /package/templates/current/clean/{.codex → .agents}/skills/use-og-dialog/SKILL.md +0 -0
  870. /package/templates/current/clean/{.codex → .agents}/skills/use-og-dialog/agents/openai.yaml +0 -0
  871. /package/templates/current/clean/{.codex → .agents}/skills/use-og-editor/SKILL.md +0 -0
  872. /package/templates/current/clean/{.codex → .agents}/skills/use-og-http/SKILL.md +0 -0
  873. /package/templates/current/clean/{.codex → .agents}/skills/use-og-http/agents/openai.yaml +0 -0
  874. /package/templates/current/clean/{.codex → .agents}/skills/use-og-router-tabs/SKILL.md +0 -0
  875. /package/templates/current/{examples/.codex → clean/.claude}/skills/style-og-origen-ui/SKILL.md +0 -0
  876. /package/templates/current/{examples/.codex → clean/.claude}/skills/use-og-dialog/SKILL.md +0 -0
  877. /package/templates/current/{examples/.codex → clean/.claude}/skills/use-og-editor/SKILL.md +0 -0
  878. /package/templates/current/{examples/.codex → clean/.claude}/skills/use-og-http/SKILL.md +0 -0
  879. /package/templates/current/{examples/.codex → clean/.claude}/skills/use-og-router-tabs/SKILL.md +0 -0
  880. /package/templates/current/clean/src/{features/security/components → components}/DevtoolsProtectionOverlay.vue +0 -0
  881. /package/templates/current/clean/src/{features/shell/composables → composables}/useRouteProgress.ts +0 -0
  882. /package/templates/current/clean/src/{features/workspace → views/fallback}/pages/Empty.vue +0 -0
  883. /package/templates/current/examples/{.codex → .agents}/skills/style-og-origen-ui/agents/openai.yaml +0 -0
  884. /package/templates/current/examples/{.codex → .agents}/skills/use-og-dialog/agents/openai.yaml +0 -0
  885. /package/templates/current/examples/{.codex → .agents}/skills/use-og-http/agents/openai.yaml +0 -0
  886. /package/templates/current/examples/src/{features/security/components → components}/DevtoolsProtectionOverlay.vue +0 -0
  887. /package/templates/current/examples/src/{features/shell/composables → composables}/useRouteProgress.ts +0 -0
  888. /package/templates/current/examples/src/{features/workspace → views/fallback}/pages/Empty.vue +0 -0
@@ -0,0 +1,813 @@
1
+ ---
2
+ title: OgTable
3
+ description: 面向远程 CRUD 场景的配置化数据表格。
4
+ ---
5
+
6
+ # OgTable
7
+
8
+ 公共 CSS 入口、暗色主题和稳定覆盖边界见[样式与主题](../../.codex/rules/05-style.md)。本页只记录表格自身的布局、滚动和列宽约束。
9
+
10
+ 基础 `OgTable` 只管理表格状态和查询协议,不再隐式渲染搜索 UI。本文带搜索的示例使用 `@origen-ui/table-search` 提供的 `OgTableWithSearch`;自定义搜索实现可使用基础组件的 `#search` 作用域插槽。
11
+
12
+ 面向远程 CRUD 场景的配置化数据表格。组件负责请求竞态、分页、搜索、表格状态与通用工具栏;业务应用仍然持有数据源、权限策略和提交逻辑。
13
+
14
+ ## 何时使用
15
+
16
+ - 需要统一远程列表、搜索、排序、分页与失败重试。
17
+ - 需要在同一张表中管理选择、编辑和状态恢复。
18
+ - 需要将业务请求逻辑封装为可测试的 `dataSource` 适配器。
19
+
20
+ ## 基础用法
21
+
22
+ 组件会在内部生成并管理自己的实例标识,无需传入表格 ID。`rowKey` 是行身份:仅远程纯展示、没有行级能力时可以省略;启用选择、展开/树、编辑与事务、单行刷新、行操作、虚拟渲染或网格编辑等依赖行身份的能力时,必须提供稳定且唯一的 `rowKey`。无 rowKey 的纯展示表也不能调用 ref 上的 `toggleRowSelection` / `toggleRowExpansion`;这些命令同样属于行级能力。
23
+
24
+ ```vue
25
+ <OgTable row-key="id" :og-columns="columns" :og-data-source="dataSource" :og-config="config" />
26
+ ```
27
+
28
+ <div id="table-basic-data"></div>
29
+ ### 基础数据源
30
+
31
+ 输入关键字、切换分页,观察表格通过同一 dataSource 管理请求与工具栏。
32
+
33
+ ## 典型用法
34
+
35
+ <div id="table-query-recovery"></div>
36
+ <div id="table-search-fields"></div>
37
+ <div id="table-request-lifecycle"></div>
38
+ <div id="table-first-load-error"></div>
39
+ ### 搜索、请求与错误恢复
40
+
41
+ 合并搜索字段、请求竞态和首屏错误,演示重试、取消与错误插槽的完整流程。
42
+
43
+ <div id="table-editing-commands"></div>
44
+ <div id="table-column-actions"></div>
45
+ <div id="table-staged-edit"></div>
46
+ <div id="table-editable-actions"></div>
47
+ ### 列操作、暂存编辑与命令 API
48
+
49
+ 合并列类型、暂存单元格和命令式编辑操作,展示提交、丢弃与行级动作。
50
+
51
+ ## 高级能力
52
+
53
+ <div id="table-field-permissions"></div>
54
+ ### 字段级权限
55
+
56
+ 切换角色并观察列查看、编辑、复制、提示和原始值暴露权限的独立生效。
57
+
58
+ <div id="table-state-analytics"></div>
59
+ <div id="table-advanced-state"></div>
60
+ <div id="table-filter-memory"></div>
61
+ ### 高级状态、分析与筛选记忆
62
+
63
+ 观察表格快照、筛选记忆、分析事件与查询范围批量作业。
64
+
65
+ <div id="table-virtual-list"></div>
66
+ ### 1,000 行虚拟列表
67
+
68
+ 切换虚拟表格并观察大数据量、固定行高和列插槽的渲染边界。
69
+
70
+ <div id="table-span-summary"></div>
71
+ ### 单元格合并与汇总
72
+
73
+ 直接使用 Element Plus 的合并与汇总属性,同时保持 OgTable 的状态协议。
74
+
75
+ ## API
76
+
77
+ `dataSource.list(request, context)` 接收 `{ pageNum, pageSize, keyword, query, filters, sort }`。将 `context.signal` 传给 HTTP 客户端,较新的请求会中止旧请求,过期响应不会覆盖当前列表。
78
+
79
+ ## 分页请求与响应
80
+
81
+ 表格内部的分页状态始终是 `{ pageNum, pageSize }`;仅在 `dataSource.list` 的接口边界通过 `context.pagination` 适配后端。使用 `buildRequest(extra?)` 生成分页参数,它会覆盖 `extra` 中同名的分页字段;使用 `parseResponse<T>(raw)` 返回 `Promise<PageResult<T>>` 所需的标准结果。
82
+
83
+ 分页启用时,默认字段解析器优先采用响应中的分页值;响应未提供 `pageNum` 或 `pageSize` 时,分别使用本次请求值补齐。设置 `pageNumFromRequest` 或 `pageSizeFromRequest` 为 `true` 会始终采用对应请求值;响应显式返回 `null` 或无效值仍会校验失败。此行为假设服务端遵循请求分页参数;若服务端可能调整页码或每页条数,应返回实际值或使用自定义解析器。自定义解析器、直接由 `dataSource.list` 返回的结果及 `pagination: false` 仍须提供完整的 `PageResult`。
84
+
85
+ 全局配置普通字段映射,实例自动继承:
86
+
87
+ ```ts
88
+ app.use(
89
+ createOgTable({
90
+ config: {
91
+ pagination: {
92
+ request: { pageNumKey: 'current', pageSizeKey: 'size' },
93
+ response: {
94
+ listKey: 'items',
95
+ totalKey: 'totalCount',
96
+ pageNumFromRequest: true,
97
+ pageSizeFromRequest: true,
98
+ },
99
+ },
100
+ },
101
+ }),
102
+ )
103
+
104
+ const dataSource: OgTableDataSource<User> = {
105
+ async list(query, context) {
106
+ const raw = await api.get('/users', {
107
+ params: context.pagination.buildRequest({ keyword: query.keyword, ...query.query }),
108
+ signal: context.signal,
109
+ })
110
+ return context.pagination.parseResponse<User>(raw)
111
+ },
112
+ }
113
+ ```
114
+
115
+ 局部配置可覆盖全局映射,例如改为 offset/limit:
116
+
117
+ ```ts
118
+ const config: OgTableConfig<User> = {
119
+ pagination: {
120
+ request: { type: 'offset', offsetKey: 'skip', limitKey: 'take' },
121
+ response: {
122
+ listKey: 'records',
123
+ totalKey: 'count',
124
+ pageNumFromRequest: true,
125
+ pageSizeFromRequest: true,
126
+ },
127
+ }
128
+ ```
129
+
130
+ 只有嵌套或特殊协议需要自定义解析。解析器收到请求页码和页大小;它仍须返回标准 `PageResult`:
131
+
132
+ ```ts
133
+ const config: OgTableConfig<User> = {
134
+ pagination: {
135
+ request: {
136
+ type: 'custom',
137
+ build: (query) => ({ cursorPage: query.pageNum, limit: query.pageSize }),
138
+ },
139
+ response: {
140
+ type: 'custom',
141
+ parse: (raw, { pageNum, pageSize }) => {
142
+ const payload = raw as { payload: { users: User[]; total: number } }
143
+ return { list: payload.payload.users, total: payload.payload.total, pageNum, pageSize }
144
+ },
145
+ },
146
+ },
147
+ }
148
+ ```
149
+
150
+ 设置 `pagination: false` 时分页 UI 隐藏,`buildRequest()` 返回 `{}`,但 `parseResponse()` 仍使用默认的 `{ list, total, pageNum, pageSize }` 解析。
151
+
152
+ `OgTable` 默认使用中文文案;`config.locale` 可以在全局或实例层覆盖组件文案,包含行操作以及 `copySucceeded` 复制成功状态等无障碍标签。列表失败触发 `load-error`;提交、批量、行操作和单行刷新失败触发带 `{ operation, error }` 载荷的 `operation-error`。`retry.read` 控制读取重试,`retry.write` 仅在编辑提交提供幂等键时生效。
153
+
154
+ ## 列与操作
155
+
156
+ 移动端固定内联第一个可见操作,其余操作归集到“更多”菜单;该规则优先于 `maxInlineActions: false`。移动端操作列固定为 `128px`,并覆盖桌面端的 `width` 与 `minWidth` 配置。
157
+
158
+ 列模型支持数据列、选择列、序号列、展开列、拼接列与操作列。数据列可组合远程排序、TSX `render`、格式化、脱敏、提示、复制与单元格编辑能力。桌面端操作列默认内联显示 3 个可见操作,超出的操作归集到“更多”菜单;使用 `maxInlineActions: false` 可关闭归集,或传入正整数覆盖内联数量。
159
+
160
+ `format` 把值转换为默认文本展示,适合日期、金额和字典标签;`render` 则直接返回自定义 VNode,可用 `ElTag`、`ElText` 等组件设置官方展示属性。自定义 `render` 自行决定显示文案和空值外观,不会自动套用默认文本高亮或 `column.tooltip`。它收到的是原始单元格值,脱敏字段应继续使用默认 renderer,除非自定义内容也做了安全处理。复制仍走独立的文本格式化与脱敏流程;若列可复制,应让组件显示文案与复制文本保持一致。虚拟表格行高固定,组件内容应保持单行,较高内容需调整 `config.virtual.rowHeight`。
161
+
162
+ ## 表头与单元格说明
163
+
164
+ 所有列都可配置 `labelTip`。数据列与拼接列还可配置 `cellTip`;字符串默认显示问号 Tooltip,`mode: 'inline'` 则在标题或展示值下方常驻显示。普通表格与虚拟表格使用相同解析规则,`placement`、`maxWidth` 仅作用于 Tooltip 模式。
165
+
166
+ ```ts
167
+ const columns: TableColumn<Order>[] = [
168
+ {
169
+ prop: 'amount',
170
+ label: '金额',
171
+ labelTip: '含税金额',
172
+ cellTip: {
173
+ content: ({ row }) => `订单 ${row.id} 的结算金额`,
174
+ mode: 'tooltip',
175
+ allowRaw: true,
176
+ },
177
+ copyable: true,
178
+ },
179
+ ]
180
+ ```
181
+
182
+ 动态 `cellTip` 回调会接收 `OgTableCellScope<T>` 的原始行与值,因此必须显式配置 `allowRaw: true`,并同时通过列的 `permission.tooltip` 与 `permission.reveal`;不满足时不会执行回调,也不会渲染提示。静态说明不读取原始数据。`cellTip` 与现有的值 `tooltip` 可同时使用。
183
+
184
+ 虚拟表格使用固定行高;配置 inline `cellTip` 时,应按说明文案长度同步设置足够的 `config.virtual.rowHeight` 与列宽。
185
+
186
+ 数据列与拼接列的最终展示文本为空或仅为空白时默认显示 `-`。通过 `config.emptyCellText` 可改为任意文本;设置为 `''` 可关闭可见占位符。格式化器处理缺失值时应返回空文本,由占位符统一负责界面展示。占位符只影响非编辑态的渲染,不会写回数据,也不会进入编辑输入、Tooltip 原始值、排序或筛选。自定义 `column.render` 自行决定空状态的呈现。
187
+
188
+ 可复制列中有实际复制内容的单元格会在展示值前方常驻复制图标;复制状态按底层字段值判断,因此缺失值、空数组、空字符串或仅包含空白字符的值即使被格式化器转换成 `-` 等文本,也不显示图标、不响应整格或键盘复制。`0` 和 `false` 仍视为有效值。hover 或键盘 focus 时图标增强颜色,复制成功后原位切换为绿色勾选 1.5 秒。权限、复制来源与脱敏规则保持不变。
189
+
190
+ ## 搜索、请求与失败状态
191
+
192
+ 搜索会自动回到第一页。请求控制器会中止已过期读取,并保留最近一次成功数据,避免失败时表格突然清空。
193
+
194
+ ### 草稿与已应用查询
195
+
196
+ OgTable 将搜索状态分为两层:搜索插槽的 `modelValue` 与 `keyword` 是可继续编辑的草稿;`dataSource.list`、分页、排序和刷新始终使用最近一次成功提交的已应用查询。因此编辑条件后切换页码或排序,不会意外携带未点击“查询”的值。
197
+
198
+ 收到 OgSearch 的 `search` 载荷时,OgTable 会先以候选查询执行 `beforeSearch`;钩子返回 `false` 时草稿仍保留,但已应用查询不变。批准后才应用字段转换、`modelTransform`、权限过滤并发起请求。`reset` 载荷遵循相同规则;筛选记忆恢复后也会按当前字段可见性和权限重新规范化,避免恢复已失效的条件。
199
+
200
+ 首屏错误示例的第一次 `list` 调用确实抛出异常;重试、空结果及连续刷新都继续走同一 `dataSource.list(request, { signal })`。连续刷新时组件中止前一请求,业务适配器必须监听 `signal`,不要用 Demo 自己丢弃旧结果来模拟竞态处理。
201
+
202
+ ::: tip 接入建议
203
+
204
+ 在请求适配器中尊重 `AbortSignal`。这能避免用户快速搜索或翻页时,旧响应反向覆盖最新结果。
205
+
206
+ :::
207
+
208
+ ## 选择与暂存编辑
209
+
210
+ 选择状态通过内存 key map 跨页保留。多选模式下,表头复选框只操作当前页中的可选行:标准树表格会包含当前页已加载的全部后代节点,即使其父节点处于折叠状态;全部选中时显示选中,部分选中时显示半选,全部取消时恢复未选。标准树表格挂载或重新挂载时,行复选框会从 OgTable 保留的选择状态同步。虚拟表格不支持树模式。单元格编辑会生成 `{ original, current }` 快照,并通过实例 API 管理提交或丢弃。
211
+
212
+ 已暂存的字段单元格会显示浅色底、强调线和状态标记,仍直接显示新值;工具栏「待提交更改」入口显示受影响行数。预览按字段列出行标识、列名、原始值和当前值,并沿用列格式与 `config.masking`。把字段改回原值会自动清除该字段的暂存,整行没有剩余差异时不会进入提交。
213
+
214
+ `commitChanges(idempotencyKey?)` 只在存在暂存变更且业务提供 `submitChanges`(或完整事务配置)时调用适配器。示例的“失败”和“冲突”选项分别让真实提交回调抛错或返回 `{ status: 'conflict', latest }`,因此错误事件和冲突对话框仍由组件本身决定;业务不应把任意错误包装成不存在的 conflict API。
215
+
216
+ `OgTableLocal` 的数字列默认使用数字编辑器,并将 `editable.emptyBehavior` 设为 `restore`:退格清空只保留编辑草稿,筛选隐藏只影响当前显示结果,不会删除 `v-model` 行,也不会触发 `rowRemove`。失焦或回车后才执行列校验;空值或非法值恢复编辑前的原值并提示,合法值才重新应用本地筛选。需要保存空值的业务字段显式设置 `emptyBehavior: 'allow'`。
217
+
218
+ ## 字段权限
219
+
220
+ 列权限可分别控制查看、编辑、Tooltip、复制及原始值暴露。无查看权限的字段不会出现在表格或列设置中;无编辑权限的字段保留展示但不可编辑;原始复制与明文 Tooltip 必须额外拥有 `reveal` 权限。
221
+
222
+ `config.search.fields` 使用同一个 `config.permissions.has` 检查器。无权的搜索字段不会渲染、校验或进入已应用查询;配置中任一搜索字段声明 `permission` 时必须提供 `permissions.has`。
223
+
224
+ ## 工具栏与状态记忆
225
+
226
+ 工具栏可按配置启用刷新、全屏、密度、列设置和重置。标准表格的密度会调整单元格间距;虚拟表格未显式配置 `virtual.rowHeight` 时会按密度使用 36、44、54 像素行高。显式固定虚拟行高后,该值优先且密度工具会自动隐藏;也可以通过 `config.lockedDensity` 主动隐藏密度工具。启用筛选记忆时,表格会保存白名单允许的查询条件以及列布局等状态,具体配置见下文 `filterMemory`。
227
+
228
+ 操作行在有边框和无边框模式下都会保留左右留白;存在搜索区时,操作内容边缘与搜索控件内容边缘对齐,没有搜索区时仍保留相同留白。无边框模式下数据区仍保持全宽。
229
+
230
+ ### 列设置面板
231
+
232
+ 点击工具栏「列设置」打开右侧抽屉。面板支持:
233
+
234
+ - **搜索过滤**:在面板顶部按列名快速定位。
235
+ - **拖拽排序**:按住行左侧手柄上下拖拽,调整列在表格中的显示顺序(任意位置重排,不再局限于相邻移动)。
236
+ - **显示 / 隐藏**:勾选切换列的可见性;分组标题下可批量管理同一组的列。
237
+ - **列宽调整**:每行列宽输入框直接写入像素宽度,与「筛选记忆」中的 `widths` 复用同一持久化。
238
+ - **冻结列**:循环切换「冻结至左侧 / 冻结至右侧 / 取消冻结」,运行时覆盖列的静态 `fixed` 配置。
239
+ - **分组**:为列声明 `group` 字段后,面板按组聚类展示,便于在宽表中有序管理显隐与顺序。
240
+
241
+ ```ts
242
+ const columns: TableColumn<Order>[] = [
243
+ { prop: 'id', label: '编号', group: '基础' },
244
+ { prop: 'name', label: '名称', group: '基础' },
245
+ { prop: 'amount', label: '金额', group: '财务' },
246
+ ]
247
+ ```
248
+
249
+ 启用 `config.state.filterMemory` 后,列顺序、可见性、宽度与冻结状态会与筛选记忆中的其他表格状态一并恢复。
250
+
251
+ ### 工具列自定义
252
+
253
+ 点击工具栏最右侧的设置图标,可勾选显示/隐藏刷新、全屏、密度、列设置等工具。偏好存储由应用通过 `config.toolbar.customization` 注入,组件只负责读取当前偏好、发出写入/清除调用和更新 UI;组件不会直接访问 `localStorage` 或其他存储介质。adapter 实例替换后,工具栏会重新读取新 adapter 的偏好。窄屏(< 920px)下非核心工具自动折叠进「更多」菜单。
254
+
255
+ ```ts
256
+ import type {
257
+ OgTableToolbarCustomization,
258
+ OgTableToolbarCustomizationAdapter,
259
+ } from '@origen-ui/table'
260
+
261
+ const toolbarCustomization: OgTableToolbarCustomizationAdapter = {
262
+ read: (): OgTableToolbarCustomization | undefined => {
263
+ const raw = window.localStorage.getItem('orders-toolbar')
264
+ return raw ? (JSON.parse(raw) as OgTableToolbarCustomization) : undefined
265
+ },
266
+ write: (value) => {
267
+ window.localStorage.setItem('orders-toolbar', JSON.stringify(value))
268
+ },
269
+ clear: () => {
270
+ window.localStorage.removeItem('orders-toolbar')
271
+ },
272
+ }
273
+
274
+ const config = {
275
+ toolbar: {
276
+ customization: toolbarCustomization,
277
+ },
278
+ }
279
+ ```
280
+
281
+ ### 键盘快捷键
282
+
283
+ 表格聚焦且未在输入框中打字时支持键盘操作:
284
+
285
+ - `R`:刷新当前页(等价于工具栏刷新)。
286
+ - `F`:切换全屏。
287
+
288
+ 快捷键仅在对应工具已启用时生效,且不会拦截带 `Ctrl` / `Meta` / `Alt` 的组合键。
289
+
290
+ ### 完整状态快照
291
+
292
+ `TableStateSnapshot<TQuery>` 是公开实例 API 与筛选记忆共用的状态契约,包含已应用的搜索条件、筛选、排序、当前页、每页条数、列可见性/顺序/宽度、冻结覆盖和密度。`getState()` 返回当前快照;`applyState(snapshot)` 应用快照、清除选择并重新加载一次。应用可以把快照存放在自己的状态层中,表格包不规定 URL 或服务端存储方式。
293
+
294
+ ```ts
295
+ const snapshot = tableRef.value?.getState()
296
+ if (snapshot) await tableRef.value?.applyState(snapshot)
297
+ ```
298
+
299
+ ### 实例身份与持久化范围
300
+
301
+ 表格实例标识由组件内部生成和管理,无需传入 ID;`rowKey` 用于识别数据行,不能用表格实例标识替代。
302
+
303
+ 筛选记忆如需稳定命名空间,可显式设置 `config.state.filterMemory.key`。默认持久化键跟随组件实例:普通更新和 KeepAlive 暂存/恢复时不变;组件完全卸载后即使在相同模板位置重建,也会得到新键,旧默认状态不会自动迁移、合并或回退。若需跨卸载重建恢复状态,请使用应用自己的显式业务 key。如果多个 Vue root app(例如微前端)共用浏览器存储源,给 app 设置不同的 `app.config.idPrefix` 只能降低默认键碰撞概率;要可靠隔离,仍须为每张表显式设置不同的 `filterMemory.key`。远程纯展示场景可以省略 `rowKey`;启用行级能力时,`rowKey` 才是识别数据行的稳定身份。
304
+
305
+ ## 虚拟渲染
306
+
307
+ `ogConfig.virtual.enabled` 是渲染表面的显式选择:未配置或设为 `false` 时使用 Element Plus `ElTable`,设为 `true` 时使用 `TableV2`。OgTable 不会根据数据量自动覆盖此选择。虚拟模式复用行 key、选择、编辑、受控展开与会话列宽状态,不应传入标准 `ElTable` 专属属性。由于 TableV2 没有通用全宽详情行 API,展开插槽内容会渲染在展开列内。
308
+
309
+ Element Plus 普通属性直接放在 OgTable 顶层,例如标准模式的 `border`、`stripe` 或 `summaryMethod`,虚拟模式的 `cache` 或 `estimatedRowHeight`。`ogConfig.virtual.enabled` 决定实际目标,公开类型会按 `ElTable` / `TableV2` 分别约束属性,因此不能混用另一表面的专属属性。数据、表格高度、树结构、展开键和默认排序由 OgTable 工作流管理;`data`、`height`、`treeProps`、`indent`、`expandRowKeys`、`defaultSort` 不属于可透传属性。行标识 `rowKey` 保留 Element Plus 官方命名,同时供 OgTable 内部选择和状态逻辑使用。树配置使用 `ogConfig.tree`,展开与排序使用 OgTable 的对应状态和事件;其他 Element Plus 官方属性参考官方文档。组件 ref 的 `getElTable()` 返回当前实际挂载的 `TableInstance` 或 `TableV2Instance`,挂载前返回 `undefined`。
310
+
311
+ ## 单元格合并与汇总
312
+
313
+ 标准渲染表面直接在组件顶层设置 Element Plus 的合并与汇总属性,无需在列上单独声明:
314
+
315
+ | 属性 | 类型 | 说明 |
316
+ | --------------- | ------------------------------------------------------------------ | ------------------------------------------- |
317
+ | `spanMethod` | `({ row, column, rowIndex, columnIndex }) => { rowspan, colspan }` | 合并单元格;`rowspan: 0` 隐藏被合并的单元格 |
318
+ | `showSummary` | `boolean` | 是否显示表尾汇总行 |
319
+ | `summaryMethod` | `({ columns, data }) => string[]` | 自定义汇总行各列文案 |
320
+ | `sumText` | `string` | 汇总行首列文案,默认 `合计` |
321
+
322
+ ```ts
323
+ const config: OgTableConfig<User> = {}
324
+ const nativeTableProps = {
325
+ spanMethod: ({ column, rowIndex }) =>
326
+ column.property === 'department' ? { rowspan: 2, colspan: 1 } : { rowspan: 1, colspan: 1 },
327
+ showSummary: true,
328
+ summaryMethod: ({ columns, data }) =>
329
+ columns.map((column, index) =>
330
+ index === 0
331
+ ? '合计'
332
+ : column.property === 'amount'
333
+ ? data.reduce((total, row) => total + row.amount, 0)
334
+ : '',
335
+ ),
336
+ sumText: '合计',
337
+ }
338
+ ```
339
+
340
+ 在模板中将属性逐项绑定到 OgTable 根组件,或用 `v-bind="nativeTableProps"` 展开同一组顶层属性;不要再传入旧的表格属性包对象。
341
+
342
+ 合并跨度依赖当前渲染的完整行集,与筛选、排序、分页结果一致;汇总行也按当前页数据计算。`spanMethod` 与 `config.editing` 或选择列并存时可能产生错位,开发环境会输出一次性警告;虚拟表面不支持该属性组合,运行时直接拒绝。
343
+
344
+ ### Element Plus 表面透传
345
+
346
+ Element Plus 事件不作为普通属性白名单处理。与 OgTable 业务事件同名的官方事件使用 `ogTableEvents.standard` 或 `ogTableEvents.virtual`,组件会同时执行官方回调和 OgTable 内部行为。选择列由 OgTable 的业务选择控制器渲染,因此 `select`、`select-all`、`selection-change` 也由该控制器显式转发;回调收到当前业务选择快照,启用查询范围选择时只包含已加载行,与 `selectionChange` 的语义一致。标准 `ElTable` 的 `#empty` 与 `#append` 在 OgTable 中分别使用 `#tableEmpty` 与 `#tableAppend`;虚拟 TableV2 的 `#empty` 仍使用 `#tableEmpty`,且不支持 `#tableAppend`。TableV2 的 `row`、`cell`、`header`、`header-cell`、`footer`、`overlay` 插槽通过 `ogTableSlots.virtual` 转发,要求 `ogConfig.virtual.enabled: true`;作用域中的 `rowData` 会恢复为调用方的行类型。`cell` / `header-cell` 会替换 OgTable 对应的默认单元格/表头内容,因此相关内建编辑、选择、复制、排序、筛选和列宽调整控件可能随替换而不再显示;`row` / `header` 会替换整行/整组表头,并且在 OgFormTable 网格无障碍模式启用时明确报错,因为内部需要接管这两个插槽维护行列语义。没有数据时,单独传入 `#tableEmpty` 会显示当前表格表面的原生空态;若同时传入业务 `#empty`,业务空态优先;请求失败时仍由业务 `#error` 状态优先展示。其他 Element Plus 插槽详情参考官方文档;实际可用插槽以当前表格表面的类型声明和上述边界为准。
347
+
348
+ TableV2 插槽通过组件级配置对象传入,且行数据保持 `T` 类型:
349
+
350
+ ```ts
351
+ import { h } from 'vue'
352
+ import type { OgTableSurfaceSlots } from '@origen-ui/table'
353
+
354
+ const ogTableSlots: OgTableSurfaceSlots<User> = {
355
+ virtual: {
356
+ cell: ({ rowData }) => h('span', rowData.name),
357
+ 'header-cell': ({ column }) => h('span', column.title ?? ''),
358
+ },
359
+ }
360
+ ```
361
+
362
+ ## 右键菜单(contextMenu)
363
+
364
+ 通过 `config.contextMenu` 配置表格右键菜单:
365
+
366
+ | 属性 | 类型 | 说明 |
367
+ | --------------------- | ----------------------- | ----------------------------------------------- |
368
+ | `enabled` | `boolean` | 是否启用右键菜单 |
369
+ | `actions` | `OgTableAction[]` | 自定义菜单项,与操作列共享 `OgTableAction` 类型 |
370
+ | `builtIns.refreshRow` | `boolean \| Permission` | 是否显示内置「刷新行」菜单项,支持权限控制 |
371
+ | `builtIns.selectRow` | `boolean \| Permission` | 是否显示内置「选择行」菜单项,支持权限控制 |
372
+
373
+ ```ts
374
+ config.contextMenu = {
375
+ enabled: true,
376
+ actions: [{ key: 'detail', label: '查看详情', onClick: (row) => navigateTo(row.id) }],
377
+ builtIns: { refreshRow: true, selectRow: true },
378
+ }
379
+ ```
380
+
381
+ ## Hooks 生命周期
382
+
383
+ 通过 `config.hooks` 注册生命周期钩子,可在关键操作执行前进行拦截。**返回 `false` 或 `Promise<false>` 可取消当前操作**。
384
+
385
+ | Hook 名称 | 触发时机 | 上下文中的关键字段 |
386
+ | --------------- | -------------- | ------------------------------- |
387
+ | `beforeRefresh` | 表格刷新前 | `query` |
388
+ | `beforeSearch` | 搜索载荷应用前 | 候选的已规范化 `query` |
389
+ | `beforeSort` | 排序切换前 | `query` |
390
+ | `beforeEdit` | 进入编辑态前 | `query`、`row`、`actionKey` |
391
+ | `beforeCommit` | 提交变更之前 | `query`、`changes` |
392
+ | `beforeBatch` | 批量操作执行前 | `query`、`changes`、`actionKey` |
393
+
394
+ 所有 hook 签名为:
395
+
396
+ ```ts
397
+ type OgTableHook<T, TQuery> = (
398
+ context: OgTableHookContext<T, TQuery>,
399
+ ) => boolean | void | Promise<boolean | void>
400
+ ```
401
+
402
+ 其中 `OgTableHookContext` 包含:
403
+
404
+ | 字段 | 类型 | 说明 |
405
+ | ------------ | ---------------------- | -------------------------------- |
406
+ | `query` | `OgTableQuery<TQuery>` | 当前查询参数 |
407
+ | `rows` | `T[]` | 当前表格数据 |
408
+ | `changes` | `OgTableChange<T>[]` | 当前未提交的编辑变更 |
409
+ | `row?` | `T` | 当前操作行(仅部分 hook 可用) |
410
+ | `actionKey?` | `string` | 当前操作标识(仅部分 hook 可用) |
411
+
412
+ ## 事件
413
+
414
+ | 事件名称 | 类型 | 说明 |
415
+ | -------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------- |
416
+ | `loadSuccess` | `(data: PageResult<T>) => void` | 数据加载成功时触发 |
417
+ | `loadError` | `(error: unknown) => void` | 数据加载失败时触发 |
418
+ | `operationError` | `(payload: { operation, error, context }) => void` | 操作失败时触发;`context` 包含包名、操作面、操作名与可选 traceId |
419
+ | `pluginError` | `(payload: { pluginId: string, error: unknown }) => void` | 插件执行出错时触发 |
420
+ | `filterOptionsError` | `(payload: { columnKey: string, error: unknown }) => void` | 异步列筛选选项加载失败时触发 |
421
+ | `selectionChange` | `(rows: T[]) => void` | 选择行变化时触发 |
422
+ | `sortChange` | `(sort: SortState) => void` | 排序状态变化时触发 |
423
+ | `search` | `(query: OgTableQuery) => void` | 搜索触发时触发 |
424
+ | `searchOptionsError` | `(error: unknown) => void` | 搜索选项加载失败时触发 |
425
+
426
+ ## 插槽
427
+
428
+ | 插槽名称 | 作用域参数 | 说明 |
429
+ | ----------------- | ---------------------------- | -------------------------------------------------------------------------- |
430
+ | `empty` | 无 | 表格数据为空时的自定义内容 |
431
+ | `error` | `{ error, retry, hasData }` | 加载失败时的自定义内容;`retry` 为重试函数,`hasData` 表示是否已有历史数据 |
432
+ | `expand` | 行数据 | 展开行的自定义内容 |
433
+ | `beforeActions` | 无 | 左侧操作区、批量动作前的自定义内容 |
434
+ | `actions` | `OgTableActionsSlotProps<T>` | 左侧操作区的自定义批量按钮、状态和受保护的执行方法 |
435
+ | `afterActions` | 无 | 左侧操作区、批量动作后的自定义内容 |
436
+ | `overflowActions` | `OgTableActionsSlotProps<T>` | 左侧操作区的可折叠内容;仅此插槽会在空间不足时收进悬停菜单 |
437
+ | `beforeToolbar` | 无 | 右侧工具栏之前的自定义内容,紧邻工具栏 |
438
+ | `afterToolbar` | 无 | 右侧工具栏之后的自定义内容 |
439
+ | `beforeTable` | 无 | 工具栏下方、表格数据区上方的整行自定义内容 |
440
+ | `search-*` | 字段对应值 | 动态插槽,用于自定义搜索字段的渲染,插槽名格式为 `search-{字段名}` |
441
+
442
+ `beforeActions`、`actions`、`afterActions` 与 `overflowActions` 位于工具栏左侧的独立操作区。`overflowActions` 只有在空间不足时才会收进 Element Plus Dropdown,鼠标悬停展开;其余插槽内容不会自动折叠。自定义操作区通过 `actions` 插槽绘制批量按钮、任务进度和取消控件。`OgTableActionsSlotProps<T>` 提供当前通过可见性与权限筛选的动作(不含 `onClick`)、选择数量和模式、`disabled`、`loading`、`tooltip`、`run` 以及批量任务状态和取消方法。`run(action)` 仍经过确认、`beforeBatch`、权限与只读复核及错误处理;行选择调用配置动作的回调,查询范围选择交给 `batchJobs` adapter,插槽作用域不暴露查询快照。选择查询范围的控件保留在左侧操作区。
443
+
444
+ 选择数量大于零时,如果 `actions` 插槽注册了锚点,组件仅在鼠标悬停于该元素或其后代获得键盘焦点时显示已选提示气泡。通过 `setSelectionTooltipTarget` 注册自定义批量按钮的 DOM 包裹元素;`selectionTooltip` 可使用字符串或接收 `{ selectedCount, selectionMode }` 的回调自定义提示文案,未设置时使用本地化默认文案。每个表格的 `actions.batch` 列表中,动作 `key` 必须唯一;运行时配置校验会拒绝重复值。
445
+
446
+ ```vue
447
+ <script setup lang="ts">
448
+ const toTooltipTarget = (target: unknown): HTMLElement | null => {
449
+ if (typeof HTMLElement === 'undefined') return null
450
+ return target instanceof HTMLElement ? target : null
451
+ }
452
+ </script>
453
+
454
+ <template>
455
+ <OgTable :og-columns="columns" :og-data-source="dataSource" :og-config="ogConfig">
456
+ <template #actions="{ actions, disabled, loading, run, setSelectionTooltipTarget }">
457
+ <span :ref="(element) => setSelectionTooltipTarget(toTooltipTarget(element))">
458
+ <ElButton
459
+ v-for="action in actions.slice(0, 1)"
460
+ :key="action.key"
461
+ :disabled="disabled(action)"
462
+ :loading="loading(action)"
463
+ @click="run(action)"
464
+ >
465
+ {{ action.label }}
466
+ </ElButton>
467
+ </span>
468
+ </template>
469
+ <template #overflowActions="{ actions, disabled, loading, run }">
470
+ <ElButton
471
+ v-for="action in actions.slice(1)"
472
+ :key="action.key"
473
+ :disabled="disabled(action)"
474
+ :loading="loading(action)"
475
+ @click="run(action)"
476
+ >
477
+ {{ action.label }}
478
+ </ElButton>
479
+ </template>
480
+ </OgTable>
481
+ </template>
482
+ ```
483
+
484
+ 示例将第一项作为常驻操作,其余动作交给 `overflowActions`;实际项目可按动作权限或业务优先级划分两个列表,但同一个动作不要同时渲染在两个插槽中。
485
+
486
+ 仅注册了 `actions.batch` 配置不会绘制按钮;调用方需要提供 `actions` 插槽。`OgTableLocal`、`OgTableWithSearch` 与 `OgFormTable` 同样透传这些操作区插槽和选择提示属性。
487
+
488
+ ## 高度与滚动
489
+
490
+ `config.height` 控制整个 `OgTable` 的高度。配置数值或 CSS 高度值后,搜索区、工具栏和分页保持在组件内,标准表格与虚拟表格都会自动填充剩余数据区并在其中滚动。
491
+
492
+ 默认值为 `100%`。使用该默认值时,调用方需要为表格的祖先容器提供确定高度;否则组件会按内容自然撑开。
493
+
494
+ `ogConfig.border` 在未提供标准 Element Plus 顶层 `border` 时控制表格网格与外边框,默认 `true`。设置为 `false` 可使用无边框表格。标准模式下,组件顶层 `border` 优先于 `ogConfig.border`;这样官方 `ElTable` 属性保持有效,同时保留现有业务布局能力。Admin 列表页依据最终状态移除数据区内缩,让表格直接贴合工作台。
495
+
496
+ ## 内置配置与自定义扩展
497
+
498
+ 内置能力只有命名配置入口:筛选记忆使用 `config.state.filterMemory`,展示与分析能力使用 `config.masking`、`config.analytics`、`config.analyticsQueue`。自定义行为只使用 `config.extensions`,并必须先通过 `createOgTable({ extensions })` 注册;内置标识不能放进 extensions,因此不存在第二套语法或优先级。
499
+
500
+ ```ts
501
+ interface OgTableExtensionConfig {
502
+ id: string
503
+ enabled?: boolean
504
+ options?: Record<string, unknown>
505
+ }
506
+ ```
507
+
508
+ | 属性 | 说明 |
509
+ | --------- | ---------------------- |
510
+ | `id` | 已注册的自定义扩展标识 |
511
+ | `enabled` | 是否启用该扩展 |
512
+ | `options` | 传递给扩展的实例选项 |
513
+
514
+ 包导出了 `createOgTable` 辅助函数,用于创建自定义插件:
515
+
516
+ ```ts
517
+ import { createOgTable } from '@origen-ui/table'
518
+ ```
519
+
520
+ ### 内置能力
521
+
522
+ #### masking — 数据脱敏
523
+
524
+ 在展示层对敏感信息进行遮蔽,原始数据不受影响。通过 `config.masking` 配置。`MaskingConfig` 结构如下:
525
+
526
+ ```ts
527
+ interface MaskingConfig {
528
+ enabled?: boolean
529
+ rules?: Partial<
530
+ Record<string, 'phone' | 'id-card' | 'bank-card' | 'email' | ((value: string) => string)>
531
+ >
532
+ }
533
+ ```
534
+
535
+ | options 属性 | 说明 |
536
+ | ------------ | ------------------------------------------------------------------ |
537
+ | `enabled` | 是否启用脱敏 |
538
+ | `rules` | 脱敏规则映射,key 为列的 `prop` 名称,value 为内置规则或自定义函数 |
539
+
540
+ 内置规则:
541
+
542
+ | 规则名 | 效果示例 |
543
+ | ----------- | --------------------- |
544
+ | `phone` | `138****1234` |
545
+ | `id-card` | `110***********1234` |
546
+ | `bank-card` | `6222 **** **** 1234` |
547
+ | `email` | `a***@example.com` |
548
+
549
+ 也可传入自定义函数 `(value: string) => string` 实现任意脱敏逻辑。包还导出了 `maskValue` 辅助函数,可在业务代码中手动对值进行脱敏:
550
+
551
+ ```ts
552
+ import { maskValue } from '@origen-ui/table'
553
+ ```
554
+
555
+ #### analytics — 行为埋点
556
+
557
+ 追踪用户操作,用于数据分析。通过 `config.analytics` 配置。`AnalyticsConfig` 结构如下:
558
+
559
+ ```ts
560
+ interface AnalyticsConfig {
561
+ enabled?: boolean
562
+ whitelist?: string[] // 仅上报的事件名白名单
563
+ blacklist?: string[] // 不上报的事件名黑名单
564
+ context?: () => Record<string, unknown> // 附加上下文信息
565
+ adapters?: AnalyticsAdapter[]
566
+ }
567
+ ```
568
+
569
+ `AnalyticsAdapter` 定义埋点上报适配器:
570
+
571
+ ```ts
572
+ interface AnalyticsAdapter {
573
+ id: string
574
+ behavior: (event: AnalyticsEvent) => void | Promise<void> // 正常行为上报
575
+ error: (event: AnalyticsEvent & { error: unknown }) => void | Promise<void> // 异常行为上报
576
+ }
577
+ ```
578
+
579
+ 其中 `AnalyticsEvent` 包含:
580
+
581
+ | 字段 | 类型 | 说明 |
582
+ | --------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
583
+ | `name` | `string` | 事件名称 |
584
+ | `context` | `OgTableAnalyticsContext` | 事件上下文包含 `route`、`environment`、`timestamp`、`result`、`query`、`pageNum`、`selectionCount`、`rowKey` 等;应用可通过 `config.analytics.context()` 增加自有字段,组件实例标识不会放入载荷 |
585
+
586
+ #### analyticsQueue — 埋点队列
587
+
588
+ 控制埋点上报的批量合并策略,避免频繁请求。通常与 `analytics` 配合使用。通过 `config.analyticsQueue` 配置。`AnalyticsQueueConfig` 结构如下:
589
+
590
+ ```ts
591
+ interface AnalyticsQueueConfig {
592
+ enabled?: boolean // 是否启用队列批量上报
593
+ delay?: number // 批量上报延迟时间(ms)
594
+ }
595
+ ```
596
+
597
+ #### filterMemory — 筛选记忆
598
+
599
+ 在会话或本地存储中恢复 `TableStateSnapshot`,包括搜索、分页、列设置、列宽与密度。通过 `config.state.filterMemory` 配置。查询和列筛选仍必须通过白名单显式允许;旧格式条目会被丢弃。`FilterMemoryConfig` 结构详见 [工具栏与状态记忆](#工具栏与状态记忆) 章节。
600
+
601
+ ## 重试机制(retry)
602
+
603
+ 通过 `config.retry` 配置请求失败后的自动重试策略:
604
+
605
+ | 属性 | 类型 | 说明 |
606
+ | ------------- | -------- | -------------------------------------------------- |
607
+ | `retry.read` | `number` | 读取操作(列表加载、单行刷新)失败后的最大重试次数 |
608
+ | `retry.write` | `number` | 写入操作(编辑提交、批量操作)失败后的最大重试次数 |
609
+
610
+ **重试时机与约束:**
611
+
612
+ - **读取重试**(`retry.read`):当 `dataSource.list` 或 `dataSource.getRow` 请求失败时自动重试,适用于网络抖动等临时性错误。
613
+ - **写入重试**(`retry.write`):仅在编辑提交提供了幂等键(`idempotencyKey`)时生效。幂等键确保重试不会产生重复数据。若未提供幂等键,写入操作失败后不会自动重试。
614
+ - **失败后行为**:重试次数耗尽后,读取失败触发 `loadError` 事件并保留已有数据;写入失败触发 `operationError` 事件,携带 `{ operation, error, context }`。`context` 固定标识 `@origen-ui/table`、操作面和操作名,并在底层错误提供时保留 traceId;业务侧如需关联业务表格范围,应在自己的错误处理上下文中提供 scope。
615
+
616
+ ## 编辑未保存警告(editing.warnOnUnsaved)
617
+
618
+ 当 `config.editing.warnOnUnsaved` 为 `true`(默认启用)时,如果表格存在未提交的编辑变更,用户尝试通过浏览器导航离开页面时,浏览器会弹出确认对话框,防止意外丢失编辑数据。
619
+
620
+ ```ts
621
+ config.editing = {
622
+ mode: 'cell', // 编辑模式:'cell' | 'row'
623
+ commitPermission: 'admin', // 提交权限
624
+ warnOnUnsaved: true, // 启用浏览器导航警告(默认 true)
625
+ }
626
+ ```
627
+
628
+ ## 分页配置(pagination)
629
+
630
+ 通过 `config.pagination` 自定义分页行为:
631
+
632
+ | 属性 | 类型 | 默认值 | 说明 |
633
+ | ----------- | ------------------- | -------------- | ---------------------- |
634
+ | `pageSize` | `number` | 10 | 默认每页行数 |
635
+ | `pageSizes` | `number[]` | `[10, 20, 50]` | 可选的每页行数列表 |
636
+ | `align` | `'left' \| 'right'` | `'right'` | 分页控件的水平对齐方式 |
637
+
638
+ ```ts
639
+ config.pagination = {
640
+ pageSize: 50,
641
+ pageSizes: [10, 25, 50, 100, 200],
642
+ align: 'left',
643
+ }
644
+ ```
645
+
646
+ ## 性能与稳定性
647
+
648
+ 标准表格建议保持在 100 行以内,并将当前页行数与可见列数的乘积控制在 2,500 以下;需要展示更大或更宽的结果集时,由使用者显式启用 `config.virtual.enabled`。虚拟模式以 5,000 行为首轮验证基线,保留可见行和列的 DOM。OgTable 不自动切换表面,因此该配置是性能决策的一部分。
649
+
650
+ 开发环境中,标准模式超过 100 行、达到 2,500 个可见单元格或虚拟模式超过 5,000 行会输出一次去重的性能预算告警。生产环境不会抛出异常;配置并启用 analytics 时会报告 `performance-budget`,其上下文包含模式、行数、可见列数、可见单元格数和命中的预算,便于应用侧观测。
651
+
652
+ `OgTableLocal` 适合约 100 行内存数据的搜索和排序;`OgFormTable` 的 100 x 10 编辑场景作为交互响应基线。快速搜索、翻页或卸载期间应始终将 `context.signal` 传递给数据源,以避免过期响应覆盖较新结果。
653
+
654
+ ## 加载状态
655
+
656
+ `OgTable` 在组件内部维护列表读取的加载状态。标准表格与虚拟表格都会直接使用 Element Plus 的 `v-loading` 遮罩表格区域,应用无需全局注册该指令,也无需传入可写的 `loading` 属性。
657
+
658
+ 整表遮罩只表示 `dataSource.list` 正在读取数据;暂存编辑提交和批处理仍分别在其自身操作区域显示 loading。请求成功、失败、取消或被新请求替换后,当前列表遮罩都会正确关闭,旧请求不会提前关闭新请求的遮罩。
659
+
660
+ ## Props
661
+
662
+ | 属性 | 类型 | 说明 |
663
+ | --------------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
664
+ | `rowKey` | `TableRowKey<T>` | 按能力要求提供。行主键字段名或返回 `string \| number` 的函数;选择/批量操作、树/展开、编辑/行操作、虚拟渲染、单行刷新或提交能力启用时必须稳定且唯一。仅远程纯展示且无这些能力时可省略。 |
665
+ | `ogColumns` | `TableColumn<T>[]` | 必填。数据、选择、索引、展开、操作和拼接列定义。 |
666
+ | `ogDataSource` | `OgTableDataSource<T, TQuery>` | 必填。远程列表、单行刷新和提交等数据协议。 |
667
+ | `ogConfig` | `OgTableConfig<T, TQuery>` | 可选。表格呈现、搜索、工具栏、编辑、权限、插件和持久化配置。 |
668
+ | `ogTableEvents` | `OgTableSurfaceEvents<T>` | 可选。按标准或虚拟表面转发官方事件回调;回调签名参考官方文档。 |
669
+ | `ogTableSlots` | `OgTableSurfaceSlots<T>` | 可选。转发 TableV2 插槽;支持项、替换行为及限制见[表面透传](#element-plus-表面透传)。 |
670
+ | `ogReadonly` | `boolean` | 可选。禁止编辑、提交及本地新增/删除,保留查询和展示。 |
671
+ | `selectionTooltip` | `string \| ((context: OgTableSelectionTooltipContext) => string)` | 可选。自定义悬停或键盘聚焦已选按钮锚点时显示的选择提示文案。 |
672
+ | `ogRenderDisabledGridCells` | `boolean` | `false` | 内部组合钩子:网格模式下保持禁用编辑器可见;业务通常无需设置。 |
673
+ | `ogQueryDefaults` | `Partial<TQuery>` | 可选。路由、工作区等外部上下文的响应式查询基线。 |
674
+ | `ogOnVisibleColumnsChange` | `(columns: readonly TableColumn<T>[], meta?: OgTablePresentationMeta) => void` | 可选。组合组件读取最终可见列及分页/树表 presentation metadata;业务通常无需传入。 |
675
+
676
+ `ogConfig` 中的 `search` 只定义查询协议;基础 `OgTable` 通过 `#search` 插槽渲染查询 UI。需要内置 OgSearch 时使用 [OgTableWithSearch](./table-with-search.md)。内存受控数据场景使用 [OgTableLocal](./table-local.md)。
677
+
678
+ 表格实例标识不是公开 prop;`rowKey` 只在启用依赖行身份的能力时必需。
679
+
680
+ `ogQueryDefaults` 适用于路由、工作区或租户等外部上下文。它覆盖 `ogConfig.search.defaultValues`;其语义值变化时,表格从第 1 页重新查询,并清空关键字、列筛选、排序、选择、展开和暂存编辑,同时保留页大小、列设置和密度。未提供该 prop 时,`ogConfig.search.defaultValues` 仍只参与首次初始化,重置会清空搜索条件。
681
+
682
+ ## 树选择(Tree selection)
683
+
684
+ 将 `config.selection.tree.cascade` 设置为 `true`,即可让标准树表格的行切换级联应用到所有已加载的合格后代节点。仅当所有合格后代都被选中时,可选择的祖先节点才显示为选中;后代集合部分选中时显示半选。不可选择的节点自身会被跳过,但不会阻断对后代的遍历。该开关默认关闭(`false`);虚拟渲染下仍不支持树模式。
685
+
686
+ ## 常用操作导航
687
+
688
+ 本节是任务导向索引;参数、默认值、事件和实例返回值以[Props](#props)及其后的完整 API 参考为唯一详细定义。
689
+
690
+ ## 公共导出索引
691
+
692
+ ### 官方表格表面属性、事件与插槽类型:`OgTableStandardNativeProps`、`OgTableVirtualNativeProps`、`OgTableSurfaceEvents`、`OgTableStandardEvents`、`OgTableVirtualEvents`、`OgTableSurfaceSlots`、`OgTableVirtualSlots`
693
+
694
+ 属性联合与模式配置:`OgTableBusinessProps`、`OgTableLocalBusinessProps`、`OgTableStandardConfig`、`OgTableVirtualConfig`。
695
+
696
+ 根入口 `@origen-ui/table` 同时导出两个组件、工厂/状态工具、事件转发器、locale 常量和类型契约。以下为可直接导入的非类型导出:
697
+
698
+ ### 完整名称索引
699
+
700
+ 以下根入口类型和工具由本页的 Props、数据源、编辑、状态和事件章节定义。
701
+
702
+ | 分类 | 导出 |
703
+ | ---------- | --------------------------------------------------------------------------------------------------------- |
704
+ | 组件 | `OgTable`、`OgTableLocal` |
705
+ | 工厂与状态 | `createOgTable`、`DEFAULT_CONFIG`、`mergeOgTableConfig`、`useOgTableConfig`、`assertOgTableSurfaceConfig` |
706
+ | 事件转发 | `createOgTableEventForwarders`、`createOgTableLocalEventForwarders`、`OG_TABLE_FORWARDABLE_SLOT_NAMES` |
707
+ | locale | `OG_TABLE_LOCALE_EN_US`、`OG_TABLE_LOCALE_ZH_CN`、`OG_TABLE_LOCALE_ZH_TW` |
708
+ | 筛选与脱敏 | `filterMemoryKey`、`saveFilterMemory`、`restoreFilterMemory`、`clearFilterMemory`、`maskValue` |
709
+
710
+ | 类型分类 | 根入口导出 |
711
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
712
+ | 基础/列 | `OgTableRow`、`RowKey`、`TableRowKey`、`TableColumn`、`DataColumn`、`ConcatColumn`、`SelectionColumn`、`IndexColumn`、`ExpandColumn`、`ActionColumn`、`CellFormat`、`SortState`、`SortOrder`、`Density`、`ColumnPriority` |
713
+ | 数据/请求 | `OgTableProps`、`OgTableConfig`、`OgTableDataSource`、`OgTableQuery`、`OgTableRequestContext`、`OgTablePaginationRequest`、`OgTablePaginationResponse`、`OgTableSubmitResult`、`OgTableCommitResult` |
714
+ | 交互/实例 | `OgTableExpose`、`OgTableSlots`、`OgTableActionsSlotProps`、`OgTableSelectionTooltipContext`、`OgTableEmits`、`OgTableCellScope`、`OgTableSearchSlotProps`、`OgTableSelection`、`OgTableSelectionRows`、`OgTableQuerySelection`、`OgTableChange`、`OgTableOperationError`、`OgTableOperationErrorContext` |
715
+ | 编辑/扩展/状态 | `EditableColumn`、`OgTableTransactionRequest`、`OgTableTransactionResult`、`OgTableTransactionConflict`、`OgTableExtension`、`OgTableHooks`、`OgTableStateConfig`、`TableStateSnapshot`、`AnalyticsConfig` |
716
+ | Local/工具栏 | `OgTableLocalProps`、`OgTableLocalOptions`、`OgTableLocalExpose`、`OgTableLocalEmits`、`OgTableToolbarAction`、`OgTableToolbarCustomization`、`OgTableToolbarTool`、`CreateOgTableOptions`、`OgTableEventForwarders`、`OgTableLocalEventForwarders` |
717
+ | 树表配置 | `OgTableTreeConfig` |
718
+ | Presentation | `OgTablePresentationMeta` |
719
+ | 编辑放弃 | `OgTableDiscardOptions` |
720
+ | 属性类型 | `OgTableBusinessProps`、`OgTableLocalBusinessProps`、`OgTableStandardConfig`、`OgTableVirtualConfig` |
721
+
722
+ | 细分类型分类 | 根入口导出 |
723
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
724
+ | 单元格、筛选与提示 | `ColumnFilter`、`DataCellScope`、`FilterMemoryConfig`、`MaskingConfig`、`TableCellTip`、`TableCellTipConfig`、`TooltipConfig` |
725
+ | 动作、批量与权限 | `OgTableAction`、`OgTableActionPresentation`、`OgTableBatchAction`、`OgTableActionsSlotProps`、`OgTableSelectionTooltipContext`、`OgTableBatchJob`、`OgTableBatchJobAdapter`、`OgTableColumnPermission`、`OgTableConfirmOptions`、`Permission`、`PermissionChecker` |
726
+ | 分页、事件与 Element Plus 实例 | `OgTableEmitFunction`、`OgTableLocalEmitFunction`、`OgTableElInstance`、`OgTableOperation`、`OgTablePaginationContext`、`OgTablePaginationResponseContext`、`OgTableLocale` |
727
+ | 扩展、工具栏与事务 | `OgTableExtensionApi`、`OgTableExtensionConfig`、`OgTableHook`、`OgTableHookContext`、`OgTableToolbarCustomizationAdapter`、`OgTableTransactionChange`、`OverlayManager` |
728
+ | 分析 | `AnalyticsAdapter`、`AnalyticsEvent`、`AnalyticsQueueConfig`、`OgTableAnalyticsContext` |
729
+
730
+ 上表的 payload、adapter 与 presentation 类型也属于根入口。可通过所属配置字段获取类型推断,或从根入口显式导入。
731
+
732
+ `createOgTable({ extensions })` 只注册自定义扩展;内置 filter memory、masking 和 analytics 能力使用 `config` 命名入口,不能通过第二套旧语法配置。
733
+
734
+ 通过 `ref` 获取组件实例,可调用以下方法:
735
+
736
+ | 方法 | 参数 | 返回值 | 说明 |
737
+ | -------------------- | ------------------------------------------------------------- | ---------------------------------------------- | ------------------------------------------------------------ |
738
+ | `refresh` | 无 | `Promise<void>` | 刷新当前页数据 |
739
+ | `reset` | 无 | `Promise<void>` | 重置搜索、分页与筛选状态并重新加载 |
740
+ | `refreshRow` | `key: RowKey` | `Promise<void>` | 按行 key 刷新单行数据 |
741
+ | `clearFilterMemory` | 无 | `void` | 清除当前表格的筛选记忆 |
742
+ | `getSelectedRows` | 无 | `T[]` | 获取当前已选行 |
743
+ | `clearSelection` | 无 | `void` | 清空所有选择 |
744
+ | `toggleRowSelection` | `row: T, selected?: boolean` | `void` | 切换行选择状态,`selected` 省略时取反 |
745
+ | `getChanges` | 无 | `OgTableChange<T>[]` | 获取当前未提交的编辑变更列表 |
746
+ | `hasChanges` | 无 | `boolean` | 是否存在未提交的编辑变更 |
747
+ | `discardChanges` | `key?: RowKey` | `void` | 丢弃编辑变更;传入 `key` 仅丢弃指定行,省略则丢弃全部 |
748
+ | `commitChanges` | `idempotencyKey?: string` | `Promise<OgTableSubmitResult<T> \| undefined>` | 提交所有编辑变更;提供幂等键可安全重试 |
749
+ | `toggleRowExpansion` | `row: T, expanded?: boolean` | `void` | 切换行展开状态,`expanded` 省略时取反 |
750
+ | `getExpandedRows` | 无 | `T[]` | 获取当前已展开的行 |
751
+ | `resetColumnWidths` | 无 | `void` | 重置所有列宽为默认值 |
752
+ | `scrollTo` | `options: { top?: number, left?: number, rowIndex?: number }` | `void` | 滚动到指定位置;`rowIndex` 为行索引,`top`/`left` 为像素偏移 |
753
+ | `getState` | 无 | `TableStateSnapshot<TQuery>` | 获取不可变的完整表格状态快照 |
754
+ | `applyState` | `snapshot: TableStateSnapshot<TQuery>` | `Promise<void>` | 应用完整快照并只重新加载一次 |
755
+
756
+ 完整配置类型由 `@origen-ui/table` 导出。优先通过 `OgTableConfig`、`OgTableDataSource`、`TableColumn` 与 `TableStateSnapshot` 获得端到端类型约束。
757
+
758
+ Search configuration uses `OgTableSearchConfig` (`OgTableSearchConfig<TQuery>`) for the framework-neutral query fields, defaults, layout, quick search, collapsed summary, and locale options accepted by `OgTableConfig.search`.
759
+
760
+ | Public type | Description |
761
+ | --------------------- | -------------------------------------------------------- |
762
+ | `OgTableSearchConfig` | Search configuration accepted by `OgTableConfig.search`. |
763
+
764
+ ## 企业版批处理与事务编辑
765
+
766
+ 启用 `config.selection.queryScope.enabled` 后,当前页所有可选行被选中时,工具栏可升级为“选择全部匹配项”。组件继续触发 `selectionChange`(仅已加载行),并额外触发 `selectionScopeChange`:其值要么是行与键,要么是去除分页参数后的查询快照和 `excludedKeys`。搜索、筛选和排序会清除查询范围;翻页、改变每页数量和刷新不会清除。
767
+
768
+ 查询范围批量操作必须同时配置 `actions.batch[].queryScope.enabled` 与应用提供的 `batchJobs` adapter。adapter 负责提交、轮询和可选取消,组件默认每 1500ms 轮询,读取失败遵循 `retry.read`,并通过 `batchJobChange` 和 `operationError` 报告状态与错误。后端必须重新校验权限、查询和可选资格,客户端选择范围不能作为授权依据。
769
+
770
+ 原子编辑需要同时设置 `editing.transaction.enabled`、`editing.transaction.versionOf` 与 `dataSource.submitTransaction`。提交请求包含每一行的原始值、当前值、已编辑字段和乐观版本;服务端必须返回全部冲突的最新行。冲突不会清除草稿,用户可以重基(只覆盖本地已编辑字段)、保留草稿或整批放弃。`commitChanges` 返回旧提交结果或事务结果联合类型,冲突同时触发 `transactionConflict`。
771
+
772
+ ## Runtime 子路径
773
+
774
+ 从 `@origen-ui/table/runtime` 可在应用启动阶段安装 `createOgTable`,并复用根入口的配置、扩展与 locale 类型和常量。
775
+
776
+ | ------------------ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
777
+ | `useOgTableConfig` | `() => Readonly<OgTableConfig>` | 在 setup 中读取当前应用安装的配置;没有安装时返回内置默认配置的只读视图。仅返回配置,不暴露 overlay 或扩展内部状态。 |
778
+
779
+ ## 相关组合示例
780
+
781
+ 需要把搜索模型和表格请求接线时,查看 [OgTableWithSearch](./table-with-search.md);页面级布局、跨组件状态和路由恢复见[数据与查询场景](../../.agents/skills/admin-component-usage/references/component-directory.md)。
782
+
783
+ <!-- component-contract:start -->
784
+
785
+ ## 公共契约
786
+
787
+ > 由组件目录生成;每条记录对应可公开导入的组件及其消费者 API 摘要。
788
+
789
+ ### Imports
790
+
791
+ - `table`: `import { OgTable } from '@origen-ui/table'`
792
+
793
+ ### Props
794
+
795
+ - `table`: `rowKey`, `ogColumns`, `ogDataSource`, `ogConfig`, `ogQueryDefaults`, `ogTableEvents`, `ogTableSlots`, `ogReadonly`, `ogRenderDisabledGridCells`, `ogOnVisibleColumnsChange`, `selectionTooltip`
796
+
797
+ ### Events
798
+
799
+ - `table`: `selectionChange`, `loadSuccess`, `loadError`, `operationError`, `pluginError`, `selectionScopeChange`, `batchJobChange`, `transactionConflict`, `sortChange`, `search`, `searchOptionsError`, `cellChange`, `filterOptionsError`
800
+
801
+ ### Slots
802
+
803
+ - `table`: `search`, `empty`, `error`, `expand`, `editor`, `beforeActions`, `actions`, `afterActions`, `overflowActions`, `beforeToolbar`, `afterToolbar`, `beforeTable`, `tableEmpty`, `tableAppend`
804
+
805
+ ### Exposes
806
+
807
+ - `table`: `getElTable`, `refresh`, `reset`, `refreshRow`, `clearFilterMemory`, `getSelectedRows`, `getChanges`, `hasChanges`, `discardChanges`, `commitChanges`, `clearSelection`, `toggleRowSelection`, `toggleRowExpansion`, `getExpandedRows`, `resetColumnWidths`, `scrollTo`, `getState`, `applyState`
808
+
809
+ ### Types
810
+
811
+ - `table`:属性类型:`OgTableProps`;公开方法类型:无
812
+
813
+ <!-- component-contract:end -->