Browse Source

refactor out from TextFilter

Jason Gorst 1 tháng trước cách đây
mục cha
commit
85f50aa40a
2 tập tin đã thay đổi với 22 bổ sung0 xóa
  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
+}