visuddhinanda пре 1 година
родитељ
комит
4c06b079c4

+ 3 - 2
dashboard/src/components/template/Wbw/WbwDetailCase.tsx

@@ -19,7 +19,7 @@ interface IWidget {
 const WbwDetailCaseWidget = ({ data, readonly = false, onChange }: IWidget) => {
   const inlineDict = useAppSelector(_inlineDict);
   const intl = useIntl();
-
+  console.debug("readonly", readonly);
   return (
     <div style={{ display: "flex", width: "100%" }}>
       <SelectCase
@@ -32,6 +32,7 @@ const WbwDetailCaseWidget = ({ data, readonly = false, onChange }: IWidget) => {
         }}
       />
       <Dropdown
+        trigger={readonly ? [] : ["click"]}
         menu={{
           items: data.real.value
             ? caseInDict(
@@ -50,7 +51,7 @@ const WbwDetailCaseWidget = ({ data, readonly = false, onChange }: IWidget) => {
         }}
         placement="bottomRight"
       >
-        <Button type="text" icon={<MoreOutlined />} />
+        <Button disabled={readonly} type="text" icon={<MoreOutlined />} />
       </Dropdown>
     </div>
   );

+ 6 - 2
dashboard/src/components/template/Wbw/WbwDetailFm.tsx

@@ -133,6 +133,7 @@ const WbwFactorMeaningItem = ({
     />
   ) : (
     <Button
+      disabled={readonly}
       key={1}
       size="small"
       type="text"
@@ -145,7 +146,7 @@ const WbwFactorMeaningItem = ({
     </Button>
   );
 
-  return editable ? (
+  return editable || readonly ? (
     meaningInner
   ) : (
     <Dropdown
@@ -265,6 +266,7 @@ const WbwDetailFmWidget = ({
                 {factors[index]?.split("-").map((item1, index1) => {
                   return (
                     <WbwFactorMeaningItem
+                      readonly={readonly}
                       key={index1}
                       pali={item1}
                       meaning={fm[index1]}
@@ -291,11 +293,12 @@ const WbwDetailFmWidget = ({
                 })}
 
                 {index < currValue.length - 1 ? (
-                  <PlusOutlined key={`icon-${index}`} />
+                  <PlusOutlined disabled={readonly} key={`icon-${index}`} />
                 ) : (
                   <>
                     <Tooltip title="在文本框中编辑">
                       <Button
+                        disabled={readonly}
                         key="EditOutlined"
                         size="small"
                         type="text"
@@ -305,6 +308,7 @@ const WbwDetailFmWidget = ({
                     </Tooltip>
                     <Tooltip title="合并后替换含义">
                       <Button
+                        disabled={readonly}
                         key="CheckOutlined"
                         size="small"
                         type="text"