Made all interactions much better
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
(ns auto-ap.views.components.grid
|
||||
(:require [reagent.core :as r]
|
||||
[auto-ap.views.utils :refer [appearing]]
|
||||
[react :as react]))
|
||||
[react :as react]
|
||||
[re-frame.core :as re-frame]
|
||||
[auto-ap.views.pages.data-page :as data-page]))
|
||||
|
||||
(defonce grid-context (react/createContext "default"))
|
||||
(def Provider (.-Provider grid-context))
|
||||
@@ -105,6 +107,7 @@
|
||||
[:> Consumer {}
|
||||
(fn [consume]
|
||||
(let [{:strs [on-params-change params] :as consume} (js->clj consume)]
|
||||
(println "PARAMS" params)
|
||||
(r/as-element (into
|
||||
[:div {:style {:margin-bottom "1rem"}}
|
||||
[:div.level
|
||||
@@ -215,19 +218,35 @@
|
||||
children)
|
||||
(sort-icon sort-key (:sort params))))))]))
|
||||
|
||||
(defn grid [{:keys [on-params-change on-check-changed checked params status column-count check-boxes?]}]
|
||||
(r/create-element Provider
|
||||
#js {:value #js {:on-params-change on-params-change
|
||||
:on-check-changed on-check-changed
|
||||
:check-boxes? check-boxes?
|
||||
:checked checked
|
||||
:params params
|
||||
:status status
|
||||
:column-count column-count}}
|
||||
(r/as-element
|
||||
(into
|
||||
[:<> ]
|
||||
(r/children (r/current-component))))))
|
||||
(defn grid [{:keys [on-params-change on-check-changed checked params status column-count check-boxes? data-page]}]
|
||||
(if data-page
|
||||
(let [page @(re-frame/subscribe [::data-page/page data-page])]
|
||||
(r/create-element Provider
|
||||
#js {:value #js {:on-params-change (fn [p]
|
||||
(re-frame/dispatch [::data-page/table-params-changed data-page p]))
|
||||
:on-check-changed (fn [new]
|
||||
(re-frame/dispatch [::data-page/toggle-check data-page new]))
|
||||
:check-boxes? check-boxes?
|
||||
:checked (:checked page)
|
||||
:params (:params page)
|
||||
:status (:status page)
|
||||
:column-count column-count}}
|
||||
(r/as-element
|
||||
(into
|
||||
[:<> ]
|
||||
(r/children (r/current-component))))))
|
||||
(r/create-element Provider
|
||||
#js {:value #js {:on-params-change on-params-change
|
||||
:on-check-changed on-check-changed
|
||||
:check-boxes? check-boxes?
|
||||
:checked checked
|
||||
:params params
|
||||
:status status
|
||||
:column-count column-count}}
|
||||
(r/as-element
|
||||
(into
|
||||
[:<> ]
|
||||
(r/children (r/current-component)))))))
|
||||
|
||||
(defn virtual-paginate [start xs ]
|
||||
(take 100 (drop (or start 0) xs)))
|
||||
|
||||
Reference in New Issue
Block a user