-
{{ column.title }}
diff --git a/packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue b/packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue
index 419351a332..6a25439393 100644
--- a/packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue
+++ b/packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue
@@ -31,35 +31,6 @@ const icon = computed(() => {
}
return GenericIcon
})
-
-/*
-*
-
- mdi-math-integral
-
-
-
- mdi-table-column-plus-before
-
-
- mdi-table-column-plus-before
-
-
- mdi-table-column-plus-before
-
-
-
-
- {{ rollupIcon }}
-
-
- {{ rollupIcon }}
-
-
- {{ rollupIcon }}
-
-
-* */
diff --git a/packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilter.vue b/packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilter.vue
index 969e9cb902..d3047452c6 100644
--- a/packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilter.vue
+++ b/packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilter.vue
@@ -3,7 +3,7 @@ import { UITypes } from 'nocodb-sdk'
import FieldListAutoCompleteDropdown from './FieldListAutoCompleteDropdown.vue'
import { useNuxtApp } from '#app'
import { inject } from '#imports'
-import { comparisonOp } from '~/utils/filterUtils'
+import { comparisonOpList } from '~/utils/filterUtils'
import { ActiveViewInj, MetaInj, ReloadViewDataHookInj } from '~/components'
import useViewFilters from '~/composables/useViewFilters'
import MdiDeleteIcon from '~icons/mdi/close-box'
@@ -28,7 +28,7 @@ const filterUpdateCondition = (filter, i) => {
})
}
-// todo
+// todo : filter based on type
// const filterComparisonOp = (f) =>
// comparisonOp.filter((op) => {
// // if (
@@ -69,311 +69,6 @@ watch(
},
{ immediate: true },
)
-
-/* import { UITypes, getUIDTIcon } from '~/components/project/spreadsheet/helpers/uiTypes'
-import FieldListAutoCompleteDropdown from '~/components/project/spreadsheet/components/FieldListAutoCompleteDropdown'
-
-export default {
- name: 'ColumnFilter',
- components: {
- FieldListAutoCompleteDropdown,
- },
- props: {
- fieldList: [Array],
- meta: Object,
- nested: Boolean,
- parentId: String,
- viewId: String,
- shared: Boolean,
- webHook: Boolean,
- hookId: String,
- },
- data: () => ({
- filters: [],
- opList: [
- 'is equal',
- 'is not equal',
- 'is like',
- 'is not like',
- // 'is empty', 'is not empty',
- 'is null',
- 'is not null',
- '>',
- '<',
- '>=',
- '<=',
- ],
- comparisonOp: [
- {
- text: 'is equal',
- value: 'eq',
- },
- {
- text: 'is not equal',
- value: 'neq',
- },
- {
- text: 'is like',
- value: 'like',
- },
- {
- text: 'is not like',
- value: 'nlike',
- },
- {
- text: 'is empty',
- value: 'empty',
- ignoreVal: true,
- },
- {
- text: 'is not empty',
- value: 'notempty',
- ignoreVal: true,
- },
- {
- text: 'is null',
- value: 'null',
- ignoreVal: true,
- },
- {
- text: 'is not null',
- value: 'notnull',
- ignoreVal: true,
- },
- {
- text: '>',
- value: 'gt',
- },
- {
- text: '<',
- value: 'lt',
- },
- {
- text: '>=',
- value: 'gte',
- },
- {
- text: '<=',
- value: 'lte',
- },
- ],
- }),
- computed: {
- columnIcon() {
- return this.meta.columns.reduce((iconsObj, c) => {
- return { ...iconsObj, [c.title]: getUIDTIcon(c.uidt) }
- }, {})
- },
- columnsById() {
- return (this.columns || []).reduce((o, c) => ({ ...o, [c.id]: c }), {})
- },
- autoApply() {
- return this.$store.state.settings.autoApplyFilter && !this.webHook
- },
- columns() {
- return (
- this.meta &&
- this.meta.columns
- .filter((c) => c && (!c.colOptions || !c.system))
- .map((c) => ({
- ...c,
- icon: getUIDTIcon(c.uidt),
- }))
- )
- },
- types() {
- if (!this.meta || !this.meta.columns || !this.meta.columns.length) {
- return {}
- }
-
- return this.meta.columns.reduce((obj, col) => {
- switch (col.uidt) {
- case UITypes.Number:
- case UITypes.Decimal:
- obj[col.title] = obj[col.column_name] = 'number'
- break
- case UITypes.Checkbox:
- obj[col.title] = obj[col.column_name] = 'boolean'
- break
- default:
- break
- }
- return obj
- }, {})
- },
- },
- watch: {
- async viewId(v) {
- if (v) {
- await this.loadFilter()
- }
- },
- filters: {
- handler(v) {
- this.$emit('input', v && v.filter((f) => (f.fk_column_id && f.comparison_op) || f.is_group))
- },
- deep: true,
- },
- },
- created() {
- this.loadFilter()
- },
- methods: {
- filterComparisonOp(f) {
- return this.comparisonOp.filter((op) => {
- if (
- f &&
- f.fk_column_id &&
- this.columnsById[f.fk_column_id] &&
- this.columnsById[f.fk_column_id].uidt === UITypes.LinkToAnotherRecord &&
- this.columnsById[f.fk_column_id].uidt === UITypes.Lookup
- ) {
- return !['notempty', 'empty', 'notnull', 'null'].includes(op.value)
- }
- return true
- })
- },
- async applyChanges(nested = false, { hookId } = {}) {
- for (const [i, filter] of Object.entries(this.filters)) {
- if (filter.status === 'delete') {
- if (this.hookId || hookId) {
- await this.$api.dbTableFilter.delete(filter.id)
- } else {
- await this.$api.dbTableFilter.delete(filter.id)
- }
- } else if (filter.status === 'update') {
- if (filter.id) {
- if (this.hookId || hookId) {
- await this.$api.dbTableFilter.update(filter.id, {
- ...filter,
- fk_parent_id: this.parentId,
- })
- } else {
- await this.$api.dbTableFilter.update(filter.id, {
- ...filter,
- fk_parent_id: this.parentId,
- })
- }
- } else if (this.hookId || hookId) {
- this.$set(
- this.filters,
- i,
- await this.$api.dbTableWebhookFilter.create(this.hookId || hookId, {
- ...filter,
- fk_parent_id: this.parentId,
- }),
- )
- } else {
- this.$set(
- this.filters,
- i,
- await this.$api.dbTableFilter.create(this.viewId, {
- ...filter,
- fk_parent_id: this.parentId,
- }),
- )
- }
- }
- }
- if (this.$refs.nestedFilter) {
- for (const nestedFilter of this.$refs.nestedFilter) {
- await nestedFilter.applyChanges(true)
- }
- }
- this.loadFilter()
- if (!nested) {
- this.$emit('updated')
- }
- },
- async loadFilter() {
- let filters = []
- if (this.viewId && this._isUIAllowed('filterSync')) {
- filters = this.parentId
- ? await this.$api.dbTableFilter.childrenRead(this.parentId)
- : await this.$api.dbTableFilter.read(this.viewId)
- }
- if (this.hookId && this._isUIAllowed('filterSync')) {
- filters = this.parentId
- ? await this.$api.dbTableFilter.childrenRead(this.parentId)
- : await this.$api.dbTableWebhookFilter.read(this.hookId)
- }
-
- this.filters = filters
- },
- addFilter() {
- this.filters.push({
- fk_column_id: null,
- comparison_op: 'eq',
- value: '',
- status: 'update',
- logical_op: 'and',
- })
- this.filters = this.filters.slice()
- this.$e('a:filter:add', { length: this.filters.length })
- },
- addFilterGroup() {
- this.filters.push({
- parentId: this.parentId,
- is_group: true,
- status: 'update',
- })
- this.filters = this.filters.slice()
- const index = this.filters.length - 1
- this.saveOrUpdate(this.filters[index], index)
- },
- filterUpdateCondition(filter, i) {
- this.saveOrUpdate(filter, i)
- this.$e('a:filter:update', {
- logical: filter.logical_op,
- comparison: filter.comparison_op,
- })
- },
- async saveOrUpdate(filter, i) {
- if (this.shared || !this._isUIAllowed('filterSync')) {
- // this.$emit('input', this.filters.filter(f => f.fk_column_id && f.comparison_op))
- this.$emit('updated')
- } else if (!this.autoApply) {
- filter.status = 'update'
- } else if (filter.id) {
- await this.$api.dbTableFilter.update(filter.id, {
- ...filter,
- fk_parent_id: this.parentId,
- })
-
- this.$emit('updated')
- } else {
- this.$set(
- this.filters,
- i,
- await this.$api.dbTableFilter.create(this.viewId, {
- ...filter,
- fk_parent_id: this.parentId,
- }),
- )
-
- this.$emit('updated')
- }
- },
- async deleteFilter(filter, i) {
- if (this.shared || !this._isUIAllowed('filterSync')) {
- this.filters.splice(i, 1)
- this.$emit('updated')
- } else if (filter.id) {
- if (!this.autoApply) {
- this.$set(filter, 'status', 'delete')
- } else {
- await this.$api.dbTableFilter.delete(filter.id)
- await this.loadFilter()
- this.$emit('updated')
- }
- } else {
- this.filters.splice(i, 1)
- this.$emit('updated')
- }
- this.$e('a:filter:delete')
- },
- },
-} */
@@ -475,7 +170,7 @@ export default {
-
-
diff --git a/packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue b/packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue
index d5fd294ca1..0eaee3b286 100644
--- a/packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue
+++ b/packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue
@@ -23,101 +23,6 @@ watch(
},
{ immediate: true },
)
-
-/* import { RelationTypes, UITypes } from 'nocodb-sdk'
-import { getUIDTIcon } from '~/components/project/spreadsheet/helpers/uiTypes'
-import FieldListAutoCompleteDropdown from '~/components/project/spreadsheet/components/FieldListAutoCompleteDropdown'
-
-export default {
- name: 'SortListMenu',
- components: { FieldListAutoCompleteDropdown },
- props: {
- fieldList: Array,
- value: [Array, Object],
- isLocked: Boolean,
- meta: [Object],
- viewId: String,
- shared: Boolean,
- },
- data: () => ({
- sortList: [],
- }),
- computed: {
- columns() {
- if (!this.meta || !this.meta.columns) {
- return []
- }
- return this.meta.columns
- .filter((c) => !(c.uidt === UITypes.LinkToAnotherRecord && c.colOptions.type !== RelationTypes.BELONGS_TO))
- .map((c) => ({
- ...c,
- icon: getUIDTIcon(c.uidt),
- }))
- },
- },
- watch: {
- value(v) {
- this.sortList = v || []
- },
- async viewId(v) {
- if (v) {
- await this.loadSortList()
- }
- },
- },
- async created() {
- this.sortList = this.value || []
- this.loadSortList()
- },
- methods: {
- addSort() {
- this.sortList.push({
- fk_column_id: null,
- direction: 'asc',
- })
- this.sortList = this.sortList.slice()
- this.$e('a:sort:add', { length: this.sortList.length })
- },
- async loadSortList() {
- if (!this.shared) {
- // && !this._isUIAllowed('sortSync')) {
- let sortList = []
-
- if (this.viewId) {
- const data = await this.$api.dbTableSort.list(this.viewId)
- sortList = data.sorts.list
- }
-
- this.sortList = sortList
- }
- },
- async saveOrUpdate(sort, i) {
- if (!this.shared && this._isUIAllowed('sortSync')) {
- if (sort.id) {
- await this.$api.dbTableSort.update(sort.id, sort)
- } else {
- this.$set(this.sortList, i, await this.$api.dbTableSort.create(this.viewId, sort))
- }
- } else {
- this.$emit('input', this.sortList)
- }
- this.$emit('updated')
-
- this.$e('a:sort:dir', { direction: sort.direction })
- },
- async deleteSort(sort, i) {
- if (!this.shared && sort.id && this._isUIAllowed('sortSync')) {
- await this.$api.dbTableSort.delete(sort.id)
- await this.loadSortList()
- } else {
- this.sortList.splice(i, 1)
- this.$emit('input', this.sortList)
- }
- this.$emit('updated')
- this.$e('a:sort:delete')
- },
- },
-} */