Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
this.data = Handsontable.helper['createSpreadsheetData'](100, 12); // tslint:disable-line:no-string-literal
this.options = {
height: 396,
colHeaders: true,
rowHeaders: true,
stretchH: 'all',
columnSorting: true,
contextMenu: true
};
}
}
c.sortFunction=function (sortOrder) {
// Handsontable's object iteration helper
let objectEach = Handsontable.helper.objectEach;
let unitsRatios = {
'TiB': 1024*1024*1024*1024,
'GiB': 1024*1024*1024,
'MiB': 1024*1024,
'KiB': 1024,
'B': 1,
};
let parseUnit = function(value, unit, ratio) {
if (isNil(value)) return value;
if (isNaN(value) && value.indexOf(' ' + unit) > -1) {
value = parseFloat(value.replace(unit, '')) * ratio;
}
return value;
};
visualcol: visualIndex,
prop: columnSettings.data,
row: null,
visualRow: null,
};
getSourceItems.call(cellProperties, columnSettings.source, (items) => {
// Prepare the items with key and value properties to be handled by intersectValues transparently
const visibleValues = items.map(item => ({
key: item[columnSettings.keyProperty],
value: item[columnSettings.valueProperty],
}));
callback(visibleValues);
});
} else {
const visibleValues = Handsontable.helper.arrayMap(
this.hot.getDataAtCol(visualIndex),
v => toEmptyString(v),
);
callback(visibleValues);
}
}
'the `columns` option is defined as a function', async (done) => {
console.warn = jasmine.createSpy('warn');
const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
, {attachTo: document.body.querySelector('#hotContainer')}
it('should use the renderer component as Handsontable renderer, when it\'s nested under HotColumn and assigned the \'hot-renderer\' attribute', async (done) => {
const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
, {attachTo: document.body.querySelector('#hotContainer')}
);
it('should use the editor component as Handsontable editor, when it\'s nested under HotTable and assigned the \'hot-editor\' attribute', async (done) => {
const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
, {attachTo: document.body.querySelector('#hotContainer')}
);
await sleep(100);
const hotInstance = wrapper.instance().hotInstance;
expect((document.querySelector('#editorComponentContainer') as any).style.display).toEqual('none');
render(): React.ReactElement {
return (
<div id="{this.props.editorId}">
{this.state.value}
</div>
);
}
}
let globalEditorInstance = null;
let columnEditorInstance = null;
const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
const [count, setCount] = useState(0);
return (
<div>
<p>{props.value}</p>: <span>{count}</span>
<button> setCount(count + 1)}>
Click me
</button>
</div>
);
}
const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
, {attachTo: document.body.querySelector('#hotContainer')}
);
await sleep(100);
const hotInstance = wrapper.instance().hotInstance;
class EditorComponent3 extends React.Component {
render() {
return (
<>
{this.context}
)
}
}
EditorComponent3.contextType = TestContext;
const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
await TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestComponent);
const app = fixture.componentInstance;
app.prop['settings'] = {
data: Handsontable.helper.createSpreadsheetData(5, 5)
};
fixture.detectChanges();
expect(app.getHotInstance(app.id).getDataAtCell(0, 0)).toBe('A1');
});
});