(ns microtables-frontend.subs (:require [re-frame.core :as re-frame])) ;TODO: insert other display mode data? ("value": formula (cursor), "display" (default): evaluated, "highlighted": in a selection (just a class?)) (re-frame/reg-sub ::table-data (fn [db] (println "returning table data") (let [data (:table-data db) cursor (get-in db [:position :cursor])] (if cursor (map #(if (and (= (:row cursor) (:row %)) (= (:col cursor) (:col %))) (assoc % :view :value) %) data) data))))