openxiangda 1.0.18 → 1.0.20

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.
@@ -127,6 +127,13 @@ interface PageDataSourceDescriptor {
127
127
  defaultFilter?: SearchExpression | string;
128
128
  [key: string]: unknown;
129
129
  }
130
+ type CustomPageEntryMode = "app-shell" | "plain-page";
131
+ interface CustomPageEntryConfig {
132
+ mode?: CustomPageEntryMode | string;
133
+ hidePlatformNav?: boolean;
134
+ defaultRoute?: string;
135
+ [key: string]: unknown;
136
+ }
130
137
  interface PageInfo {
131
138
  id: string;
132
139
  code: string;
@@ -138,6 +145,7 @@ interface PageInfo {
138
145
  status: string;
139
146
  props: Record<string, unknown>;
140
147
  route: Record<string, unknown> | object;
148
+ entry?: CustomPageEntryConfig;
141
149
  dataSources: PageDataSourceDescriptor[];
142
150
  capabilities: Record<string, unknown>;
143
151
  version?: string;
@@ -164,6 +172,8 @@ interface PageNavigationApi {
164
172
  */
165
173
  pushPage(pageKey: string, query?: Record<string, unknown>): void;
166
174
  replacePage(pageKey: string, query?: Record<string, unknown>): void;
175
+ pushRoute(route: string, query?: Record<string, unknown>): void;
176
+ replaceRoute(route: string, query?: Record<string, unknown>): void;
167
177
  updateQuery(query: Record<string, unknown>): void;
168
178
  setHash(hash: string): void;
169
179
  back(): void;
@@ -856,4 +866,4 @@ declare const usePageRoute: () => PageRouteInfo;
856
866
 
857
867
  declare const usePageSdk: () => PageSdk;
858
868
 
859
- export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type FieldPermissionDto, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationMessageRecord, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
869
+ export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type FieldPermissionDto, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationMessageRecord, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
@@ -127,6 +127,13 @@ interface PageDataSourceDescriptor {
127
127
  defaultFilter?: SearchExpression | string;
128
128
  [key: string]: unknown;
129
129
  }
130
+ type CustomPageEntryMode = "app-shell" | "plain-page";
131
+ interface CustomPageEntryConfig {
132
+ mode?: CustomPageEntryMode | string;
133
+ hidePlatformNav?: boolean;
134
+ defaultRoute?: string;
135
+ [key: string]: unknown;
136
+ }
130
137
  interface PageInfo {
131
138
  id: string;
132
139
  code: string;
@@ -138,6 +145,7 @@ interface PageInfo {
138
145
  status: string;
139
146
  props: Record<string, unknown>;
140
147
  route: Record<string, unknown> | object;
148
+ entry?: CustomPageEntryConfig;
141
149
  dataSources: PageDataSourceDescriptor[];
142
150
  capabilities: Record<string, unknown>;
143
151
  version?: string;
@@ -164,6 +172,8 @@ interface PageNavigationApi {
164
172
  */
165
173
  pushPage(pageKey: string, query?: Record<string, unknown>): void;
166
174
  replacePage(pageKey: string, query?: Record<string, unknown>): void;
175
+ pushRoute(route: string, query?: Record<string, unknown>): void;
176
+ replaceRoute(route: string, query?: Record<string, unknown>): void;
167
177
  updateQuery(query: Record<string, unknown>): void;
168
178
  setHash(hash: string): void;
169
179
  back(): void;
@@ -856,4 +866,4 @@ declare const usePageRoute: () => PageRouteInfo;
856
866
 
857
867
  declare const usePageSdk: () => PageSdk;
858
868
 
859
- export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type FieldPermissionDto, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationMessageRecord, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
869
+ export { type ApiPermissionListParams, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type FieldPermissionDto, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type NotificationChannel, type NotificationMessageRecord, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type ProcessApproveAction, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RoleListParams, type RoleUsersParams, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createPageSdk, createReactPage, useCurrentUser, useDataSource, useFormViewPermissions, useMessage, useModal, useNavigation, usePageContext, usePageProps, usePageRoute, usePageSdk };
@@ -66,6 +66,7 @@ export function buildDirectPagePublishPayload(config, pages) {
66
66
  code: page.config.code,
67
67
  name: page.config.name,
68
68
  description: page.config.description || "",
69
+ entry: page.config.entry || {},
69
70
  route: page.config.route,
70
71
  props: page.config.props || {},
71
72
  dataSources: page.config.dataSources || [],
@@ -1,7 +1,9 @@
1
- import { describe, expect, it } from "vitest";
1
+ import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+
4
+ import { describe, expect, it, vi } from "vitest";
2
5
 
3
6
  import { getFormBundleUrl, getPageAssetUrl } from "./load-config.mjs";
4
- import { discoverPages } from "./pages.mjs";
5
7
  import { buildDirectPagePublishPayload } from "./register-payload.mjs";
6
8
 
7
9
  const config = {
@@ -25,10 +27,47 @@ const config = {
25
27
 
26
28
  describe("register payload helpers", () => {
27
29
  it("discovers publishable code pages", async () => {
28
- const pages = await discoverPages("customer-dashboard");
30
+ const workspaceRoot = await mkdtemp(
31
+ join(process.cwd(), ".tmp-openxiangda-pages-test-"),
32
+ );
33
+ const previousWorkspaceRoot = process.env.LOWCODE_WORKSPACE_ROOT;
34
+
35
+ try {
36
+ const pageDir = join(workspaceRoot, "src/pages/customer-dashboard");
37
+ await mkdir(pageDir, { recursive: true });
38
+ await writeFile(join(pageDir, "index.tsx"), "export {};\n", "utf8");
39
+ await writeFile(
40
+ join(pageDir, "App.tsx"),
41
+ "export default function App() { return null; }\n",
42
+ "utf8",
43
+ );
44
+ await writeFile(
45
+ join(pageDir, "page.config.ts"),
46
+ `export default {
47
+ code: "customer-dashboard",
48
+ name: "客户经营看板",
49
+ route: { pathKey: "customer-dashboard" },
50
+ };
51
+ `,
52
+ "utf8",
53
+ );
54
+
55
+ process.env.LOWCODE_WORKSPACE_ROOT = workspaceRoot;
56
+ vi.resetModules();
57
+ const { discoverPages } = await import("./pages.mjs");
58
+ const pages = await discoverPages("customer-dashboard");
29
59
 
30
- expect(pages).toHaveLength(1);
31
- expect(pages[0].config.code).toBe("customer-dashboard");
60
+ expect(pages).toHaveLength(1);
61
+ expect(pages[0].config.code).toBe("customer-dashboard");
62
+ } finally {
63
+ if (previousWorkspaceRoot === undefined) {
64
+ delete process.env.LOWCODE_WORKSPACE_ROOT;
65
+ } else {
66
+ process.env.LOWCODE_WORKSPACE_ROOT = previousWorkspaceRoot;
67
+ }
68
+ vi.resetModules();
69
+ await rm(workspaceRoot, { recursive: true, force: true });
70
+ }
32
71
  });
33
72
 
34
73
  it("builds stable form and page asset URLs from one build id", () => {
@@ -46,6 +85,11 @@ describe("register payload helpers", () => {
46
85
  config: {
47
86
  code: "customer-dashboard",
48
87
  name: "客户经营看板",
88
+ entry: {
89
+ mode: "app-shell",
90
+ hidePlatformNav: true,
91
+ defaultRoute: "home",
92
+ },
49
93
  route: { pathKey: "customer-dashboard" },
50
94
  props: { title: "客户经营看板" },
51
95
  dataSources: [],
@@ -56,6 +100,11 @@ describe("register payload helpers", () => {
56
100
  expect(payload.pages[0].runtime.entryUrl).toBe(
57
101
  "https://bucket.oss-cn-hangzhou.aliyuncs.com/lowcode/app-workspace/dev/1.2.3/BUILD_001/pages/customer-dashboard/index.js",
58
102
  );
103
+ expect(payload.pages[0].entry).toEqual({
104
+ mode: "app-shell",
105
+ hidePlatformNav: true,
106
+ defaultRoute: "home",
107
+ });
59
108
  expect(JSON.stringify(payload)).not.toMatch(/manifest/i);
60
109
  });
61
110
 
@@ -26,6 +26,42 @@ export interface AppWorkspaceConfig {
26
26
  };
27
27
  }
28
28
 
29
+ export type CustomPageEntryMode = "app-shell" | "plain-page";
30
+
31
+ export interface CustomPageEntryConfig {
32
+ mode?: CustomPageEntryMode | string;
33
+ hidePlatformNav?: boolean;
34
+ defaultRoute?: string;
35
+ }
36
+
37
+ export interface CustomPageConfig {
38
+ code: string;
39
+ name: string;
40
+ description?: string;
41
+ publish?: boolean;
42
+ route?: {
43
+ pathKey?: string;
44
+ allowQueryKeys?: string[];
45
+ allowHash?: boolean;
46
+ subRouteMode?: "hash" | "memory" | string;
47
+ defaultQuery?: Record<string, unknown>;
48
+ };
49
+ entry?: CustomPageEntryConfig;
50
+ props?: Record<string, unknown>;
51
+ dataSources?: Array<Record<string, unknown>>;
52
+ menu?: {
53
+ enabled?: boolean;
54
+ name?: string;
55
+ parentId?: string | null;
56
+ icon?: string | null;
57
+ };
58
+ cssIsolation?: "namespace" | "shadow" | "none";
59
+ }
60
+
29
61
  export function defineAppWorkspaceConfig<T extends AppWorkspaceConfig>(config: T): T {
30
62
  return config;
31
63
  }
64
+
65
+ export function definePageConfig<T extends CustomPageConfig>(config: T): T {
66
+ return config;
67
+ }