Skip to content

Commit

Permalink
Merge branch 'master' into migrate-to-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
rboixaderg committed Jan 20, 2024
2 parents 779797f + 0f6913b commit 43f66ab
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
0.25.2
------
- feat: use label property to render info in search inputs and to sort elements

0.25.1
------
- chore: export generic Messages

0.25.0
------
- feat: Add inputs search to editComponent
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.25.0",
"version": "0.25.2",
"repository": {
"type": "git",
"url": "[email protected]:guillotinaweb/guillotina_react.git"
Expand Down
7 changes: 2 additions & 5 deletions src/guillo-gmi/components/input/search_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const SearchInput = ({
const wrapperRef = React.useRef(null)
const { PageSize, SearchEngine } = useConfig()
const [valueLabel, setValueLabel] = useState(undefined)
const [isLoadingData, setIsLoadingData] = useState(false)
const [uid] = useState(generateUID('search_input'))

useClickAway(wrapperRef, () => {
Expand All @@ -85,7 +84,6 @@ export const SearchInput = ({

const inicializeLabels = async () => {
if (labelProperty !== 'id' && value) {
setIsLoadingData(true)
let searchTermQs = []
const searchTermParsed = [`id`, value]
const { get: getSearch } = traversal.registry
Expand Down Expand Up @@ -124,7 +122,6 @@ export const SearchInput = ({
return result
}, {})
setValueLabel(newValuesLabel)
setIsLoadingData(false)
}
}

Expand All @@ -143,7 +140,7 @@ export const SearchInput = ({
pageSize: PageSize,
withDepth: false,
})
let sortParsed = parser(`_sort_des=title`)
let sortParsed = parser(`_sort_des=${labelProperty}`)
let typeNameParsed = []
if (typeNameQuery) {
typeNameParsed = parser(`type_name__in=${typeNameQuery}`)
Expand Down Expand Up @@ -185,7 +182,7 @@ export const SearchInput = ({
if (renderTextItemOption) {
return renderTextItemOption(item)
}
return item.title || item['@name']
return get(item, labelProperty, item.title) || item['@name']
}

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/guillo-gmi/components/input/search_input_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const SearchInputList = ({
pageSize: PageSize,
withDepth: false,
})
let sortParsed = parser(`_sort_des=title`)
let sortParsed = parser(`_sort_des=${labelProperty}`)
let typeNameParsed = []
if (typeNameQuery) {
typeNameParsed = parser(`type_name__in=${typeNameQuery}`)
Expand Down Expand Up @@ -188,7 +188,7 @@ export const SearchInputList = ({
if (renderTextItemOption) {
return renderTextItemOption(item)
}
return item.title || item['@name']
return get(item, labelProperty, item.title) || item['@name']
}

React.useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/guillo-gmi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ export * from './views/folder'
export * from './views/item'
export * from './views/users'
export * from './views/groups'

export * from './locales/generic_messages'

0 comments on commit 43f66ab

Please sign in to comment.