@wecode-team/we0-cms 1.1.31 → 1.1.32

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 CHANGED
@@ -287,6 +287,7 @@ const siteConfigModel = {
287
287
  type: 'asset',
288
288
  comment: '网站 Logo',
289
289
  upload: {
290
+ assetKind: 'image',
290
291
  accept: 'image/*',
291
292
  maxSize: 2 * 1024 * 1024,
292
293
  directory: 'logos',
@@ -324,6 +325,7 @@ const siteConfigModel = {
324
325
  comment: "网站 Logo",
325
326
  required: false,
326
327
  upload: {
328
+ assetKind: "image",
327
329
  accept: "image/*",
328
330
  maxSize: 2 * 1024 * 1024,
329
331
  directory: "logos",
@@ -337,6 +339,7 @@ const siteConfigModel = {
337
339
  comment: "站点图标",
338
340
  required: false,
339
341
  upload: {
342
+ assetKind: "image",
340
343
  accept: ".ico,image/png,image/svg+xml",
341
344
  maxSize: 512 * 1024,
342
345
  directory: "favicons",
@@ -344,6 +347,20 @@ const siteConfigModel = {
344
347
  buttonText: "上传 favicon",
345
348
  },
346
349
  },
350
+ {
351
+ name: "terms_pdf",
352
+ type: "asset",
353
+ comment: "用户协议",
354
+ required: false,
355
+ upload: {
356
+ assetKind: "file",
357
+ accept: "application/pdf",
358
+ maxSize: 10 * 1024 * 1024,
359
+ directory: "docs",
360
+ placeholder: "请上传 PDF 文件",
361
+ buttonText: "上传 PDF",
362
+ },
363
+ },
347
364
  ],
348
365
  },
349
366
  }
@@ -353,6 +370,7 @@ const siteConfigModel = {
353
370
 
354
371
  | 字段 | 类型 | 说明 |
355
372
  |------|------|------|
373
+ | `assetKind` | `"auto" \| "image" \| "file"` | 预览模式。默认 `auto`,会先参考 `accept` 再根据 URL 推断;可强制按图片/文件模式展示 |
356
374
  | `accept` | `string` | 文件类型限制,等同于 `<input type="file" accept="...">` |
357
375
  | `maxSize` | `number` | 单文件大小限制,单位字节 |
358
376
  | `directory` | `string` | 透传给宿主上传函数的目录标识,CMS 不直接处理存储 |
@@ -3,6 +3,7 @@ import type { CmsModel, SchemaField } from "../../services";
3
3
  export declare function AssetUrlPreview(props: {
4
4
  url?: string | null;
5
5
  emptyText?: string;
6
+ mode?: "image" | "file";
6
7
  className?: string;
7
8
  }): React.JSX.Element;
8
9
  export declare function AssetUploadField(props: {