Browse Source

fix(web): 修复合同区域依赖选择项的占位文字回显

sy 1 giờ trước cách đây
mục cha
commit
468c9355ef

+ 1 - 1
web-scaffold/src/components/CustomerTeamSelect.tsx

@@ -18,5 +18,5 @@ export function CustomerTeamSelect({ options, value, onChange, disabled = false,
   const current = options.find((item) => item.id === value);
   const summary = current?.name ?? emptyLabel;
   function pick(id: string) { onChange(id); details.current?.removeAttribute("open"); }
-  return <details ref={details} className={`customer-team-multi${disabled ? " is-disabled" : ""}`}><summary aria-label={`运维团队:${current?.name ?? "未选择"}`} aria-disabled={disabled || undefined} title={summary} onClick={(event) => { if (disabled) event.preventDefault(); }}><span>{summary}</span><ChevronDown size={15} /></summary><div className="customer-team-multi-options"><div className="customer-team-multi-head"><span>只能选择 1 支运维团队</span></div>{options.map((item) => <label key={item.id}><input type="radio" name={groupName} checked={item.id === value} disabled={disabled} onChange={() => pick(item.id)} /><span>{item.name}</span>{item.hint && <small>{item.hint}</small>}</label>)}{!options.length && <p>当前范围暂无可选团队</p>}</div></details>;
+  return <details ref={details} className={`customer-team-multi${disabled ? " is-disabled" : ""}${!current ? " is-placeholder" : ""}`}><summary aria-label={`运维团队:${current?.name ?? "未选择"}`} aria-disabled={disabled || undefined} title={summary} onClick={(event) => { if (disabled) event.preventDefault(); }}><span>{summary}</span><ChevronDown size={15} /></summary><div className="customer-team-multi-options"><div className="customer-team-multi-head"><span>只能选择 1 支运维团队</span></div>{options.map((item) => <label key={item.id}><input type="radio" name={groupName} checked={item.id === value} disabled={disabled} onChange={() => pick(item.id)} /><span>{item.name}</span>{item.hint && <small>{item.hint}</small>}</label>)}{!options.length && <p>当前范围暂无可选团队</p>}</div></details>;
 }

+ 5 - 0
web-scaffold/src/styles/contract-editor.css

@@ -68,6 +68,11 @@
   font: 400 var(--type-support)/1.5 var(--font-sans);
 }
 .contract-editor select[data-placeholder="true"] option { color: var(--foreground); }
+.contract-editor select[data-placeholder="true"]:not(:open) option:checked {
+  color: var(--border-hover);
+  font: 400 var(--type-support)/1.5 var(--font-sans);
+}
+.contract-editor .customer-team-multi.is-placeholder > summary > span { color: var(--border-hover); }
 .contract-editor :is(input, select, textarea):focus-visible {
   outline: none;
   border-color: var(--ring);