@macrowing/inbiz-codegen 0.0.0-stage → 1.0.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.
- package/README.md +592 -2
- package/bin/inbiz-codegen.mjs +7 -0
- package/package.json +32 -4
- package/scripts/prepare-templates.mjs +35 -0
- package/src/backend/init.mjs +170 -0
- package/src/config.mjs +150 -0
- package/src/favicon.mjs +100 -0
- package/src/generate.mjs +935 -0
- package/src/generated-output.mjs +107 -0
- package/src/index.mjs +346 -0
- package/src/menu/build.mjs +252 -0
- package/src/menu/check.mjs +163 -0
- package/src/menu/command.mjs +179 -0
- package/src/migrate-runtime.mjs +106 -0
- package/src/platform/client.mjs +167 -0
- package/src/platform/command.mjs +386 -0
- package/src/platform/pack.mjs +591 -0
- package/src/platform/recover.mjs +236 -0
- package/src/platform/startup.mjs +343 -0
- package/src/platform/state.mjs +116 -0
- package/src/platform/update.mjs +157 -0
- package/src/platform/zip.mjs +134 -0
- package/src/pull.mjs +284 -0
- package/src/scaffold/commands.mjs +349 -0
- package/src/scaffold/init.mjs +370 -0
- package/src/scaffold/template-files.mjs +40 -0
- package/src/scaffold/template-source.mjs +235 -0
- package/src/scaffold/template-sync.mjs +335 -0
- package/src/transform/heaviness.mjs +380 -0
- package/src/transform/preview-props.mjs +108 -0
- package/src/transform/published-page-links.mjs +61 -0
- package/src/transform/published-script.mjs +110 -0
- package/src/transform/registry.mjs +781 -0
- package/src/transform/schema-to-jsx.mjs +1708 -0
- package/src/util/des.mjs +10 -0
- package/templates/README.md +34 -0
- package/templates/backend/Directory.Build.props +19 -0
- package/templates/backend/Directory.Packages.props +49 -0
- package/templates/backend/Macrowing.Scaffold.slnx +13 -0
- package/templates/backend/host/Macrowing.Start/Init/app.json +8 -0
- package/templates/backend/host/Macrowing.Start/Init/menus.json +4 -0
- package/templates/backend/host/Macrowing.Start/Initialization/InitializationDefinition.cs +245 -0
- package/templates/backend/host/Macrowing.Start/Initialization/InitializationEndpoints.cs +57 -0
- package/templates/backend/host/Macrowing.Start/Initialization/InitializationHostedService.cs +63 -0
- package/templates/backend/host/Macrowing.Start/Initialization/InitializationOptions.cs +44 -0
- package/templates/backend/host/Macrowing.Start/Initialization/InitializationRunner.cs +294 -0
- package/templates/backend/host/Macrowing.Start/Initialization/InitializationState.cs +72 -0
- package/templates/backend/host/Macrowing.Start/Initialization/MenuFactory.cs +118 -0
- package/templates/backend/host/Macrowing.Start/Initialization/PackageBuilder.cs +317 -0
- package/templates/backend/host/Macrowing.Start/Initialization/PlatformAppImporter.cs +371 -0
- package/templates/backend/host/Macrowing.Start/Macrowing.Start.csproj +26 -0
- package/templates/backend/host/Macrowing.Start/Program.cs +33 -0
- package/templates/backend/host/Macrowing.Start/StartModule.cs +67 -0
- package/templates/backend/host/Macrowing.Start/appsettings.json +38 -0
- package/templates/backend/modules/Macrowing.Generated/Application/GeneratedApplicationAutoMapperProfile.cs +42 -0
- package/templates/backend/modules/Macrowing.Generated/Domain/Entities/GeneratedEntityBase.cs +72 -0
- package/templates/backend/modules/Macrowing.Generated/Domain/GeneratedConsts.cs +50 -0
- package/templates/backend/modules/Macrowing.Generated/EntityFrameworkCore/GeneratedDbContext.cs +55 -0
- package/templates/backend/modules/Macrowing.Generated/EntityFrameworkCore/GeneratedDbContextModelBuilderExtensions.cs +61 -0
- package/templates/backend/modules/Macrowing.Generated/EntityFrameworkCore/IGeneratedDbContext.cs +32 -0
- package/templates/backend/modules/Macrowing.Generated/GeneratedModule.cs +89 -0
- package/templates/backend/modules/Macrowing.Generated/Macrowing.Generated.csproj +22 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Cms/CmsClient.cs +95 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Cms/CmsModels.cs +81 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Dictionary/DictionaryClient.cs +44 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/InBizSdkModule.cs +16 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/InterfaceEngine/InterfaceEngineClient.cs +50 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Localization/LocalizationClient.cs +28 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Macrowing.InBiz.SDK.csproj +16 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Message/MessageClient.cs +99 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Message/MessageModels.cs +63 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Model/ModelClient.cs +131 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Model/ModelQuery.cs +108 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Model/ModelWrite.cs +44 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Permission/PermissionClient.cs +86 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Platform/InBizPlatformException.cs +42 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Platform/InBizPlatformRegistration.cs +60 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Platform/InBizPlatformTransport.cs +96 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/Platform/InBizRequestContext.cs +27 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/README.md +117 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Details/WorkFlowDetailsClient.cs +35 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Details/WorkFlowDetailsQuery.cs +20 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Operations/WorkFlowOperationRequests.cs +105 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Operations/WorkFlowOperationsClient.cs +53 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/README.md +132 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Tracking/WorkFlowTrackingClient.cs +50 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Upgrade/WorkFlowUpgradeClient.cs +78 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Upgrade/WorkFlowUpgradeModels.cs +34 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/WorkFlowContracts.cs +88 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/WorkFlowRegistration.cs +59 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/WorkFlowTransport.cs +163 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Workbench/WorkFlowWorkbenchClient.cs +59 -0
- package/templates/backend/modules/Macrowing.InBiz.SDK/WorkFlow/Workbench/WorkFlowWorkbenchModels.cs +76 -0
- package/templates/backend/modules/Macrowing.OC.SDK/Macrowing.OC.SDK.csproj +20 -0
- package/templates/backend/modules/Macrowing.OC.SDK/OcSdkModule.cs +18 -0
- package/templates/backend/modules/Macrowing.OC.SDK/Protos/README.md +22 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/Macrowing.InBiz.SDK.Tests.csproj +14 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/PlatformContractTests.cs +288 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/PlatformLiveTests.cs +173 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/WorkFlowHttpServer.cs +113 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/WorkFlowLiveTests.cs +269 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/WorkFlowOperationsTests.cs +80 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/WorkFlowQueryTests.cs +163 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/WorkFlowTransportTests.cs +111 -0
- package/templates/backend/tests/Macrowing.InBiz.SDK.Tests/WorkFlowUpgradeTests.cs +87 -0
- package/templates/frontend/components/README.md +39 -0
- package/templates/frontend/components/app-components/README.md +33 -0
- package/templates/frontend/components/app-components/common/.gitkeep +0 -0
- package/templates/frontend/components/app-components/components/.gitkeep +0 -0
- package/templates/frontend/components/app-components/package.json +20 -0
- package/templates/frontend/mgt/.umirc.ts +574 -0
- package/templates/frontend/mgt/package.json +96 -0
- package/templates/frontend/mgt/src/app-extends.ts +9 -0
- package/templates/frontend/mgt/src/app.tsx +20 -0
- package/templates/frontend/mgt/src/config/app.ts +31 -0
- package/templates/frontend/mgt/src/layout/header.tsx +14 -0
- package/templates/frontend/mgt/src/layout/index.tsx +11 -0
- package/templates/frontend/mgt/src/layout/sidebar.tsx +14 -0
- package/templates/frontend/mgt/src/locales.ts +8 -0
- package/templates/frontend/mgt/src/pages/.gitkeep +0 -0
- package/templates/frontend/mgt/src/root.tsx +12 -0
- package/templates/frontend/mgt/src/route-view.tsx +3 -0
- package/templates/frontend/mgt/src/runtime.ts +21 -0
- package/templates/frontend/mgt/src/styles/app.css +1 -0
- package/templates/frontend/mgt/src/styles/layout.less +79 -0
- package/templates/frontend/mgt/tsconfig.json +65 -0
- package/templates/frontend/mgt/typings.d.ts +57 -0
- package/templates/frontend/wap/.umirc.ts +574 -0
- package/templates/frontend/wap/package.json +73 -0
- package/templates/frontend/wap/src/app-extends.ts +9 -0
- package/templates/frontend/wap/src/app.tsx +28 -0
- package/templates/frontend/wap/src/config/app.ts +31 -0
- package/templates/frontend/wap/src/layout/header.tsx +14 -0
- package/templates/frontend/wap/src/layout/index.tsx +18 -0
- package/templates/frontend/wap/src/layout/sidebar.tsx +14 -0
- package/templates/frontend/wap/src/locales.ts +8 -0
- package/templates/frontend/wap/src/pages/.gitkeep +0 -0
- package/templates/frontend/wap/src/root.tsx +12 -0
- package/templates/frontend/wap/src/route-view.tsx +3 -0
- package/templates/frontend/wap/src/runtime.ts +21 -0
- package/templates/frontend/wap/src/styles/adaptation.less +190 -0
- package/templates/frontend/wap/src/styles/app.css +7 -0
- package/templates/frontend/wap/src/styles/global.less +81 -0
- package/templates/frontend/wap/src/styles/layout.less +92 -0
- package/templates/frontend/wap/tsconfig.json +66 -0
- package/templates/frontend/wap/typings.d.ts +24 -0
- package/templates/frontend/web/.umirc.ts +574 -0
- package/templates/frontend/web/package.json +26 -0
- package/templates/frontend/web/src/app-extends.ts +9 -0
- package/templates/frontend/web/src/app.tsx +25 -0
- package/templates/frontend/web/src/config/app.ts +31 -0
- package/templates/frontend/web/src/layout/header.tsx +14 -0
- package/templates/frontend/web/src/layout/index.tsx +11 -0
- package/templates/frontend/web/src/layout/sidebar.tsx +14 -0
- package/templates/frontend/web/src/locales.ts +8 -0
- package/templates/frontend/web/src/root.tsx +12 -0
- package/templates/frontend/web/src/route-view.tsx +3 -0
- package/templates/frontend/web/src/runtime.ts +21 -0
- package/templates/frontend/web/src/styles/app.css +104 -0
- package/templates/frontend/web/src/styles/layout.less +124 -0
- package/templates/frontend/web/tsconfig.json +91 -0
- package/templates/frontend/web/typings.d.ts +46 -0
- package/templates/package.json +14 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 移动端启动入口。
|
|
3
|
+
*
|
|
4
|
+
* 运行时装配(鉴权、应用信息、站点内容、InBiz 对象、多语言)全部由
|
|
5
|
+
* `@macrowing/inbiz-runtime/web` 提供,模板不再持有 provider 副本。
|
|
6
|
+
*
|
|
7
|
+
* 样式顺序有意义:
|
|
8
|
+
* 1. runtime 的 web.css —— 含 antd 变量样式与运行时的全局/布局规则;
|
|
9
|
+
* 2. antd-mobile 的全局样式 —— 提供 `--adm-*` 变量与基础重置;
|
|
10
|
+
* 3. 本工程样式 —— global → adaptation → layout,最后是生成的应用样式 app.css。
|
|
11
|
+
*/
|
|
12
|
+
import '@macrowing/inbiz-runtime/web.css';
|
|
13
|
+
import 'antd-mobile/es/global';
|
|
14
|
+
import '@/styles/global.less';
|
|
15
|
+
import '@/styles/adaptation.less';
|
|
16
|
+
import '@/styles/layout.less';
|
|
17
|
+
import { bootstrapWeb } from '@macrowing/inbiz-runtime/web';
|
|
18
|
+
import libraryLocales, { basicPreviewLocales } from '@inbiz/entry/locales/index';
|
|
19
|
+
import { APP_CONFIG } from '@/config/app';
|
|
20
|
+
import { customLocales } from '@/locales';
|
|
21
|
+
import appCss from '@/styles/app.css?inbiz-app-style';
|
|
22
|
+
|
|
23
|
+
bootstrapWeb({
|
|
24
|
+
config: APP_CONFIG,
|
|
25
|
+
componentLocales: [basicPreviewLocales, libraryLocales],
|
|
26
|
+
customLocales,
|
|
27
|
+
appCss,
|
|
28
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare const __INBIZ_APP_ENV__: {
|
|
2
|
+
appId: string;
|
|
3
|
+
siteType: string;
|
|
4
|
+
siteOutId: string;
|
|
5
|
+
dataVersionId: string;
|
|
6
|
+
homeRoute: string;
|
|
7
|
+
loginPath: string;
|
|
8
|
+
previewAccount: string;
|
|
9
|
+
previewPassword: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const ENV = __INBIZ_APP_ENV__;
|
|
13
|
+
|
|
14
|
+
export const APP_CONFIG = {
|
|
15
|
+
appId: ENV.appId,
|
|
16
|
+
siteType: Number(ENV.siteType || 1),
|
|
17
|
+
siteOutId: ENV.siteOutId,
|
|
18
|
+
dataVersionId: ENV.dataVersionId,
|
|
19
|
+
homeRoute: ENV.homeRoute || '/',
|
|
20
|
+
loginPath: ENV.loginPath || '/login',
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 预览账号:仅本地开发用。
|
|
24
|
+
* 配置后未登录时会静默调用平台登录接口换取 token。
|
|
25
|
+
* 生产部署请留空 —— 让用户走平台登录页。
|
|
26
|
+
*/
|
|
27
|
+
previewAccount: ENV.previewAccount,
|
|
28
|
+
previewPassword: ENV.previewPassword,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const SITE_TYPE = { Web: 0, Wap: 1, Mgt: 2 } as const;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 应用框架的「top」区域。
|
|
5
|
+
*
|
|
6
|
+
* 初始工程只有空壳,保证首次 generate 之前页面能渲染。
|
|
7
|
+
* `inbiz-codegen generate` 会用平台布局重写这个文件(菜单、搜索、消息、个人信息等),
|
|
8
|
+
* 业务内容不进模板。
|
|
9
|
+
*/
|
|
10
|
+
export function Header() {
|
|
11
|
+
return <div className="app-header" />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Header;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 移动端应用框架。
|
|
5
|
+
*
|
|
6
|
+
* 初始工程只有安全区与内容容器,保证首次 generate 之前页面能渲染。
|
|
7
|
+
* `inbiz-codegen generate` 会用平台布局重写这个文件(顶部栏 / 底部导航等),
|
|
8
|
+
* 业务内容不进模板。
|
|
9
|
+
*/
|
|
10
|
+
export function Layout({ children }: { children?: React.ReactNode }) {
|
|
11
|
+
return (
|
|
12
|
+
<div className="app-wap-shell">
|
|
13
|
+
<main className="app-wap-content">{children}</main>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default Layout;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 应用框架的「left」区域。
|
|
5
|
+
*
|
|
6
|
+
* 初始工程只有空壳,保证首次 generate 之前页面能渲染。
|
|
7
|
+
* `inbiz-codegen generate` 会用平台布局重写这个文件(VerticalMenu 及插件插槽),
|
|
8
|
+
* 业务内容不进模板。
|
|
9
|
+
*/
|
|
10
|
+
export function Sidebar() {
|
|
11
|
+
return <div className="app-sidebar-content" />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Sidebar;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// 应用级文案目录。
|
|
2
|
+
//
|
|
3
|
+
// `inbiz-codegen generate` 会把平台上的应用词条(组件包 locale 之外的)追加到这里。
|
|
4
|
+
// 初始工程没有任何业务词条,保持空表即可;组件库自己的词条由 app.tsx 里的
|
|
5
|
+
// `@inbiz/entry/locales/index` 统一注册。
|
|
6
|
+
import type { PreviewCatalog } from '@macrowing/inbiz-runtime';
|
|
7
|
+
|
|
8
|
+
export const customLocales: Record<string, PreviewCatalog> = {};
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createWebRuntime } from '@macrowing/inbiz-runtime/web';
|
|
2
|
+
import { APP_CONFIG } from '@/config/app';
|
|
3
|
+
import { PAGES } from '@/pages/routes';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 运行时装配。
|
|
7
|
+
*
|
|
8
|
+
* 这里只做「把配置和页面清单交给运行时」这一件事:
|
|
9
|
+
* - `config` 来自 .env,由 init 写入、pull 回填站点信息;
|
|
10
|
+
* - `pages` 是 generate 产出的页面清单,首次 generate 前是空表;
|
|
11
|
+
* - `importPage` 按页面目录懒加载,`loadExtensions` 加载应用扩展。
|
|
12
|
+
*
|
|
13
|
+
* 应用特有的能力(宿主对象、私有组件、业务扩展)不写在模板里:
|
|
14
|
+
* 组件包通过自己的入口暴露契约,应用侧在 generate 产物或 src/app-extends.ts 中接入。
|
|
15
|
+
*/
|
|
16
|
+
export const runtime = createWebRuntime({
|
|
17
|
+
config: APP_CONFIG,
|
|
18
|
+
pages: PAGES,
|
|
19
|
+
importPage: (dir) => import(`./pages/${dir}`),
|
|
20
|
+
loadExtensions: () => import('@/app-extends'),
|
|
21
|
+
});
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 移动端适配方案:**vw 为主,px 为常态**;1px 边框用「伪元素 + scaleY(0.5)」。
|
|
3
|
+
*
|
|
4
|
+
* ============================ 为什么选 vw,不选 rem ============================
|
|
5
|
+
*
|
|
6
|
+
* 前提:本工程里两套界面组件**全部是 px 书写的**。
|
|
7
|
+
* - antd-mobile 5 的整包 CSS 里 rem 出现 0 次;
|
|
8
|
+
* - 组件库的 wap preview(WapNavHeader、WapSearchBar、wap 菜单…)也是 px。
|
|
9
|
+
*
|
|
10
|
+
* 由此 rem 方案有两条路,都不划算:
|
|
11
|
+
*
|
|
12
|
+
* a) 构建期 px→rem(postcss-pxtorem)
|
|
13
|
+
* 插件必须对 node_modules 里 antd-mobile 的 CSS 同样生效,否则会变成
|
|
14
|
+
* 「本工程的 CSS 按屏幕等比缩放、组件库的 CSS 不缩放」。375 以外的机型上
|
|
15
|
+
* 两套比例分叉:标题变大了、同一行的表单控件没变大,页面会错位。
|
|
16
|
+
* 而要让插件覆盖 node_modules,就得往配置里塞 exclude 白名单,
|
|
17
|
+
* 组件库每次升级都要复核一遍 —— 这正是 memory 里记过的那类坑。
|
|
18
|
+
*
|
|
19
|
+
* b) 运行期 flexible 脚本(动态设置 html font-size)
|
|
20
|
+
* 多一次首帧前的 DOM 变更:慢网下先按默认字号渲染、再跳变,
|
|
21
|
+
* 移动端能直接看到文字闪一下。而且脚本被 CSP 拦掉时整站尺寸全废。
|
|
22
|
+
*
|
|
23
|
+
* vw 没有这两个问题:纯 CSS、无依赖、不依赖构建插件。所以主方案取 vw。
|
|
24
|
+
*
|
|
25
|
+
* 具体做法不是「把所有 px 换成 vw」——那样同样会和 px 书写的组件库分叉。
|
|
26
|
+
* 而是只把**确实需要等比缩放**的尺寸(自定义头图高度、内容区留白、
|
|
27
|
+
* 自定义按钮热区)写成 vw;其余一律保持 px,与组件库同源。
|
|
28
|
+
* 这样 375 基准机型完全对齐设计稿,其它机型上只有自定义区块做等比伸缩。
|
|
29
|
+
*
|
|
30
|
+
* 用法(Less 变量 `@app-vw` 就是「1 个设计像素」):
|
|
31
|
+
*
|
|
32
|
+
* @import '@/styles/adaptation.less';
|
|
33
|
+
* .my-banner { height: calc(120 * @app-vw); } // 375 宽时 = 120px
|
|
34
|
+
*
|
|
35
|
+
* 上限保护:`--app-vw` 用 clamp 夹在 320px ~ 544px 的等效范围内。
|
|
36
|
+
* 不夹的话,平板竖屏(768)会把 120px 的图放大到 245px,
|
|
37
|
+
* 横屏更容易失控。
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
@app-vw: var(--app-vw);
|
|
41
|
+
|
|
42
|
+
:root {
|
|
43
|
+
/**
|
|
44
|
+
* 1 个设计像素 = 视口宽度 / 375。
|
|
45
|
+
* clamp 的三段:最小 0.85px(≈320 宽)、首选 100vw/375、最大 1.45px(≈544 宽)。
|
|
46
|
+
*/
|
|
47
|
+
--app-vw: clamp(0.85px, calc(100vw / 375), 1.45px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* ============================ 1px 边框处理 ============================
|
|
52
|
+
*
|
|
53
|
+
* 问题:DPR=2 的屏幕上 1 个 CSS 像素 = 2 个物理像素,1px 实线看起来是「粗线」。
|
|
54
|
+
*
|
|
55
|
+
* 方案:伪元素画 1px,再用 transform: scaleY(0.5) 压成半个物理像素。
|
|
56
|
+
* 不用 `border-width: 0.5px`:部分安卓 WebView 不支持小数像素,
|
|
57
|
+
* 会退化成 0(线消失)或 1(回到粗线),表现随机型漂移,不可控。
|
|
58
|
+
*
|
|
59
|
+
* 只在 DPR ≥ 2 时缩放;1x 屏保持 1px,否则会细到看不见。
|
|
60
|
+
*
|
|
61
|
+
* 组件库与 antd-mobile 自带的 1px 分隔线**不动**:
|
|
62
|
+
* 那些线是平台既有的观感,改了就和平台不一致(还原度优先)。
|
|
63
|
+
* 本混入只用于出码产物自己画的线。
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
.hairline-pseudo() {
|
|
67
|
+
content: '';
|
|
68
|
+
position: absolute;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
box-sizing: border-box;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** 下边框:.hairline-b() 或 .hairline-b(#eee) */
|
|
74
|
+
.hairline-b(@color: var(--adm-color-border, #ebedf0)) {
|
|
75
|
+
position: relative;
|
|
76
|
+
|
|
77
|
+
&::after {
|
|
78
|
+
.hairline-pseudo();
|
|
79
|
+
right: 0;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
height: 0;
|
|
83
|
+
border-bottom: 1px solid @color;
|
|
84
|
+
transform: scaleY(0.5);
|
|
85
|
+
transform-origin: 0 100%;
|
|
86
|
+
|
|
87
|
+
@media (-webkit-max-device-pixel-ratio: 1.99), (max-resolution: 1.99dppx) {
|
|
88
|
+
transform: none;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** 上边框 */
|
|
94
|
+
.hairline-t(@color: var(--adm-color-border, #ebedf0)) {
|
|
95
|
+
position: relative;
|
|
96
|
+
|
|
97
|
+
&::before {
|
|
98
|
+
.hairline-pseudo();
|
|
99
|
+
top: 0;
|
|
100
|
+
right: 0;
|
|
101
|
+
left: 0;
|
|
102
|
+
height: 0;
|
|
103
|
+
border-top: 1px solid @color;
|
|
104
|
+
transform: scaleY(0.5);
|
|
105
|
+
transform-origin: 0 0;
|
|
106
|
+
|
|
107
|
+
@media (-webkit-max-device-pixel-ratio: 1.99), (max-resolution: 1.99dppx) {
|
|
108
|
+
transform: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** 四边外框(卡片、分组容器) */
|
|
114
|
+
.hairline-all(@color: var(--adm-color-border, #ebedf0), @radius: 8px) {
|
|
115
|
+
position: relative;
|
|
116
|
+
|
|
117
|
+
&::after {
|
|
118
|
+
.hairline-pseudo();
|
|
119
|
+
top: 0;
|
|
120
|
+
right: 0;
|
|
121
|
+
bottom: 0;
|
|
122
|
+
left: 0;
|
|
123
|
+
border: 1px solid @color;
|
|
124
|
+
border-radius: calc(@radius * 2);
|
|
125
|
+
transform: scale(0.5);
|
|
126
|
+
transform-origin: 0 0;
|
|
127
|
+
|
|
128
|
+
@media (-webkit-max-device-pixel-ratio: 1.99), (max-resolution: 1.99dppx) {
|
|
129
|
+
transform: none;
|
|
130
|
+
border-radius: @radius;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 直接可用的工具类:出码产物在 JSX 里写 className="hairline-b" 即可,
|
|
137
|
+
* 不必为一条线单独写样式块。
|
|
138
|
+
*/
|
|
139
|
+
.hairline-b {
|
|
140
|
+
.hairline-b();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.hairline-t {
|
|
144
|
+
.hairline-t();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.hairline-box {
|
|
148
|
+
.hairline-all();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* ============================ 安全区 ============================
|
|
153
|
+
*
|
|
154
|
+
* viewport 里已开 viewport-fit=cover,刘海屏/圆角屏才会给出
|
|
155
|
+
* safe-area-inset-*。底部导航必须吃下这块,否则被 Home 指示条压住。
|
|
156
|
+
* constant() 与 env() 同时写:iOS 11.0~11.2 只认前者,后续版本只认后者,
|
|
157
|
+
* 浏览器会忽略不认识的那条。
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
.safe-top {
|
|
161
|
+
padding-top: constant(safe-area-inset-top);
|
|
162
|
+
padding-top: env(safe-area-inset-top);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.safe-bottom {
|
|
166
|
+
padding-bottom: constant(safe-area-inset-bottom);
|
|
167
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.safe-x {
|
|
171
|
+
padding-left: constant(safe-area-inset-left);
|
|
172
|
+
padding-left: env(safe-area-inset-left);
|
|
173
|
+
padding-right: constant(safe-area-inset-right);
|
|
174
|
+
padding-right: env(safe-area-inset-right);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** 固定底部栏:内容要预留「栏高 + 安全区」,否则最后一项被挡住。 */
|
|
178
|
+
.pb-tabbar(@bar-height: 50px) {
|
|
179
|
+
padding-bottom: calc(@bar-height + constant(safe-area-inset-bottom));
|
|
180
|
+
padding-bottom: calc(@bar-height + env(safe-area-inset-bottom));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 视口高度:100vh 在 iOS Safari 上包含地址栏,滚动时会跳。
|
|
185
|
+
* dvh 是动态视口高度,支持时优先用;不支持的浏览器落在 100vh。
|
|
186
|
+
*/
|
|
187
|
+
.viewport-height() {
|
|
188
|
+
min-height: 100vh;
|
|
189
|
+
min-height: 100dvh;
|
|
190
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全局重置与主题桥接。
|
|
3
|
+
*
|
|
4
|
+
* 这里只处理「整站都成立」的规则:盒模型、字体、点按反馈、滚动行为。
|
|
5
|
+
* 具体尺寸与适配规则见 adaptation.less,框架骨架见 layout.less。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
*,
|
|
9
|
+
*::before,
|
|
10
|
+
*::after {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
html,
|
|
15
|
+
body,
|
|
16
|
+
#root {
|
|
17
|
+
height: 100%;
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
html {
|
|
23
|
+
/* iOS 横屏时自动放大字号会打乱布局,WAP 端关掉 */
|
|
24
|
+
-webkit-text-size-adjust: 100%;
|
|
25
|
+
text-size-adjust: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
body {
|
|
29
|
+
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
|
|
30
|
+
'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
31
|
+
font-size: var(--adm-font-size-6, 14px);
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
color: var(--adm-color-text, #333);
|
|
34
|
+
background: var(--adm-color-box, #f5f5f5);
|
|
35
|
+
|
|
36
|
+
/* 移动端:去掉长按选中与点击高亮,避免「长按出现选择条」 */
|
|
37
|
+
-webkit-tap-highlight-color: transparent;
|
|
38
|
+
-webkit-touch-callout: none;
|
|
39
|
+
|
|
40
|
+
/* 禁止整页橡皮筋滚动;局部滚动容器自己开 overscroll-behavior */
|
|
41
|
+
overscroll-behavior-y: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
body,
|
|
45
|
+
input,
|
|
46
|
+
button,
|
|
47
|
+
textarea,
|
|
48
|
+
select {
|
|
49
|
+
font-family: inherit;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
img {
|
|
53
|
+
max-width: 100%;
|
|
54
|
+
vertical-align: top;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
a {
|
|
58
|
+
color: var(--adm-color-primary, #1677ff);
|
|
59
|
+
text-decoration: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 主题桥接:组件库的 wap 组件用的是平台的 `--inbiz-color-*` 变量,
|
|
64
|
+
* 而 antd-mobile 用自己的 `--adm-*`。两者不打通时,同一页面上
|
|
65
|
+
* 「组件库的导航栏」与「antd-mobile 的列表项」会呈现两种主色。
|
|
66
|
+
*
|
|
67
|
+
* 只在变量缺失时才回退到平台默认色(var() 的第二参数),
|
|
68
|
+
* 这样平台运行时注入的主题(后插入的 <style>)依然优先生效。
|
|
69
|
+
*/
|
|
70
|
+
:root {
|
|
71
|
+
--adm-color-primary: var(--inbiz-color-primary, #1677ff);
|
|
72
|
+
--adm-color-success: var(--inbiz-color-success, #00b578);
|
|
73
|
+
--adm-color-warning: var(--inbiz-color-warning, #ff8f1f);
|
|
74
|
+
--adm-color-danger: var(--inbiz-color-danger, #ff3141);
|
|
75
|
+
--adm-color-text: var(--inbiz-color-text, #333);
|
|
76
|
+
--adm-color-text-secondary: var(--inbiz-color-text-secondary, #666);
|
|
77
|
+
--adm-color-weak: var(--inbiz-color-text-weak, #999);
|
|
78
|
+
--adm-color-border: var(--inbiz-color-border-base, #ebedf0);
|
|
79
|
+
--adm-color-background: var(--inbiz-color-bg, #fff);
|
|
80
|
+
--adm-color-box: var(--inbiz-color-bg-page, #f5f5f5);
|
|
81
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 框架骨架样式:只负责「区域怎么摆」。
|
|
3
|
+
*
|
|
4
|
+
* 区域内部长什么样由组件库自己的样式提供(wap 菜单、NavBar、TabBar 等)。
|
|
5
|
+
* 出码生成的 src/layout/*.tsx 会复用这里的类名;骨架未生成时
|
|
6
|
+
* src/provider/layout-host.tsx 的占位框架也用同一套类名。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
@import './adaptation.less';
|
|
10
|
+
|
|
11
|
+
.app-wap-shell {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
.viewport-height();
|
|
15
|
+
background: var(--adm-color-box, #f5f5f5);
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.app-wap-header {
|
|
20
|
+
flex: 0 0 auto;
|
|
21
|
+
.safe-top();
|
|
22
|
+
|
|
23
|
+
/* 顶栏高度与组件库 WapNavHeader 一致,避免内容区上下串位 */
|
|
24
|
+
height: 50px;
|
|
25
|
+
padding: 0 12px;
|
|
26
|
+
line-height: 50px;
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
color: var(--adm-color-text, #333);
|
|
30
|
+
background: var(--adm-color-background, #fff);
|
|
31
|
+
.hairline-b();
|
|
32
|
+
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.app-wap-content {
|
|
39
|
+
flex: 1 1 auto;
|
|
40
|
+
min-height: 0;
|
|
41
|
+
overflow-x: hidden;
|
|
42
|
+
overflow-y: auto;
|
|
43
|
+
|
|
44
|
+
/* 惯性滚动 + 独立滚动链,避免和 body 抢滚动 */
|
|
45
|
+
-webkit-overflow-scrolling: touch;
|
|
46
|
+
overscroll-behavior-y: contain;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 底部导航(出码生成的布局会用;antd-mobile 的 TabBar 也可直接套这个壳) */
|
|
50
|
+
.app-wap-tabbar {
|
|
51
|
+
flex: 0 0 auto;
|
|
52
|
+
background: var(--adm-color-background, #fff);
|
|
53
|
+
.hairline-t();
|
|
54
|
+
.safe-bottom();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ------------------------------------------------------------------ */
|
|
58
|
+
/* 状态页:登录校验、应用信息加载、页面占位。 */
|
|
59
|
+
/* 都走同一套居中布局,出码产物里的页面不必各自实现一套。 */
|
|
60
|
+
/* ------------------------------------------------------------------ */
|
|
61
|
+
|
|
62
|
+
.app-wap-status {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
.viewport-height();
|
|
68
|
+
padding: 0 calc(24 * @app-vw);
|
|
69
|
+
text-align: center;
|
|
70
|
+
background: var(--adm-color-background, #fff);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.app-wap-status-text {
|
|
74
|
+
margin-top: 12px;
|
|
75
|
+
font-size: 14px;
|
|
76
|
+
color: var(--adm-color-weak, #999);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.app-wap-status-hint {
|
|
80
|
+
margin: 8px 0 0;
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
line-height: 1.6;
|
|
83
|
+
color: var(--adm-color-weak, #999);
|
|
84
|
+
word-break: break-all;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.app-wap-empty {
|
|
88
|
+
padding: calc(48 * @app-vw) 24px;
|
|
89
|
+
font-size: 14px;
|
|
90
|
+
color: var(--adm-color-text-secondary, #666);
|
|
91
|
+
text-align: center;
|
|
92
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": [
|
|
5
|
+
"DOM",
|
|
6
|
+
"DOM.Iterable",
|
|
7
|
+
"ES2020"
|
|
8
|
+
],
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"strict": false,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"allowSyntheticDefaultImports": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"forceConsistentCasingInFileNames": false,
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"noEmit": true,
|
|
20
|
+
"baseUrl": ".",
|
|
21
|
+
"paths": {
|
|
22
|
+
"@components/*": [
|
|
23
|
+
"./node_modules/@macrowing/inbiz-components/core/components/*"
|
|
24
|
+
],
|
|
25
|
+
"@common/*": [
|
|
26
|
+
"./node_modules/@macrowing/inbiz-components/core/common/*"
|
|
27
|
+
],
|
|
28
|
+
"@custom/*": [
|
|
29
|
+
"../components/*"
|
|
30
|
+
],
|
|
31
|
+
"*": [
|
|
32
|
+
"node_modules/@types/*",
|
|
33
|
+
"node_modules/*"
|
|
34
|
+
],
|
|
35
|
+
"@inbiz/entry/locales/index": [
|
|
36
|
+
"./node_modules/@macrowing/inbiz-components/core/entry/locales/index"
|
|
37
|
+
],
|
|
38
|
+
"@/*": [
|
|
39
|
+
"src/*"
|
|
40
|
+
],
|
|
41
|
+
"@inbiz/containers/*": [
|
|
42
|
+
"./node_modules/@macrowing/inbiz-runtime/compat/*"
|
|
43
|
+
],
|
|
44
|
+
"@inbiz/render": [
|
|
45
|
+
"./node_modules/@macrowing/inbiz-runtime/compat/inbiz-render.tsx"
|
|
46
|
+
],
|
|
47
|
+
"@inbiz/core": [
|
|
48
|
+
"./node_modules/@macrowing/inbiz-runtime/compat/inbiz-core.tsx"
|
|
49
|
+
],
|
|
50
|
+
"@inbiz/react": [
|
|
51
|
+
"./node_modules/@macrowing/inbiz-runtime/compat/inbiz-react.tsx"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"include": [
|
|
56
|
+
"src/**/*",
|
|
57
|
+
".umirc.ts",
|
|
58
|
+
"typings.d.ts"
|
|
59
|
+
],
|
|
60
|
+
"exclude": [
|
|
61
|
+
"node_modules",
|
|
62
|
+
"dist",
|
|
63
|
+
"src/.umi",
|
|
64
|
+
"src/.umi-production"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare module '*.less' {
|
|
2
|
+
const content: { [className: string]: string };
|
|
3
|
+
export default content;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module '*.css' {
|
|
7
|
+
const content: { [className: string]: string };
|
|
8
|
+
export default content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module '*.css?inbiz-app-style' {
|
|
12
|
+
const css: string;
|
|
13
|
+
export default css;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module '*.svg' {
|
|
17
|
+
const content: string;
|
|
18
|
+
export default content;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module '*.png' {
|
|
22
|
+
const content: string;
|
|
23
|
+
export default content;
|
|
24
|
+
}
|