Browse Source

feat: enable search box for ace editor #412

Jacky 1 year ago
parent
commit
020a9ba2f2

+ 4 - 0
app/src/components/CodeEditor/CodeEditor.vue

@@ -1,7 +1,9 @@
 <script setup lang="ts">
 import { VAceEditor } from 'vue3-ace-editor'
 import 'ace-builds/src-noconflict/mode-nginx'
+import ace from 'ace-builds'
 import 'ace-builds/src-noconflict/theme-monokai'
+import extSearchboxUrl from 'ace-builds/src-noconflict/ext-searchbox?url'
 import { computed } from 'vue'
 
 const props = defineProps<{
@@ -21,6 +23,8 @@ const value = computed({
     emit('update:content', v)
   },
 })
+
+ace.config.setModuleUrl('ace/ext/searchbox', extSearchboxUrl)
 </script>
 
 <template>

+ 15 - 1
app/src/components/StdDesign/StdDataDisplay/StdTable.vue

@@ -141,12 +141,26 @@ watch(route, () => {
   params.trash = route.query.trash === 'true'
 })
 
+const filterParams = reactive({})
+
+watch(filterParams, () => {
+  Object.assign(params, {
+    ...filterParams,
+    page: 1,
+  })
+})
+
 onMounted(() => {
   if (!props.disableQueryParams) {
     Object.assign(params, {
       ...route.query,
       trash: route.query.trash === 'true',
     })
+
+    Object.assign(filterParams, {
+      ...route.query,
+      trash: route.query.trash === 'true',
+    })
   }
 
   get_list()
@@ -429,7 +443,7 @@ const paginationSize = computed(() => {
       v-if="!disableSearch && searchColumns.length"
       :key="updateFilter"
       :data-list="searchColumns"
-      :data-source="params"
+      :data-source="filterParams"
       type="search"
       layout="inline"
     >