Files
shrimp-admin/src/index.ts
T
wc24 603e33d17f 0.8.0: 契约副本刷齐并改为自动同步;未注册字段类型不再静默回落
契约副本(src/IShrimpType.ts)此前漂了一整代:停在旧的 json 类型,
缺 object / array / IFieldConfig.fields / IFieldConfig.item / parse / IPageResult.refs。
而本包自己的组件早就在读这些字段——FieldArray 读 field.item、FieldObject 读 fields、
FieldRelation 与 ShrimpTable 读 refs。等于组件在用、类型说没有。
接入方照这份副本理解 shrimp 能渲染什么,只会得出"结构化数据只有 json"的结论。

现在由 shrimp-server 的 postbuild 单向覆盖过来(它是契约真身),
本仓库另提供 npm run check:contract / sync:contract 手动比对与同步。
注释头不参与同步,它声明的是"我是副本",与契约正文是两回事。

VueAdmin.getFieldComponent:未注册类型仍回落成 string(类型词汇表是开放的,
消费侧放个 Field<X>.vue 就能扩,改成严格校验会当场打死 theseus 的 gesture/goodsList
和 hand 的 dropList/matterPointDropList),但按类型去重告警一次,
打印出现位置、已注册类型和两条修法。上面那个 json 就是这么静默活下来的。

resolveVue:内置组件表为空时报"本包没被 vite 正常转换、消费侧缺 optimizeDeps.exclude",
不再报"找不到 layout.vue"把人引去查文件路径。

README 重写成可照抄的接入模板 + 出错对照表 + "那几行为什么不能删"。
版本与 shrimp-server 归一到 0.8.0,删掉 @syncedFrom 这条手维护的版本标记。
2026-08-10 19:48:57 +08:00

74 lines
1.9 KiB
TypeScript

// ============== 主入口 ==============
//
// 消费侧用法见 README.md。本文件只做 re-export。
// ===== 类型契约(IShrimpType 是 shrimp-server 那份的副本,由其 postbuild 自动同步)=====
export {
ShrimpCode,
ShrimpError,
ShrimpFieldTypes,
ShrimpConfig,
isShrimpCondition,
} from './IShrimpType'
export type {
ILabel,
IShrimpResponse,
IModuleInfo,
ILoginResult,
IMeResult,
IMenuItem,
ITableProto,
ITableCrudProto,
IUser,
IRole,
IOperationLog,
WithId,
IShrimpOperator,
IShrimpPowerData,
ShrimpRequestFn,
IShrimpClient,
ShrimpFieldType,
FieldEditable,
IFieldTypeHandler,
IFieldConfig,
IFieldRule,
IPageQuery,
IPageResult,
IShrimpCondition,
IShrimpPopulate,
IShrimpQuery,
IPowerItem,
IUserProto,
IRoleProto,
} from './IShrimpType'
export {
VueAdmin,
vueAdmin,
createShrimpAdmin,
resolveVue,
type ShrimpAdminOptions,
type ShrimpAdminConfig,
} from './VueAdmin'
export {
ShrimpClient,
handleShrimpResponse,
type IShrimpTipper,
type IRouteInfo,
} from './ShrimpClient'
// 框架组件 — 业务页面想直接复用就 import 这些。
// 这些是「静态」导出,拿到的就是框架内置版本,不受消费侧 sources 影响。
export { default as ShrimpTable } from './components/ShrimpTable.vue'
export { default as ShrimpEditDrawer } from './components/ShrimpEditDrawer.vue'
export { default as ShrimpFilterDrawer } from './components/ShrimpFilterDrawer.vue'
export { default as ShrimpFilterTrigger } from './components/ShrimpFilterTrigger.vue'
export { default as ShrimpSearchInput } from './components/ShrimpSearchInput.vue'
export { default as ShrimpPowerTree } from './components/ShrimpPowerTree.vue'
export { default as ShrimpLangSwitch } from './components/ShrimpLangSwitch.vue'
// 应用入口视图(消费侧 createApp 用)
export { default as App } from './App.vue'