Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
227e2dbf
Commit
227e2dbf
authored
Feb 27, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
53dd0472
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
index.js
src/util/index.js
+7
-4
index.jsx
src/view/Manage/AssetDraft/index.jsx
+5
-5
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+4
-4
No files found.
src/util/index.js
View file @
227e2dbf
...
...
@@ -232,7 +232,7 @@ function highlightSearchContent(content) {
)
}
export
function
searchContentAddDecorate
(
content
,
terms
,
matchCount
=
0
)
{
export
function
searchContentAddDecorate
(
content
,
terms
,
matchCount
=
0
,
caseSensitive
=
false
)
{
if
(
!
content
||
content
===
''
)
return
''
;
if
((
terms
||
[]).
length
===
0
||
typeof
(
content
)
!==
'string'
)
return
content
;
...
...
@@ -241,7 +241,10 @@ export function searchContentAddDecorate(content, terms, matchCount=0) {
let
start
=
-
1
;
let
useTerm
=
''
;
terms
.
forEach
(
term
=>
{
const
index
=
content
.
indexOf
(
term
);
let
index
=
content
.
indexOf
(
term
);
if
(
caseSensitive
)
{
index
=
content
.
toLowerCase
().
indexOf
(
term
.
toLowerCase
())
}
if
(
index
!==
-
1
)
{
if
(
start
===
-
1
)
{
...
...
@@ -265,12 +268,12 @@ export function searchContentAddDecorate(content, terms, matchCount=0) {
return
content
;
}
export
function
highlightSearchContentByTerms
(
content
,
terms
)
{
export
function
highlightSearchContentByTerms
(
content
,
terms
,
caseSensitive
=
false
)
{
if
(
!
content
||
content
===
''
)
return
''
;
if
((
terms
||
[]).
length
===
0
||
typeof
(
content
)
!==
'string'
)
return
content
;
let
processContent
=
content
;
processContent
=
searchContentAddDecorate
(
processContent
,
terms
);
processContent
=
searchContentAddDecorate
(
processContent
,
terms
,
0
,
caseSensitive
);
return
highlightSearchContent
(
processContent
);
}
...
...
src/view/Manage/AssetDraft/index.jsx
View file @
227e2dbf
...
...
@@ -6,7 +6,7 @@ import { useDebounceEffect } from 'ahooks'
import
{
appId
}
from
"../../../App"
import
{
dispatch
}
from
'../../../model'
import
Table
from
'../ResizeableTable'
import
{
isSzseEnv
,
showMessage
}
from
"../../../util"
import
{
highlightSearchContentByTerms
,
isSzseEnv
,
showMessage
}
from
"../../../util"
import
{
AssetItem
}
from
"../AssetManage/Component/AssetTable"
import
UpdateAsset
from
"../AssetManage/Component/AssetDetailDrawer"
import
{
AssetDraftReference
}
from
"../../../util/constant"
...
...
@@ -92,7 +92,7 @@ const FC = (props) => {
return
(
<
Tooltip
title=
{
text
}
>
<
Typography
.
Text
ellipsis=
{
true
}
>
{
text
}
{
highlightSearchContentByTerms
(
text
,
[
keyword
??
''
],
true
)
}
</
Typography
.
Text
>
</
Tooltip
>
);
...
...
@@ -141,7 +141,7 @@ const FC = (props) => {
return
(
<
Tooltip
title=
{
text
}
>
<
Typography
.
Text
ellipsis=
{
true
}
>
{
text
}
{
highlightSearchContentByTerms
(
text
,
[
keyword
??
''
],
true
)
}
</
Typography
.
Text
>
</
Tooltip
>
);
...
...
@@ -164,7 +164,7 @@ const FC = (props) => {
metadata
=
text
;
}
return
(
<
AssetItem
metadata=
{
metadata
}
/>
<
AssetItem
metadata=
{
metadata
}
terms=
{
[
keyword
??
''
]
}
/>
);
}
}
...
...
@@ -201,7 +201,7 @@ const FC = (props) => {
return
[[
pathCol
,
...
newColumns
,
...
fixedCols
]
,
newTableData
,
data
?.
total
??
0
]
},
[
filterElements
,
data
,
loadingFilterElements
,
users
,
fixedCols
])
},
[
filterElements
,
data
,
loadingFilterElements
,
users
,
fixedCols
,
keyword
,
pathCol
])
const
getAdmin
=
()
=>
{
dispatch
({
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
227e2dbf
...
...
@@ -82,7 +82,7 @@ export const AssetItem = (props) => {
</
div
>
}
>
<
Text
ellipsis=
{
true
}
>
{
highlightSearchContentByTerms
(
content
,
terms
)
}
{
highlightSearchContentByTerms
(
content
,
terms
,
true
)
}
</
Text
>
</
Tooltip
>
);
...
...
@@ -410,7 +410,7 @@ const AssetTable = (props) => {
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
Text
ellipsis=
{
true
}
>
{
highlightSearchContentByTerms
(
text
,
[
keyword
]
)
}
{
highlightSearchContentByTerms
(
text
,
[
keyword
??
''
],
true
)
}
</
Text
>
</
Tooltip
>
);
...
...
@@ -440,7 +440,7 @@ const AssetTable = (props) => {
params
.
render
=
(
metadata
,
_
)
=>
{
return
(
<
AssetItem
metadata=
{
metadata
}
terms=
{
[
keyword
]
}
/>
<
AssetItem
metadata=
{
metadata
}
terms=
{
[
keyword
??
''
]
}
/>
);
}
...
...
@@ -456,7 +456,7 @@ const AssetTable = (props) => {
event
.
dirId
=
record
.
dirId
||
''
;
window
?.
dispatchEvent
(
event
);
}
}
>
{
highlightSearchContentByTerms
(
text
,
[
keyword
]
)
}
{
highlightSearchContentByTerms
(
text
,
[
keyword
??
''
],
true
)
}
</
a
>
</
Text
>
</
Tooltip
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment