@operato/scene-table 8.0.0-beta.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/CHANGELOG.md +0 -870
- package/schema.graphql +0 -4549
- package/src/data-list/data-cell.ts +0 -79
- package/src/data-list/data-list-layout.ts +0 -117
- package/src/data-list/data-list.ts +0 -727
- package/src/helper-functions.ts +0 -189
- package/src/index.ts +0 -6
- package/src/table-cell.ts +0 -138
- package/src/table.ts +0 -1448
- package/src/templates/data-list.ts +0 -20
- package/src/templates/index.ts +0 -4
- package/src/templates/table.ts +0 -26
- package/src/types.ts +0 -51
- package/test/basic-test.html +0 -67
- package/test/index.html +0 -22
- package/test/unit/a-test-table.js +0 -72
- package/test/unit/test-table-find-merged-cell.js +0 -95
- package/test/unit/test-table-insert-column.js +0 -81
- package/test/unit/test-table-insert-row.js +0 -79
- package/test/unit/test-table-rows-columns.js +0 -47
- package/test/unit/util.js +0 -21
- package/tsconfig.json +0 -24
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const icon = new URL('../../icons/icon-data-list.png', import.meta.url).href
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
type: 'data-list',
|
|
5
|
-
description: 'data list',
|
|
6
|
-
group: 'table',
|
|
7
|
-
/* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
|
|
8
|
-
icon,
|
|
9
|
-
model: {
|
|
10
|
-
type: 'data-list',
|
|
11
|
-
top: 100,
|
|
12
|
-
left: 100,
|
|
13
|
-
width: 500,
|
|
14
|
-
height: 200,
|
|
15
|
-
strokeStyle: '#999',
|
|
16
|
-
fillStyle: 'white',
|
|
17
|
-
lineWidth: 2,
|
|
18
|
-
columns: 5
|
|
19
|
-
}
|
|
20
|
-
}
|
package/src/templates/index.ts
DELETED
package/src/templates/table.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const icon = new URL('../../icons/icon-table.png', import.meta.url).href
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
type: 'table',
|
|
5
|
-
description: 'table',
|
|
6
|
-
group: 'table',
|
|
7
|
-
/* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
|
|
8
|
-
icon,
|
|
9
|
-
model: {
|
|
10
|
-
type: 'table',
|
|
11
|
-
top: 100,
|
|
12
|
-
left: 100,
|
|
13
|
-
width: 500,
|
|
14
|
-
height: 200,
|
|
15
|
-
strokeStyle: '#999',
|
|
16
|
-
fillStyle: 'white',
|
|
17
|
-
lineWidth: 2,
|
|
18
|
-
rows: 5,
|
|
19
|
-
columns: 5,
|
|
20
|
-
data: [
|
|
21
|
-
['header1', 'header2', 'header3'],
|
|
22
|
-
[100, 200, 300],
|
|
23
|
-
[1000, 2000, 3000]
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { WHERE } from './helper-functions'
|
|
2
|
-
import { Component, LAYOUT, Style } from '@hatiolab/things-scene'
|
|
3
|
-
|
|
4
|
-
export interface ITableCell {}
|
|
5
|
-
|
|
6
|
-
export interface ITable {
|
|
7
|
-
get widths(): number[]
|
|
8
|
-
get heights(): number[]
|
|
9
|
-
get layout(): LAYOUT
|
|
10
|
-
get rows(): number
|
|
11
|
-
|
|
12
|
-
buildCells(newrows: number, newcolumns: number, oldrows: number, oldcolumns: number): void
|
|
13
|
-
setCellsStyle(cells: ITableCell[], style: Style, where: WHERE): void
|
|
14
|
-
setCellsData(): void
|
|
15
|
-
|
|
16
|
-
getRowColumn(cell: ITableCell): { column: number; row: number }
|
|
17
|
-
getCellsByRow(row: number): Component[]
|
|
18
|
-
|
|
19
|
-
getCellsByColumn(column: number): Component[]
|
|
20
|
-
|
|
21
|
-
// 한 개의 행을 매개변수로 받아서 첫 번째 셀부터 우측으로 이동하면서 병합된 셀이 있는지 검사한다.
|
|
22
|
-
findMergedCellByX(row: number): Component[]
|
|
23
|
-
|
|
24
|
-
// 한 개의 열을 매개변수로 받아서 첫 번째 셀부터 아래로 이동하면서 병합된 셀이 있는지 검사한다.
|
|
25
|
-
findMergedCellByY(column: number): Component[]
|
|
26
|
-
|
|
27
|
-
mergeCells(cells: ITableCell[]): void
|
|
28
|
-
splitCells(cells: ITableCell[]): void
|
|
29
|
-
deleteRows(cells: ITableCell[]): void
|
|
30
|
-
|
|
31
|
-
deleteColumns(cells: ITableCell[]): void
|
|
32
|
-
insertCellsAbove(cells: ITableCell[]): void
|
|
33
|
-
insertCellsBelow(cells: ITableCell[]): void
|
|
34
|
-
insertCellsLeft(cells: ITableCell[]): void
|
|
35
|
-
insertCellsRight(cells: ITableCell[]): void
|
|
36
|
-
distributeHorizontal(cells: ITableCell[]): void
|
|
37
|
-
|
|
38
|
-
distributeVertical(cells: ITableCell[]): void
|
|
39
|
-
toObjectArrayValue(array: any[]): void
|
|
40
|
-
|
|
41
|
-
get columns(): number
|
|
42
|
-
get lefts(): Component[]
|
|
43
|
-
get centers(): Component[]
|
|
44
|
-
|
|
45
|
-
get rights(): Component[]
|
|
46
|
-
get tops(): Component[]
|
|
47
|
-
get middles(): Component[]
|
|
48
|
-
get bottoms(): Component[]
|
|
49
|
-
get widths_sum(): number
|
|
50
|
-
get heights_sum(): number
|
|
51
|
-
}
|
package/test/basic-test.html
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<!--
|
|
3
|
-
@license
|
|
4
|
-
Copyright © HatioLab Inc. All rights reserved.
|
|
5
|
-
-->
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="utf-8">
|
|
9
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
10
|
-
|
|
11
|
-
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
|
12
|
-
<script src="../../web-component-tester/browser.js"></script>
|
|
13
|
-
|
|
14
|
-
<!-- Step 1: import the element to test -->
|
|
15
|
-
<link rel="import" href="../things-scene-table.html">
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
|
|
19
|
-
<!-- You can use the document as a place to set up your fixtures. -->
|
|
20
|
-
<test-fixture id="things-scene-table-fixture">
|
|
21
|
-
<template>
|
|
22
|
-
<things-scene-table>
|
|
23
|
-
<h2>things-scene-table</h2>
|
|
24
|
-
</things-scene-table>
|
|
25
|
-
</template>
|
|
26
|
-
</test-fixture>
|
|
27
|
-
|
|
28
|
-
<script>
|
|
29
|
-
suite('<things-scene-table>', function() {
|
|
30
|
-
|
|
31
|
-
var myEl;
|
|
32
|
-
|
|
33
|
-
setup(function() {
|
|
34
|
-
myEl = fixture('things-scene-table-fixture');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('defines the "author" property', function() {
|
|
38
|
-
assert.equal(myEl.author.name, 'Dimitri Glazkov');
|
|
39
|
-
assert.equal(myEl.author.image, 'http://addyosmani.com/blog/wp-content/uploads/2013/04/unicorn.jpg');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('says hello', function() {
|
|
43
|
-
assert.equal(myEl.sayHello(), 'things-scene-table says, Hello World!');
|
|
44
|
-
|
|
45
|
-
var greetings = myEl.sayHello('greetings Earthlings');
|
|
46
|
-
assert.equal(greetings, 'things-scene-table says, greetings Earthlings');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('fires lasers', function(done) {
|
|
50
|
-
myEl.addEventListener('things-scene-table-lasers', function(event) {
|
|
51
|
-
assert.equal(event.detail.sound, 'Pew pew!');
|
|
52
|
-
done();
|
|
53
|
-
});
|
|
54
|
-
myEl.fireLasers();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('distributed children', function() {
|
|
58
|
-
var els = myEl.getContentChildren();
|
|
59
|
-
assert.equal(els.length, 1, 'one distributed node');
|
|
60
|
-
assert.equal(els[0], myEl.querySelector('h2'), 'content distributed correctly');
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
package/test/index.html
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<!--
|
|
3
|
-
@license
|
|
4
|
-
Copyright © HatioLab Inc. All rights reserved.
|
|
5
|
-
-->
|
|
6
|
-
<html><head>
|
|
7
|
-
<meta charset="utf-8">
|
|
8
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
9
|
-
|
|
10
|
-
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
|
11
|
-
<script src="../../web-component-tester/browser.js"></script>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<script>
|
|
15
|
-
// Load and run all tests (.html, .js):
|
|
16
|
-
WCT.loadSuites([
|
|
17
|
-
'basic-test.html',
|
|
18
|
-
'basic-test.html?dom=shadow'
|
|
19
|
-
]);
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
</body></html>
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import '../util'
|
|
5
|
-
|
|
6
|
-
import * as Const from '../../../src/const'
|
|
7
|
-
import { RootContainer, Component } from '../../../src/components'
|
|
8
|
-
|
|
9
|
-
import { expect } from 'chai'
|
|
10
|
-
|
|
11
|
-
describe('(root-container) id, alias indexing', function () {
|
|
12
|
-
const DELAY = 1000;
|
|
13
|
-
|
|
14
|
-
var root;
|
|
15
|
-
var component;
|
|
16
|
-
|
|
17
|
-
beforeEach(function () {
|
|
18
|
-
root = new RootContainer()
|
|
19
|
-
component = new Component({})
|
|
20
|
-
|
|
21
|
-
component.set('id', 'TEST-01')
|
|
22
|
-
component.set('alias', ['ALIAS-01', 'ALIAS-02'])
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('컴포넌트가 add 될때, id나 alias가 정의되어 있으면 인덱스가 추가되어야 한다.', function () {
|
|
26
|
-
|
|
27
|
-
root.addComponent(component)
|
|
28
|
-
|
|
29
|
-
expect(Const.MODE_VIEW).to.equal(0);
|
|
30
|
-
|
|
31
|
-
expect(root.findById('TEST-01')).to.equal(component)
|
|
32
|
-
expect(root.findById('ALIAS-01')).to.equal(component)
|
|
33
|
-
expect(root.findById('ALIAS-02')).to.equal(component)
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('컴포넌트가 add 될 때, alias는 Array이어야 한다.', function () {
|
|
38
|
-
|
|
39
|
-
expect(Const.MODE_VIEW).to.equal(0);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('컴포넌트가 remove 될 때, id나 alias가 정의되어 있으면 인덱스에서 제거되어야 한다.', function () {
|
|
43
|
-
|
|
44
|
-
root.addComponent(component)
|
|
45
|
-
|
|
46
|
-
expect(root.findById('TEST-01')).to.equal(component)
|
|
47
|
-
expect(root.findById('ALIAS-01')).to.equal(component)
|
|
48
|
-
expect(root.findById('ALIAS-02')).to.equal(component)
|
|
49
|
-
|
|
50
|
-
root.removeComponent(component)
|
|
51
|
-
|
|
52
|
-
expect(root.findById('TEST-01')).to.equal(undefined)
|
|
53
|
-
expect(root.findById('ALIAS-01')).to.equal(undefined)
|
|
54
|
-
expect(root.findById('ALIAS-02')).to.equal(undefined)
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('컴포넌트의 id나 alias가 변경되면, 변경전 id와 alias는 제거되고, 변경후 id와 alias가 인덱스에 추가되어야 한다.', function () {
|
|
59
|
-
|
|
60
|
-
root.addComponent(component)
|
|
61
|
-
|
|
62
|
-
expect(root.findById('TEST-01')).to.equal(component)
|
|
63
|
-
expect(root.findById('ALIAS-01')).to.equal(component)
|
|
64
|
-
expect(root.findById('ALIAS-02')).to.equal(component)
|
|
65
|
-
|
|
66
|
-
component.set('id', 'TEST-02')
|
|
67
|
-
|
|
68
|
-
expect(root.findById('TEST-01')).to.equal(undefined)
|
|
69
|
-
expect(root.findById('TEST-02')).to.equal(component)
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import './util'
|
|
5
|
-
|
|
6
|
-
import { expect } from 'chai'
|
|
7
|
-
|
|
8
|
-
import '../../bower_components/things-scene-core/things-scene-min'
|
|
9
|
-
import { Table } from '../../src/index'
|
|
10
|
-
|
|
11
|
-
describe('Table - 행 추가하기', function () {
|
|
12
|
-
|
|
13
|
-
var board;
|
|
14
|
-
|
|
15
|
-
beforeEach(function () {
|
|
16
|
-
board = scene.create({
|
|
17
|
-
model: {
|
|
18
|
-
components: [{
|
|
19
|
-
id: 'table',
|
|
20
|
-
type: 'table',
|
|
21
|
-
rows: 5,
|
|
22
|
-
columns: 10
|
|
23
|
-
}]
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('첫 번째 행에서 합쳐진 셀이 없으면 리턴 값의 길이는 0이어야 한다', function () {
|
|
29
|
-
|
|
30
|
-
var table = board.findById('table')
|
|
31
|
-
|
|
32
|
-
var mergedCells = table.findMergedCellByX(0)
|
|
33
|
-
|
|
34
|
-
expect(mergedCells.length).to.equal(0);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('첫 번째 행에서 합쳐진 셀이 2개 있으면 리턴 값의 길이는 2이어야 한다', function () {
|
|
38
|
-
|
|
39
|
-
var table = board.findById('table');
|
|
40
|
-
|
|
41
|
-
table.components[1].merged = true;
|
|
42
|
-
table.components[2].set('merged', true);
|
|
43
|
-
|
|
44
|
-
var mergedCells = table.findMergedCellByX(0);
|
|
45
|
-
|
|
46
|
-
expect(mergedCells.length).to.equal(2);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('첫 번째 행에서 합쳐진 셀이 행을 전부 포함하고 있으면 리턴 값의 길이는 테이블의 columns 이어야 한다', function () {
|
|
50
|
-
|
|
51
|
-
var table = board.findById('table');
|
|
52
|
-
|
|
53
|
-
table.components.forEach((cell) => {
|
|
54
|
-
cell.merged = true;
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
var mergedCells = table.findMergedCellByX(0);
|
|
58
|
-
|
|
59
|
-
expect(mergedCells.length).to.equal(table.columns);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('첫 번째 열에서 합쳐진 셀이 없으면 리턴 값의 길이는 0이어야 한다', function () {
|
|
63
|
-
|
|
64
|
-
var table = board.findById('table')
|
|
65
|
-
|
|
66
|
-
var mergedCells = table.findMergedCellByY(0)
|
|
67
|
-
|
|
68
|
-
expect(mergedCells.length).to.equal(0);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('첫 번째 열에서 합쳐진 셀이 2개 있으면 리턴 값의 길이는 2이어야 한다', function () {
|
|
72
|
-
|
|
73
|
-
var table = board.findById('table');
|
|
74
|
-
|
|
75
|
-
table.components[0].merged = true;
|
|
76
|
-
table.components[table.columns].set('merged', true);
|
|
77
|
-
|
|
78
|
-
var mergedCells = table.findMergedCellByY(0);
|
|
79
|
-
|
|
80
|
-
expect(mergedCells.length).to.equal(2);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('첫 번째 행에서 합쳐진 셀이 행을 전부 포함하고 있으면 리턴 값의 길이는 테이블의 rows 이어야 한다', function () {
|
|
84
|
-
|
|
85
|
-
var table = board.findById('table');
|
|
86
|
-
|
|
87
|
-
table.components.forEach((cell) => {
|
|
88
|
-
cell.merged = true;
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
var mergedCells = table.findMergedCellByY(0);
|
|
92
|
-
|
|
93
|
-
expect(mergedCells.length).to.equal(table.rows);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import './util'
|
|
5
|
-
|
|
6
|
-
import { expect } from 'chai'
|
|
7
|
-
|
|
8
|
-
import '../../bower_components/things-scene-core/things-scene-min'
|
|
9
|
-
import { Table } from '../../src/index'
|
|
10
|
-
|
|
11
|
-
describe('Table - 열 추가하기', function () {
|
|
12
|
-
|
|
13
|
-
var board;
|
|
14
|
-
|
|
15
|
-
beforeEach(function () {
|
|
16
|
-
board = scene.create({
|
|
17
|
-
model: {
|
|
18
|
-
components: [{
|
|
19
|
-
id: 'table',
|
|
20
|
-
type: 'table',
|
|
21
|
-
rows: 2,
|
|
22
|
-
columns: 2
|
|
23
|
-
}]
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('첫 번째 셀의 왼쪽에 컬럼을 추가하면, columns 값이 하나 증가해야한다.', function () {
|
|
29
|
-
|
|
30
|
-
var table = board.findById('table')
|
|
31
|
-
|
|
32
|
-
var columns = table.get('columns')
|
|
33
|
-
|
|
34
|
-
var cell = table.components[0]
|
|
35
|
-
table.insertCellsLeft([cell])
|
|
36
|
-
|
|
37
|
-
expect(table.get('columns')).to.equal(columns + 1)
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('insertCellsLeft 하면 선택한 셀의 인덱스 값이 하나 증가해야한다.', function() {
|
|
41
|
-
|
|
42
|
-
var table = board.findById('table');
|
|
43
|
-
|
|
44
|
-
var cell = table.components[0];
|
|
45
|
-
|
|
46
|
-
var beforeIndex = table.components.indexOf(cell);
|
|
47
|
-
|
|
48
|
-
table.insertCellsLeft([cell]);
|
|
49
|
-
|
|
50
|
-
var afterIndex = table.components.indexOf(cell);
|
|
51
|
-
|
|
52
|
-
expect(afterIndex).to.equal(beforeIndex + 1);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('첫 번째 셀의 오른쪽에 컬럼을 추가하면, columns 값이 하나 증가해야한다.', function(){
|
|
56
|
-
|
|
57
|
-
var table = board.findById('table');
|
|
58
|
-
|
|
59
|
-
var columns = table.get('columns');
|
|
60
|
-
|
|
61
|
-
var cell = table.components[0];
|
|
62
|
-
table.insertCellsRight([cell]);
|
|
63
|
-
|
|
64
|
-
expect(table.get('columns')).to.equal(columns + 1);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('insertCellsRight 하면 선택한 셀의 인덱스 값이 증가하면 안된다.', function(){
|
|
68
|
-
|
|
69
|
-
var table = board.findById('table');
|
|
70
|
-
|
|
71
|
-
var cell = table.components[0];
|
|
72
|
-
|
|
73
|
-
var beforeIndex = table.components.indexOf(cell);
|
|
74
|
-
|
|
75
|
-
table.insertCellsRight([cell]);
|
|
76
|
-
|
|
77
|
-
var afterIndex = table.components.indexOf(cell);
|
|
78
|
-
|
|
79
|
-
expect(afterIndex).to.equal(beforeIndex);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import './util'
|
|
5
|
-
|
|
6
|
-
import { expect } from 'chai'
|
|
7
|
-
|
|
8
|
-
import '../../bower_components/things-scene-core/things-scene-min'
|
|
9
|
-
import { Table } from '../../src/index'
|
|
10
|
-
|
|
11
|
-
describe('Table - 행 추가하기', function () {
|
|
12
|
-
|
|
13
|
-
var board;
|
|
14
|
-
|
|
15
|
-
beforeEach(function () {
|
|
16
|
-
board = scene.create({
|
|
17
|
-
model: {
|
|
18
|
-
components: [{
|
|
19
|
-
id: 'table',
|
|
20
|
-
type: 'table',
|
|
21
|
-
rows: 2,
|
|
22
|
-
columns: 2
|
|
23
|
-
}]
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('첫 번째 셀 위에 행을 추가하면, rows 값이 하나 증가해야한다.', function () {
|
|
29
|
-
|
|
30
|
-
var table = board.findById('table')
|
|
31
|
-
|
|
32
|
-
var rows = table.get('rows')
|
|
33
|
-
|
|
34
|
-
var cell = table.components[0]
|
|
35
|
-
table.insertCellsAbove([cell])
|
|
36
|
-
|
|
37
|
-
expect(table.get('rows')).to.equal(rows + 1)
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('첫 번째 셀 위에 행을 추가하면, 첫 번째 셀의 인덱스는 열의 수만큼 증가해야한다.', function(){
|
|
41
|
-
|
|
42
|
-
var table = board.findById('table');
|
|
43
|
-
|
|
44
|
-
var cell = table.components[0];
|
|
45
|
-
|
|
46
|
-
var beforeIndex = table.components.indexOf(cell);
|
|
47
|
-
|
|
48
|
-
table.insertCellsAbove([cell]);
|
|
49
|
-
|
|
50
|
-
var afterIndex = table.components.indexOf(cell);
|
|
51
|
-
|
|
52
|
-
expect(afterIndex).to.equal(beforeIndex + table.columns);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('첫 번째 셀 아래에 행을 추가하면, rows 값이 하나 증가해야 한다.', function() {
|
|
56
|
-
var table = board.findById('table')
|
|
57
|
-
|
|
58
|
-
var rows = table.get('rows')
|
|
59
|
-
|
|
60
|
-
var cell = table.components[0]
|
|
61
|
-
table.insertCellsBelow([cell])
|
|
62
|
-
|
|
63
|
-
expect(table.get('rows')).to.equal(rows + 1)
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('첫 번째 셀 아래에 행을 추가하면, 첫 번째 셀의 인덱스는 변하지 않아야 한다.', function() {
|
|
67
|
-
var table = board.findById('table');
|
|
68
|
-
|
|
69
|
-
var cell = table.components[0];
|
|
70
|
-
|
|
71
|
-
var beforeIndex = table.components.indexOf(cell);
|
|
72
|
-
|
|
73
|
-
table.insertCellsBelow([cell]);
|
|
74
|
-
|
|
75
|
-
var afterIndex = table.components.indexOf(cell);
|
|
76
|
-
|
|
77
|
-
expect(afterIndex).to.equal(beforeIndex);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import './util'
|
|
5
|
-
|
|
6
|
-
import { expect } from 'chai'
|
|
7
|
-
|
|
8
|
-
import '../../bower_components/things-scene-core/things-scene-min'
|
|
9
|
-
import { Table } from '../../src/index'
|
|
10
|
-
|
|
11
|
-
describe('Table - Rows, Columns', function () {
|
|
12
|
-
|
|
13
|
-
var board;
|
|
14
|
-
|
|
15
|
-
beforeEach(function () {
|
|
16
|
-
board = scene.create({
|
|
17
|
-
model: {
|
|
18
|
-
components: [{
|
|
19
|
-
id: 'table',
|
|
20
|
-
type: 'table',
|
|
21
|
-
rows: 2,
|
|
22
|
-
columns: 2
|
|
23
|
-
}]
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('생성시 테이블 셀의 갯수는 테이블의 rows * columns 와 같아야 한다.', function () {
|
|
29
|
-
|
|
30
|
-
var table = board.findById('table')
|
|
31
|
-
|
|
32
|
-
expect(table.components.length).to.equal(4)
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('rows와 columns값을 새로 설정할 경우 테이블 셀의 갯수는 테이블의 새로운 rows * columns 와 같아야 한다.', function () {
|
|
36
|
-
|
|
37
|
-
var table = board.findById('table')
|
|
38
|
-
|
|
39
|
-
table.set({
|
|
40
|
-
rows: 5,
|
|
41
|
-
columns: 5
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
expect(table.components.length).to.equal(25)
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
});
|
package/test/unit/util.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
var noop = () => {}
|
|
5
|
-
|
|
6
|
-
global.Canvas = require('canvas');
|
|
7
|
-
|
|
8
|
-
Canvas.prototype.setAttribute = noop;
|
|
9
|
-
Canvas.prototype.style = {};
|
|
10
|
-
|
|
11
|
-
global.Image = Canvas.Image;
|
|
12
|
-
global.screen = {
|
|
13
|
-
width: 1280,
|
|
14
|
-
height: 800
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
global.window = global;
|
|
18
|
-
|
|
19
|
-
global.addEventListener = noop;
|
|
20
|
-
global.location = {};
|
|
21
|
-
global.getComputedStyle = noop;
|
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2018",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": ["es2019", "dom"],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowJs": true,
|
|
11
|
-
"allowSyntheticDefaultImports": true,
|
|
12
|
-
"experimentalDecorators": true,
|
|
13
|
-
"importHelpers": true,
|
|
14
|
-
"outDir": "dist",
|
|
15
|
-
"sourceMap": true,
|
|
16
|
-
"inlineSources": true,
|
|
17
|
-
"rootDir": "src",
|
|
18
|
-
"declaration": true,
|
|
19
|
-
"incremental": true,
|
|
20
|
-
"skipLibCheck": true,
|
|
21
|
-
"types": []
|
|
22
|
-
},
|
|
23
|
-
"include": ["**/*.ts", "*.d.ts"]
|
|
24
|
-
}
|
package/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/tslib/tslib.d.ts","../../node_modules/@hatiolab/things-scene/things-scene.d.ts","../../node_modules/@types/lodash/common/common.d.ts","../../node_modules/@types/lodash/common/array.d.ts","../../node_modules/@types/lodash/common/collection.d.ts","../../node_modules/@types/lodash/common/date.d.ts","../../node_modules/@types/lodash/common/function.d.ts","../../node_modules/@types/lodash/common/lang.d.ts","../../node_modules/@types/lodash/common/math.d.ts","../../node_modules/@types/lodash/common/number.d.ts","../../node_modules/@types/lodash/common/object.d.ts","../../node_modules/@types/lodash/common/seq.d.ts","../../node_modules/@types/lodash/common/string.d.ts","../../node_modules/@types/lodash/common/util.d.ts","../../node_modules/@types/lodash/index.d.ts","../../node_modules/@types/lodash-es/merge.d.ts","./src/table-cell.ts","./src/table.ts","./src/index.ts","./src/data-list/data-cell.ts","./src/data-list/data-list-layout.ts","./src/data-list/data-list.ts","./src/helper-functions.ts","./src/types.ts","./src/templates/data-list.ts","./src/templates/table.ts","./src/templates/index.ts"],"fileIdsList":[[52],[40,42,43,44,45,46,47,48,49,50,51,52],[40,41,43,44,45,46,47,48,49,50,51,52],[41,42,43,44,45,46,47,48,49,50,51,52],[40,41,42,44,45,46,47,48,49,50,51,52],[40,41,42,43,45,46,47,48,49,50,51,52],[40,41,42,43,44,46,47,48,49,50,51,52],[40,41,42,43,44,45,47,48,49,50,51,52],[40,41,42,43,44,45,46,48,49,50,51,52],[40,41,42,43,44,45,46,47,49,50,51,52],[40,41,42,43,44,45,46,47,48,50,51,52],[40,41,42,43,44,45,46,47,48,49,51,52],[40,41,42,43,44,45,46,47,48,49,50,52],[40,41,42,43,44,45,46,47,48,49,50,51],[38,39,56],[38,39,57,59],[38,39,57,58,60],[38,39,53,54,55,59],[38,54,55,59],[38,39,55],[38,39,54,60],[38],[38,62,63],[38,39,60]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"ef4e4dc2fd14de20903f5010671dab9cf547c831dce4802306676c80649b990b","impliedFormat":1},{"version":"7220461ab7f6d600b313ce621346c315c3a0ebc65b5c6f268488c5c55b68d319","impliedFormat":1},{"version":"f90d4c1ae3af9afb35920b984ba3e41bdd43f0dc7bae890b89fbd52b978f0cac","impliedFormat":1},{"version":"fcf79300e5257a23ed3bacaa6861d7c645139c6f7ece134d15e6669447e5e6db","impliedFormat":1},{"version":"187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","impliedFormat":1},{"version":"aa2c18a1b5a086bbcaae10a4efba409cc95ba7287d8cf8f2591b53704fea3dea","impliedFormat":1},{"version":"b88749bdb18fc1398370e33aa72bc4f88274118f4960e61ce26605f9b33c5ba2","impliedFormat":1},{"version":"0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","impliedFormat":1},{"version":"00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","impliedFormat":1},{"version":"bdf0ed7d9ebae6175a5d1b4ec4065d07f8099379370a804b1faff05004dc387d","impliedFormat":1},{"version":"7c14ccd2eaa82619fffc1bfa877eb68a012e9fb723d07ee98db451fadb618906","impliedFormat":1},{"version":"288d992cd0d35fd4bb5a0f23df62114b8bfbc53e55b96a4ad00dde7e6fb72e31","impliedFormat":1},{"version":"df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9","impliedFormat":1},{"version":"4f6a12044ee6f458db11964153830abbc499e73d065c51c329ec97407f4b13dd","impliedFormat":1},{"version":"a957ad4bd562be0662fb99599dbcf0e16d1631f857e5e1a83a3f3afb6c226059","impliedFormat":99},{"version":"788225a56c6b6415159dc5b44dc161cf4520be5eee9204ca367f5c3815dc6170","signature":"8de99cc34384570330ba19781c23b0d6aa555e4cf3d016ba4f8139c78e1c3e40"},{"version":"bd65cb08aad9c050186a420adbef0035e74351b0fa76263c6907adf7b94190de","signature":"a4707d60dd24b85914f945b2dd7b92c580d599e1394442126dff86fbbfa54fbb"},{"version":"0f1377d787433323434405a062d09a1398f5d33e1576f9c613673d9f469a7e0f","signature":"7d02d97a7a65065e1d520da2d020a3f25be2e84759bc46753477fe9a9f8b538c"},{"version":"b3ff423135d373a82c875df559573d94f9384fc596605cbb7aa54dd2dd949a26","signature":"e1c2b72c82d4b574bdfc7040fa1bf9ebac600104d61481824d3cef6b09de5dd1"},{"version":"77bd6e9bc8261369e74fcf648938ee878a75b9d126e19ee414fd452abaf5d272","signature":"592c7e5ea2df68aa407be1398a544900b41b58ee0345428d34223fc30d978240"},{"version":"b4b28cc38bf392f33973d68eccf05776a9f612435f01ad8f1f57b6c4cc2991dd","signature":"2ddcb04dd47b4886309b0a8d8c12c988a2cf75c547c6b822938a6ef0d8c6e765"},{"version":"4efeaa6452e149d26f878e8084cb56dc0d065bfed5f2aa2ed81f58fb54a64e9c","signature":"24adbf9fd807b5c2fa0fa78879445da592b2190140c5d5d8976c4b66008cad57"},{"version":"baa275c80f50945517e25fc292e3e96f84b484282ebbeb3cdc15a12249f855f9","signature":"66bcab35d001493a84cdf682f0e313872d10b6ed388efe767bb21fd883c4eac6"},{"version":"3fc4d42c1027b356c77c522b7a3daca6e87e23d89c111a432fce43e7c1d58e09","signature":"66ec166d01b5aea41847fb62680d88b5688b0aaf9496c73951a4a6239bcb878f"},{"version":"652be17ef64607e9eb0a0e87d9ffb1325f461a20362c877e0003f196b217f762","signature":"72d84e028e717c9076493b4a96f9523d24f3ebd0e08744c18d3ef714c70c2eaf"},{"version":"02b675f5beeeaf581b1b21b7bc72a1d67964dd9bccfb69ae19a79731e26f92c1","signature":"5ec5bde912e6a83d79b62a2d034bd2daf05071307bb667da8562163381f57662"}],"root":[[54,64]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":false,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitOnError":true,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":5},"referencedMap":[[53,1],[41,2],[42,3],[40,4],[43,5],[44,6],[45,7],[46,8],[47,9],[48,10],[49,11],[50,12],[51,13],[52,14],[57,15],[58,16],[59,17],[60,18],[56,19],[54,20],[55,21],[62,22],[64,23],[63,22],[61,24]],"version":"5.7.2"}
|