Browse Source

fixed some bugs

Brandon Wong 3 years ago
parent
commit
27a462cac3

+ 2 - 2
frontend/resources/public/site.css

@@ -114,7 +114,7 @@ td input:not(:focus) {
 }
 #left-controls-button {
     left: 0;
-    width: calc(var(--controls-width) + 2 * var(--controls-padding) - 2px);
+    width: calc(var(--controls-width) + 2 * var(--controls-padding) - 1px);
     height: var(--controls-opener-width);
     z-index: 999;
     bottom: calc(var(--controls-width) + 2 * var(--controls-padding));
@@ -123,7 +123,7 @@ td input:not(:focus) {
 }
 #bottom-controls-button {
     bottom: 0;
-    height: calc(var(--controls-width) + 2 * var(--controls-padding) - 2px);
+    height: calc(var(--controls-width) + 2 * var(--controls-padding) - 1px);
     width: var(--controls-opener-width);
     z-index: 999;
     left: calc(var(--controls-width) + 2 * var(--controls-padding));

+ 16 - 16
frontend/src/cljs/microtables_frontend/db.cljs

@@ -5,20 +5,20 @@
    :controls nil
    ;TODO: add "start" and "end" corners as selection
    :position {:cursor nil
-              :selection {:start {:col "A" :row 5}
-                          :end {:col "C" :row 8}}}
-   :table-data {"A" {1 {:value "59"}
-                     12 {:value "2405"}}
-                "B" {4 {:value "7893"}
-                     5 {:value "7863"}
-                     7 {:value "=C5 + D6"}
-                     8 {:value "=B7 * 2"}
-                     12 {:value "=C12"}}
-                "C" {7 {:value "=D1"}
-                     5 {:value "269"}}
-                "D" {6 {:value "4065"}
-                     10 {:value "8272"}
-                     11 {:value "2495"}}
-                "F" {2 {:value "8650"}
-                     7 {:value "5316"}}}})
+              :selection nil #_{:start {:col "A" :row 5}
+                                :end {:col "C" :row 8}}}
+   :table-data nil #_{"A" {1 {:value "59"}
+                           12 {:value "2405"}}
+                      "B" {4 {:value "7893"}
+                           5 {:value "7863"}
+                           7 {:value "=C5 + D6"}
+                           8 {:value "=B7 * 2"}
+                           12 {:value "=C12"}}
+                      "C" {7 {:value "=D1"}
+                           5 {:value "269"}}
+                      "D" {6 {:value "4065"}
+                           10 {:value "8272"}
+                           11 {:value "2495"}}
+                      "F" {2 {:value "8650"}
+                           7 {:value "5316"}}}})
 

+ 3 - 3
frontend/src/cljs/microtables_frontend/utils.cljs

@@ -64,7 +64,7 @@
         col2 (second (re-find #":\s*([A-Z]+)" range-string))
         row1 (.parseInt js/window (second (re-find #"([0-9]+)\s*:" range-string)))
         row2 (.parseInt js/window (second (re-find #"([0-9]+)\s*\)" range-string)))]
-    (range->list col1 col2 row1 row2)))
+    (range->list col1 row1 col2 row2)))
 
 (def range->commalist
   "Converts a range in \"A1:B2\" notation to a comma-separated list of cells: \"A1,A2,B1,B2\"."
@@ -76,7 +76,7 @@
 (def replace-ranges-in-expression
   "Receives an expression string, and replaces all ranges in colon notation (\"A1:B2\") into a comma-separated list of cells (\"A1,A2,B1,B2\")."
   (memoize (fn [expression]
-             (clojure.string/replace expression #"\(\s*[A-Z]+[0-9]+\s*:\s*[A-Z]+[0-9]+\s*\)" parse-range))))
+             (clojure.string/replace expression #"\(\s*[A-Z]+[0-9]+\s*:\s*[A-Z]+[0-9]+\s*\)" range->commalist))))
 
 (defn formula?
   "Determines if a value is a fomula. If it is, it returns it (without the leading equals sign. If not, it returns nil."
@@ -92,6 +92,7 @@
                                   (map #(.toUpperCase %) $)
                                   (filter #(re-matches #"[A-Z]+[0-9]+" %) $)))))
 
+
 (def str->rc (memoize (fn [s]
                         (let [c (re-find #"^[A-Z]+" s)
                               r (.parseInt js/window (re-find #"[0-9]+$" s))]
@@ -223,7 +224,6 @@
 (defn remove-valueless-range-elements
   "Remove nil values specifically from ranges (to solve issues with some functions like average)."
   [variables var-list]
-  (println "remove-valueless-range-elements" variables var-list (first var-list))
   (let [l (clojure.string/split (clojure.string/replace (first var-list) #"[()]" "") #",")
         has-values (filter #(not (nil? (variables %))) l)]
     (str "(" (clojure.string/join "," has-values) ")")))

+ 7 - 4
frontend/src/cljs/microtables_frontend/views.cljs

@@ -68,10 +68,13 @@
    ;copy range (figure out clipboard)
    [:div
     {:class "control-group"}
-    [:a ;TODO: consider making the "About" info an overlay rather than a link
-     {:href "/about.html"
-      :target "_blank"}
-     "About"]]])
+    #_[:a ;TODO: consider making the "About" info an overlay rather than a link
+       {:href "/about.html"
+        :target "_blank"}
+       "About"]
+    "This is a demo version only, and still in development"
+    [:br]
+    "Try adding values (plain numbers) or formulae (starting with an '=') into the cells."]])
 
 (defn control-panel [state]
   [:div