Blame view

美国版/Food Labeling Management Platform/src/lib/formDialogLayout.ts 1.74 KB
923d50c0   杨鑫   更新bug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  import type { CSSProperties } from "react";
  
  /**
   * 新增/编辑弹框:50% 宽、70vh 高;中间区域滚动。
   * 使用 grid 三行(与 DialogContent 默认 display:grid 一致),避免 flex 被覆盖后高度失效。
   */
  export const FORM_DIALOG_CONTENT_CLASS =
    "form-dialog-shell sm:max-w-none w-[min(50%,calc(100vw-2rem))] max-w-[min(50%,calc(100vw-2rem))] gap-0 overflow-hidden p-0 grid-rows-[auto_minmax(0,1fr)_auto]";
  
  export const FORM_DIALOG_CONTENT_STYLE: CSSProperties = {
    display: "grid",
    height: "70vh",
    maxHeight: "70vh",
    minHeight: 0,
    width: "50%",
    maxWidth: "min(50%, calc(100vw - 2rem))",
    overflow: "hidden",
    padding: 0,
    boxSizing: "border-box",
  };
  
  export const FORM_DIALOG_HEADER_CLASS =
    "shrink-0 space-y-2 px-6 pt-6 pr-14 pb-2 text-center sm:text-left min-h-0";
  
  export const FORM_DIALOG_SCROLL_BODY_CLASS =
    "form-dialog-scroll-body min-h-0 overflow-y-auto overflow-x-hidden overscroll-contain px-6 pb-4";
  
  export const FORM_DIALOG_FOOTER_CLASS =
    "shrink-0 gap-2 border-t border-gray-100 bg-background px-6 py-4 sm:flex-row sm:justify-end min-h-0";
  
fdce24a6   杨鑫   修改bug
31
32
33
34
35
36
37
38
39
  /** 删除/确认类小弹框:固定适中宽度,避免 w-full 撑满主内容区 */
  export const CONFIRM_DIALOG_CONTENT_CLASS =
    "sm:max-w-none w-[min(26rem,calc(100vw-2rem))] max-w-[min(26rem,calc(100vw-2rem))]";
  
  /** 禁止点击遮罩或按 Esc 关闭弹框(仅 X / Cancel 等显式操作可关) */
  export function preventDialogDismissOnOverlay(event: { preventDefault: () => void }) {
    event.preventDefault();
  }
  
923d50c0   杨鑫   更新bug
40
41
42
43
44
  /** 弹框内 Button Image 上传区边长(px) */
  export const FORM_DIALOG_IMAGE_UPLOAD_SIZE_PX = 120;
  
  /** 弹框内 Button Image 上传区 class(配合 boxSizePx 使用) */
  export const FORM_DIALOG_IMAGE_UPLOAD_BOX_CLASS = "shrink-0";