cm-reporting 0.8.5 → 0.8.6

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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ForwardRefExoticComponent } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
2
3
  import { ReactNode } from 'react';
3
4
  import { RefAttributes } from 'react';
4
5
  import { ThemeConfig } from 'antd';
@@ -157,7 +158,7 @@ declare function cirsGpmLegacyToInternal(input: unknown): {
157
158
  * CM 自定义 CSS 变量配置。
158
159
  * 用于覆盖 lib/variables.css 中定义的默认值。
159
160
  */
160
- declare interface CMCSSVariables {
161
+ export declare interface CMCSSVariables {
161
162
  /** 布局相关 */
162
163
  layout?: {
163
164
  /** 内容区域最大宽度 */
@@ -247,6 +248,36 @@ export declare interface CMReportingApi {
247
248
  validate: () => Promise<boolean>;
248
249
  }
249
250
 
251
+ /**
252
+ * CMReportingApp:主入口组件。
253
+ * 接收 templateType、versionId 作为 props,内部管理页面导航状态。
254
+ */
255
+ export declare function CMReportingApp({ templateType, versionId, readOnly, showPageActions, pageKey: controlledPageKey, onNavigatePage, maxContentWidth, integrations, children, }: CMReportingAppProps): JSX.Element;
256
+
257
+ /**
258
+ * CMReportingApp Props。
259
+ */
260
+ export declare interface CMReportingAppProps {
261
+ /** 模板类型 */
262
+ templateType: TemplateType;
263
+ /** 版本 ID */
264
+ versionId: string;
265
+ /** 全局只读模式 */
266
+ readOnly?: boolean;
267
+ /** 是否显示底部翻页操作(默认 true) */
268
+ showPageActions?: boolean;
269
+ /** 当前页面(受控模式) */
270
+ pageKey?: PageKey;
271
+ /** 页面导航回调(受控模式) */
272
+ onNavigatePage?: (pageKey: PageKey) => void;
273
+ /** 内容区域最大宽度(可选,不设置则填充父容器) */
274
+ maxContentWidth?: number;
275
+ /** 宿主扩展点:外部选择/回写列表等 */
276
+ integrations?: CMReportingIntegrations;
277
+ /** 插入点:用于对外门面组件做 snapshot/export 绑定(不作为 public API 承诺) */
278
+ children?: ReactNode;
279
+ }
280
+
250
281
  export declare interface CMReportingIntegrations {
251
282
  smelterList?: SmelterListIntegration;
252
283
  productList?: ProductListIntegration;
@@ -274,10 +305,16 @@ export declare interface CMReportingProps {
274
305
  fallback?: ReactNode;
275
306
  }
276
307
 
308
+ /**
309
+ * CMReportingProvider:顶层 Provider。
310
+ * 负责 i18n 初始化、Ant Design 配置和 Suspense 边界。
311
+ */
312
+ export declare function CMReportingProvider({ locale, onLocaleChange, theme, cssVariables, children, fallback, }: CMReportingProviderProps): JSX.Element;
313
+
277
314
  /**
278
315
  * CMReportingProvider Props。
279
316
  */
280
- declare interface CMReportingProviderProps {
317
+ export declare interface CMReportingProviderProps {
281
318
  /** 初始语言,默认 'en-US' */
282
319
  locale?: Locale;
283
320
  /** 语言变化回调 */
@@ -302,6 +339,17 @@ export declare interface CMReportingRef {
302
339
  validate: () => Promise<boolean>;
303
340
  }
304
341
 
342
+ /**
343
+ * CM 主题配置。
344
+ * 结合 Ant Design 主题和 CM 自定义 CSS 变量。
345
+ */
346
+ export declare interface CMThemeConfig {
347
+ /** Ant Design 主题配置 */
348
+ antd?: ThemeConfig;
349
+ /** CM 自定义 CSS 变量 */
350
+ cssVariables?: CMCSSVariables;
351
+ }
352
+
305
353
  /**
306
354
  * 导出接口类型:CompanyQuestionDef。
307
355
  */
@@ -1550,6 +1598,11 @@ declare const _default: {
1550
1598
  }
1551
1599
  };
1552
1600
 
1601
+ /**
1602
+ * 默认 Ant Design 主题配置。
1603
+ */
1604
+ export declare const defaultAntdTheme: ThemeConfig;
1605
+
1553
1606
  declare type DotNestedKeys<T> = T extends object ? {
1554
1607
  [K in keyof T & string]: T[K] extends Array<unknown> ? `${K}` : T[K] extends object ? `${K}` | `${K}.${DotNestedKeys<T[K]>}` : `${K}`;
1555
1608
  }[keyof T & string] : never;
@@ -1644,6 +1697,12 @@ declare function internalToCirsGpmLegacy(snapshot: ReportSnapshotV1, ctx: CirsGp
1644
1697
  */
1645
1698
  export declare type Locale = 'en-US' | 'zh-CN';
1646
1699
 
1700
+ /**
1701
+ * 合并主题配置。
1702
+ * 将用户提供的配置与默认配置深度合并。
1703
+ */
1704
+ export declare function mergeThemeConfig(customTheme?: ThemeConfig, defaultTheme?: ThemeConfig): ThemeConfig;
1705
+
1647
1706
  /**
1648
1707
  * 导出类型:MetalDropdownSource。
1649
1708
  */
package/dist/index.js CHANGED
@@ -13166,7 +13166,26 @@ const SN = {
13166
13166
  boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)",
13167
13167
  boxShadowSecondary: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"
13168
13168
  }
13169
- }, { useToken: CN } = sm, kN = [
13169
+ };
13170
+ function uI(e, t = SN) {
13171
+ return e ? {
13172
+ ...t,
13173
+ ...e,
13174
+ cssVar: {
13175
+ ...t.cssVar,
13176
+ ...e.cssVar
13177
+ },
13178
+ token: {
13179
+ ...t.token,
13180
+ ...e.token
13181
+ },
13182
+ components: {
13183
+ ...t.components,
13184
+ ...e.components
13185
+ }
13186
+ } : t;
13187
+ }
13188
+ const { useToken: CN } = sm, kN = [
13170
13189
  ["--app-bg-layout", "colorBgLayout"],
13171
13190
  ["--app-bg-container", "colorBgContainer"],
13172
13191
  ["--app-bg-elevated", "colorBgElevated"],
@@ -13905,7 +13924,7 @@ function jN({ children: e, cssVariables: t, fallback: n }) {
13905
13924
  function HN({
13906
13925
  locale: e = "en-US",
13907
13926
  onLocaleChange: t,
13908
- theme: n = SN,
13927
+ theme: n,
13909
13928
  cssVariables: o,
13910
13929
  children: r,
13911
13930
  fallback: i
@@ -15237,7 +15256,7 @@ const b_ = 1, w_ = Ar(["cmrt", "emrt", "crt", "amrt"]), v_ = Ar(["en-US", "zh-CN
15237
15256
  productList: $e(N_)
15238
15257
  })
15239
15258
  });
15240
- function uI(e) {
15259
+ function mI(e) {
15241
15260
  const t = __.parse(e), n = {};
15242
15261
  for (const [o, r] of Object.entries(t.data.companyInfo)) {
15243
15262
  if (o === "authorizationDate") {
@@ -15322,7 +15341,7 @@ function I_({
15322
15341
  [d, c, w, e, u, t]
15323
15342
  ), null;
15324
15343
  }
15325
- const mI = Wu(function({
15344
+ const dI = Wu(function({
15326
15345
  templateType: t,
15327
15346
  versionId: n,
15328
15347
  locale: o = "en-US",
@@ -15372,7 +15391,7 @@ const mI = Wu(function({
15372
15391
  }
15373
15392
  );
15374
15393
  });
15375
- function dI() {
15394
+ function pI() {
15376
15395
  const { meta: e, form: t, lists: n } = Ze(), { setFormData: o, validateForm: r } = en(), { locale: i } = ke(), s = fo(), a = Nt(() => ({
15377
15396
  schemaVersion: 1,
15378
15397
  templateType: e.templateType,
@@ -16163,7 +16182,7 @@ function tI(e) {
16163
16182
  if (e === "emrt") return 2;
16164
16183
  if (e === "amrt") return 3;
16165
16184
  }
16166
- const pI = {
16185
+ const fI = {
16167
16186
  parse: Qu,
16168
16187
  toInternal: ju,
16169
16188
  toExternal: Nl,
@@ -16204,12 +16223,16 @@ function nI(e, t) {
16204
16223
  return ju(o).ctx;
16205
16224
  }
16206
16225
  export {
16207
- mI as CMReporting,
16226
+ dI as CMReporting,
16227
+ gT as CMReportingApp,
16228
+ HN as CMReportingProvider,
16208
16229
  b_ as REPORT_SNAPSHOT_SCHEMA_VERSION,
16209
- pI as cirsGpmLegacyAdapter,
16230
+ fI as cirsGpmLegacyAdapter,
16231
+ SN as defaultAntdTheme,
16210
16232
  zu as exportToExcel,
16211
- uI as parseSnapshot,
16233
+ uI as mergeThemeConfig,
16234
+ mI as parseSnapshot,
16212
16235
  Fu as stringifySnapshot,
16213
- dI as useCMReporting
16236
+ pI as useCMReporting
16214
16237
  };
16215
16238
  //# sourceMappingURL=index.js.map