Skip to content

Commit

Permalink
Merge pull request #313 from jpmorganchase/viewer-refactor-2
Browse files Browse the repository at this point in the history
Further refactored PerspectiveViewer
  • Loading branch information
texodus authored Nov 15, 2018
2 parents 09206d8 + e5c7ab7 commit 881f62a
Show file tree
Hide file tree
Showing 27 changed files with 1,259 additions and 1,272 deletions.
2 changes: 1 addition & 1 deletion packages/perspective-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@jpmorganchase/perspective-viewer",
"version": "0.2.7",
"description": "Perspective.js",
"main": "src/js/view.js",
"main": "src/js/viewer.js",
"files": [
"build/**/*",
"src/**/*",
Expand Down
3 changes: 1 addition & 2 deletions packages/perspective-viewer/src/config/view.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ const path = require("path");
const common = require("@jpmorganchase/perspective/src/config/common.config.js");

module.exports = Object.assign({}, common(), {
entry: "./src/js/view.js",
entry: "./src/js/viewer.js",
output: {
filename: "perspective.view.js",
library: "perspective-view",
libraryTarget: "umd",
path: path.resolve(__dirname, "../../build")
}
Expand Down
10 changes: 3 additions & 7 deletions packages/perspective-viewer/src/js/computed_column.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@
*
*/

import {polyfill} from "mobile-drag-drop";

import {bindTemplate} from "./utils.js";
import State from "./computed_column/State.js";
import Computation from "./computed_column/Computation.js";
import State from "./computed_column/state.js";
import Computation from "./computed_column/computation.js";

import template from "../html/computed_column.html";

import style from "../less/computed_column.less";

import {disallow_drop} from "./dragdrop.js";

polyfill({});
import {disallow_drop} from "./viewer/dragdrop.js";

// Computations
const hour_of_day = function(val) {
Expand Down
5 changes: 3 additions & 2 deletions packages/perspective-viewer/src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ export function registerElement(templateString, styleString, proto) {
window.customElements.define(name, _perspective_element);
}

export function bindTemplate(template, styleString) {
export function bindTemplate(template, ...styleStrings) {
const style = styleStrings.map(x => x.toString()).join("\n");
return function(cls) {
return registerElement(template, styleString, cls);
return registerElement(template, {toString: () => style}, cls);
};
}

Expand Down
Loading

0 comments on commit 881f62a

Please sign in to comment.