diff --git a/Project.toml b/Project.toml index 8e4ca8e..cc505a5 100644 --- a/Project.toml +++ b/Project.toml @@ -4,14 +4,20 @@ authors = ["Benjamin Lungwitz and contributors"] version = "0.1.2" [deps] +CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" +URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" [compat] +CSV = "0.10.15" DataFrames = "1" HypertextLiteral = "0.9" +JSON = "0.21.4" Tables = "1" +URIs = "1.5.1" julia = "1" [extras] diff --git a/src/PlutoGrid.jl b/src/PlutoGrid.jl index ac6c868..43da04c 100644 --- a/src/PlutoGrid.jl +++ b/src/PlutoGrid.jl @@ -4,6 +4,9 @@ using HypertextLiteral: @htl, JavaScript using Tables using DataFrames +##Custom packages required for the pluto notebook +using CSV, JSON, URIs + export readonly_table, editable_table, create_dataframe const MODIFIED_COL_INDICATOR = "modified_column_" @@ -176,6 +179,7 @@ function numberParser(params) { return Number(params.newValue); }; + var div = currentScript.parentElement; // set default output value div.value = null; @@ -257,6 +261,11 @@ function _make_col_defs(df; filterable=true, editable_cols=String[]) col_dict["type"] = "numericColumn" filterable && (col_dict["filter"] = "agNumberColumnFilter") col_is_editable && (col_dict["valueParser"] = JavaScript("numberParser")) + + elseif eltype(df[!, c]) <: URI + col_dict["cellRenderer"] = JavaScript(raw"""params => { + return ``; + }""") end # ToDo: add type / filter for dates