@lovrabet/rabetbase-cli 2.4.3 → 2.4.4-beta.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 (381) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/index.js +1 -1
  20. package/lib/commands/app/list.js +1 -1
  21. package/lib/commands/app/members-list.js +1 -1
  22. package/lib/commands/app/remote-directory.js +1 -1
  23. package/lib/commands/app/shared.js +1 -1
  24. package/lib/commands/app-config/delete.js +1 -1
  25. package/lib/commands/app-config/get.js +1 -1
  26. package/lib/commands/app-config/index.js +1 -1
  27. package/lib/commands/app-config/list.js +1 -1
  28. package/lib/commands/app-config/set.js +1 -1
  29. package/lib/commands/app-config/shared.js +1 -1
  30. package/lib/commands/auth/index.js +1 -1
  31. package/lib/commands/bff/create.js +1 -1
  32. package/lib/commands/bff/delete.js +1 -1
  33. package/lib/commands/bff/detail.js +1 -1
  34. package/lib/commands/bff/index.js +1 -1
  35. package/lib/commands/bff/list.js +1 -1
  36. package/lib/commands/bff/pull.js +1 -1
  37. package/lib/commands/bff/push.js +1 -1
  38. package/lib/commands/bff/status.js +1 -1
  39. package/lib/commands/cli-skill/index.js +1 -1
  40. package/lib/commands/cli-update.js +1 -1
  41. package/lib/commands/codegen/index.js +1 -1
  42. package/lib/commands/codegen/sdk.js +1 -1
  43. package/lib/commands/codegen/sql.js +1 -1
  44. package/lib/commands/common/app-registry.js +1 -1
  45. package/lib/commands/common/app-selector.js +1 -1
  46. package/lib/commands/common/async-task.js +1 -1
  47. package/lib/commands/common/dry-run.js +1 -1
  48. package/lib/commands/common/flags.js +1 -1
  49. package/lib/commands/common/local-file.js +1 -1
  50. package/lib/commands/common/validate.js +1 -1
  51. package/lib/commands/config/get.js +1 -1
  52. package/lib/commands/config/index.js +1 -1
  53. package/lib/commands/config/list.js +1 -1
  54. package/lib/commands/config/set.js +1 -1
  55. package/lib/commands/config/shared.js +1 -1
  56. package/lib/commands/data/filter.js +1 -1
  57. package/lib/commands/data/getOne.js +1 -1
  58. package/lib/commands/data/index.js +1 -1
  59. package/lib/commands/data/shared.js +1 -1
  60. package/lib/commands/dataset/business-group-update.js +1 -1
  61. package/lib/commands/dataset/capability.js +1 -1
  62. package/lib/commands/dataset/delete.js +1 -1
  63. package/lib/commands/dataset/detail.js +1 -1
  64. package/lib/commands/dataset/extend-update.js +1 -1
  65. package/lib/commands/dataset/field-update.js +1 -1
  66. package/lib/commands/dataset/generate.js +1 -1
  67. package/lib/commands/dataset/index.js +1 -1
  68. package/lib/commands/dataset/list.js +1 -1
  69. package/lib/commands/dataset/operations.js +1 -1
  70. package/lib/commands/dataset/relation-audit.js +1 -1
  71. package/lib/commands/dataset/relation-create.js +1 -1
  72. package/lib/commands/dataset/relation-delete.js +1 -1
  73. package/lib/commands/dataset/relation-shared.js +1 -1
  74. package/lib/commands/dataset/relation-update.js +1 -1
  75. package/lib/commands/dataset/relations.js +1 -1
  76. package/lib/commands/dataset/rename.js +1 -1
  77. package/lib/commands/dataset/restore.js +1 -1
  78. package/lib/commands/db/analysis-batching.js +1 -1
  79. package/lib/commands/db/analyze-batch-plan.js +1 -1
  80. package/lib/commands/db/analyze-cancel.js +1 -1
  81. package/lib/commands/db/analyze-start.js +1 -1
  82. package/lib/commands/db/analyze-status.js +1 -1
  83. package/lib/commands/db/create.js +1 -1
  84. package/lib/commands/db/delete.js +1 -1
  85. package/lib/commands/db/detail.js +1 -1
  86. package/lib/commands/db/diff-refresh-start.d.ts +2 -0
  87. package/lib/commands/db/diff-refresh-start.js +1 -0
  88. package/lib/commands/db/diff-refresh-status.d.ts +2 -0
  89. package/lib/commands/db/diff-refresh-status.js +1 -0
  90. package/lib/commands/db/diff.js +1 -1
  91. package/lib/commands/db/index.js +1 -1
  92. package/lib/commands/db/list.js +1 -1
  93. package/lib/commands/db/shared.js +1 -1
  94. package/lib/commands/db/tables.js +1 -1
  95. package/lib/commands/db/test.js +1 -1
  96. package/lib/commands/db/update.js +1 -1
  97. package/lib/commands/doctor.js +1 -1
  98. package/lib/commands/file/index.js +1 -1
  99. package/lib/commands/init/index.js +1 -1
  100. package/lib/commands/issue/index.js +1 -1
  101. package/lib/commands/issue/nudge.js +1 -1
  102. package/lib/commands/issue/report.js +1 -1
  103. package/lib/commands/issue/shared.js +1 -1
  104. package/lib/commands/kb/create.js +1 -1
  105. package/lib/commands/kb/delete.js +1 -1
  106. package/lib/commands/kb/detail.js +1 -1
  107. package/lib/commands/kb/index.js +1 -1
  108. package/lib/commands/kb/list.js +1 -1
  109. package/lib/commands/kb/shared.js +1 -1
  110. package/lib/commands/kb/update.js +1 -1
  111. package/lib/commands/logs/index.js +1 -1
  112. package/lib/commands/menu/asset-update.js +1 -1
  113. package/lib/commands/menu/delete.js +1 -1
  114. package/lib/commands/menu/external-link-create.js +1 -1
  115. package/lib/commands/menu/external-link-update.js +1 -1
  116. package/lib/commands/menu/group-create.js +1 -1
  117. package/lib/commands/menu/group-update.js +1 -1
  118. package/lib/commands/menu/index.js +1 -1
  119. package/lib/commands/menu/list.js +1 -1
  120. package/lib/commands/menu/move.js +1 -1
  121. package/lib/commands/menu/regroup-start.js +1 -1
  122. package/lib/commands/menu/rename.js +1 -1
  123. package/lib/commands/menu/shared/compare-table.js +1 -1
  124. package/lib/commands/menu/shared/delete-plan.js +1 -1
  125. package/lib/commands/menu/shared/facts.js +1 -1
  126. package/lib/commands/menu/shared/index.js +1 -1
  127. package/lib/commands/menu/shared/inquirer.js +1 -1
  128. package/lib/commands/menu/shared/local-pages.js +1 -1
  129. package/lib/commands/menu/shared/logic.js +1 -1
  130. package/lib/commands/menu/shared/mutations.js +1 -1
  131. package/lib/commands/menu/shared/service.js +1 -1
  132. package/lib/commands/menu/shared/sync-core.js +1 -1
  133. package/lib/commands/menu/shared/update-core.js +1 -1
  134. package/lib/commands/menu/shared/valid-url.js +1 -1
  135. package/lib/commands/menu/sync.js +1 -1
  136. package/lib/commands/notification/config-create.d.ts +2 -0
  137. package/lib/commands/notification/config-create.js +1 -0
  138. package/lib/commands/notification/config-delete.d.ts +2 -0
  139. package/lib/commands/notification/config-delete.js +1 -0
  140. package/lib/commands/notification/config-list.js +1 -1
  141. package/lib/commands/notification/config-update.d.ts +2 -0
  142. package/lib/commands/notification/config-update.js +1 -0
  143. package/lib/commands/notification/index.js +1 -1
  144. package/lib/commands/notification/shared.d.ts +97 -0
  145. package/lib/commands/notification/shared.js +1 -0
  146. package/lib/commands/ocr/index.js +1 -1
  147. package/lib/commands/page/generate-start.js +1 -1
  148. package/lib/commands/page/generate-status.js +1 -1
  149. package/lib/commands/page/index.js +1 -1
  150. package/lib/commands/page/pull.js +1 -1
  151. package/lib/commands/page/push.js +1 -1
  152. package/lib/commands/page/react/create.js +1 -1
  153. package/lib/commands/page/react/detail.js +1 -1
  154. package/lib/commands/page/react/list.js +1 -1
  155. package/lib/commands/page/react/publish.js +1 -1
  156. package/lib/commands/page/react/shared.js +1 -1
  157. package/lib/commands/page/react/syntax.js +1 -1
  158. package/lib/commands/page/react/template.js +1 -1
  159. package/lib/commands/page/react/update.js +1 -1
  160. package/lib/commands/page/relation-audit.js +1 -1
  161. package/lib/commands/page/restore.js +1 -1
  162. package/lib/commands/page/shared.js +1 -1
  163. package/lib/commands/page/standard-page-status.js +1 -1
  164. package/lib/commands/page/sync.js +1 -1
  165. package/lib/commands/permit/index.js +1 -1
  166. package/lib/commands/permit/page-get.js +1 -1
  167. package/lib/commands/permit/page-set.js +1 -1
  168. package/lib/commands/permit/role-apis-set.js +1 -1
  169. package/lib/commands/permit/role-menus-set.js +1 -1
  170. package/lib/commands/permit/role-menus.js +1 -1
  171. package/lib/commands/permit/shared.js +1 -1
  172. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  173. package/lib/commands/project/create/format-elapsed.js +1 -1
  174. package/lib/commands/project/create/main.d.ts +1 -0
  175. package/lib/commands/project/create/main.js +1 -1
  176. package/lib/commands/project/create/materialize-project-template.d.ts +11 -0
  177. package/lib/commands/project/create/materialize-project-template.js +1 -0
  178. package/lib/commands/project/create/project-name.d.ts +2 -0
  179. package/lib/commands/project/create/project-name.js +1 -0
  180. package/lib/commands/project/create/project-template-archive.d.ts +6 -0
  181. package/lib/commands/project/create/project-template-archive.js +1 -0
  182. package/lib/commands/project/create/project-template-path.d.ts +1 -3
  183. package/lib/commands/project/create/project-template-path.js +1 -1
  184. package/lib/commands/project/create/use-copy-project-template.d.ts +2 -1
  185. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  186. package/lib/commands/project/create/use-format-code.js +1 -1
  187. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  188. package/lib/commands/project/index.js +1 -1
  189. package/lib/commands/project/upgrade.js +1 -1
  190. package/lib/commands/registry.js +1 -1
  191. package/lib/commands/role/create.js +1 -1
  192. package/lib/commands/role/delete.js +1 -1
  193. package/lib/commands/role/detail.js +1 -1
  194. package/lib/commands/role/index.js +1 -1
  195. package/lib/commands/role/list.js +1 -1
  196. package/lib/commands/role/shared.js +1 -1
  197. package/lib/commands/role/update.js +1 -1
  198. package/lib/commands/role/user-add.js +1 -1
  199. package/lib/commands/role/user-remove.js +1 -1
  200. package/lib/commands/role/user-resolve.js +1 -1
  201. package/lib/commands/run/index.js +1 -1
  202. package/lib/commands/schema.js +1 -1
  203. package/lib/commands/sql/create.js +1 -1
  204. package/lib/commands/sql/delete.js +1 -1
  205. package/lib/commands/sql/detail.js +1 -1
  206. package/lib/commands/sql/exec.js +1 -1
  207. package/lib/commands/sql/index.js +1 -1
  208. package/lib/commands/sql/list.js +1 -1
  209. package/lib/commands/sql/pull.js +1 -1
  210. package/lib/commands/sql/push.js +1 -1
  211. package/lib/commands/sql/shared.js +1 -1
  212. package/lib/commands/sql/status.js +1 -1
  213. package/lib/commands/sql/validate.js +1 -1
  214. package/lib/commands/task/index.js +1 -1
  215. package/lib/commands/task/status.js +1 -1
  216. package/lib/commands/tenant/index.js +1 -1
  217. package/lib/commands/tenant/members-list.js +1 -1
  218. package/lib/commands/tenant/shared.js +1 -1
  219. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  220. package/lib/commands/user-account/index.js +1 -1
  221. package/lib/commands/workspace/add.js +1 -1
  222. package/lib/commands/workspace/index.js +1 -1
  223. package/lib/commands/workspace/remove.js +1 -1
  224. package/lib/config/schema.js +1 -1
  225. package/lib/constant/cdn.d.ts +2 -0
  226. package/lib/constant/cdn.js +1 -1
  227. package/lib/constant/cli.js +1 -1
  228. package/lib/constant/defaults.js +1 -1
  229. package/lib/constant/domain.js +1 -1
  230. package/lib/constant/env.js +1 -1
  231. package/lib/constant/output.js +1 -1
  232. package/lib/constant/paths.js +1 -1
  233. package/lib/constant/risk.js +1 -1
  234. package/lib/context/app-resolver.js +1 -1
  235. package/lib/context/auth-resolver.js +1 -1
  236. package/lib/context/config-loader.js +1 -1
  237. package/lib/context.d.ts +1 -1
  238. package/lib/context.js +1 -1
  239. package/lib/core/alias-resolver.js +1 -1
  240. package/lib/core/api-client.d.ts +29 -2
  241. package/lib/core/api-client.js +1 -1
  242. package/lib/core/bff/config.js +1 -1
  243. package/lib/core/bff/file-system.js +1 -1
  244. package/lib/core/bff/hash.js +1 -1
  245. package/lib/core/bff/lock.js +1 -1
  246. package/lib/core/bff/utils.js +1 -1
  247. package/lib/core/db-resolver.js +1 -1
  248. package/lib/core/page/file-system.js +1 -1
  249. package/lib/core/page/hash.js +1 -1
  250. package/lib/core/page/lock.js +1 -1
  251. package/lib/core/sql-index-auditor.js +1 -1
  252. package/lib/core/sql-sync/config.js +1 -1
  253. package/lib/core/sql-sync/file-system.js +1 -1
  254. package/lib/core/sql-sync/hash.js +1 -1
  255. package/lib/core/sql-sync/lock.js +1 -1
  256. package/lib/core/sql-sync/utils.js +1 -1
  257. package/lib/core/sql-validator.js +1 -1
  258. package/lib/errors.js +1 -1
  259. package/lib/framework/build-all-flags.js +1 -1
  260. package/lib/framework/error-output.js +1 -1
  261. package/lib/framework/explicit-yes.js +1 -1
  262. package/lib/framework/flags.js +1 -1
  263. package/lib/framework/help.js +1 -1
  264. package/lib/framework/index.js +1 -1
  265. package/lib/framework/output.js +1 -1
  266. package/lib/framework/response.js +1 -1
  267. package/lib/framework/runner-alias.js +1 -1
  268. package/lib/framework/runner.js +1 -1
  269. package/lib/framework/schema-export.js +1 -1
  270. package/lib/framework/types.js +1 -1
  271. package/lib/generated/build-info.d.ts +4 -4
  272. package/lib/generated/build-info.js +1 -1
  273. package/lib/help.js +1 -1
  274. package/lib/postinstall.js +1 -1
  275. package/lib/runtime/confirmation.js +1 -1
  276. package/lib/runtime/event.js +1 -1
  277. package/lib/runtime/index.js +1 -1
  278. package/lib/runtime/queue.js +1 -1
  279. package/lib/runtime/resolve.js +1 -1
  280. package/lib/skills/builtin-skill.js +1 -1
  281. package/lib/skills/main.js +1 -1
  282. package/lib/skills/npx-skills-add.js +1 -1
  283. package/lib/skills/skill-presence.js +1 -1
  284. package/lib/telemetry/cli-command-trace.js +1 -1
  285. package/lib/telemetry/cli-help-trace.js +1 -1
  286. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  287. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  288. package/lib/telemetry/send-cli-trace-log.js +1 -1
  289. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  290. package/lib/utils/ai_config.js +1 -1
  291. package/lib/utils/apply-jq-filter.js +1 -1
  292. package/lib/utils/cdn-config.js +1 -1
  293. package/lib/utils/check-sdk-version.js +1 -1
  294. package/lib/utils/cli-version-check.js +1 -1
  295. package/lib/utils/cli-version-policy.d.ts +13 -0
  296. package/lib/utils/cli-version-policy.js +1 -1
  297. package/lib/utils/config.js +1 -1
  298. package/lib/utils/entity-with-id.js +1 -1
  299. package/lib/utils/file-utils.js +1 -1
  300. package/lib/utils/guides-cdn.js +1 -1
  301. package/lib/utils/http-client.js +1 -1
  302. package/lib/utils/is-non-interactive.js +1 -1
  303. package/lib/utils/logger.js +1 -1
  304. package/lib/utils/params.js +1 -1
  305. package/lib/utils/platform.js +1 -1
  306. package/lib/utils/rules-cdn.js +1 -1
  307. package/lib/utils/sleep.js +1 -1
  308. package/lib/utils/template-replacer.js +1 -1
  309. package/lib/utils/update-notice.js +1 -1
  310. package/lib/utils/version.js +1 -1
  311. package/lib/utils/with-active-cookie.js +1 -1
  312. package/lib/utils/write-cli-side-channel.js +1 -1
  313. package/package.json +9 -4
  314. package/skills/rabetbase/SKILL.md +33 -22
  315. package/skills/rabetbase/guides/backend-function.md +5 -3
  316. package/skills/rabetbase/guides/bff-creation-workflow.md +2 -2
  317. package/skills/rabetbase/guides/conflict-detection.md +2 -2
  318. package/skills/rabetbase/guides/database-connection-workflow.md +39 -5
  319. package/skills/rabetbase/guides/react-custom-page-workflow.md +16 -4
  320. package/skills/rabetbase/guides/sql-creation-workflow.md +4 -2
  321. package/skills/rabetbase/guides/sql-mybatis.md +2 -2
  322. package/skills/rabetbase/knowledge/page-schema/YtPage.md +3 -37
  323. package/skills/rabetbase/knowledge/react-page/generation-standards.md +14 -3
  324. package/skills/rabetbase/references/rabetbase-app-config.md +2 -2
  325. package/skills/rabetbase/references/rabetbase-bff-push.md +4 -5
  326. package/skills/rabetbase/references/rabetbase-bff-save.md +3 -3
  327. package/skills/rabetbase/references/rabetbase-config.md +2 -2
  328. package/skills/rabetbase/references/rabetbase-db-analyze.md +2 -2
  329. package/skills/rabetbase/references/rabetbase-db-detail.md +3 -0
  330. package/skills/rabetbase/references/rabetbase-db-diff-refresh.md +53 -0
  331. package/skills/rabetbase/references/rabetbase-db-diff.md +40 -21
  332. package/skills/rabetbase/references/rabetbase-db-list.md +1 -1
  333. package/skills/rabetbase/references/rabetbase-kb.md +5 -3
  334. package/skills/rabetbase/references/rabetbase-menu-asset-update.md +9 -10
  335. package/skills/rabetbase/references/rabetbase-menu-external-link-update.md +1 -3
  336. package/skills/rabetbase/references/rabetbase-menu-regroup-start.md +2 -3
  337. package/skills/rabetbase/references/rabetbase-notification-config-list.md +2 -2
  338. package/skills/rabetbase/references/rabetbase-notification-config-mutations.md +56 -0
  339. package/skills/rabetbase/references/rabetbase-page-react-detail.md +1 -1
  340. package/skills/rabetbase/references/rabetbase-page-react-list.md +1 -1
  341. package/skills/rabetbase/references/rabetbase-page-react-publish.md +2 -2
  342. package/skills/rabetbase/references/rabetbase-project-create.md +3 -0
  343. package/skills/rabetbase/references/rabetbase-run.md +1 -1
  344. package/skills/rabetbase/references/rabetbase-sql-create.md +1 -1
  345. package/skills/rabetbase/references/rabetbase-sql-push.md +3 -4
  346. package/skills/rabetbase/references/rabetbase-user-account.md +0 -1
  347. package/skills/rabetbase.manifest.json +5 -5
  348. package/templates/README.md +14 -2
  349. package/lib/commands/project/create/non-interactive.d.ts +0 -9
  350. package/lib/commands/project/create/non-interactive.js +0 -1
  351. package/lib/utils/copy-directory.d.ts +0 -1
  352. package/lib/utils/copy-directory.js +0 -1
  353. package/skills/rabetbase/knowledge/page-schema/LrSmartEcharts.md +0 -291
  354. package/skills/rabetbase/knowledge/page-schema/LrSmartStatistic.md +0 -223
  355. package/templates/projects/sub-app-react-demo/.prettierrc +0 -1
  356. package/templates/projects/sub-app-react-demo/CHANGELOG.md +0 -67
  357. package/templates/projects/sub-app-react-demo/README.md +0 -246
  358. package/templates/projects/sub-app-react-demo/docs/quick-start.md +0 -245
  359. package/templates/projects/sub-app-react-demo/index.html +0 -27
  360. package/templates/projects/sub-app-react-demo/package.json +0 -34
  361. package/templates/projects/sub-app-react-demo/public/logo.svg +0 -1
  362. package/templates/projects/sub-app-react-demo/public/vite.svg +0 -1
  363. package/templates/projects/sub-app-react-demo/src/api/api.ts +0 -26
  364. package/templates/projects/sub-app-react-demo/src/api/client.ts +0 -32
  365. package/templates/projects/sub-app-react-demo/src/components/demo-page-container/DemoPageContainer.module.css +0 -28
  366. package/templates/projects/sub-app-react-demo/src/components/demo-page-container/DemoPageContainer.tsx +0 -55
  367. package/templates/projects/sub-app-react-demo/src/layouts/MainLayout.tsx +0 -308
  368. package/templates/projects/sub-app-react-demo/src/main.tsx +0 -52
  369. package/templates/projects/sub-app-react-demo/src/pages/dashboard/index.tsx +0 -570
  370. package/templates/projects/sub-app-react-demo/src/pages/data-screen/index.tsx +0 -531
  371. package/templates/projects/sub-app-react-demo/src/pages/index.module.css +0 -500
  372. package/templates/projects/sub-app-react-demo/src/pages/index.tsx +0 -641
  373. package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +0 -536
  374. package/templates/projects/sub-app-react-demo/src/pages/workbench/index.module.css +0 -295
  375. package/templates/projects/sub-app-react-demo/src/pages/workbench/index.tsx +0 -242
  376. package/templates/projects/sub-app-react-demo/src/router/index.tsx +0 -30
  377. package/templates/projects/sub-app-react-demo/src/style.css +0 -108
  378. package/templates/projects/sub-app-react-demo/src/utils/api.ts +0 -12
  379. package/templates/projects/sub-app-react-demo/src/vite-env.d.ts +0 -2
  380. package/templates/projects/sub-app-react-demo/tsconfig.json +0 -26
  381. package/templates/projects/sub-app-react-demo/vite.config.ts +0 -111
@@ -1,28 +0,0 @@
1
- .root {
2
- width: 100%;
3
- min-width: 0;
4
- }
5
-
6
- /* 标准演示页的页面级 gutter 只保留这一层。
7
- 页面自身不要再补外层 padding,避免和容器叠成双层留白。 */
8
- .standard {
9
- padding: 16px 16px 24px;
10
- }
11
-
12
- /* bleed 页面由页面自己决定内部留白,用于数据大屏这类全宽舞台。 */
13
- .bleed {
14
- padding: 0;
15
- }
16
-
17
- .inner {
18
- width: 100%;
19
- min-width: 0;
20
- max-width: var(--demo-page-max-width, 100%);
21
- margin: 0 auto;
22
- }
23
-
24
- @media (max-width: 768px) {
25
- .standard {
26
- padding: 12px;
27
- }
28
- }
@@ -1,55 +0,0 @@
1
- import type { CSSProperties, ReactNode } from "react";
2
- import styles from "./DemoPageContainer.module.css";
3
-
4
- type DemoPageContainerVariant = "standard" | "bleed";
5
-
6
- interface DemoPageContainerProps {
7
- children: ReactNode;
8
- className?: string;
9
- innerClassName?: string;
10
- innerStyle?: CSSProperties;
11
- maxWidth?: number | string;
12
- style?: CSSProperties;
13
- variant?: DemoPageContainerVariant;
14
- }
15
-
16
- function joinClassNames(...classNames: Array<string | undefined>) {
17
- return classNames.filter(Boolean).join(" ");
18
- }
19
-
20
- export default function DemoPageContainer({
21
- children,
22
- className,
23
- innerClassName,
24
- innerStyle,
25
- maxWidth,
26
- style,
27
- variant = "standard",
28
- }: DemoPageContainerProps) {
29
- const mergedInnerStyle = {
30
- ...innerStyle,
31
- } as CSSProperties & Record<string, string>;
32
-
33
- if (maxWidth !== undefined) {
34
- mergedInnerStyle["--demo-page-max-width"] =
35
- typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
36
- }
37
-
38
- return (
39
- <div
40
- className={joinClassNames(
41
- styles.root,
42
- variant === "bleed" ? styles.bleed : styles.standard,
43
- className,
44
- )}
45
- style={style}
46
- >
47
- <div
48
- className={joinClassNames(styles.inner, innerClassName)}
49
- style={mergedInnerStyle}
50
- >
51
- {children}
52
- </div>
53
- </div>
54
- );
55
- }
@@ -1,308 +0,0 @@
1
- import React, { useState } from "react";
2
- import { isInIcestark } from "@ice/stark-app";
3
- import { Outlet, useNavigate, useLocation } from "react-router-dom";
4
- import {
5
- Layout,
6
- Menu,
7
- Button,
8
- Breadcrumb,
9
- Avatar,
10
- Space,
11
- Dropdown,
12
- } from "antd";
13
- import type { MenuProps } from "antd";
14
- import {
15
- HomeOutlined,
16
- DashboardOutlined,
17
- ApiOutlined,
18
- MenuFoldOutlined,
19
- MenuUnfoldOutlined,
20
- UserOutlined,
21
- BarChartOutlined,
22
- FileTextOutlined,
23
- } from "@ant-design/icons";
24
-
25
- const { Header, Sider, Content } = Layout;
26
-
27
- // 路由配置,用于生成面包屑
28
- const routeConfig = [
29
- { path: "/", title: "首页" },
30
- { path: "/workbench", title: "工作台" },
31
- { path: "/dashboard", title: "数据看板" },
32
- { path: "/sdk-demo", title: "SDK 演示" },
33
- { path: "/data-screen", title: "数据大屏" },
34
- ];
35
-
36
- const MainLayout: React.FC = () => {
37
- const navigate = useNavigate();
38
- const location = useLocation();
39
-
40
- // 菜单收起/展开状态
41
- const [collapsed, setCollapsed] = useState(false);
42
- // 菜单是否完全隐藏
43
- const [menuHidden, setMenuHidden] = useState(false);
44
-
45
- const menuItems: MenuProps["items"] = [
46
- {
47
- key: "/",
48
- icon: <HomeOutlined />,
49
- label: "首页",
50
- },
51
- {
52
- key: "/sdk-demo",
53
- icon: <ApiOutlined />,
54
- label: "SDK 演示",
55
- },
56
- {
57
- key: "page-examples",
58
- icon: <FileTextOutlined />,
59
- label: "页面案例",
60
- children: [
61
- {
62
- key: "/workbench",
63
- icon: <DashboardOutlined />,
64
- label: "工作台",
65
- },
66
- {
67
- key: "/dashboard",
68
- icon: <DashboardOutlined />,
69
- label: "数据看板",
70
- },
71
- {
72
- key: "/data-screen",
73
- icon: <BarChartOutlined />,
74
- label: "数据大屏",
75
- },
76
- ],
77
- },
78
- ];
79
-
80
- const handleMenuClick = ({ key }: { key: string }) => {
81
- // 如果是外部链接(以 http:// 或 https:// 开头),在新标签页打开
82
- if (key.startsWith("http://") || key.startsWith("https://")) {
83
- window.open(key, "_blank", "noopener,noreferrer");
84
- } else {
85
- navigate(key);
86
- }
87
- };
88
-
89
- const toggleCollapsed = () => {
90
- setCollapsed(!collapsed);
91
- };
92
-
93
- const toggleMenuHidden = () => {
94
- setMenuHidden(!menuHidden);
95
- // 如果隐藏菜单,同时收起菜单
96
- if (!menuHidden) {
97
- setCollapsed(true);
98
- }
99
- };
100
-
101
- // 生成面包屑
102
- const getBreadcrumbItems = () => {
103
- const items: any[] = [{ title: "首页" }];
104
- const currentRoute = routeConfig.find((r) => r.path === location.pathname);
105
- if (currentRoute && currentRoute.path !== "/") {
106
- items.push({ title: currentRoute.title });
107
- }
108
- return items;
109
- };
110
-
111
- // 用户菜单
112
- const userMenuItems: MenuProps["items"] = [
113
- {
114
- key: "profile",
115
- label: "个人中心",
116
- icon: <UserOutlined />,
117
- },
118
- {
119
- key: "settings",
120
- label: "系统设置",
121
- },
122
- {
123
- type: "divider",
124
- },
125
- {
126
- key: "logout",
127
- label: "退出登录",
128
- danger: true,
129
- },
130
- ];
131
-
132
- // 可选:根据isInIcestark()判断当前运行环境,被嵌入时,不渲染layout布局
133
- if (isInIcestark()) {
134
- return <Outlet />;
135
- }
136
-
137
- return (
138
- <Layout style={{ minHeight: "100vh", background: "#fff" }}>
139
- {!menuHidden && (
140
- <Sider
141
- trigger={null}
142
- collapsible
143
- collapsed={collapsed}
144
- width={220}
145
- style={{ background: "#fff" }}
146
- >
147
- {/* 系统标题 */}
148
- <div
149
- style={{
150
- height: 64,
151
- padding: collapsed ? "16px 8px" : "16px 20px",
152
- display: "flex",
153
- alignItems: "center",
154
- justifyContent: collapsed ? "center" : "flex-start",
155
- background: "#fff",
156
- borderBottom: "1px solid #f0f0f0",
157
- }}
158
- >
159
- {!collapsed ? (
160
- <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
161
- <img
162
- src="/logo.svg"
163
- alt="Logo"
164
- style={{ height: 28, width: 28 }}
165
- />
166
- <span
167
- style={{
168
- fontSize: 16,
169
- fontWeight: 600,
170
- }}
171
- >
172
- Lovrabet System
173
- </span>
174
- </div>
175
- ) : (
176
- <img
177
- src="/logo.svg"
178
- alt="Logo"
179
- style={{ height: 28, width: 28 }}
180
- />
181
- )}
182
- </div>
183
- <Menu
184
- mode="inline"
185
- selectedKeys={[location.pathname]}
186
- items={menuItems}
187
- onClick={handleMenuClick}
188
- style={{
189
- height: "calc(100vh - 64px)",
190
- borderRight: 0,
191
- }}
192
- className="custom-menu"
193
- />
194
- </Sider>
195
- )}
196
- <Layout style={{ background: "#fff" }}>
197
- <Header
198
- style={{
199
- padding: "0 24px",
200
- display: "flex",
201
- alignItems: "center",
202
- justifyContent: "space-between",
203
- boxShadow: "0 2px 8px 0 rgba(29,35,41,.05)",
204
- height: 64,
205
- background: "#fff",
206
- borderBottom: "1px solid #f0f0f0",
207
- }}
208
- >
209
- <div style={{ display: "flex", alignItems: "center", gap: 16 }}>
210
- <Button
211
- type="text"
212
- icon={
213
- menuHidden ? (
214
- <MenuUnfoldOutlined />
215
- ) : collapsed ? (
216
- <MenuUnfoldOutlined />
217
- ) : (
218
- <MenuFoldOutlined />
219
- )
220
- }
221
- onClick={menuHidden ? toggleMenuHidden : toggleCollapsed}
222
- style={{
223
- fontSize: 16,
224
- width: 40,
225
- height: 40,
226
- display: "flex",
227
- alignItems: "center",
228
- justifyContent: "center",
229
- }}
230
- />
231
- {menuHidden && (
232
- <Button
233
- type="text"
234
- icon={<MenuUnfoldOutlined />}
235
- onClick={toggleMenuHidden}
236
- style={{
237
- fontSize: 14,
238
- height: 32,
239
- }}
240
- >
241
- 显示菜单
242
- </Button>
243
- )}
244
- {/* 面包屑导航 */}
245
- <Breadcrumb
246
- items={getBreadcrumbItems()}
247
- style={{
248
- marginLeft: menuHidden ? 0 : 16,
249
- fontSize: 14,
250
- }}
251
- itemRender={(route, params, routes, paths) => {
252
- const isLast = routes.indexOf(route) === routes.length - 1;
253
- return (
254
- <span
255
- style={{
256
- color: isLast ? "#262626" : "#595959",
257
- fontWeight: isLast ? 500 : 400,
258
- }}
259
- >
260
- {route.title}
261
- </span>
262
- );
263
- }}
264
- />
265
- </div>
266
- <div style={{ display: "flex", alignItems: "center", gap: 16 }}>
267
- {/* 用户信息 */}
268
- <Dropdown menu={{ items: userMenuItems }} placement="bottomRight">
269
- <Space
270
- style={{
271
- cursor: "pointer",
272
- padding: "4px 8px",
273
- borderRadius: 4,
274
- transition: "background 0.3s",
275
- }}
276
- onMouseEnter={(e) => {
277
- e.currentTarget.style.background = "rgba(0,0,0,0.06)";
278
- }}
279
- onMouseLeave={(e) => {
280
- e.currentTarget.style.background = "transparent";
281
- }}
282
- >
283
- <Avatar
284
- size="small"
285
- icon={<UserOutlined />}
286
- style={{ background: "#1890ff" }}
287
- />
288
- <span style={{ fontSize: 14 }}>管理员</span>
289
- </Space>
290
- </Dropdown>
291
- </div>
292
- </Header>
293
- <Content
294
- className="subapp-shell-content"
295
- style={{
296
- minHeight: 280,
297
- }}
298
- >
299
- <div className="subapp-shell-stage">
300
- <Outlet />
301
- </div>
302
- </Content>
303
- </Layout>
304
- </Layout>
305
- );
306
- };
307
-
308
- export default MainLayout;
@@ -1,52 +0,0 @@
1
- import React from "react";
2
- import { createRoot } from "react-dom/client";
3
- import { isInIcestark } from "@ice/stark-app";
4
- import { ConfigProvider } from "antd";
5
- import zhCN from "antd/locale/zh_CN";
6
- import App from "./router";
7
- import "./style.css";
8
-
9
- // 可选:根据 isInIcestark() 判断当前的运行环境,可同时兼容独立使用和嵌入使用
10
- if (!isInIcestark()) {
11
- const container = document.getElementById("root");
12
- if (container) {
13
- const root = createRoot(container);
14
- root.render(
15
- <ConfigProvider locale={zhCN}>
16
- <App />
17
- </ConfigProvider>,
18
- );
19
- }
20
- }
21
-
22
- // 关键:暴露 mount 供主应用加载时调用
23
- export function mount({
24
- container,
25
- customProps,
26
- }: {
27
- container: HTMLElement;
28
- customProps: object;
29
- }) {
30
- let root = (container as any)._reactRoot;
31
- if (!root) {
32
- root = createRoot(container);
33
- (container as any)._reactRoot = root;
34
- }
35
-
36
- root.render(
37
- <ConfigProvider locale={zhCN}>
38
- <App {...customProps} />
39
- </ConfigProvider>,
40
- );
41
- return root;
42
- }
43
-
44
- // 关键:暴露 unmount 供主应用卸载时调用
45
- export function unmount({ container }: { container: HTMLElement }) {
46
- // React 18 中不再需要手动卸载,但为了兼容性保留
47
- const root = (container as any)._reactRoot;
48
- if (root) {
49
- root.unmount();
50
- delete (container as any)._reactRoot;
51
- }
52
- }