ソースを参照

fix(tslint): fix https://github.com/ant-design/ant-design/issues/34952

lind 3 年 前
コミット
cea3315457

+ 3 - 0
src/components/HeaderSearch/index.tsx

@@ -47,6 +47,7 @@ const HeaderSearch: React.FC<HeaderSearchProps> = (props) => {
   const inputClass = classNames(styles.input, {
     [styles.show]: searchMode,
   });
+  // @ts-ignore
   return (
     <div
       className={classNames(className, styles.headerSearch)}
@@ -70,11 +71,13 @@ const HeaderSearch: React.FC<HeaderSearchProps> = (props) => {
           cursor: 'pointer',
         }}
       />
+
       <AutoComplete
         key="AutoComplete"
         className={inputClass}
         value={value}
         options={restProps.options}
+        // @ts-ignore
         onChange={setValue}
       >
         <Input

+ 2 - 3
src/components/SearchComponent/index.tsx

@@ -355,8 +355,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   const handleHistory = (item: SearchHistory) => {
     const log = JSON.parse(item.content) as SearchTermsUI;
     form.setValues(log);
-    // @ts-ignore
-    setExpand(!(log.terms1?.length > 1 || log.terms2?.length > 1));
+    setExpand(!((log.terms1 && log.terms1?.length > 1) || (log.terms2 && log.terms2?.length > 1)));
   };
 
   const historyDom = (
@@ -413,7 +412,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     }
 
     return _value
-      .filter((i) => i.terms?.length > 0)
+      .filter((i) => i.terms && i.terms?.length > 0)
       .map((term) => {
         term.terms?.map((item) => {
           if (item.termType === 'like') {

+ 1 - 0
src/pages/device/Instance/Detail/Functions/form.tsx

@@ -46,6 +46,7 @@ export default (props: FunctionProps) => {
       case 'double':
         return <InputNumber style={{ width: '100%' }} placeholder={'请输入'} />;
       case 'date':
+        // @ts-ignore
         return <DatePicker style={{ width: '100%' }} />;
       default:
         return <Input placeholder={'请输入'} />;

+ 26 - 22
src/pages/device/Instance/Detail/MetadataLog/Property/index.tsx

@@ -68,6 +68,7 @@ const PropertyLog = (props: Props) => {
     }
   }, [visible]);
 
+  // @ts-ignore
   return (
     <Modal
       maskClosable={false}
@@ -110,28 +111,31 @@ const PropertyLog = (props: Props) => {
             <Radio.Button value="week">近一周</Radio.Button>
             <Radio.Button value="month">近一月</Radio.Button>
           </Radio.Group>
-          <DatePicker.RangePicker
-            value={dateValue}
-            showTime
-            onChange={(dates: any) => {
-              if (dates) {
-                setRadioValue(undefined);
-                setDateValue(dates);
-                const st = dates[0]?.valueOf();
-                const et = dates[1]?.valueOf();
-                setStart(st);
-                setEnd(et);
-                handleSearch(
-                  {
-                    pageSize: 10,
-                    pageIndex: 0,
-                  },
-                  st,
-                  et,
-                );
-              }
-            }}
-          />
+          {
+            // @ts-ignore
+            <DatePicker.RangePicker
+              value={dateValue}
+              showTime
+              onChange={(dates: any) => {
+                if (dates) {
+                  setRadioValue(undefined);
+                  setDateValue(dates);
+                  const st = dates[0]?.valueOf();
+                  const et = dates[1]?.valueOf();
+                  setStart(st);
+                  setEnd(et);
+                  handleSearch(
+                    {
+                      pageSize: 10,
+                      pageIndex: 0,
+                    },
+                    st,
+                    et,
+                  );
+                }
+              }}
+            />
+          }
         </Space>
       </div>