@operato/scene-table 7.3.9 → 7.3.19
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/dist/data-list/data-list.d.ts +16 -6
- package/dist/data-list/data-list.js +72 -30
- package/dist/data-list/data-list.js.map +1 -1
- package/dist/helper-functions.d.ts +3 -0
- package/dist/helper-functions.js +30 -19
- package/dist/helper-functions.js.map +1 -1
- package/dist/table.d.ts +8 -2
- package/dist/table.js +28 -2
- package/dist/table.js.map +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -826
- package/schema.graphql +0 -4405
- 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 -674
- package/src/helper-functions.ts +0 -171
- package/src/index.ts +0 -6
- package/src/table-cell.ts +0 -138
- package/src/table.ts +0 -1417
- 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.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/helper-functions.ts","./src/data-list/data-cell.ts","./src/data-list/data-list-layout.ts","./src/data-list/data-list.ts","./src/index.ts","./src/types.ts","./src/templates/data-list.ts","./src/templates/table.ts","./src/templates/index.ts"],"fileIdsList":[[51],[39,41,42,43,44,45,46,47,48,49,50,51],[39,40,42,43,44,45,46,47,48,49,50,51],[40,41,42,43,44,45,46,47,48,49,50,51],[39,40,41,43,44,45,46,47,48,49,50,51],[39,40,41,42,44,45,46,47,48,49,50,51],[39,40,41,42,43,45,46,47,48,49,50,51],[39,40,41,42,43,44,46,47,48,49,50,51],[39,40,41,42,43,44,45,47,48,49,50,51],[39,40,41,42,43,44,45,46,48,49,50,51],[39,40,41,42,43,44,45,46,47,49,50,51],[39,40,41,42,43,44,45,46,47,48,50,51],[39,40,41,42,43,44,45,46,47,48,49,51],[39,40,41,42,43,44,45,46,47,48,49,50],[37,38,59],[37,38,56,58],[37,38,55,56,57],[37,38,52,53,54],[37,53,54,58],[37,38,54],[37,38,53,55],[37],[37,61,62],[37,38,55]],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"9e8ca8ed051c2697578c023d9c29d6df689a083561feba5c14aedee895853999","affectsGlobalScope":true,"impliedFormat":1},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"45d8ccb3dfd57355eb29749919142d4321a0aa4df6acdfc54e30433d7176600a","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":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true,"impliedFormat":1},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","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":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"4a882ffbb4ed09d9b7734f784aebb1dfe488d63725c40759165c5d9c657ca029","impliedFormat":1},{"version":"26d1ec00a52200684283272eaed524de74adc033bdff6522f72e03c796a46ff8","impliedFormat":1},{"version":"ff81bffa4ecfceae2e86b5920c3fcb250b66b1d6ed72944dffdf58123be2481b","impliedFormat":1},{"version":"458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","impliedFormat":1},{"version":"da2b6356b84a40111aaecb18304ea4e4fcb43d70efb1c13ca7d7a906445ee0d3","impliedFormat":1},{"version":"187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","impliedFormat":1},{"version":"aa2c18a1b5a086bbcaae10a4efba409cc95ba7287d8cf8f2591b53704fea3dea","impliedFormat":1},{"version":"6f294731b495c65ecf46a5694f0082954b961cf05463bea823f8014098eaffa0","impliedFormat":1},{"version":"0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","impliedFormat":1},{"version":"00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","impliedFormat":1},{"version":"bdf0ed7d9ebae6175a5d1b4ec4065d07f8099379370a804b1faff05004dc387d","impliedFormat":1},{"version":"3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","impliedFormat":1},{"version":"b03afe4bec768ae333582915146f48b161e567a81b5ebc31c4d78af089770ac9","impliedFormat":1},{"version":"df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9","impliedFormat":1},{"version":"4f6a12044ee6f458db11964153830abbc499e73d065c51c329ec97407f4b13dd","impliedFormat":1},{"version":"a957ad4bd562be0662fb99599dbcf0e16d1631f857e5e1a83a3f3afb6c226059","impliedFormat":99},{"version":"788225a56c6b6415159dc5b44dc161cf4520be5eee9204ca367f5c3815dc6170","signature":"8de99cc34384570330ba19781c23b0d6aa555e4cf3d016ba4f8139c78e1c3e40"},{"version":"eb50fb0fe1a1ec87fb570386be025a27f22e6c469974c783c9824677d7fefff9","signature":"ca82e73cdfb9c622adda9fee58bf17c609fd69e969d43ac4675ccbab08a088cd"},{"version":"2f42fc631a6e1a1de4226885b557c22a684790ef359adb97ca8085ead48c02a0","signature":"ee8b1adc2ecf6cd62ef6ef0e3353f03e04a84b780ac15bf1cbc3d81af94cd1b2"},{"version":"b3ff423135d373a82c875df559573d94f9384fc596605cbb7aa54dd2dd949a26","signature":"e1c2b72c82d4b574bdfc7040fa1bf9ebac600104d61481824d3cef6b09de5dd1"},{"version":"77bd6e9bc8261369e74fcf648938ee878a75b9d126e19ee414fd452abaf5d272","signature":"592c7e5ea2df68aa407be1398a544900b41b58ee0345428d34223fc30d978240"},{"version":"c200d5e71dd670456317187c7696e9d3014875017bd1d6b12393c4aefa1a8739","signature":"eecc3ca9156ee760957a9b522f3c154ecc95d318de05a314379b0a02097e8d3c"},{"version":"0f1377d787433323434405a062d09a1398f5d33e1576f9c613673d9f469a7e0f","signature":"7d02d97a7a65065e1d520da2d020a3f25be2e84759bc46753477fe9a9f8b538c"},{"version":"baa275c80f50945517e25fc292e3e96f84b484282ebbeb3cdc15a12249f855f9","signature":"66bcab35d001493a84cdf682f0e313872d10b6ed388efe767bb21fd883c4eac6"},{"version":"3fc4d42c1027b356c77c522b7a3daca6e87e23d89c111a432fce43e7c1d58e09","signature":"66ec166d01b5aea41847fb62680d88b5688b0aaf9496c73951a4a6239bcb878f"},{"version":"652be17ef64607e9eb0a0e87d9ffb1325f461a20362c877e0003f196b217f762","signature":"72d84e028e717c9076493b4a96f9523d24f3ebd0e08744c18d3ef714c70c2eaf"},{"version":"02b675f5beeeaf581b1b21b7bc72a1d67964dd9bccfb69ae19a79731e26f92c1","signature":"5ec5bde912e6a83d79b62a2d034bd2daf05071307bb667da8562163381f57662"}],"root":[[53,63]],"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":[[52,1],[40,2],[41,3],[39,4],[42,5],[43,6],[44,7],[45,8],[46,9],[47,10],[48,11],[49,12],[50,13],[51,14],[56,15],[57,16],[58,17],[55,18],[59,19],[53,20],[54,21],[61,22],[63,23],[62,22],[60,24]],"version":"5.6.2"}
|