@_tc/template-core 0.0.3 → 0.1.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 (177) hide show
  1. package/.skills/tc-generator/SKILL.md +62 -0
  2. package/.skills/tc-generator/reference/example.md +357 -0
  3. package/.skills/tc-generator/reference/model-schema.md +326 -0
  4. package/.skills/tc-generator/reference/project-template/app/controller/product.js +73 -0
  5. package/.skills/tc-generator/reference/project-template/app/router/product.js +9 -0
  6. package/.skills/tc-generator/reference/project-template/config/config.default.js +3 -0
  7. package/.skills/tc-generator/reference/project-template/index.js +17 -0
  8. package/.skills/tc-generator/reference/project-template/model/product/mode.js +179 -0
  9. package/.skills/tc-generator/reference/project-template/model/product/project/default.js +4 -0
  10. package/.skills/tc-generator/reference/project-template/package.json +10 -0
  11. package/README.md +239 -17
  12. package/cjs/_virtual/_rolldown/runtime.js +1 -1
  13. package/cjs/app/controller/base.js +1 -1
  14. package/cjs/app/controller/project.js +1 -1
  15. package/cjs/app/controller/view.js +1 -1
  16. package/cjs/app/extend/$fetch.js +1 -1
  17. package/cjs/app/extend/db.js +1 -1
  18. package/cjs/app/extend/generateErrorMessage.js +1 -1
  19. package/cjs/app/extend/logger.js +1 -1
  20. package/cjs/app/extend/parsingParamsOnUrl.js +1 -1
  21. package/cjs/app/middleware/api-sign-verify.js +1 -1
  22. package/cjs/app/middleware/error-handle.js +1 -1
  23. package/cjs/app/middleware/project-handler.js +1 -1
  24. package/cjs/app/middleware.js +1 -1
  25. package/cjs/app/router/project.js +1 -1
  26. package/cjs/app/router/view.js +1 -1
  27. package/cjs/app/router-schema/project.js +1 -1
  28. package/cjs/app/service/base.js +1 -1
  29. package/cjs/app/service/project.js +1 -1
  30. package/cjs/app/type.js +0 -1
  31. package/cjs/app/typings.js +0 -1
  32. package/cjs/app/view/entry.tpl +27 -28
  33. package/cjs/bundler/defaultAlias.js +1 -1
  34. package/cjs/bundler/dev.js +1 -1
  35. package/cjs/bundler/index.js +1 -1
  36. package/cjs/bundler/prod.js +1 -1
  37. package/cjs/bundler/state.js +1 -1
  38. package/cjs/config/config.default.js +1 -0
  39. package/cjs/index.js +1 -1
  40. package/cjs/packages/common/LRUCache.js +1 -1
  41. package/cjs/packages/common/array/index.js +1 -1
  42. package/cjs/packages/common/cache/LRUCache.js +1 -1
  43. package/cjs/packages/common/cache/index.js +1 -1
  44. package/cjs/packages/common/guards/index.js +1 -1
  45. package/cjs/packages/common/http/index.js +1 -1
  46. package/cjs/packages/common/i18n/default.js +1 -1
  47. package/cjs/packages/common/i18n/en-US.js +1 -1
  48. package/cjs/packages/common/i18n/index.js +1 -1
  49. package/cjs/packages/common/i18n/locales.js +1 -1
  50. package/cjs/packages/common/i18n/types.js +0 -1
  51. package/cjs/packages/common/index.js +1 -1
  52. package/cjs/packages/common/log/index.js +1 -1
  53. package/cjs/packages/common/number/index.js +1 -1
  54. package/cjs/packages/common/object/filterEmpty.js +1 -1
  55. package/cjs/packages/common/object/filtereEmpty.js +1 -1
  56. package/cjs/packages/common/object/index.js +1 -1
  57. package/cjs/packages/common/string/index.js +1 -1
  58. package/cjs/packages/common/types/index.js +0 -1
  59. package/cjs/packages/core/env.js +1 -1
  60. package/cjs/packages/core/index.js +1 -1
  61. package/cjs/packages/core/loader/config.js +1 -1
  62. package/cjs/packages/core/loader/controller.js +1 -1
  63. package/cjs/packages/core/loader/extend.js +1 -1
  64. package/cjs/packages/core/loader/middleware.js +1 -1
  65. package/cjs/packages/core/loader/router-schema.js +1 -1
  66. package/cjs/packages/core/loader/service.js +1 -1
  67. package/cjs/packages/core/paths.js +1 -1
  68. package/cjs/packages/core/types.js +0 -1
  69. package/cjs/packages/utils/getAllFnReturnValue.js +0 -1
  70. package/cjs/packages/utils/index.js +1 -1
  71. package/esm/_virtual/_rolldown/runtime.js +2 -15
  72. package/esm/app/controller/view.js +13 -11
  73. package/esm/app/middleware/api-sign-verify.js +9 -11
  74. package/esm/app/middleware.js +6 -6
  75. package/esm/app/view/entry.tpl +27 -28
  76. package/esm/config/config.default.js +9 -0
  77. package/esm/index.js +1 -1
  78. package/esm/packages/core/index.js +24 -26
  79. package/esm/packages/core/loader/config.js +11 -10
  80. package/esm/packages/core/loader/extend.js +13 -8
  81. package/fe/frontend/apps/dash/Dashboard.js +100 -1
  82. package/fe/frontend/apps/dash/dash.entry.js +2 -2
  83. package/fe/frontend/apps/ui-components/index.js +8 -0
  84. package/fe/frontend/apps/ui-components/ui-components.entry.d.ts +2 -0
  85. package/fe/frontend/src/api/baseInfo.d.ts +2 -2
  86. package/fe/frontend/src/common/fetchErrorShow.js +2 -1
  87. package/fe/frontend/src/common/generateMenuData.js +2 -1
  88. package/fe/frontend/src/common/importComponent.js +5 -2
  89. package/fe/frontend/src/common/language.d.ts +2 -1
  90. package/fe/frontend/src/common/language.js +7 -5
  91. package/fe/frontend/src/common/logFn/index.js +6 -4
  92. package/fe/frontend/src/common/request.js +6 -4
  93. package/fe/frontend/src/components/BasePage/HeaderView.d.ts +2 -1
  94. package/fe/frontend/src/components/BasePage/HeaderView.js +9 -4
  95. package/fe/frontend/src/defaultPages/Iframe/index.js +1 -7
  96. package/fe/frontend/src/defaultPages/NotFoundPage/index.d.ts +3 -0
  97. package/fe/frontend/src/defaultPages/NotFoundPage/index.js +7 -0
  98. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +3 -2
  99. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +8 -2
  100. package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +4 -3
  101. package/fe/frontend/src/defaultPages/SchemaPage/index.css +0 -55
  102. package/fe/frontend/src/defaultPages/SchemaPage/index.js +3 -1
  103. package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +5 -1
  104. package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.js +142 -7
  105. package/fe/frontend/src/defaultPages/SidebarSlotPage/index.js +2 -1
  106. package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.js +1 -1
  107. package/fe/frontend/src/defaultPages/SlotPage/index.js +2 -1
  108. package/fe/frontend/src/hooks/useCurrentMenuData.js +1 -1
  109. package/fe/frontend/src/index.d.ts +4 -0
  110. package/fe/frontend/src/index.js +4 -0
  111. package/fe/frontend/src/language/en-US.d.ts +76 -0
  112. package/fe/frontend/src/language/en-US.js +75 -0
  113. package/fe/frontend/src/language/index.d.ts +66 -0
  114. package/fe/frontend/src/language/index.js +69 -0
  115. package/fe/frontend/src/language/zh-CN.d.ts +76 -0
  116. package/fe/frontend/src/language/zh-CN.js +75 -0
  117. package/fe/frontend/src/typing/window.d.ts +2 -0
  118. package/fe/model/types/data/button.d.ts +2 -2
  119. package/fe/model/types/data/button.js +1 -1
  120. package/fe/model/types/model.d.ts +19 -12
  121. package/fe/packages/ui/react/components/Card/Card.d.ts +10 -0
  122. package/fe/packages/ui/react/components/Card/Card.js +8 -0
  123. package/fe/packages/ui/react/components/Card/index.d.ts +2 -0
  124. package/fe/packages/ui/react/components/Card/index.js +1 -0
  125. package/fe/packages/ui/react/components/DataTable/index.js +7 -3
  126. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +3 -3
  127. package/fe/packages/ui/react/components/Layout/Layout.d.ts +11 -0
  128. package/fe/packages/ui/react/components/Layout/Layout.js +8 -0
  129. package/fe/packages/ui/react/components/Layout/index.d.ts +2 -0
  130. package/fe/packages/ui/react/components/Layout/index.js +1 -0
  131. package/fe/packages/ui/react/components/Loading/Loading.d.ts +9 -0
  132. package/fe/packages/ui/react/components/Loading/Loading.js +13 -0
  133. package/fe/packages/ui/react/components/Loading/index.d.ts +2 -0
  134. package/fe/packages/ui/react/components/Loading/index.js +1 -0
  135. package/fe/packages/ui/react/components/Menu/Menu.js +3 -2
  136. package/fe/packages/ui/react/components/Notification/Notification.d.ts +14 -0
  137. package/fe/packages/ui/react/components/Notification/Notification.js +29 -0
  138. package/fe/packages/ui/react/components/Notification/index.d.ts +2 -0
  139. package/fe/packages/ui/react/components/Notification/index.js +1 -0
  140. package/fe/packages/ui/react/components/Radio/Radio.d.ts +9 -0
  141. package/fe/packages/ui/react/components/Radio/Radio.js +20 -0
  142. package/fe/packages/ui/react/components/Radio/RadioGroup.d.ts +19 -0
  143. package/fe/packages/ui/react/components/Radio/RadioGroup.js +21 -0
  144. package/fe/packages/ui/react/components/Radio/index.d.ts +3 -0
  145. package/fe/packages/ui/react/components/Radio/index.js +2 -0
  146. package/fe/packages/ui/react/components/Search/Search.d.ts +1 -1
  147. package/fe/packages/ui/react/components/Search/Search.js +1 -5
  148. package/fe/packages/ui/react/components/Tabs/Tabs.d.ts +16 -0
  149. package/fe/packages/ui/react/components/Tabs/Tabs.js +19 -0
  150. package/fe/packages/ui/react/components/Tabs/index.d.ts +2 -0
  151. package/fe/packages/ui/react/components/Tabs/index.js +1 -0
  152. package/fe/packages/ui/react/components/hooks/useInputController.js +0 -1
  153. package/fe/packages/ui/react/components/index.d.ts +6 -0
  154. package/fe/packages/ui/react/components/index.js +6 -0
  155. package/fe/packages/ui/react/components/table/table.d.ts +3 -0
  156. package/fe/packages/ui/react/components/table/table.js +6 -6
  157. package/fe/packages/ui/react/components/testPage/index.js +54 -11
  158. package/fe/packages/ui/react/index.css +4 -0
  159. package/model/index.d.ts +1 -1
  160. package/model/types/data/button.d.ts +2 -2
  161. package/model/types/index.d.ts +1 -1
  162. package/model/types/model.d.ts +19 -12
  163. package/package.json +15 -16
  164. package/types/app/typings.d.ts +1 -1
  165. package/types/config/config.default.d.ts +3 -2
  166. package/types/index.d.ts +1 -1
  167. package/types/packages/core/index.d.ts +3 -3
  168. package/types/packages/core/loader/extend.d.ts +1 -1
  169. package/types/packages/core/paths.d.ts +4 -7
  170. package/types/packages/core/types.d.ts +31 -6
  171. package/cjs/app/data/signKey.js +0 -1
  172. package/esm/app/data/signKey.js +0 -8
  173. package/fe/frontend/apps/testPage/index.js +0 -6
  174. package/fe/frontend/apps/testPage/testPage.entry.d.ts +0 -2
  175. package/types/app/data/signKey.d.ts +0 -1
  176. /package/fe/frontend/apps/{testPage → ui-components}/index.d.ts +0 -0
  177. /package/fe/frontend/apps/{testPage/testPage.entry.js → ui-components/ui-components.entry.js} +0 -0
@@ -4,6 +4,7 @@ type TableFixedCellProps = {
4
4
  fixed?: TableFixed;
5
5
  fixedOffset?: React.CSSProperties['left'];
6
6
  fixedShadow?: boolean;
7
+ fixedActive?: boolean;
7
8
  fixedZIndex?: React.CSSProperties['zIndex'];
8
9
  };
9
10
  declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & {
@@ -17,6 +18,8 @@ declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<
17
18
  declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
18
19
  declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & {
19
20
  isAction?: boolean;
21
+ showSeparator?: boolean;
22
+ hideSeparatorWhenFixedActive?: boolean;
20
23
  } & TableFixedCellProps & React.RefAttributes<HTMLTableCellElement>>;
21
24
  declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & {
22
25
  isAction?: boolean;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from '../../lib/utils';
3
3
  import * as React from 'react';
4
4
  const fixedShadowClassNames = {
@@ -40,7 +40,7 @@ const isFixedCellActive = (cell, fixed, containerRect) => {
40
40
  const updateFixedSideState = (row, fixed, containerRect, canShow) => {
41
41
  if (!canShow)
42
42
  return;
43
- const cells = Array.from(row.querySelectorAll(`[data-tc-table-fixed="${fixed}"][data-tc-table-fixed-shadow="true"]`));
43
+ const cells = Array.from(row.querySelectorAll(`[data-tc-table-fixed="${fixed}"][data-tc-table-fixed-active="true"]`));
44
44
  const activeCells = cells.filter((cell) => isFixedCellActive(cell, fixed, containerRect));
45
45
  if (activeCells.length === 0)
46
46
  return;
@@ -103,12 +103,12 @@ const TableFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("tf
103
103
  TableFooter.displayName = 'TableFooter';
104
104
  const TableRow = React.forwardRef(({ className, ...props }, ref) => (_jsx("tr", { ref: ref, className: cn('tc-ui-table-row border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className), ...props })));
105
105
  TableRow.displayName = 'TableRow';
106
- const TableHead = React.forwardRef(({ className, isAction, fixed, fixedOffset, fixedShadow = true, fixedZIndex = 10, style, ...props }, ref) => {
107
- return (_jsx("th", { ref: ref, "data-tc-table-fixed": fixed, "data-tc-table-fixed-shadow": fixed && fixedShadow ? 'true' : undefined, className: cn('tc-ui-table-head h-12 px-4 text-left align-middle text-xs font-normal', 'text-table-head-text', isAction && 'bg-table-header text-table-head-text w-[96px] text-center', fixed && 'data-[fixed-active=true]:bg-table-header', fixed && fixedShadow && fixedShadowClassNames[fixed], className), style: getFixedCellStyle({ fixed, fixedOffset, fixedZIndex, style }), ...props }));
106
+ const TableHead = React.forwardRef(({ className, children, isAction, showSeparator = true, hideSeparatorWhenFixedActive, fixed, fixedOffset, fixedShadow = true, fixedActive = true, fixedZIndex = 10, style, ...props }, ref) => {
107
+ return (_jsxs("th", { ref: ref, "data-tc-table-fixed": fixed, "data-tc-table-fixed-shadow": fixed && fixedShadow ? 'true' : undefined, "data-tc-table-fixed-active": fixed && fixedActive ? 'true' : undefined, "data-hide-separator-when-fixed-active": hideSeparatorWhenFixedActive ? 'true' : undefined, className: cn('tc-ui-table-head relative h-12 px-4 text-left align-middle text-xs font-normal', 'text-table-head-text', 'first:[&>.tc-ui-table-head-separator]:hidden', isAction && 'bg-table-header text-table-head-text w-[96px] text-center', fixed && 'data-[fixed-active=true]:bg-table-header', fixed && fixedShadow && fixedShadowClassNames[fixed], className), style: getFixedCellStyle({ fixed, fixedOffset, fixedZIndex, style }), ...props, children: [showSeparator && (_jsx("span", { "aria-hidden": "true", className: "tc-ui-table-head-separator pointer-events-none absolute left-0 top-1/2 h-5 w-px -translate-y-1/2 bg-[hsl(var(--table-head-text)/0.5)]" })), children] }));
108
108
  });
109
109
  TableHead.displayName = 'TableHead';
110
- const TableCell = React.forwardRef(({ className, isAction, fixed, fixedOffset, fixedShadow = true, fixedZIndex = 1, style, ...props }, ref) => {
111
- return (_jsx("td", { ref: ref, "data-tc-table-fixed": fixed, "data-tc-table-fixed-shadow": fixed && fixedShadow ? 'true' : undefined, className: cn('tc-ui-table-cell p-4 align-middle text-sm font-normal', 'text-table-cell-text', isAction && 'text-table-action-text w-[96px] text-center', isAction && !fixed && 'bg-background', fixed && 'data-[fixed-active=true]:bg-background', fixed && fixedShadow && fixedShadowClassNames[fixed], className), style: getFixedCellStyle({ fixed, fixedOffset, fixedZIndex, style }), ...props }));
110
+ const TableCell = React.forwardRef(({ className, isAction, fixed, fixedOffset, fixedShadow = true, fixedActive = true, fixedZIndex = 1, style, ...props }, ref) => {
111
+ return (_jsx("td", { ref: ref, "data-tc-table-fixed": fixed, "data-tc-table-fixed-shadow": fixed && fixedShadow ? 'true' : undefined, "data-tc-table-fixed-active": fixed && fixedActive ? 'true' : undefined, className: cn('tc-ui-table-cell p-4 align-middle text-sm font-normal', 'text-table-cell-text', isAction && 'text-table-action-text w-[96px] text-center', isAction && !fixed && 'bg-background', fixed && 'data-[fixed-active=true]:bg-background', fixed && fixedShadow && fixedShadowClassNames[fixed], className), style: getFixedCellStyle({ fixed, fixedOffset, fixedZIndex, style }), ...props }));
112
112
  });
113
113
  TableCell.displayName = 'TableCell';
114
114
  const TableCaption = React.forwardRef(({ className, ...props }, ref) => (_jsx("caption", { ref: ref, className: cn('tc-ui-table-caption mt-4 text-sm text-muted-foreground', className), ...props })));
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Checkbox, ConfirmDialog, DataTable, Drawer, Dropdown, Form, FormItem, ImageUpload, Input, InputNumber, Label, message, Modal, modal, Pagination, PreviewImage, SchemaForm, Search, Select, Skeleton, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableSearch, Textarea, Tooltip, TreeSelect, useForm, } from '../../components';
2
+ import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, ConfirmDialog, DataTable, Drawer, Dropdown, Form, FormItem, ImageUpload, Input, InputNumber, Label, Layout, Loading, message, Modal, modal, Notification, Pagination, PreviewImage, Radio, RadioGroup, SchemaForm, Search, Select, Skeleton, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableSearch, Tabs, Textarea, Tooltip, TreeSelect, useForm, } from '../../components';
3
3
  import React, { useEffect, useRef, useState } from 'react';
4
4
  import DateTestPage from '../Date/DateTestPage';
5
5
  import MenuTestPage from './MenuTestPage';
@@ -158,16 +158,16 @@ function DataTableDemo() {
158
158
  { key: 'name', title: '姓名' },
159
159
  { key: 'role', title: '角色1', fixed: 'left' },
160
160
  { key: 'status', title: '状态1', fixed: 'left' },
161
- { key: 'role', title: '角色2s' },
162
- { key: 'status', title: '状态2' },
163
- { key: 'role', title: '角色1' },
164
- { key: 'status', title: '状态1' },
165
- { key: 'role', title: '角色2s' },
166
- { key: 'status', title: '状态2' },
167
- { key: 'role', title: '角色1' },
168
- { key: 'status', title: '状态1' },
169
- { key: 'role', title: '角色2s' },
161
+ { key: 'role', title: '角色2' },
170
162
  { key: 'status', title: '状态2' },
163
+ { key: 'role', title: '角色3' },
164
+ { key: 'status', title: '状态3' },
165
+ { key: 'role', title: '角色4' },
166
+ { key: 'status', title: '状态4' },
167
+ { key: 'role', title: '角色5' },
168
+ { key: 'status', title: '状态5' },
169
+ { key: 'role', title: '角色6' },
170
+ { key: 'status', title: '状态6' },
171
171
  { key: 'role', title: '角色', fixed: 'right' },
172
172
  { key: 'status', title: '状态' },
173
173
  {
@@ -330,8 +330,51 @@ function ImageUploadDemo() {
330
330
  return parseInt(Math.random() * 10 + '') % 2 === 0;
331
331
  } }) }));
332
332
  }
333
+ // ─── Radio ───────────────────────────────────────────────────────────────────
334
+ function RadioDemo() {
335
+ const [selected, setSelected] = useState('a');
336
+ const [groupValue, setGroupValue] = useState('green');
337
+ const options = [
338
+ { label: '选项 A', value: 'a' },
339
+ { label: '选项 B', value: 'b' },
340
+ { label: '选项 C', value: 'c' },
341
+ ];
342
+ return (_jsxs(Section, { title: "Radio", children: [_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { className: "text-sm text-muted-foreground", children: ["\u53D7\u63A7: ", selected] }), options.map((opt) => (_jsx(Radio, { name: "demo-radio", label: opt.label, checked: selected === opt.value, onChange: () => setSelected(opt.value) }, opt.value)))] }), _jsxs("div", { className: "space-y-2 ml-8", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "\u975E\u53D7\u63A7\u9ED8\u8BA4\u9009\u4E2D" }), _jsx(Radio, { name: "demo-radio-2", label: "\u9ED8\u8BA4\u9009\u4E2D", defaultChecked: true }), _jsx(Radio, { name: "demo-radio-2", label: "\u7981\u7528\u72B6\u6001", disabled: true }), _jsx(Radio, { name: "demo-radio-2", label: "\u7981\u7528\u4E14\u9009\u4E2D", disabled: true, defaultChecked: true })] }), _jsxs("div", { className: "w-full ml-8 space-y-2", children: [_jsxs("p", { className: "text-sm text-muted-foreground", children: ["RadioGroup \u5782\u76F4\u5E03\u5C40: ", groupValue] }), _jsxs(RadioGroup, { name: "demo-group", value: groupValue, onChange: setGroupValue, children: [_jsx(Radio, { value: "default", label: "\u9ED8\u8BA4\u4E3B\u9898" }), _jsx(Radio, { value: "green", label: "\u7EFF\u8272\u4E3B\u9898" }), _jsx(Radio, { value: "gray", label: "\u7070\u8272\u4E3B\u9898" })] })] }), _jsxs("div", { className: "w-full ml-8 space-y-2", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "RadioGroup \u6C34\u5E73\u5E03\u5C40 (\u975E\u53D7\u63A7)" }), _jsxs(RadioGroup, { name: "demo-group-2", defaultValue: "b", direction: "horizontal", children: [_jsx(Radio, { value: "a", label: "\u9009\u9879 A" }), _jsx(Radio, { value: "b", label: "\u9009\u9879 B" }), _jsx(Radio, { value: "c", label: "\u9009\u9879 C" }), _jsx(Radio, { value: "d", label: "\u7981\u7528\u9009\u9879", disabled: true })] })] })] }));
343
+ }
344
+ // ─── Notification ────────────────────────────────────────────────────────────
345
+ function NotificationDemo() {
346
+ return (_jsx(Section, { title: "Notification", children: _jsxs("div", { className: "w-full space-y-3", children: [_jsx(Notification, { type: "info", title: "\u4FE1\u606F\u63D0\u793A", message: "\u8FD9\u662F\u4E00\u6761\u666E\u901A\u4FE1\u606F\u901A\u77E5\u3002" }), _jsx(Notification, { type: "success", title: "\u64CD\u4F5C\u6210\u529F", message: "\u6570\u636E\u5DF2\u6210\u529F\u4FDD\u5B58\u3002" }), _jsx(Notification, { type: "warning", title: "\u8B66\u544A", message: "\u8BF7\u6CE8\u610F\u68C0\u67E5\u914D\u7F6E\u9879\u662F\u5426\u6B63\u786E\u3002" }), _jsx(Notification, { type: "error", title: "\u9519\u8BEF", message: "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002", closable: false }), _jsx(Notification, { type: "info", title: "\u4E0D\u81EA\u52A8\u5173\u95ED", message: "\u6B64\u901A\u77E5\u9700\u8981\u624B\u52A8\u5173\u95ED\u3002", duration: 0 })] }) }));
347
+ }
348
+ // ─── Loading ─────────────────────────────────────────────────────────────────
349
+ function LoadingDemo() {
350
+ return (_jsx(Section, { title: "Loading", children: _jsxs("div", { className: "flex items-end gap-8", children: [_jsx(Loading, { size: "sm", text: "\u52A0\u8F7D\u4E2D..." }), _jsx(Loading, { size: "md", text: "\u52A0\u8F7D\u4E2D..." }), _jsx(Loading, { size: "lg" })] }) }));
351
+ }
352
+ // ─── Layout ──────────────────────────────────────────────────────────────────
353
+ function LayoutDemo() {
354
+ return (_jsx(Section, { title: "Layout", children: _jsx("div", { className: "w-full h-80 border rounded-lg overflow-hidden", children: _jsx(Layout, { header: _jsx("div", { className: "flex items-center h-12 px-4 text-sm font-medium", children: "Header" }), sidebar: _jsxs("div", { className: "p-4", children: [_jsx("p", { className: "text-sm font-medium mb-2", children: "Sidebar" }), _jsxs("div", { className: "space-y-1", children: [_jsx("div", { className: "text-sm text-muted-foreground p-1 rounded hover:bg-muted cursor-pointer", children: "\u83DC\u5355\u9879 1" }), _jsx("div", { className: "text-sm text-muted-foreground p-1 rounded hover:bg-muted cursor-pointer", children: "\u83DC\u5355\u9879 2" }), _jsx("div", { className: "text-sm text-muted-foreground p-1 rounded hover:bg-muted cursor-pointer", children: "\u83DC\u5355\u9879 3" })] })] }), footer: _jsx("div", { className: "flex items-center h-10 px-4 text-xs text-muted-foreground", children: "Footer" }), children: _jsxs("div", { className: "p-4", children: [_jsx("p", { className: "text-sm font-medium mb-1", children: "Content" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "\u8FD9\u662F\u4E3B\u8981\u5185\u5BB9\u533A\u57DF\u3002" })] }) }) }) }));
355
+ }
356
+ // ─── Card ────────────────────────────────────────────────────────────────────
357
+ function CardDemo() {
358
+ return (_jsxs(Section, { title: "Card", children: [_jsx("div", { className: "w-72", children: _jsx(Card, { header: _jsx("span", { className: "text-sm font-medium", children: "\u5361\u7247\u6807\u9898" }), footer: _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { size: "sm", children: "\u53D6\u6D88" }), _jsx(Button, { variant: "primary", size: "sm", children: "\u786E\u8BA4" })] }), children: _jsx("p", { className: "text-sm text-muted-foreground", children: "\u8FD9\u662F\u4E00\u5F20\u57FA\u7840\u5361\u7247\uFF0C\u5305\u542B header\u3001body \u548C footer \u4E09\u4E2A\u533A\u57DF\u3002" }) }) }), _jsx("div", { className: "w-72", children: _jsx(Card, { className: "border-theme", children: _jsx("p", { className: "text-sm text-muted-foreground", children: "\u65E0 header/footer \u7684\u7B80\u6D01\u5361\u7247\u3002" }) }) })] }));
359
+ }
360
+ // ─── Tabs ────────────────────────────────────────────────────────────────────
361
+ function TabsDemo() {
362
+ const [activeTab, setActiveTab] = useState('tab1');
363
+ const items = [
364
+ { key: 'tab1', label: '标签页 1' },
365
+ { key: 'tab2', label: '标签页 2' },
366
+ { key: 'tab3', label: '标签页 3' },
367
+ { key: 'tab4', label: '禁用标签', disabled: true },
368
+ ];
369
+ const tabContents = {
370
+ tab1: '这是标签页 1 的内容区域。',
371
+ tab2: '这是标签页 2 的内容区域。',
372
+ tab3: '这是标签页 3 的内容区域。',
373
+ };
374
+ return (_jsx(Section, { title: "Tabs", children: _jsxs("div", { className: "w-full", children: [_jsx(Tabs, { items: items, activeKey: activeTab, onChange: setActiveTab }), _jsx("div", { className: "p-4 border border-t-0 rounded-b-lg bg-background", children: _jsx("p", { className: "text-sm text-muted-foreground", children: tabContents[activeTab] }) })] }) }));
375
+ }
333
376
  // ─── Main ─────────────────────────────────────────────────────────────────────
334
377
  const TestPage = () => {
335
- return (_jsxs("div", { className: "p-6 max-w-5xl mx-auto", children: [_jsx("h1", { className: "text-2xl font-bold mb-6", children: "\u7EC4\u4EF6\u5C55\u793A" }), _jsx(ThemeSwitcher, {}), _jsx(ButtonDemo, {}), _jsx(InputDemo, {}), _jsx(InputNumberDemo, {}), _jsx(TextareaDemo, {}), _jsx(SelectDemo, {}), _jsx(CheckboxDemo, {}), _jsx(SwitchDemo, {}), _jsx(TooltipDemo, {}), _jsx(DropdownDemo, {}), _jsx(MessageDemo, {}), _jsx(ModalDemo, {}), _jsx(DrawerDemo, {}), _jsx(ConfirmDialogDemo, {}), _jsx(PaginationDemo, {}), _jsx(TableDemo, {}), _jsx(DataTableDemo, {}), _jsx(SearchDemo, {}), _jsx(BreadcrumbDemo, {}), _jsx(LabelDemo, {}), _jsx(FormDemo, {}), _jsx(SchemaFormDemo, {}), _jsx(TableSearchDemo, {}), _jsx(SkeletonDemo, {}), _jsx(TreeSelectDemo, {}), _jsx(DateTestPage, {}), _jsx(PreviewImageDemo, {}), _jsx(ImageUploadDemo, {}), _jsx(MenuTestPage, {})] }));
378
+ return (_jsxs("div", { className: "p-6 max-w-5xl mx-auto", children: [_jsx("h1", { className: "text-2xl font-bold mb-6", children: "\u7EC4\u4EF6\u5C55\u793A" }), _jsx(ThemeSwitcher, {}), _jsx(ButtonDemo, {}), _jsx(InputDemo, {}), _jsx(InputNumberDemo, {}), _jsx(TextareaDemo, {}), _jsx(SelectDemo, {}), _jsx(CheckboxDemo, {}), _jsx(RadioDemo, {}), _jsx(SwitchDemo, {}), _jsx(TooltipDemo, {}), _jsx(DropdownDemo, {}), _jsx(MessageDemo, {}), _jsx(NotificationDemo, {}), _jsx(LoadingDemo, {}), _jsx(ModalDemo, {}), _jsx(DrawerDemo, {}), _jsx(ConfirmDialogDemo, {}), _jsx(PaginationDemo, {}), _jsx(TableDemo, {}), _jsx(DataTableDemo, {}), _jsx(SearchDemo, {}), _jsx(BreadcrumbDemo, {}), _jsx(LabelDemo, {}), _jsx(LayoutDemo, {}), _jsx(CardDemo, {}), _jsx(TabsDemo, {}), _jsx(FormDemo, {}), _jsx(SchemaFormDemo, {}), _jsx(TableSearchDemo, {}), _jsx(SkeletonDemo, {}), _jsx(TreeSelectDemo, {}), _jsx(DateTestPage, {}), _jsx(PreviewImageDemo, {}), _jsx(ImageUploadDemo, {}), _jsx(MenuTestPage, {})] }));
336
379
  };
337
380
  export default TestPage;
@@ -7,6 +7,10 @@
7
7
  /* 暗色模式变体 */
8
8
  @custom-variant dark (&:where(.dark, .dark *));
9
9
 
10
+ .tc-ui-table-head[data-fixed-active='true'][data-hide-separator-when-fixed-active='true'] > .tc-ui-table-head-separator {
11
+ display: none;
12
+ }
13
+
10
14
  /* 主题配置 */
11
15
  @theme {
12
16
  /* 圆角 */
package/model/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export type { ModelDataType } from './types';
1
+ export type { MBMenuType, ModelDataType, ModelMode, ModelModeMap } from './types';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -6,7 +6,7 @@ type ButtonTemplates = {
6
6
  */
7
7
  label?: string;
8
8
  } & ButtonProps;
9
- type ParamsValueData = 'schema::tableKey' | string | number;
9
+ type ParamsValueData = '$schema::tableKey' | string | number;
10
10
  type RemoveBtn = {
11
11
  eventKey: 'remove';
12
12
  /**
@@ -15,7 +15,7 @@ type RemoveBtn = {
15
15
  eventOption: {
16
16
  params: {
17
17
  /**
18
- * @example user_id: 'schema::tableKey' | '123' | 123
18
+ * @example user_id: '$schema::tableKey' | '123' | 123
19
19
  */
20
20
  [paramKey: string]: ParamsValueData;
21
21
  };
@@ -1,3 +1,3 @@
1
- export type { ModelDataType } from './model';
1
+ export type { MBMenuType, ModelDataType, ModelMode, ModelModeMap } from './model';
2
2
  export type { BuiltInCallComConfigMap, BuiltInCallComNames, BuiltInCallComOptionMap, CallComNamespace, ComponentConfig, ComponentFieldOption, ComponentNames, ComponentsOption, } from './data/component';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,33 +1,40 @@
1
- import { TopMenuType, LeftMenuType } from "./menuType";
1
+ import { LeftMenuType, TopMenuType } from './menuType';
2
2
  type MTopMenuType = {
3
3
  /**
4
4
  * 默认为 left
5
5
  */
6
- menuLayout: "top";
6
+ menuLayout: 'top';
7
7
  menu: TopMenuType[];
8
8
  };
9
9
  type MLeftMenuType = {
10
10
  /**
11
11
  * 默认为 left
12
12
  */
13
- menuLayout?: "left";
13
+ menuLayout?: 'left';
14
14
  menu: LeftMenuType[];
15
15
  };
16
- export type ModeMenuType = MTopMenuType | MLeftMenuType;
17
- export type ModelDataType = {
16
+ export type MBMenuType = MTopMenuType | MLeftMenuType;
17
+ export interface ModelModeMap {
18
+ MB: MBMenuType;
19
+ }
20
+ export type ModelMode = Extract<keyof ModelModeMap, string>;
21
+ type ModelBaseDataType<M extends ModelMode> = {
18
22
  /**
19
23
  * - 使用哪一块的模型数据 内置 MB
20
24
  * - MB = 管理后台
21
25
  */
22
- mode: "MB";
26
+ mode: M;
23
27
  key?: string;
24
- name: string;
25
- desc: string;
26
- icon: string;
28
+ name?: string;
29
+ desc?: string;
30
+ icon?: string;
27
31
  /**
28
- * 首页(项目配置)
32
+ * 首页(项目配置) 不配置 会自动找寻第一个可用路由地址
29
33
  */
30
- homePage: string;
31
- } & ModeMenuType;
34
+ homePage?: string;
35
+ };
36
+ export type ModelDataType<M extends ModelMode = ModelMode> = {
37
+ [K in M]: ModelBaseDataType<K> & ModelModeMap[K];
38
+ }[M];
32
39
  export {};
33
40
  //# sourceMappingURL=model.d.ts.map
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@_tc/template-core",
3
- "version": "0.0.3",
4
- "description": "A TypeScript Koa framework template - Monorepo root",
5
- "main": "./index.js",
6
- "types": "./dist/types/index.d.ts",
3
+ "version": "0.1.1",
4
+ "description": "A full-stack TypeScript admin framework powered by Koa, React, and Vite - monorepo root",
5
+ "types": "./types/index.d.ts",
7
6
  "exports": {
8
7
  ".": {
9
8
  "import": "./esm/index.js",
@@ -46,18 +45,18 @@
46
45
  }
47
46
  },
48
47
  "dependencies": {
49
- "@tailwindcss/vite": "^4.2.4",
50
- "ajv": "^8.18.0",
51
- "chokidar": "^4.0.3",
52
- "glob": "^10.3.10",
53
- "immer": "^11.1.7",
54
- "koa-bodyparser": "^4.4.1",
55
- "koa-compress": "^5.2.1",
56
- "koa-static": "^5.0.0",
57
- "log4js": "^6.9.1",
58
- "md5": "^2.3.0",
59
- "nunjucks": "^3.2.4",
60
- "tailwind": "^4.0.0"
48
+ "@tailwindcss/vite": "4.2.4",
49
+ "ajv": "8.18.0",
50
+ "chokidar": "4.0.3",
51
+ "glob": "10.5.0",
52
+ "immer": "11.1.7",
53
+ "koa-bodyparser": "4.4.1",
54
+ "koa-compress": "5.2.1",
55
+ "koa-static": "5.0.0",
56
+ "log4js": "6.9.1",
57
+ "md5": "2.3.0",
58
+ "nunjucks": "3.2.4",
59
+ "tailwindcss": "4.2.4"
61
60
  },
62
61
  "peerDependencies": {
63
62
  "@types/node": ">=18.0.0",
@@ -35,7 +35,7 @@ declare module '../packages/core/index' {
35
35
  apiParamsVerify: import('koa').Middleware;
36
36
  projectHandler: import('koa').Middleware;
37
37
  }
38
- interface AppConfigAugmented extends DefaultAppConfig {
38
+ interface AppConfigAugmented extends Partial<DefaultAppConfig> {
39
39
  }
40
40
  }
41
41
  }
@@ -3,12 +3,13 @@ export interface DefaultAppConfig {
3
3
  port?: number;
4
4
  host?: string;
5
5
  env?: string;
6
+ signKey: string;
6
7
  apiSignVerify?: {
7
8
  whiteList?: string[];
8
9
  };
9
10
  viewsPath?: string;
10
- nunjucks?: import("nunjucks").ConfigureOptions;
11
- notFoundRedirectCount: number;
11
+ nunjucks?: import('nunjucks').ConfigureOptions;
12
+ notFoundRedirectCount?: number;
12
13
  }
13
14
  declare const _default: DefaultAppConfig;
14
15
  export default _default;
package/types/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { MOmit } from "./typings/type";
5
5
  export type { FrameworkAugment, KoaApp } from "./packages/core/index";
6
6
  export type { ControllerFN, Ctx, ServiceFN } from "./app/type";
7
7
  export type { Router };
8
- export declare const serverStart: (options?: MOmit<StartOptions, "frameBaseDir">) => import("./packages/core/index").KoaApp;
8
+ export declare const serverStart: (options?: MOmit<StartOptions, "frameBaseDir">) => Promise<import("./packages/core/index").KoaApp>;
9
9
  export declare const baseFn: {
10
10
  baseControllerFn: (app: import("./app/type").KoaApp) => {
11
11
  new (): {
@@ -1,6 +1,6 @@
1
- import "./types";
2
1
  import "../../app/typings";
2
+ import "./types";
3
3
  import type { KoaApp, StartOptions } from "./types";
4
4
  export declare const loaderModel: (app: KoaApp) => import("./loader/model").ModelConfig;
5
- export type { AppConfig, AppOptions, StartOptions, KoaMiddleware, ProcessingFileCallbackFN, IService, IController, IExtends, IMiddlewares, KoaApp, KoaRouter, KoaAppExtensions, FrameworkAugment, } from "./types";
6
- export declare const start: (options?: StartOptions) => KoaApp;
5
+ export type { AppConfig, AppOptions, FrameworkAugment, IController, IExtends, IMiddlewares, IService, KoaApp, KoaAppExtensions, KoaMiddleware, KoaRouter, ProcessingFileCallbackFN, StartOptions, } from "./types";
6
+ export declare const start: (options?: StartOptions) => Promise<KoaApp>;
@@ -4,5 +4,5 @@ import type { KoaApp } from "../types";
4
4
  *
5
5
  * 加载 xx/app/extend 文件,可通过 'app.extends.${文件}' 访问
6
6
  */
7
- declare const _default: (app: KoaApp) => void;
7
+ declare const _default: (app: KoaApp) => Promise<void>;
8
8
  export default _default;
@@ -1,11 +1,8 @@
1
- export type AppPathType = "frame" | "business";
1
+ import type { KoaApp } from "app/typings";
2
+ export type AppPathType = 'frame' | 'business';
2
3
  export interface AppPathInfo {
3
4
  type: AppPathType;
4
5
  path: string;
5
6
  }
6
- export declare function getAppPath(app: {
7
- paths?: AppPathInfo[];
8
- }, type: AppPathType): string | undefined;
9
- export declare function getAppPaths(app: {
10
- paths?: AppPathInfo[];
11
- }): string[];
7
+ export declare function getAppPath(app: KoaApp, type: AppPathType): string | undefined;
8
+ export declare function getAppPaths(app: KoaApp): string[];
@@ -29,13 +29,13 @@ export declare namespace FrameworkAugment {
29
29
  export type ICTX = Parameters<Router.IMiddleware<any, {}>>[0];
30
30
  export interface KoaAppExtensions {
31
31
  /**
32
- * 框架路径 .root/app
32
+ * 框架路径 .root
33
33
  */
34
34
  frameBaseDir: string;
35
35
  /**
36
- * 框架跟路径 .root
36
+ * 框架跟路径 .root/app
37
37
  */
38
- framePath: string;
38
+ frameAppPath: string;
39
39
  /**
40
40
  * 使用方根路径 .root
41
41
  */
@@ -43,7 +43,10 @@ export interface KoaAppExtensions {
43
43
  /**
44
44
  * 使用方 .root/app
45
45
  */
46
- businessPath: string;
46
+ businessAppPath: string;
47
+ /**
48
+ * 存着 框架 以及业务方的 app路径
49
+ */
47
50
  paths: AppPathInfo[];
48
51
  /**
49
52
  * 服务生命周期
@@ -86,12 +89,34 @@ export interface AppConfig extends AppConfigBase {
86
89
  [key: string]: unknown;
87
90
  }
88
91
  export interface StartOptions {
92
+ /**
93
+ * 写入 html.title
94
+ */
89
95
  name?: string;
96
+ /**
97
+ * - 配置时,当找不到模板文件时 重定向的路径
98
+ * @default '/'
99
+ */
90
100
  homePage?: string;
91
101
  frameBaseDir?: string;
102
+ /**
103
+ * 如果不设置 默认为 运行目录
104
+ * @default process.cwd()
105
+ */
92
106
  baseDir?: string;
93
107
  /**
94
- * 页面访问前缀 默认为 /
108
+ * - 可配置的 资源路径(不要输入相对路径)
109
+ * - 主要是配合 buildFE 修改了输出路径时使用
110
+ */
111
+ additionalPublicPaths?: string | string[];
112
+ /**
113
+ * - 页面访问前缀 默认为 /
114
+ * @default '/'
115
+ * @example
116
+ * - 配置 '/test'
117
+ * - 所有前端页面的路径以 /test开头
118
+ * - 如: '/test/dash'
119
+ *
95
120
  */
96
121
  pageBasePage?: string;
97
122
  }
@@ -108,6 +133,6 @@ export type KoaRouter = Router & {
108
133
  level?: number;
109
134
  };
110
135
  export type KoaMiddleware = Koa.Middleware;
111
- export type { EnvType, EnvKeys } from "./env";
136
+ export type { EnvKeys, EnvType } from "./env";
112
137
  /** 文件处理回调函数 */
113
138
  export type ProcessingFileCallbackFN = <T extends Record<string, unknown>>(fileName: string, filePath: string, isDir: boolean, tempData: T) => T | undefined;
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../_virtual/_rolldown/runtime.js`);var t=e.__exportAll({signKey:()=>n}),n,r=e.__esmMin((()=>{n=`sakjdfnkjwjfnfkjkjldljksndf`}));r(),Object.defineProperty(exports,`init_signKey`,{enumerable:!0,get:function(){return r}}),exports.signKey=n,Object.defineProperty(exports,`signKey_exports`,{enumerable:!0,get:function(){return t}});
@@ -1,8 +0,0 @@
1
- import { __esmMin as e, __exportAll as t } from "../../_virtual/_rolldown/runtime.js";
2
- //#region app/data/signKey.ts
3
- var n = /* @__PURE__ */ t({ signKey: () => r }), r, i = e((() => {
4
- r = "sakjdfnkjwjfnfkjkjldljksndf";
5
- }));
6
- //#endregion
7
- i();
8
- export { i as init_signKey, r as signKey, n as signKey_exports };
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button } from "../../../packages/ui/react/components";
3
- import TestPage from "../../../packages/ui/react/components/testPage";
4
- export default () => {
5
- return (_jsxs("div", { children: [_jsx("h1", { children: "test page" }), _jsx(Button, { children: "click me" }), _jsx(TestPage, {})] }));
6
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=testPage.entry.d.ts.map
@@ -1 +0,0 @@
1
- export declare const signKey = "sakjdfnkjwjfnfkjkjldljksndf";