Browse Source

required={!hasChannel}

visuddhinanda 2 years ago
parent
commit
4f54fef73b
1 changed files with 6 additions and 9 deletions
  1. 6 9
      dashboard/src/components/term/TermEdit.tsx

+ 6 - 9
dashboard/src/components/term/TermEdit.tsx

@@ -298,6 +298,11 @@ const TermEditWidget = ({
         />
         />
         <ProFormDependency name={["channel"]}>
         <ProFormDependency name={["channel"]}>
           {({ channel }) => {
           {({ channel }) => {
+            const hasChannel = channel
+              ? channel.length === 0 || channel[0] === ""
+                ? false
+                : true
+              : false;
             let noChange = true;
             let noChange = true;
             if (!channel || channel.length === 0 || channel[0] === "") {
             if (!channel || channel.length === 0 || channel[0] === "") {
               if (!channelId || channelId === null || channelId === "") {
               if (!channelId || channelId === null || channelId === "") {
@@ -314,15 +319,7 @@ const TermEditWidget = ({
             }
             }
             return (
             return (
               <Space>
               <Space>
-                <LangSelect
-                  disabled={
-                    channel
-                      ? channel.length === 0 || channel[0] === ""
-                        ? false
-                        : true
-                      : false
-                  }
-                />
+                <LangSelect disabled={hasChannel} required={!hasChannel} />
                 <ProFormSelect
                 <ProFormSelect
                   initialValue={"move"}
                   initialValue={"move"}
                   name="copy"
                   name="copy"