Skip to content

Commit

Permalink
wip: create a style manager - filter/sorter (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Feb 21, 2025
1 parent 6813e8d commit d29949e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
8 changes: 7 additions & 1 deletion map/api/services/styles/styles.hooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import fuzzySearch from 'feathers-mongodb-fuzzy-search'
import { hooks as kdkCoreHooks } from '../../../../core/api/index.js'

export default {
before: {
all: [],
find: [],
find: [
fuzzySearch({ fields: ['name'] }),
kdkCoreHooks.diacriticSearch()
],
get: [],
create: [],
update: [],
Expand Down
15 changes: 4 additions & 11 deletions map/client/components/styles/KStyleManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import { computed, ref } from 'vue'
import _ from 'lodash'
import sift from 'sift'
import { KGrid } from '../../../../core/client/components'
import { Store, api } from '@kalisio/kdk/core.client'
import { Filter, Sorter, Store, api } from '@kalisio/kdk/core.client'
import KStyleEditor from './KStyleEditor.vue'
import { useCurrentActivity } from '../../composables/activity.js'
import { isLayerStyleEditable, editLayerStyle } from '../../utils/utils.layers.js'
Expand All @@ -86,21 +86,16 @@ defineProps({
// Data
const { getSelectedFeaturesByLayer, CurrentActivity } = useCurrentActivity()
const filter = Store.get('filter')
const styleEditor = ref(null)
const style = ref(null)
const viewMode = ref('list')
// Computed
const baseQuery = computed(() => {
// Filter the objets of type of table
const query = { }
return query
return Object.assign({}, Sorter.get().query)
})
const filterQuery = computed(() => {
const query = _.clone(filter.query)
// Filter the objects against the group
return query
return Object.assign({}, Filter.get().query)
})
const toolbar = computed(() => {
if (viewMode.value === 'edit') return []
Expand All @@ -111,9 +106,7 @@ const toolbar = computed(() => {
tooltip: 'KStyleManager.SORT',
options: [
{ icon: 'las la-sort-alpha-down', value: { field: 'name', order: 1 }, default: true },
{ icon: 'las la-sort-alpha-up', value: { field: 'name', order: -1 } },
{ icon: 'kdk:clockwise.png', value: { field: 'updatedAt', order: 1 } },
{ icon: 'kdk:anticlockwise.png', value: { field: 'updatedAt', order: -1 } }
{ icon: 'las la-sort-alpha-up', value: { field: 'name', order: -1 } }
]
},
{ component: 'collection/KFilter', style: 'max-width: 200px;' },
Expand Down

0 comments on commit d29949e

Please sign in to comment.