New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

table-js

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table-js - npm Package Compare versions

Comparing version 1.0.2-0 to 1.0.3-0

test/spec/core/ElementRegistrySpec.js

8

lib/core/Sheet.js

@@ -8,3 +8,3 @@ export default class Sheet {

eventBus.on('diagram.clear', () => {
eventBus.on('table.clear', () => {
this.setRoot(null);

@@ -16,7 +16,9 @@ });

if (this._root) {
this._eventBus.fire('root.remove', { root: this._root });
const oldRoot = this._root;
this._eventBus.fire('root.remove', { root: oldRoot });
this._root = null;
this._eventBus.fire('root.removed', { root: this._root });
this._eventBus.fire('root.removed', { root: oldRoot });
}

@@ -23,0 +25,0 @@

@@ -24,7 +24,3 @@

open(position, context = {}) {
if (!position) {
throw new Error('must specifiy context menu position');
}
open(position = { x: 0, y: 0 }, context = {}) {
this.setState({

@@ -31,0 +27,0 @@ isOpen: true,

@@ -110,13 +110,5 @@ import forEach from 'lodash/forEach';

}
/**
* Returns the number of actions that are currently registered
*
* @return {Number}
*/
length() {
return Object.keys(this._actions).length;
}
/**
* Checks wether the given action is registered

@@ -123,0 +115,0 @@ *

@@ -0,6 +1,9 @@

import Modeling from '../modeling';
import Selection from '../selection';
import EditorActions from './EditorActions';
export default {
__depends__: [ Modeling, Selection ],
__init__: [ 'editorActions' ],
editorActions: [ 'type', EditorActions ]
};
import isString from 'lodash/isString';
import { query as domQuery } from 'min-dom';
/**

@@ -9,4 +11,5 @@ * Allows selecting a table cell. Selected cell will be highlighted.

constructor(elementRegistry, eventBus) {
constructor(elementRegistry, eventBus, renderer) {
this._elementRegistry = elementRegistry;
this._renderer = renderer;

@@ -26,5 +29,4 @@ this._selection = undefined;

* @param {Object|String} element - Element or element ID.
* @param {String} nodeId - Node ID.
*/
select(element, nodeId) {
select(element) {
if (!this._isFrozen) {

@@ -41,4 +43,6 @@ if (this._selection) {

const node = document.querySelector(`[data-element-id="${element.id}"`);
const container = this._renderer.getContainer();
const node = domQuery(`[data-element-id="${element.id}"`, container);
if (node) {

@@ -55,3 +59,5 @@ node.classList.add('selected');

if (this._selection && !this._isFrozen) {
const node = document.querySelector(`[data-element-id="${this._selection.id}"`);
const container = this._renderer.getContainer();
const node = domQuery(`[data-element-id="${this._selection.id}"`, container);

@@ -88,2 +94,2 @@ if (node) {

Selection.$inject = [ 'elementRegistry', 'eventBus' ];
Selection.$inject = [ 'elementRegistry', 'eventBus', 'renderer' ];
{
"name": "table-js",
"version": "1.0.2-0",
"version": "1.0.3-0",
"scripts": {

@@ -45,3 +45,4 @@ "all": "npm run lint && npm run test",

"sinon": "^2.4.1",
"sinon-chai": "^2.14.0"
"sinon-chai": "^2.14.0",
"watchify": "^3.9.0"
},

@@ -48,0 +49,0 @@ "browserify": {

@@ -24,2 +24,32 @@ import { inject, bootstrap } from 'test/TestHelper';

it('row', inject(function(elementFactory) {
// when
const row = elementFactory.createRow({
foo: 'foo'
});
// then
expect(row.cells).to.exist;
expect(row.id).to.exist;
expect(row.foo).to.eql('foo');
}));
it('col', inject(function(elementFactory) {
// when
const col = elementFactory.createCol({
foo: 'foo'
});
// then
expect(col.cells).to.exist;
expect(col.id).to.exist;
expect(col.foo).to.eql('foo');
}));
});

@@ -5,5 +5,6 @@ /* global sinon */

import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
import ModelingModule from 'lib/features/modeling';
describe('modeling - EditCell', function() {

@@ -65,4 +66,41 @@

it('should provide extension point for external change handlers');
describe('extension point', function() {
class Interceptor extends CommandInterceptor {
constructor(eventBus) {
super(eventBus);
this.postExecute('cell.edit', ({ context }) => {
context.cell.foo = 'foo';
});
}
}
Interceptor.$inject = [ 'eventBus' ];
beforeEach(bootstrap({
modules: [
ModelingModule,
{
__init__: [ 'interceptor' ],
interceptor: [ 'type', Interceptor ]
}
]
}));
it('should provide extension point for external change handlers', inject(function(eventBus, interceptor, modeling) {
eventBus.on('elements.changed', () => {
// then
expect(cell.foo).to.eql('foo');
});
// when
modeling.editCell(cell);
}));
});
});

@@ -13,3 +13,3 @@ import { inject, bootstrap } from 'test/TestHelper';

it('should create HUGE table', inject(function(modeling, sheet) {
it.skip('should add 20000 cells', inject(function(modeling, sheet) {

@@ -16,0 +16,0 @@ let now = performance.now();

@@ -26,5 +26,5 @@

// then
const result = findRenderedDOMElementWithClass(renderedTree, 'tjs-table');
const node = findRenderedDOMElementWithClass(renderedTree, 'tjs-table');
expect(result).to.exist;
expect(node).to.exist;
}));

@@ -60,3 +60,2 @@

expect(findRenderedDOMElementWithClass(renderedTree, 'before')).to.exist;
}));

@@ -75,3 +74,2 @@

expect(findRenderedDOMElementWithClass(renderedTree, 'after')).to.exist;
}));

@@ -78,0 +76,0 @@

@@ -9,3 +9,3 @@ import forEach from 'lodash/forEach';

let INSTANCE = null;
let TABLE_JS = null;

@@ -47,4 +47,4 @@

if (INSTANCE) {
INSTANCE.destroy();
if (TABLE_JS) {
TABLE_JS.destroy();
}

@@ -60,3 +60,3 @@

INSTANCE = new Table(actualOpts);
TABLE_JS = new Table(actualOpts);
};

@@ -69,9 +69,13 @@ }

if (!INSTANCE) {
throw new Error('no bootstrapped INSTANCE, call bootstrap(options, ...) first');
if (!TABLE_JS) {
throw new Error('no bootstrapped instance, call bootstrap(options, ...) first');
}
INSTANCE.invoke(fn);
TABLE_JS.invoke(fn);
};
}
export function getTableJS() {
return TABLE_JS;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc