Переглянути джерело

refactor out from TextFilter

Jason Gorst 1 місяць тому
батько
коміт
85f50aa40a
2 змінених файлів з 22 додано та 0 видалено
  1. 19 0
      app/utils/matchModes.js
  2. 3 0
      app/utils/nameFromMatchMode.js

+ 19 - 0
app/utils/matchModes.js

@@ -0,0 +1,19 @@
+import { FilterMatchMode } from "@primevue/core/api"
+
+export const matchModes = [
+  {
+    name: "starts with",
+    icon: "ph:arrow-line-left-bold",
+    matchMode: FilterMatchMode.STARTS_WITH
+  },
+  {
+    name: "contains",
+    icon: "ph:dots-three-outline-fill",
+    matchMode: FilterMatchMode.CONTAINS
+  },
+  {
+    name: "ends with",
+    icon: "ph:arrow-line-right-bold",
+    matchMode: FilterMatchMode.ENDS_WITH
+  }
+]

+ 3 - 0
app/utils/nameFromMatchMode.js

@@ -0,0 +1,3 @@
+export default function nameFromMatchMode(matchMode) {
+  return _find(matchModes, { matchMode }).name
+}