Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
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
Vũ Hoàng Anh
canifa_note
Commits
407d1cdc
Unverified
Commit
407d1cdc
authored
Nov 13, 2022
by
Zeng1998
Committed by
GitHub
Nov 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add visibility filter (#461)
* feat: add visibility filter * update
parent
cb50bbc3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
2 deletions
+46
-2
CreateShortcutDialog.tsx
web/src/components/CreateShortcutDialog.tsx
+2
-0
filter.ts
web/src/helpers/filter.ts
+34
-0
filter.d.ts
web/src/types/filter.d.ts
+10
-2
No files found.
web/src/components/CreateShortcutDialog.tsx
View file @
407d1cdc
...
@@ -173,6 +173,8 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn
...
@@ -173,6 +173,8 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn
const
valueDataSource
=
const
valueDataSource
=
type
===
"TYPE"
type
===
"TYPE"
?
filterConsts
[
"TYPE"
].
values
.
map
(({
text
,
value
})
=>
({
text
:
t
(
text
),
value
}))
?
filterConsts
[
"TYPE"
].
values
.
map
(({
text
,
value
})
=>
({
text
:
t
(
text
),
value
}))
:
type
===
"VISIBILITY"
?
filterConsts
[
"VISIBILITY"
].
values
.
map
(({
text
,
value
})
=>
({
text
:
t
(
text
),
value
}))
:
tags
.
sort
().
map
((
t
)
=>
{
:
tags
.
sort
().
map
((
t
)
=>
{
return
{
text
:
t
,
value
:
t
};
return
{
text
:
t
,
value
:
t
};
});
});
...
...
web/src/helpers/filter.ts
View file @
407d1cdc
...
@@ -73,6 +73,34 @@ export const filterConsts = {
...
@@ -73,6 +73,34 @@ export const filterConsts = {
},
},
],
],
},
},
VISIBILITY
:
{
text
:
"Visibility"
,
value
:
"VISIBILITY"
,
operators
:
[
{
text
:
"filter.operator.is"
,
value
:
"IS"
,
},
{
text
:
"filter.operator.is-not"
,
value
:
"IS_NOT"
,
},
],
values
:
[
{
text
:
"memo.visibility.public"
,
value
:
"PUBLIC"
,
},
{
text
:
"memo.visibility.protected"
,
value
:
"PROTECTED"
,
},
{
text
:
"memo.visibility.private"
,
value
:
"PRIVATE"
,
},
],
},
};
};
export
const
memoSpecialTypes
=
filterConsts
[
"TYPE"
].
values
;
export
const
memoSpecialTypes
=
filterConsts
[
"TYPE"
].
values
;
...
@@ -173,6 +201,12 @@ export const checkShouldShowMemo = (memo: Memo, filter: Filter) => {
...
@@ -173,6 +201,12 @@ export const checkShouldShowMemo = (memo: Memo, filter: Filter) => {
}
else
{
}
else
{
return
memo
.
displayTs
>
dayjs
(
value
).
valueOf
();
return
memo
.
displayTs
>
dayjs
(
value
).
valueOf
();
}
}
}
else
if
(
type
===
"VISIBILITY"
)
{
let
matched
=
memo
.
visibility
===
value
;
if
(
operator
===
"IS_NOT"
)
{
matched
=
!
matched
;
}
shouldShow
=
matched
;
}
}
return
shouldShow
;
return
shouldShow
;
...
...
web/src/types/filter.d.ts
View file @
407d1cdc
...
@@ -41,6 +41,14 @@ interface DisplayTimeFilter extends BaseFilter {
...
@@ -41,6 +41,14 @@ interface DisplayTimeFilter extends BaseFilter {
};
};
}
}
type
FilterType
=
"TEXT"
|
"TYPE"
|
"TAG"
|
"DISPLAY_TIME"
;
interface
VisibilityFilter
extends
BaseFilter
{
type
:
"VISIBILITY"
;
value
:
{
operator
:
"IS"
|
"IS_NOT"
;
value
:
string
;
};
}
type
FilterType
=
"TEXT"
|
"TYPE"
|
"TAG"
|
"DISPLAY_TIME"
|
"VISIBILITY"
;
type
Filter
=
BaseFilter
|
TagFilter
|
TypeFilter
|
TextFilter
|
DisplayTimeFilter
;
type
Filter
=
BaseFilter
|
TagFilter
|
TypeFilter
|
TextFilter
|
DisplayTimeFilter
|
VisibilityFilter
;
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