fixed warnings.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
(ns auto-ap.views.components.grid
|
||||
(:require [reagent.core :as r]
|
||||
[auto-ap.views.utils :refer [appearing copy-to-clipboard]]
|
||||
[auto-ap.utils :refer [default-pagination-size]]
|
||||
[react :as react]
|
||||
[re-frame.core :as re-frame]
|
||||
[auto-ap.views.pages.data-page :as data-page]
|
||||
[auto-ap.views.components.buttons :as buttons]
|
||||
[auto-ap.subs :as subs]
|
||||
[react-dom :as react-dom]))
|
||||
(:require
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.utils :refer [default-pagination-size]]
|
||||
[auto-ap.views.pages.data-page :as data-page]
|
||||
[auto-ap.views.utils :refer [copy-to-clipboard]]
|
||||
[re-frame.core :as re-frame]
|
||||
[react :as react]
|
||||
[reagent.core :as r]))
|
||||
|
||||
(set! *warn-on-infer* true)
|
||||
|
||||
(defonce ^js/React.Context grid-context ( react/createContext "default"))
|
||||
@@ -60,7 +60,7 @@
|
||||
:else
|
||||
y))
|
||||
|
||||
(defn paginator [{:keys [start per-page end count total on-change] :as g}]
|
||||
(defn paginator [{:keys [start per-page end total on-change]}]
|
||||
(let [per-page (or per-page default-pagination-size)
|
||||
max-buttons 5
|
||||
buttons-before (Math/floor (/ max-buttons 2))
|
||||
@@ -72,7 +72,7 @@
|
||||
[:li
|
||||
[:a.pagination-link {:class (when (= current-page x)
|
||||
"is-current")
|
||||
:on-click (fn [e] (on-change {:start (* x per-page)
|
||||
:on-click (fn [_] (on-change {:start (* x per-page)
|
||||
:per-page per-page}))}
|
||||
(inc x)]]))
|
||||
|
||||
@@ -117,11 +117,11 @@
|
||||
[:a.tag.is-medium.is-delete {:on-click (fn []
|
||||
(on-change {:sort (filter #(not= sort-key (:sort-key %)) sort)}))}]]])])
|
||||
|
||||
(defn controls [{:keys [start end count total per-page action-buttons] :as para}]
|
||||
(defn controls [{:keys [start end count total action-buttons]}]
|
||||
(let [children (r/children (r/current-component))]
|
||||
[:> Consumer {}
|
||||
(fn [consume]
|
||||
(let [{:strs [on-params-change params] :as consume} (js->clj consume)]
|
||||
(let [{:strs [on-params-change params]} (js->clj consume)]
|
||||
(r/as-element (into
|
||||
[:div {:style {:margin-bottom "1rem"}}
|
||||
[:div.level
|
||||
@@ -174,8 +174,8 @@
|
||||
:checked (if (get checked id)
|
||||
"checked"
|
||||
"")
|
||||
:on-change (fn [x e]
|
||||
(if id
|
||||
:on-change (fn [_ _]
|
||||
(when id
|
||||
(let [checked (or checked #{})]
|
||||
;; TODO only map once everything is moved over to data-page
|
||||
(if (map? checked)
|
||||
@@ -199,7 +199,7 @@
|
||||
]])))
|
||||
(map r/as-element children))))]))
|
||||
|
||||
(defn button-cell [params]
|
||||
(defn button-cell []
|
||||
(apply r/create-element "td" #js {"style" #js {"overflow" "visible"}}
|
||||
(map r/as-element (r/children (r/current-component)))))
|
||||
|
||||
@@ -244,13 +244,13 @@
|
||||
|
||||
children)))))]))
|
||||
|
||||
(defn sortable-header-cell [{:keys [style class sort-key sort-name asc]}]
|
||||
(defn sortable-header-cell [{:keys [style class sort-key sort-name]}]
|
||||
(let [children (r/children (r/current-component))]
|
||||
[:> Consumer {}
|
||||
(fn [consume]
|
||||
(let [{:strs [on-params-change params] :as consume} (js->clj consume)]
|
||||
(let [{:strs [on-params-change params]} (js->clj consume)]
|
||||
(r/as-element (conj (into
|
||||
[:th {:on-click (fn [e]
|
||||
[:th {:on-click (fn [_]
|
||||
(on-params-change
|
||||
(toggle-sort-by {:sort (:sort params)} sort-key sort-name)))
|
||||
:style (assoc style
|
||||
|
||||
Reference in New Issue
Block a user