openxiangda 1.0.35 → 1.0.37
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 +12 -0
- package/lib/cli.js +44 -4
- package/lib/workspace-bootstrap.js +238 -0
- package/openxiangda-skills/SKILL.md +43 -4
- package/openxiangda-skills/references/component-guide.md +10 -11
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +348 -0
- package/openxiangda-skills/references/style-system.md +14 -18
- package/openxiangda-skills/references/troubleshooting.md +13 -13
- package/openxiangda-skills/skills/openxiangda-app/SKILL.md +18 -2
- package/openxiangda-skills/skills/openxiangda-core/SKILL.md +37 -1
- package/openxiangda-skills/skills/openxiangda-form/SKILL.md +37 -2
- package/openxiangda-skills/skills/openxiangda-inspect/SKILL.md +26 -2
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +38 -4
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +19 -2
- package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +26 -2
- package/package.json +1 -1
- package/packages/sdk/dist/runtime/index.cjs +67 -30
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +67 -30
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/styles/antd-theme.cjs +11 -3
- package/packages/sdk/dist/styles/antd-theme.cjs.map +1 -1
- package/packages/sdk/dist/styles/antd-theme.d.mts +2 -1
- package/packages/sdk/dist/styles/antd-theme.d.ts +2 -1
- package/packages/sdk/dist/styles/antd-theme.mjs +11 -3
- package/packages/sdk/dist/styles/antd-theme.mjs.map +1 -1
- package/packages/sdk/dist/styles/tailwind-preset.cjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.cjs.map +1 -1
- package/packages/sdk/dist/styles/tailwind-preset.d.mts +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.d.ts +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.mjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.mjs.map +1 -1
- package/packages/sdk/dist/styles/tokens.css +1 -0
- package/packages/sdk/src/build-source/scripts/build-forms.mjs +135 -50
- package/packages/sdk/src/build-source/scripts/build-pages.mjs +37 -10
- package/packages/sdk/src/build-source/scripts/register.mjs +2 -0
- package/packages/sdk/src/build-source/scripts/utils/load-config.mjs +3 -2
- package/packages/sdk/src/build-source/scripts/utils/register-payload.test.ts +2 -1
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +9 -7
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.test.ts +6 -4
- package/packages/sdk/src/build-source/src/cli.mjs +17 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-form.mdc +20 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-page.mdc +19 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +28 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-workflow-automation.mdc +21 -0
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda.mdc +47 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-form.md +34 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-page.md +37 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +46 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-workflow-automation.md +46 -0
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda.md +47 -0
- package/templates/sy-lowcode-app-workspace/AGENTS.md +92 -0
- package/templates/sy-lowcode-app-workspace/app-workspace.config.ts +3 -3
- package/templates/sy-lowcode-app-workspace/package.json +7 -0
- package/templates/sy-lowcode-app-workspace/postcss.config.cjs +0 -15
- package/templates/sy-lowcode-app-workspace/scripts/guard-publish.mjs +29 -0
- package/templates/sy-lowcode-app-workspace/src/main.tsx +1 -12
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: openxiangda-page
|
|
3
|
-
description: Build
|
|
3
|
+
description: Build / edit / publish OpenXiangda custom code pages in `sy-lowcode-app-workspace/src/pages/<pageCode>/` using React + Ant Design + `openxiangda/runtime`. Covers app-shell portals, dashboards, workbenches, data-management lists, mobile portals, page-level connector calls, and single-page publish. Trigger on 创建页面 / 新建页面 / 修改页面 / portal / dashboard / 看板 / 驾驶舱 / 工作台 / 列表页 / mobile portal / app-shell / page.config.ts / pageCode / src/pages, JSX / React / Ant Design page work in this workspace, or any change to `src/pages/<code>/`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenXiangda Page
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## When to use this skill
|
|
9
|
+
|
|
10
|
+
- User wants to **create / edit a custom code page** under `src/pages/<pageCode>/` (portal, dashboard, list/detail, workbench, mobile portal, etc.).
|
|
11
|
+
- User wants to **publish only a page** (`workspace publish --page <code>`) or rebuild a single page bundle.
|
|
12
|
+
- User asks about page SDK (`openxiangda/runtime`), `page.config.ts`, app-shell entry mode, namespace/style isolation, ECharts, drag-drop, antd icons, or named imports from `@ant-design/icons`.
|
|
13
|
+
- User asks about **portal / admin console / mobile portal entry** — these must be app-shell code pages.
|
|
14
|
+
|
|
15
|
+
## Quick recipe
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# 1. preflight
|
|
19
|
+
openxiangda env --profile <name>
|
|
20
|
+
openxiangda page list --profile <name>
|
|
21
|
+
|
|
22
|
+
# 2. edit source under src/pages/<pageCode>/
|
|
23
|
+
# page.config.ts (entry mode, route, navigation), domain/, shared/services/, shared/hooks/, components/, styles.css
|
|
24
|
+
|
|
25
|
+
# 3. preview + publish single page
|
|
26
|
+
openxiangda workspace publish --profile <name> --page <pageCode> --dry-run
|
|
27
|
+
openxiangda workspace publish --profile <name> --page <pageCode>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## DO / DO NOT
|
|
31
|
+
|
|
32
|
+
- ✅ Formal user-facing entries (admin console / PC portal / mobile portal) MUST be app-shell pages: `entry: { mode: "app-shell", hidePlatformNav: true, defaultRoute: "<home>" }` in `page.config.ts`.
|
|
33
|
+
- ✅ Default to **native Tailwind utilities** for new pages (`bg-white`, `border-slate-200`, `grid-cols-[240px_1fr]`, ...) and `cssIsolation: "none"`. Keep namespace/shadow only for explicit legacy compatibility.
|
|
34
|
+
- ✅ Split complex pages into `domain/`, `shared/services/`, `shared/hooks/`, `components/`, route/config files, `styles.css` (see `references/best-practices.md` and `references/architecture-patterns.md`).
|
|
35
|
+
- ✅ List/detail/CRUD pages: follow `DataManagementList` pattern from `references/architecture-patterns.md`. Pagination + structured `filterGroup` + `OR`. Never fetch huge `pageSize` and filter in browser.
|
|
36
|
+
- ✅ For external APIs use `src/resources/connectors/<code>.json` + `sdk.connector.invoke()`; for joined read-only queries use `src/resources/data-views/<code>.json`.
|
|
37
|
+
- ❌ Single-file giant pages. Split per `references/best-practices.md`.
|
|
38
|
+
- ❌ Hardcoded `/view/...&isRenderNav=false` URLs scattered through page code; use the runtime navigation helper.
|
|
39
|
+
- ❌ shadcn token classes like `bg-card` / `text-muted-foreground` / `text-foreground` unless explicitly configured.
|
|
40
|
+
- ❌ Embed a single `FormProvider` field component temporarily; navigate to a full standard form page or render a complete `StandardFormPage` instead.
|
|
41
|
+
- ❌ Reuse one form UI for both PC and mobile without verifying overlay / picker / bottom-sheet behavior on both viewports.
|
|
42
|
+
- ❌ Hardcode notification or platform API URLs; use `openxiangda/runtime` and `src/resources/notifications/` declarations.
|
|
9
43
|
|
|
10
44
|
## CLI Flow
|
|
11
45
|
|
|
@@ -60,7 +94,7 @@ Read these references only when editing page code:
|
|
|
60
94
|
- `../../references/pages/page-sdk.md`
|
|
61
95
|
- `../../references/notifications.md` — notification resources and `sdk.notification` usage. Read before adding reminders, alerts, or message templates to a page.
|
|
62
96
|
- `../../references/pages/publish-flow.md`
|
|
63
|
-
- `../../references/style-system.md` —
|
|
97
|
+
- `../../references/style-system.md` — style isolation defaults, Tailwind/CSS guidance, and legacy namespace compatibility. Read before writing substantial page CSS or Tailwind classes.
|
|
64
98
|
- `../../references/architecture-patterns.md` — CRUD data flow, `DataManagementList` pattern, and recommended `src/pages/<pageCode>/` layout. Read before scaffolding a new page or list view.
|
|
65
99
|
- `../../references/component-guide.md` — when to pick platform components, raw Ant Design, or custom components. Read before introducing a new component.
|
|
66
100
|
- `../../references/troubleshooting.md` — known failure modes (missing styles, `options` runtime errors, broken option rendering, etc.) and their fixes. Read when something does not behave as expected.
|
|
@@ -83,7 +117,7 @@ Read these references only when editing page code:
|
|
|
83
117
|
- Do not scatter hardcoded `/view/...&isRenderNav=false` URLs through page code. Use the runtime navigation API or the local route helper generated for the app shell.
|
|
84
118
|
- Platform menus should bind only the formal app-shell code page for user-facing entry points. Original forms, workflows, and native view pages may remain as development / maintenance resources or permission targets, but should not become the product navigation shell.
|
|
85
119
|
- For prod, explicitly run with `--profile prod`; never rely on the current profile for release operations.
|
|
86
|
-
- Follow the style system in `../../references/style-system.md`: default to native Tailwind utilities and arbitrary values for business pages (`bg-white`, `border`, `border-slate-200`, `text-slate-600`, `grid-cols-[240px_1fr]`, etc.).
|
|
120
|
+
- Follow the style system in `../../references/style-system.md`: default to native Tailwind utilities and arbitrary values for business pages (`bg-white`, `border`, `border-slate-200`, `text-slate-600`, `grid-cols-[240px_1fr]`, etc.). New pages default to `cssIsolation: "none"` and do not need `.sy-app-workspace`; keep namespace/shadow handling only for legacy pages that explicitly configure it. Do not treat platform token classes as the default authoring pattern, and do not use shadcn token classes such as `bg-card`, `text-muted-foreground`, or `text-foreground` unless the workspace explicitly configures them.
|
|
87
121
|
- For list / detail / CRUD pages, follow `../../references/architecture-patterns.md` (e.g. `DataManagementList`) before writing custom data-fetching loops.
|
|
88
122
|
- Query pages must use pagination with structured conditions. Do not fetch a large `pageSize` and filter in the browser; avoid default `searchKeyWord`, and build multi-field fuzzy search with explicit `filterGroup` + `OR`.
|
|
89
123
|
- Pick components per `../../references/component-guide.md`: prefer the platform component, fall back to Ant Design, and only build a custom component when neither fits.
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: openxiangda-permission-settings
|
|
3
|
-
description: Manage OpenXiangda app roles, page permission groups, form permission groups, and
|
|
3
|
+
description: Manage OpenXiangda app **roles** (角色), **page permission groups** (页面权限组 / 菜单可见), **form permission groups** (表单权限组 / 提交 / 查看 / 字段权限 / 数据范围 / 数据隔离), and **form settings** (表单设置 / 索引 / 数据管理页 / 公开访问 / public access / 分享) with profile-isolated IDs and ordinary user token permissions. Trigger on 角色 / role / 权限 / permission / 数据范围 / data scope / 字段权限 / field permission / 菜单可见 / menu visibility / 公开访问 / public access / 分享 / share, or any work touching `permission ...` / `settings ...` CLI commands or `src/resources/{roles,pagePermissionGroups,formPermissionGroups,formSettings}/`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenXiangda Permission And Settings
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## When to use this skill
|
|
9
|
+
|
|
10
|
+
- User wants to **define / modify roles** for the app.
|
|
11
|
+
- User wants to **gate menu / page visibility** (page permission groups).
|
|
12
|
+
- User wants to **gate form submit / view / edit / data scope / field permissions** (form permission groups).
|
|
13
|
+
- User wants to **publish a form publicly** or change form runtime settings, indexes, data-management page config.
|
|
14
|
+
- User asks about **dynamic role governance** (role maintenance form synced to platform via automation).
|
|
15
|
+
|
|
16
|
+
## DO / DO NOT
|
|
17
|
+
|
|
18
|
+
- ✅ Use logical role / group codes locally; live IDs go under the active profile in `.openxiangda/state.json`.
|
|
19
|
+
- ✅ For dynamic multi-role apps, build a role maintenance form + automation/JS_CODE sync, not hardcoded role logic in page code.
|
|
20
|
+
- ✅ For permission scope keys, derive hidden scalars (`collegeScopeKey`, `classScopeKey`, `ownerDeptScopeKey`, `ownerUserScopeKey`, `roleCode`) via `valueSync` from visible select/person/department fields.
|
|
21
|
+
- ✅ Use page permission groups for entry visibility, form permission groups for real data isolation with condition-based data permissions.
|
|
22
|
+
- ❌ Expose raw ID text fields to users for permission scopes.
|
|
23
|
+
- ❌ Store platform-specific public-access IDs locally; CLI resolves by `appType + formUuid` per profile.
|
|
24
|
+
- ❌ Reuse role / permission-group IDs across profiles.
|
|
25
|
+
- ❌ Use AK/SK or legacy `/dingtalk-api/v1.0` — the logged-in user must have the matching app permission.
|
|
9
26
|
|
|
10
27
|
## Required Context
|
|
11
28
|
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: openxiangda-workflow-automation
|
|
3
|
-
description: Build
|
|
3
|
+
description: Build / validate / publish / enable / inspect OpenXiangda **workflows** (审批流程 / approval / approve / reject / transfer / withdraw, v3 graph, JS_CODE trusted_node) and **automations** (自动化 / 集成 / 定时任务 / cron / form data submit/update/delete events, form field change, workflow task / process events, message notifications). Includes architecture boundary between workflow and normal status-machine forms, code-first workflows (`src/workflows/<code>/workflow.ts`) and code-first automations (`src/automations/<code>/index.ts`). Trigger on 审批 / 流程 / workflow / approval / process / 节点 / 并行分支 / 条件分支 / 代办 / 转交 / 撤回 / 驳回 / 自动化 / automation / cron / 定时 / 提交后 / 字段变更 / JS_CODE / trusted_node / src/js-code-nodes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenXiangda Workflow And Automation
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## When to use this skill
|
|
9
|
+
|
|
10
|
+
- User asks for **approval workflows / 审批 / 流程 / approve / reject / transfer / withdraw / process records / approval-node side effects**.
|
|
11
|
+
- User asks for **automation / 自动化 / cron / 定时 / form-data-submitted/updated/deleted / field-changed / workflow-task-approved / message notification triggers**.
|
|
12
|
+
- User asks for **JS_CODE backend script** (cross-form query, batch update, terminate process, external HTTP, complex orchestration that frontend can't handle).
|
|
13
|
+
- User wants **code-first workflow / automation** (TypeScript source under `src/workflows/` or `src/automations/`).
|
|
14
|
+
|
|
15
|
+
## Boundary — workflow vs. status field
|
|
16
|
+
|
|
17
|
+
**Most business lifecycle flows are NOT workflows.** For ordinary `pending → processing → resolved → closed`, use a normal form + `status` field + responsibility fields + action-log form + state machine + automation/JS_CODE.
|
|
18
|
+
|
|
19
|
+
Create a workflow only when the scenario has **real approval semantics**: approvers, approval tasks, agree/reject actions, opinions, node-level field permissions, process records, approval-node side effects.
|
|
20
|
+
|
|
21
|
+
## DO / DO NOT
|
|
22
|
+
|
|
23
|
+
- ✅ New AI-authored automations: prefer **code-first** `automation_code_ts` (`src/automations/<code>/index.ts` + `definition.code.json` + `preview.json`).
|
|
24
|
+
- ✅ New AI-authored workflows that don't need canvas editing: prefer **code-first** `src/workflows/<code>/workflow.ts` using `openxiangda/workflow`.
|
|
25
|
+
- ✅ JS_CODE V2 trusted_node: source in TypeScript under `sy-lowcode-app-workspace/src/js-code-nodes/<scriptCode>/index.ts`. Run `pnpm build-js-code --script <code>` (validates with `tsc` first).
|
|
26
|
+
- ✅ Use `trigger_v2` for new automation triggers; CLI fills root `appType` / `formUuid` from active profile when `--form-code` is provided.
|
|
27
|
+
- ✅ Use logical `workflowCode` / `automationCode` locally; live IDs are profile-isolated under `.openxiangda/state.json`.
|
|
28
|
+
- ✅ `ctx.logger.debug/info/warn/error(message, data?)` at every important step — inspect via `automation executions` / `automation logs` / `automation diagnose`.
|
|
29
|
+
- ❌ JS_CODE for simple UI interactions, ordinary form validation, or display-only logic — those belong to a normal React code page.
|
|
30
|
+
- ❌ Workflow definitions for non-approval status changes — use a status field instead.
|
|
31
|
+
- ❌ Copy `workflowId` / `automationId` across profiles. Always create/bind separately for each profile.
|
|
32
|
+
- ❌ Inline large JS code blobs in v3 JSON for new work — use trusted_node TypeScript snapshots.
|
|
9
33
|
|
|
10
34
|
## Architecture Boundary
|
|
11
35
|
|
package/package.json
CHANGED
|
@@ -1279,8 +1279,7 @@ var PageProvider = ({
|
|
|
1279
1279
|
};
|
|
1280
1280
|
|
|
1281
1281
|
// packages/sdk/src/styles/antd-theme.ts
|
|
1282
|
-
var
|
|
1283
|
-
cssVar: { prefix: "sy-ant" },
|
|
1282
|
+
var baseTheme = {
|
|
1284
1283
|
hashed: false,
|
|
1285
1284
|
token: {
|
|
1286
1285
|
colorPrimary: "#1677ff",
|
|
@@ -1308,6 +1307,14 @@ var antdTheme = {
|
|
|
1308
1307
|
Card: { paddingLG: 24 }
|
|
1309
1308
|
}
|
|
1310
1309
|
};
|
|
1310
|
+
var antdTheme = {
|
|
1311
|
+
...baseTheme,
|
|
1312
|
+
cssVar: { prefix: "ant" }
|
|
1313
|
+
};
|
|
1314
|
+
var legacyAntdTheme = {
|
|
1315
|
+
...baseTheme,
|
|
1316
|
+
cssVar: { prefix: "sy-ant" }
|
|
1317
|
+
};
|
|
1311
1318
|
|
|
1312
1319
|
// packages/sdk/src/runtime/react/createReactPage.tsx
|
|
1313
1320
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -1328,6 +1335,21 @@ var MESSAGE_METHODS = [
|
|
|
1328
1335
|
var createRuntimeRoot = (el) => {
|
|
1329
1336
|
return (0, import_client2.createRoot)(el);
|
|
1330
1337
|
};
|
|
1338
|
+
var normalizeCssIsolation = (value) => {
|
|
1339
|
+
if (value === "namespace" || value === "shadow") return value;
|
|
1340
|
+
return "none";
|
|
1341
|
+
};
|
|
1342
|
+
var usesLegacyCssIsolation = (cssIsolation) => cssIsolation === "namespace" || cssIsolation === "shadow";
|
|
1343
|
+
var getRuntimeCssIsolation = (context) => normalizeCssIsolation(context.page?.capabilities?.cssIsolation);
|
|
1344
|
+
var getAntdRuntimeOptions = (cssIsolation) => {
|
|
1345
|
+
const legacy = usesLegacyCssIsolation(cssIsolation);
|
|
1346
|
+
return {
|
|
1347
|
+
prefixCls: legacy ? "sy-ant" : "ant",
|
|
1348
|
+
iconPrefixCls: legacy ? "sy-anticon" : "anticon",
|
|
1349
|
+
messagePrefixCls: legacy ? "sy-ant-message" : "ant-message",
|
|
1350
|
+
theme: legacy ? legacyAntdTheme : antdTheme
|
|
1351
|
+
};
|
|
1352
|
+
};
|
|
1331
1353
|
var isShadowRoot = (rootNode) => typeof ShadowRoot !== "undefined" && rootNode instanceof ShadowRoot;
|
|
1332
1354
|
var getStyleContainer = (el) => {
|
|
1333
1355
|
const rootNode = el.getRootNode?.();
|
|
@@ -1356,14 +1378,19 @@ var getRuntimeOverlayContainer = (el, portalContainer) => {
|
|
|
1356
1378
|
getTargetContainer: () => getRuntimeRoot(el)
|
|
1357
1379
|
};
|
|
1358
1380
|
};
|
|
1359
|
-
var createAntdConfig = (overlayContainer) =>
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1381
|
+
var createAntdConfig = (overlayContainer, cssIsolation) => {
|
|
1382
|
+
const antdOptions = getAntdRuntimeOptions(cssIsolation);
|
|
1383
|
+
return {
|
|
1384
|
+
locale: import_zh_CN.default,
|
|
1385
|
+
prefixCls: antdOptions.prefixCls,
|
|
1386
|
+
iconPrefixCls: antdOptions.iconPrefixCls,
|
|
1387
|
+
theme: antdOptions.theme,
|
|
1388
|
+
...usesLegacyCssIsolation(cssIsolation) ? {
|
|
1389
|
+
getPopupContainer: overlayContainer.getPopupContainer,
|
|
1390
|
+
getTargetContainer: overlayContainer.getTargetContainer
|
|
1391
|
+
} : {}
|
|
1392
|
+
};
|
|
1393
|
+
};
|
|
1367
1394
|
var createPortalContainer = (el) => {
|
|
1368
1395
|
const rootNode = el.getRootNode?.();
|
|
1369
1396
|
const parent = isShadowRoot(rootNode) ? rootNode : el.ownerDocument?.body || document.body;
|
|
@@ -1413,11 +1440,12 @@ var registerAntdMessageApi = (api) => {
|
|
|
1413
1440
|
}
|
|
1414
1441
|
};
|
|
1415
1442
|
};
|
|
1416
|
-
var installRuntimePortalContainer = (el) => {
|
|
1443
|
+
var installRuntimePortalContainer = (el, cssIsolation) => {
|
|
1417
1444
|
const globalScope = globalThis;
|
|
1418
|
-
const portalContainer = createPortalContainer(el);
|
|
1445
|
+
const portalContainer = usesLegacyCssIsolation(cssIsolation) ? createPortalContainer(el) : null;
|
|
1419
1446
|
const stack = Array.isArray(globalScope[PORTAL_CONTAINER_STACK_GLOBAL]) ? globalScope[PORTAL_CONTAINER_STACK_GLOBAL] : [];
|
|
1420
|
-
|
|
1447
|
+
const stackTarget = portalContainer ?? el.ownerDocument?.body ?? document.body;
|
|
1448
|
+
stack.push(stackTarget);
|
|
1421
1449
|
globalScope[PORTAL_CONTAINER_STACK_GLOBAL] = stack;
|
|
1422
1450
|
globalScope[PORTAL_CONTAINER_RESOLVER_GLOBAL] = () => {
|
|
1423
1451
|
for (let index = stack.length - 1; index >= 0; index -= 1) {
|
|
@@ -1431,42 +1459,43 @@ var installRuntimePortalContainer = (el) => {
|
|
|
1431
1459
|
return {
|
|
1432
1460
|
container: portalContainer,
|
|
1433
1461
|
release: () => {
|
|
1434
|
-
const position = stack.lastIndexOf(
|
|
1462
|
+
const position = stack.lastIndexOf(stackTarget);
|
|
1435
1463
|
if (position >= 0) {
|
|
1436
1464
|
stack.splice(position, 1);
|
|
1437
1465
|
}
|
|
1438
|
-
portalContainer
|
|
1466
|
+
portalContainer?.remove();
|
|
1439
1467
|
}
|
|
1440
1468
|
};
|
|
1441
1469
|
};
|
|
1442
|
-
var installAntdStaticHolder = (el, portalContainer) => {
|
|
1470
|
+
var installAntdStaticHolder = (el, portalContainer, cssIsolation) => {
|
|
1443
1471
|
installAntdMessageProxy();
|
|
1472
|
+
const antdOptions = getAntdRuntimeOptions(cssIsolation);
|
|
1444
1473
|
const getMessageContainer = () => {
|
|
1445
1474
|
if (portalContainer?.isConnected) return portalContainer;
|
|
1446
|
-
return getRuntimeRoot(el);
|
|
1475
|
+
return usesLegacyCssIsolation(cssIsolation) ? getRuntimeRoot(el) : document.body;
|
|
1447
1476
|
};
|
|
1448
1477
|
import_antd.ConfigProvider.config({
|
|
1449
|
-
prefixCls:
|
|
1450
|
-
iconPrefixCls:
|
|
1451
|
-
theme:
|
|
1478
|
+
prefixCls: antdOptions.prefixCls,
|
|
1479
|
+
iconPrefixCls: antdOptions.iconPrefixCls,
|
|
1480
|
+
theme: antdOptions.theme,
|
|
1452
1481
|
holderRender: (children) => {
|
|
1453
1482
|
if (!el.isConnected) {
|
|
1454
1483
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1455
1484
|
import_antd.ConfigProvider,
|
|
1456
1485
|
{
|
|
1457
|
-
prefixCls:
|
|
1458
|
-
iconPrefixCls:
|
|
1459
|
-
theme:
|
|
1486
|
+
prefixCls: antdOptions.prefixCls,
|
|
1487
|
+
iconPrefixCls: antdOptions.iconPrefixCls,
|
|
1488
|
+
theme: antdOptions.theme,
|
|
1460
1489
|
children
|
|
1461
1490
|
}
|
|
1462
1491
|
);
|
|
1463
1492
|
}
|
|
1464
1493
|
const overlayContainer = getRuntimeOverlayContainer(el, portalContainer);
|
|
1465
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_cssinjs.StyleProvider, { hashPriority: "high", container: getStyleContainer(el), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.ConfigProvider, { ...createAntdConfig(overlayContainer), children }) });
|
|
1494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_cssinjs.StyleProvider, { hashPriority: "high", container: getStyleContainer(el), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.ConfigProvider, { ...createAntdConfig(overlayContainer, cssIsolation), children }) });
|
|
1466
1495
|
}
|
|
1467
1496
|
});
|
|
1468
1497
|
import_antd.message.config({
|
|
1469
|
-
prefixCls:
|
|
1498
|
+
prefixCls: antdOptions.messagePrefixCls,
|
|
1470
1499
|
getContainer: getMessageContainer
|
|
1471
1500
|
});
|
|
1472
1501
|
};
|
|
@@ -1484,20 +1513,27 @@ var createReactPage = (AppComponent) => {
|
|
|
1484
1513
|
let currentContainer = null;
|
|
1485
1514
|
let releasePortalContainer = null;
|
|
1486
1515
|
let portalContainer = null;
|
|
1516
|
+
let currentCssIsolation = null;
|
|
1487
1517
|
const render = (el, context) => {
|
|
1488
|
-
|
|
1489
|
-
if (
|
|
1518
|
+
const cssIsolation = getRuntimeCssIsolation(context);
|
|
1519
|
+
if (usesLegacyCssIsolation(cssIsolation)) {
|
|
1520
|
+
el.classList.add(NAMESPACE_ROOT_CLASS);
|
|
1521
|
+
} else {
|
|
1522
|
+
el.classList.remove(NAMESPACE_ROOT_CLASS);
|
|
1523
|
+
}
|
|
1524
|
+
if (!root || currentContainer !== el || currentCssIsolation !== cssIsolation || usesLegacyCssIsolation(cssIsolation) && !portalContainer?.isConnected) {
|
|
1490
1525
|
root?.unmount();
|
|
1491
1526
|
releasePortalContainer?.();
|
|
1492
1527
|
root = createRuntimeRoot(el);
|
|
1493
1528
|
currentContainer = el;
|
|
1494
|
-
|
|
1529
|
+
currentCssIsolation = cssIsolation;
|
|
1530
|
+
const portalHandle = installRuntimePortalContainer(el, cssIsolation);
|
|
1495
1531
|
portalContainer = portalHandle.container;
|
|
1496
1532
|
releasePortalContainer = portalHandle.release;
|
|
1497
1533
|
}
|
|
1498
1534
|
const overlayContainer = getRuntimeOverlayContainer(el, portalContainer);
|
|
1499
|
-
installAntdStaticHolder(el, portalContainer);
|
|
1500
|
-
const antdConfig = createAntdConfig(overlayContainer);
|
|
1535
|
+
installAntdStaticHolder(el, portalContainer, cssIsolation);
|
|
1536
|
+
const antdConfig = createAntdConfig(overlayContainer, cssIsolation);
|
|
1501
1537
|
root.render(
|
|
1502
1538
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_cssinjs.StyleProvider, { hashPriority: "high", container: getStyleContainer(el), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.ConfigProvider, { ...antdConfig, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.App, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RuntimeMessageBridge, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PageProvider, { context, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppComponent, {}) }) }) }) }) })
|
|
1503
1539
|
);
|
|
@@ -1516,6 +1552,7 @@ var createReactPage = (AppComponent) => {
|
|
|
1516
1552
|
currentContainer = null;
|
|
1517
1553
|
releasePortalContainer = null;
|
|
1518
1554
|
portalContainer = null;
|
|
1555
|
+
currentCssIsolation = null;
|
|
1519
1556
|
}
|
|
1520
1557
|
};
|
|
1521
1558
|
};
|