@_tc/template-core 0.0.2 → 0.1.0

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/main.css +1 -1
  118. package/fe/frontend/src/typing/window.d.ts +2 -0
  119. package/fe/model/types/data/button.d.ts +2 -2
  120. package/fe/model/types/data/button.js +1 -1
  121. package/fe/model/types/model.d.ts +19 -12
  122. package/fe/packages/ui/react/components/Card/Card.d.ts +10 -0
  123. package/fe/packages/ui/react/components/Card/Card.js +8 -0
  124. package/fe/packages/ui/react/components/Card/index.d.ts +2 -0
  125. package/fe/packages/ui/react/components/Card/index.js +1 -0
  126. package/fe/packages/ui/react/components/DataTable/index.js +7 -3
  127. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +3 -3
  128. package/fe/packages/ui/react/components/Layout/Layout.d.ts +11 -0
  129. package/fe/packages/ui/react/components/Layout/Layout.js +8 -0
  130. package/fe/packages/ui/react/components/Layout/index.d.ts +2 -0
  131. package/fe/packages/ui/react/components/Layout/index.js +1 -0
  132. package/fe/packages/ui/react/components/Loading/Loading.d.ts +9 -0
  133. package/fe/packages/ui/react/components/Loading/Loading.js +13 -0
  134. package/fe/packages/ui/react/components/Loading/index.d.ts +2 -0
  135. package/fe/packages/ui/react/components/Loading/index.js +1 -0
  136. package/fe/packages/ui/react/components/Menu/Menu.js +3 -2
  137. package/fe/packages/ui/react/components/Notification/Notification.d.ts +14 -0
  138. package/fe/packages/ui/react/components/Notification/Notification.js +29 -0
  139. package/fe/packages/ui/react/components/Notification/index.d.ts +2 -0
  140. package/fe/packages/ui/react/components/Notification/index.js +1 -0
  141. package/fe/packages/ui/react/components/Radio/Radio.d.ts +9 -0
  142. package/fe/packages/ui/react/components/Radio/Radio.js +20 -0
  143. package/fe/packages/ui/react/components/Radio/RadioGroup.d.ts +19 -0
  144. package/fe/packages/ui/react/components/Radio/RadioGroup.js +21 -0
  145. package/fe/packages/ui/react/components/Radio/index.d.ts +3 -0
  146. package/fe/packages/ui/react/components/Radio/index.js +2 -0
  147. package/fe/packages/ui/react/components/Search/Search.d.ts +1 -1
  148. package/fe/packages/ui/react/components/Search/Search.js +1 -5
  149. package/fe/packages/ui/react/components/Tabs/Tabs.d.ts +16 -0
  150. package/fe/packages/ui/react/components/Tabs/Tabs.js +19 -0
  151. package/fe/packages/ui/react/components/Tabs/index.d.ts +2 -0
  152. package/fe/packages/ui/react/components/Tabs/index.js +1 -0
  153. package/fe/packages/ui/react/components/hooks/useInputController.js +0 -1
  154. package/fe/packages/ui/react/components/index.d.ts +6 -0
  155. package/fe/packages/ui/react/components/index.js +6 -0
  156. package/fe/packages/ui/react/components/table/table.d.ts +3 -0
  157. package/fe/packages/ui/react/components/table/table.js +6 -6
  158. package/fe/packages/ui/react/components/testPage/index.js +54 -11
  159. package/fe/packages/ui/react/index.css +4 -0
  160. package/model/index.d.ts +1 -1
  161. package/model/types/data/button.d.ts +2 -2
  162. package/model/types/index.d.ts +1 -1
  163. package/model/types/model.d.ts +19 -12
  164. package/package.json +15 -16
  165. package/types/config/config.default.d.ts +2 -1
  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
@@ -1,12 +1,57 @@
1
+ import { getText } from '../../../common/language';
2
+ import { frontendLangKeys } from '../../../language';
1
3
  import { Ajv } from 'ajv';
2
4
  // 初始化 AJV (全局复用)
3
5
  export const ajvInstance = new Ajv({ allErrors: true, verbose: true, strict: false });
6
+ const isPlainObject = (value) => Object.prototype.toString.call(value) === '[object Object]';
7
+ const isEmptyValue = (value) => value === undefined ||
8
+ value === null ||
9
+ value === '' ||
10
+ (Array.isArray(value) && value.length === 0) ||
11
+ (isPlainObject(value) && Object.keys(value).length === 0);
12
+ const getErrorPath = (error) => {
13
+ const path = error.instancePath.replace(/^\//, '');
14
+ if (path)
15
+ return path;
16
+ const missingProperty = error.params.missingProperty;
17
+ return missingProperty || getText(frontendLangKeys.validatorValue);
18
+ };
19
+ const getTypeText = (type) => {
20
+ const types = Array.isArray(type) ? type : [type];
21
+ return types
22
+ .filter((item) => typeof item === 'string')
23
+ .map((item) => {
24
+ switch (item) {
25
+ case 'string':
26
+ return getText(frontendLangKeys.validatorTypeString);
27
+ case 'number':
28
+ return getText(frontendLangKeys.validatorTypeNumber);
29
+ case 'integer':
30
+ return getText(frontendLangKeys.validatorTypeInteger);
31
+ case 'boolean':
32
+ return getText(frontendLangKeys.validatorTypeBoolean);
33
+ case 'array':
34
+ return getText(frontendLangKeys.validatorTypeArray);
35
+ case 'object':
36
+ return getText(frontendLangKeys.validatorTypeObject);
37
+ case 'null':
38
+ return getText(frontendLangKeys.validatorTypeNull);
39
+ default:
40
+ return item;
41
+ }
42
+ })
43
+ .join(' / ');
44
+ };
4
45
  /**
5
46
  * 创建验证器
6
47
  */
7
- export function createAjvValidator(schema) {
48
+ export function createAjvValidator(schema, options = {}) {
8
49
  const validate = ajvInstance.compile(schema);
9
50
  return (rule, value, callback) => {
51
+ if (!options.required && isEmptyValue(value)) {
52
+ callback();
53
+ return;
54
+ }
10
55
  const valid = validate(value);
11
56
  if (valid) {
12
57
  callback();
@@ -19,18 +64,108 @@ export function createAjvValidator(schema) {
19
64
  }
20
65
  // 格式化错误信息
21
66
  function formatError(error) {
22
- const path = error.instancePath.replace(/^\//, '') || 'value';
67
+ const path = getErrorPath(error);
23
68
  switch (error.keyword) {
24
69
  case 'required':
25
- return `缺少必填字段: ${error.params.missingProperty}`;
70
+ return getText(frontendLangKeys.validatorRequired, {
71
+ field: error.params.missingProperty,
72
+ });
26
73
  case 'type':
27
- return `${path} 类型错误,期望 ${error.params.type}`;
74
+ return getText(frontendLangKeys.validatorType, {
75
+ path,
76
+ type: getTypeText(error.params.type),
77
+ });
28
78
  case 'format':
29
- return `${path} 格式不正确`;
79
+ return getText(frontendLangKeys.validatorFormat, {
80
+ path,
81
+ format: String(error.params.format ?? ''),
82
+ });
30
83
  case 'minimum':
84
+ return getText(frontendLangKeys.validatorMinimum, {
85
+ path,
86
+ limit: error.params.limit,
87
+ });
31
88
  case 'maximum':
32
- return `${path} 超出允许范围`;
89
+ return getText(frontendLangKeys.validatorMaximum, {
90
+ path,
91
+ limit: error.params.limit,
92
+ });
93
+ case 'exclusiveMinimum':
94
+ return getText(frontendLangKeys.validatorExclusiveMinimum, {
95
+ path,
96
+ limit: error.params.limit,
97
+ });
98
+ case 'exclusiveMaximum':
99
+ return getText(frontendLangKeys.validatorExclusiveMaximum, {
100
+ path,
101
+ limit: error.params.limit,
102
+ });
103
+ case 'multipleOf':
104
+ return getText(frontendLangKeys.validatorMultipleOf, {
105
+ path,
106
+ multipleOf: error.params.multipleOf,
107
+ });
108
+ case 'minLength':
109
+ return getText(frontendLangKeys.validatorMinLength, {
110
+ path,
111
+ limit: error.params.limit,
112
+ });
113
+ case 'maxLength':
114
+ return getText(frontendLangKeys.validatorMaxLength, {
115
+ path,
116
+ limit: error.params.limit,
117
+ });
118
+ case 'pattern':
119
+ return getText(frontendLangKeys.validatorPattern, { path });
120
+ case 'minItems':
121
+ return getText(frontendLangKeys.validatorMinItems, {
122
+ path,
123
+ limit: error.params.limit,
124
+ });
125
+ case 'maxItems':
126
+ return getText(frontendLangKeys.validatorMaxItems, {
127
+ path,
128
+ limit: error.params.limit,
129
+ });
130
+ case 'uniqueItems':
131
+ return getText(frontendLangKeys.validatorUniqueItems, { path });
132
+ case 'minProperties':
133
+ return getText(frontendLangKeys.validatorMinProperties, {
134
+ path,
135
+ limit: error.params.limit,
136
+ });
137
+ case 'maxProperties':
138
+ return getText(frontendLangKeys.validatorMaxProperties, {
139
+ path,
140
+ limit: error.params.limit,
141
+ });
142
+ case 'additionalProperties':
143
+ return getText(frontendLangKeys.validatorAdditionalProperties, {
144
+ path,
145
+ property: error.params.additionalProperty,
146
+ });
147
+ case 'enum':
148
+ return getText(frontendLangKeys.validatorEnum, { path });
149
+ case 'const':
150
+ return getText(frontendLangKeys.validatorConst, { path });
151
+ case 'oneOf':
152
+ return getText(frontendLangKeys.validatorOneOf, { path });
153
+ case 'anyOf':
154
+ return getText(frontendLangKeys.validatorAnyOf, { path });
155
+ case 'allOf':
156
+ return getText(frontendLangKeys.validatorAllOf, { path });
157
+ case 'not':
158
+ return getText(frontendLangKeys.validatorNot, { path });
159
+ case 'propertyNames':
160
+ return getText(frontendLangKeys.validatorPropertyNames, { path });
161
+ case 'dependencies':
162
+ case 'dependentRequired':
163
+ return getText(frontendLangKeys.validatorDependencies, { path });
164
+ case 'contains':
165
+ return getText(frontendLangKeys.validatorContains, { path });
166
+ case 'if':
167
+ return getText(frontendLangKeys.validatorIf, { path });
33
168
  default:
34
- return `${path} ${error.message}`;
169
+ return getText(frontendLangKeys.validatorFallback, { path });
35
170
  }
36
171
  }
@@ -9,7 +9,8 @@ const SidebarSlotPage = () => {
9
9
  const params = useParams();
10
10
  // top left 从当前路由中获取到 sidebarConfig中的数据
11
11
  const { menu: parentMenuInfo } = useCurrentMenuData();
12
- const prefixPath = useMemo(() => `/${params[QK.k]}`, [params[QK.k]]);
12
+ const menuKey = params[QK.k];
13
+ const prefixPath = useMemo(() => `/${menuKey}`, [menuKey]);
13
14
  const menuItem = generateMenuItemData(parentMenuInfo?.sidebarConfig?.menu ?? []);
14
15
  return (_jsx(SidebarSlotContainer, { menuItems: menuItem, rawMenuData: parentMenuInfo?.sidebarConfig.menu, prefixPath: prefixPath }));
15
16
  };
@@ -11,7 +11,7 @@ const SidebarSlotPageTmp = () => {
11
11
  return [generateMenuItemData(projInfo.menu), projInfo.menu];
12
12
  }
13
13
  return [[], []];
14
- }, []);
14
+ }, [projInfo]);
15
15
  return (_jsx(SidebarSlotContainer, { prefixPath: '/' + leftSidebarBasePath, rawMenuData: rawMenuData, menuItems: menuItems }));
16
16
  };
17
17
  export default SidebarSlotPageTmp;
@@ -3,6 +3,7 @@ import { memo, useMemo } from 'react';
3
3
  import { logPageNotFound } from '../../common/logFn';
4
4
  import useCurrentMenuData from '../../hooks/useCurrentMenuData';
5
5
  import Iframe from '../Iframe';
6
+ import NotFoundPage from '../NotFoundPage';
6
7
  import Schema from '../SchemaPage';
7
8
  const SlotPage = memo(() => {
8
9
  const { menu } = useCurrentMenuData(true);
@@ -17,7 +18,7 @@ const SlotPage = memo(() => {
17
18
  // 运行到这 说明异常路径
18
19
  // 自定义路径会在进入这之前被拦截;
19
20
  logPageNotFound();
20
- return _jsx("div", { children: "404" });
21
+ return _jsx(NotFoundPage, {});
21
22
  }
22
23
  }, [menu?.moduleType]);
23
24
  return RenderDom;
@@ -22,7 +22,7 @@ const useCurrentMenuData = (useSibe = false) => {
22
22
  return sMenu;
23
23
  }
24
24
  return menu;
25
- }, [projectInfo?.menu, params]);
25
+ }, [projectInfo?.menu, params, useSibe]);
26
26
  return { menu: menu };
27
27
  };
28
28
  export default useCurrentMenuData;
@@ -13,4 +13,8 @@ export { merge } from './defaultPages/SchemaPage/utils/permissions';
13
13
  * 导出依赖的 共享数据
14
14
  */
15
15
  export * from './exportStore';
16
+ /**
17
+ * 导出多语言相关
18
+ */
19
+ export { i18n, i18nStore } from '../../packages/ui/react/i18n';
16
20
  //# sourceMappingURL=index.d.ts.map
@@ -11,3 +11,7 @@ export { merge } from './defaultPages/SchemaPage/utils/permissions';
11
11
  * 导出依赖的 共享数据
12
12
  */
13
13
  export * from './exportStore';
14
+ /**
15
+ * 导出多语言相关
16
+ */
17
+ export { i18n, i18nStore } from '../../packages/ui/react/i18n';
@@ -0,0 +1,76 @@
1
+ export declare const frontendEnUSResources: {
2
+ readonly frontend: {
3
+ readonly app: {
4
+ readonly title: "Template Core";
5
+ readonly uiComponentsTitle: "UI Components";
6
+ readonly uiComponentsButton: "Click me";
7
+ };
8
+ readonly common: {
9
+ readonly yes: "Yes";
10
+ readonly no: "No";
11
+ readonly noData: "No data";
12
+ readonly loading: "Loading";
13
+ readonly operation: "Actions";
14
+ };
15
+ readonly feedback: {
16
+ readonly confirmDelete: "Confirm delete?";
17
+ readonly requiredInput: "Please enter {label}";
18
+ readonly unknownError: "Unknown error";
19
+ readonly requestTimedOut: "Request timed out";
20
+ readonly networkError: "Network error";
21
+ };
22
+ readonly notFound: {
23
+ readonly title: "Page not found";
24
+ readonly description: "The current path is invalid, or the page is not registered in the router.";
25
+ };
26
+ readonly validator: {
27
+ readonly value: "value";
28
+ readonly required: "Missing required field: {field}";
29
+ readonly type: "{path} type error, expected {type}";
30
+ readonly typeString: "string";
31
+ readonly typeNumber: "number";
32
+ readonly typeInteger: "integer";
33
+ readonly typeBoolean: "boolean";
34
+ readonly typeArray: "array";
35
+ readonly typeObject: "object";
36
+ readonly typeNull: "null";
37
+ readonly format: "{path} format is invalid";
38
+ readonly minimum: "{path} cannot be less than {limit}";
39
+ readonly maximum: "{path} cannot be greater than {limit}";
40
+ readonly exclusiveMinimum: "{path} must be greater than {limit}";
41
+ readonly exclusiveMaximum: "{path} must be less than {limit}";
42
+ readonly multipleOf: "{path} must be a multiple of {multipleOf}";
43
+ readonly minLength: "{path} must be at least {limit} characters";
44
+ readonly maxLength: "{path} must be at most {limit} characters";
45
+ readonly pattern: "{path} format does not match the requirement";
46
+ readonly minItems: "{path} must contain at least {limit} items";
47
+ readonly maxItems: "{path} must contain at most {limit} items";
48
+ readonly uniqueItems: "{path} must not contain duplicate items";
49
+ readonly minProperties: "{path} must contain at least {limit} properties";
50
+ readonly maxProperties: "{path} must contain at most {limit} properties";
51
+ readonly additionalProperties: "{path} contains disallowed property {property}";
52
+ readonly enum: "{path} is not in the allowed options";
53
+ readonly const: "{path} must equal the specified value";
54
+ readonly oneOf: "{path} must match exactly one rule";
55
+ readonly anyOf: "{path} must match at least one rule";
56
+ readonly allOf: "{path} does not satisfy all rules";
57
+ readonly not: "{path} must not match this rule";
58
+ readonly propertyNames: "{path} property name is invalid";
59
+ readonly dependencies: "{path} is missing dependent fields";
60
+ readonly contains: "{path} is missing a required matching item";
61
+ readonly if: "{path} conditional validation failed";
62
+ readonly fallback: "{path} validation failed";
63
+ };
64
+ readonly log: {
65
+ readonly pageNotFound: "The URL is incorrect, or the custom page is not registered with the router.";
66
+ readonly pageNotFoundEn: "The URL is incorrect, or the custom page is not registered with the router.";
67
+ readonly illegalComponentCallback: "Illegal component callback - {comName}";
68
+ readonly illegalComponentCallbackEn: "Illegal component callback - {comName}";
69
+ readonly subscriptionError: "You haven't subscribed. Please check your code; the follow function and unsubscribe function must be the same.";
70
+ readonly subscriptionErrorEn: "You haven't subscribed. Please check your code; the follow function and unsubscribe function must be the same.";
71
+ readonly apiTamper: "API attributes cannot be tampered with";
72
+ readonly apiTamperEn: "API attributes cannot be tampered with";
73
+ };
74
+ };
75
+ };
76
+ //# sourceMappingURL=en-US.d.ts.map
@@ -0,0 +1,75 @@
1
+ export const frontendEnUSResources = {
2
+ frontend: {
3
+ app: {
4
+ title: 'Template Core',
5
+ uiComponentsTitle: 'UI Components',
6
+ uiComponentsButton: 'Click me',
7
+ },
8
+ common: {
9
+ yes: 'Yes',
10
+ no: 'No',
11
+ noData: 'No data',
12
+ loading: 'Loading',
13
+ operation: 'Actions',
14
+ },
15
+ feedback: {
16
+ confirmDelete: 'Confirm delete?',
17
+ requiredInput: 'Please enter {label}',
18
+ unknownError: 'Unknown error',
19
+ requestTimedOut: 'Request timed out',
20
+ networkError: 'Network error',
21
+ },
22
+ notFound: {
23
+ title: 'Page not found',
24
+ description: 'The current path is invalid, or the page is not registered in the router.',
25
+ },
26
+ validator: {
27
+ value: 'value',
28
+ required: 'Missing required field: {field}',
29
+ type: '{path} type error, expected {type}',
30
+ typeString: 'string',
31
+ typeNumber: 'number',
32
+ typeInteger: 'integer',
33
+ typeBoolean: 'boolean',
34
+ typeArray: 'array',
35
+ typeObject: 'object',
36
+ typeNull: 'null',
37
+ format: '{path} format is invalid',
38
+ minimum: '{path} cannot be less than {limit}',
39
+ maximum: '{path} cannot be greater than {limit}',
40
+ exclusiveMinimum: '{path} must be greater than {limit}',
41
+ exclusiveMaximum: '{path} must be less than {limit}',
42
+ multipleOf: '{path} must be a multiple of {multipleOf}',
43
+ minLength: '{path} must be at least {limit} characters',
44
+ maxLength: '{path} must be at most {limit} characters',
45
+ pattern: '{path} format does not match the requirement',
46
+ minItems: '{path} must contain at least {limit} items',
47
+ maxItems: '{path} must contain at most {limit} items',
48
+ uniqueItems: '{path} must not contain duplicate items',
49
+ minProperties: '{path} must contain at least {limit} properties',
50
+ maxProperties: '{path} must contain at most {limit} properties',
51
+ additionalProperties: '{path} contains disallowed property {property}',
52
+ enum: '{path} is not in the allowed options',
53
+ const: '{path} must equal the specified value',
54
+ oneOf: '{path} must match exactly one rule',
55
+ anyOf: '{path} must match at least one rule',
56
+ allOf: '{path} does not satisfy all rules',
57
+ not: '{path} must not match this rule',
58
+ propertyNames: '{path} property name is invalid',
59
+ dependencies: '{path} is missing dependent fields',
60
+ contains: '{path} is missing a required matching item',
61
+ if: '{path} conditional validation failed',
62
+ fallback: '{path} validation failed',
63
+ },
64
+ log: {
65
+ pageNotFound: 'The URL is incorrect, or the custom page is not registered with the router.',
66
+ pageNotFoundEn: 'The URL is incorrect, or the custom page is not registered with the router.',
67
+ illegalComponentCallback: 'Illegal component callback - {comName}',
68
+ illegalComponentCallbackEn: 'Illegal component callback - {comName}',
69
+ subscriptionError: "You haven't subscribed. Please check your code; the follow function and unsubscribe function must be the same.",
70
+ subscriptionErrorEn: "You haven't subscribed. Please check your code; the follow function and unsubscribe function must be the same.",
71
+ apiTamper: 'API attributes cannot be tampered with',
72
+ apiTamperEn: 'API attributes cannot be tampered with',
73
+ },
74
+ },
75
+ };
@@ -0,0 +1,66 @@
1
+ import type { I18nResources } from '../../../packages/ui/react/i18n';
2
+ export declare const i18nKeyPrefix = "$i18n::";
3
+ export declare const frontendI18nResources: I18nResources;
4
+ export declare const withI18nKey: (key: string) => string;
5
+ export declare const frontendLangKeys: {
6
+ readonly appTitle: string;
7
+ readonly uiComponentsTitle: string;
8
+ readonly uiComponentsButton: string;
9
+ readonly yes: string;
10
+ readonly no: string;
11
+ readonly noData: string;
12
+ readonly loading: string;
13
+ readonly operation: string;
14
+ readonly confirmDelete: string;
15
+ readonly requiredInput: string;
16
+ readonly unknownError: string;
17
+ readonly requestTimedOut: string;
18
+ readonly networkError: string;
19
+ readonly notFoundTitle: string;
20
+ readonly notFoundDescription: string;
21
+ readonly validatorValue: string;
22
+ readonly validatorRequired: string;
23
+ readonly validatorType: string;
24
+ readonly validatorTypeString: string;
25
+ readonly validatorTypeNumber: string;
26
+ readonly validatorTypeInteger: string;
27
+ readonly validatorTypeBoolean: string;
28
+ readonly validatorTypeArray: string;
29
+ readonly validatorTypeObject: string;
30
+ readonly validatorTypeNull: string;
31
+ readonly validatorFormat: string;
32
+ readonly validatorMinimum: string;
33
+ readonly validatorMaximum: string;
34
+ readonly validatorExclusiveMinimum: string;
35
+ readonly validatorExclusiveMaximum: string;
36
+ readonly validatorMultipleOf: string;
37
+ readonly validatorMinLength: string;
38
+ readonly validatorMaxLength: string;
39
+ readonly validatorPattern: string;
40
+ readonly validatorMinItems: string;
41
+ readonly validatorMaxItems: string;
42
+ readonly validatorUniqueItems: string;
43
+ readonly validatorMinProperties: string;
44
+ readonly validatorMaxProperties: string;
45
+ readonly validatorAdditionalProperties: string;
46
+ readonly validatorEnum: string;
47
+ readonly validatorConst: string;
48
+ readonly validatorOneOf: string;
49
+ readonly validatorAnyOf: string;
50
+ readonly validatorAllOf: string;
51
+ readonly validatorNot: string;
52
+ readonly validatorPropertyNames: string;
53
+ readonly validatorDependencies: string;
54
+ readonly validatorContains: string;
55
+ readonly validatorIf: string;
56
+ readonly validatorFallback: string;
57
+ readonly logPageNotFound: string;
58
+ readonly logPageNotFoundEn: string;
59
+ readonly logIllegalComponentCallback: string;
60
+ readonly logIllegalComponentCallbackEn: string;
61
+ readonly logSubscriptionError: string;
62
+ readonly logSubscriptionErrorEn: string;
63
+ readonly logApiTamper: string;
64
+ readonly logApiTamperEn: string;
65
+ };
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,69 @@
1
+ import { frontendEnUSResources } from './en-US';
2
+ import { frontendZhCNResources } from './zh-CN';
3
+ export const i18nKeyPrefix = '$i18n::';
4
+ export const frontendI18nResources = {
5
+ 'zh-CN': frontendZhCNResources,
6
+ 'en-US': frontendEnUSResources,
7
+ };
8
+ export const withI18nKey = (key) => `${i18nKeyPrefix}${key}`;
9
+ export const frontendLangKeys = {
10
+ appTitle: withI18nKey('frontend.app.title'),
11
+ uiComponentsTitle: withI18nKey('frontend.app.uiComponentsTitle'),
12
+ uiComponentsButton: withI18nKey('frontend.app.uiComponentsButton'),
13
+ yes: withI18nKey('frontend.common.yes'),
14
+ no: withI18nKey('frontend.common.no'),
15
+ noData: withI18nKey('frontend.common.noData'),
16
+ loading: withI18nKey('frontend.common.loading'),
17
+ operation: withI18nKey('frontend.common.operation'),
18
+ confirmDelete: withI18nKey('frontend.feedback.confirmDelete'),
19
+ requiredInput: withI18nKey('frontend.feedback.requiredInput'),
20
+ unknownError: withI18nKey('frontend.feedback.unknownError'),
21
+ requestTimedOut: withI18nKey('frontend.feedback.requestTimedOut'),
22
+ networkError: withI18nKey('frontend.feedback.networkError'),
23
+ notFoundTitle: withI18nKey('frontend.notFound.title'),
24
+ notFoundDescription: withI18nKey('frontend.notFound.description'),
25
+ validatorValue: withI18nKey('frontend.validator.value'),
26
+ validatorRequired: withI18nKey('frontend.validator.required'),
27
+ validatorType: withI18nKey('frontend.validator.type'),
28
+ validatorTypeString: withI18nKey('frontend.validator.typeString'),
29
+ validatorTypeNumber: withI18nKey('frontend.validator.typeNumber'),
30
+ validatorTypeInteger: withI18nKey('frontend.validator.typeInteger'),
31
+ validatorTypeBoolean: withI18nKey('frontend.validator.typeBoolean'),
32
+ validatorTypeArray: withI18nKey('frontend.validator.typeArray'),
33
+ validatorTypeObject: withI18nKey('frontend.validator.typeObject'),
34
+ validatorTypeNull: withI18nKey('frontend.validator.typeNull'),
35
+ validatorFormat: withI18nKey('frontend.validator.format'),
36
+ validatorMinimum: withI18nKey('frontend.validator.minimum'),
37
+ validatorMaximum: withI18nKey('frontend.validator.maximum'),
38
+ validatorExclusiveMinimum: withI18nKey('frontend.validator.exclusiveMinimum'),
39
+ validatorExclusiveMaximum: withI18nKey('frontend.validator.exclusiveMaximum'),
40
+ validatorMultipleOf: withI18nKey('frontend.validator.multipleOf'),
41
+ validatorMinLength: withI18nKey('frontend.validator.minLength'),
42
+ validatorMaxLength: withI18nKey('frontend.validator.maxLength'),
43
+ validatorPattern: withI18nKey('frontend.validator.pattern'),
44
+ validatorMinItems: withI18nKey('frontend.validator.minItems'),
45
+ validatorMaxItems: withI18nKey('frontend.validator.maxItems'),
46
+ validatorUniqueItems: withI18nKey('frontend.validator.uniqueItems'),
47
+ validatorMinProperties: withI18nKey('frontend.validator.minProperties'),
48
+ validatorMaxProperties: withI18nKey('frontend.validator.maxProperties'),
49
+ validatorAdditionalProperties: withI18nKey('frontend.validator.additionalProperties'),
50
+ validatorEnum: withI18nKey('frontend.validator.enum'),
51
+ validatorConst: withI18nKey('frontend.validator.const'),
52
+ validatorOneOf: withI18nKey('frontend.validator.oneOf'),
53
+ validatorAnyOf: withI18nKey('frontend.validator.anyOf'),
54
+ validatorAllOf: withI18nKey('frontend.validator.allOf'),
55
+ validatorNot: withI18nKey('frontend.validator.not'),
56
+ validatorPropertyNames: withI18nKey('frontend.validator.propertyNames'),
57
+ validatorDependencies: withI18nKey('frontend.validator.dependencies'),
58
+ validatorContains: withI18nKey('frontend.validator.contains'),
59
+ validatorIf: withI18nKey('frontend.validator.if'),
60
+ validatorFallback: withI18nKey('frontend.validator.fallback'),
61
+ logPageNotFound: withI18nKey('frontend.log.pageNotFound'),
62
+ logPageNotFoundEn: withI18nKey('frontend.log.pageNotFoundEn'),
63
+ logIllegalComponentCallback: withI18nKey('frontend.log.illegalComponentCallback'),
64
+ logIllegalComponentCallbackEn: withI18nKey('frontend.log.illegalComponentCallbackEn'),
65
+ logSubscriptionError: withI18nKey('frontend.log.subscriptionError'),
66
+ logSubscriptionErrorEn: withI18nKey('frontend.log.subscriptionErrorEn'),
67
+ logApiTamper: withI18nKey('frontend.log.apiTamper'),
68
+ logApiTamperEn: withI18nKey('frontend.log.apiTamperEn'),
69
+ };
@@ -0,0 +1,76 @@
1
+ export declare const frontendZhCNResources: {
2
+ readonly frontend: {
3
+ readonly app: {
4
+ readonly title: "Template Core";
5
+ readonly uiComponentsTitle: "UI 组件";
6
+ readonly uiComponentsButton: "点击我";
7
+ };
8
+ readonly common: {
9
+ readonly yes: "是";
10
+ readonly no: "否";
11
+ readonly noData: "暂无数据";
12
+ readonly loading: "加载中";
13
+ readonly operation: "操作";
14
+ };
15
+ readonly feedback: {
16
+ readonly confirmDelete: "确认删除?";
17
+ readonly requiredInput: "请输入{label}";
18
+ readonly unknownError: "未知错误";
19
+ readonly requestTimedOut: "请求超时";
20
+ readonly networkError: "网络错误";
21
+ };
22
+ readonly notFound: {
23
+ readonly title: "页面不存在";
24
+ readonly description: "当前路径无效,或页面未在路由中注册。";
25
+ };
26
+ readonly validator: {
27
+ readonly value: "值";
28
+ readonly required: "缺少必填字段: {field}";
29
+ readonly type: "{path} 类型错误,期望 {type}";
30
+ readonly typeString: "字符串";
31
+ readonly typeNumber: "数字";
32
+ readonly typeInteger: "整数";
33
+ readonly typeBoolean: "布尔值";
34
+ readonly typeArray: "数组";
35
+ readonly typeObject: "对象";
36
+ readonly typeNull: "空值";
37
+ readonly format: "{path} 格式不正确";
38
+ readonly minimum: "{path} 不能小于 {limit}";
39
+ readonly maximum: "{path} 不能大于 {limit}";
40
+ readonly exclusiveMinimum: "{path} 必须大于 {limit}";
41
+ readonly exclusiveMaximum: "{path} 必须小于 {limit}";
42
+ readonly multipleOf: "{path} 必须是 {multipleOf} 的倍数";
43
+ readonly minLength: "{path} 长度不能少于 {limit} 个字符";
44
+ readonly maxLength: "{path} 长度不能超过 {limit} 个字符";
45
+ readonly pattern: "{path} 格式不符合要求";
46
+ readonly minItems: "{path} 至少需要 {limit} 项";
47
+ readonly maxItems: "{path} 不能超过 {limit} 项";
48
+ readonly uniqueItems: "{path} 不能包含重复项";
49
+ readonly minProperties: "{path} 至少需要 {limit} 个属性";
50
+ readonly maxProperties: "{path} 不能超过 {limit} 个属性";
51
+ readonly additionalProperties: "{path} 包含不允许的属性 {property}";
52
+ readonly enum: "{path} 不在可选范围内";
53
+ readonly const: "{path} 必须等于指定值";
54
+ readonly oneOf: "{path} 只能匹配一个规则";
55
+ readonly anyOf: "{path} 至少需要匹配一个规则";
56
+ readonly allOf: "{path} 未满足全部规则";
57
+ readonly not: "{path} 不能匹配该规则";
58
+ readonly propertyNames: "{path} 属性名不符合要求";
59
+ readonly dependencies: "{path} 缺少关联字段";
60
+ readonly contains: "{path} 缺少符合要求的项";
61
+ readonly if: "{path} 条件校验未通过";
62
+ readonly fallback: "{path} 校验未通过";
63
+ };
64
+ readonly log: {
65
+ readonly pageNotFound: "url有问题 或者 自定义页面未在路由器注册";
66
+ readonly pageNotFoundEn: "The URL is incorrect, or the custom page is not registered with the router.";
67
+ readonly illegalComponentCallback: "非法的组件回调 - {comName}";
68
+ readonly illegalComponentCallbackEn: "Illegal component callback - {comName}";
69
+ readonly subscriptionError: "不曾订阅过,请检查代码,关注函数与取消函数必须为同一个";
70
+ readonly subscriptionErrorEn: "You haven't subscribed. Please check your code; the follow function and unsubscribe function must be the same.";
71
+ readonly apiTamper: "api属性不允许篡改";
72
+ readonly apiTamperEn: "API attributes cannot be tampered with";
73
+ };
74
+ };
75
+ };
76
+ //# sourceMappingURL=zh-CN.d.ts.map