-
Notifications
You must be signed in to change notification settings - Fork 0
/
distindex.html
542 lines (467 loc) · 19.3 KB
/
distindex.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>IW-Spreadsheet Examples - 0.2.418-SNAPSHOT</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="lib/normalize.css/normalize.css" />
<link rel="stylesheet" href="lib/font-awesome/font-awesome.css" />
<style type="text/css">
.image {
display: inline-block;
width: 32px;
height: 32px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAARCQAAEQkBwOWiGAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAG8SURBVFiF7de/axVBEAfwz2kgRNDCgIUY/JEqxSsELYSAAcFaEOyTQrCyFfv8A4r/gWgrAcEgiKCdqEW0ULDQyohBTBEjiY7F7XtsQt7dBV9yChkY7nbvOzvfm9md3S0iQpsylDeKouhgdId9LkXEQq8VEVIU5hG7pPM9v8l5Zxedd7UTEfalQOx02LeSUfQItCZ7BP5LAj8xgittERARq1hrjcAgZage0lheYg7fcBaTOFlnNKgI3I6IM7iHd7gREadwrdYyleIpzUvoarK5lNrrOIgL+J3hJpU/+L3POFN5Kf4bWccKlvE563+GXzjUxy4YTAqGMR0RL3BMmf+beF5jV5Q0tp+CH5tS0NVHmMHRbIu/qKwbfVNQR+Bh+jaX9X1JNjMVJF/hcsLdryJQl4KRiHiKB1lf9zQzlp5vMIHZDHMa19P7cqWHmgisKNfyMK7iDsaxH+8TZg3HlZPtVvr7JziHA/hQFYEmc+C1dHpJ2MO4uwnzVpmSExluAo8rxm1MoKuL+GjjWt9KP+Frg/HOR8S2SvGRhrixegjSMmx9M9oj8M8QWGrBd+mz7atZkd+O27icbiDQhvwBRpt2KPfzGu8AAAAASUVORK5CYII61aca5b15dc195f896e509d7d7121624');
}
</style>
<script>
var urlParams = (location.href.split('?')[1] || '').split('&'),
param,
key,
val,
options = {
'themes': 'base',
'showTitle': false,
'showColumnGroup': false,
'showColumnHeader': false,
'showRowHeader': false,
'numberOfColumns': 20,
'numberOfRows': 100,
'numberOfFixedRows': 0,
'numberOfFixedColumns': 0,
'dataParseUnit': 10,
'showValueEditor': false,
'showDefaultGrid': false,
'defaultGridLineColor': '#CCC',
};
for (var i = 0, l = urlParams.length; i < l; i++) {
param = urlParams[i].split('=');
key = param[0];
val = param[1];
options[key] = val === 'on' ? true : val;
}
options.themes = options.themes ? options.themes : 'base';
options.dataParseUnit = Math.max(options.dataParseUnit, 1);
options.numberOfFixedRows = Math.max(options.numberOfFixedRows, 0);
options.numberOfFixedColumns = Math.max(options.numberOfFixedColumns, 0);
options.numberOfColumns = Math.max(options.numberOfColumns, 20);
options.numberOfRows = Math.max(options.numberOfRows, 20);
options.defaultGridLineColor = decodeURIComponent(options.defaultGridLineColor);
document.write('<link rel="stylesheet" href="lib/jquery-ui/themes/' + options.themes + '/theme.css" />');
if (options.themes !== 'base') {
document.write('<link rel="stylesheet" href="lib/jquery-ui/themes/' + options.themes + '/jquery-ui.min.css" />');
}
document.write('<' + 'link rel="stylesheet" href="css/iui-january.min.css"/' + '>');
</script>
<style>
.feature-list {
position: absolute;
right: 0;
width: 35%;
}
#sheet {
position: relative;
margin-left: 30px;
}
form {
padding: 0 2em;
margin: 0.3em;
text-align: right;
}
#samplecode {
margin-left: 30px;
}
</style>
</head>
<body>
<h1>
<span class="image"></span> January, Innerwave UI Component - 0.2.418-SNAPSHOT</h1>
<form method="get">
<div>
<lable for="themes">Themes: </lable>
<select id="themes" name='themes' onchange="submit()">
<option>base</option>
<option>black-tie</option>
<option>blitzer</option>
<option>cupertino</option>
<option>dark-hive</option>
<option>dot-luv</option>
<option>eggplant</option>
<option>excite-bike</option>
<option>flick</option>
<option>hot-sneaks</option>
<option>humanity</option>
<option>le-frog</option>
<option>mint-choc</option>
<option>overcast</option>
<option>pepper-grinder</option>
<option>redmond</option>
<option>smoothness</option>
<option>south-street</option>
<option>start</option>
<option>sunny</option>
<option>swanky-purse</option>
<option>trontastic</option>
<option>ui-darkness</option>
<option>ui-lightness</option>
<option>vader</option>
</select>
</div>
<div>
<label for="showTitle">Show Title</label>
<input type="checkbox" id="showTitle" name="showTitle" />
</div>
<div>
<label for="showColumnGroup">Show Column Group</label>
<input type="checkbox" id="showColumnGroup" name="showColumnGroup" />
</div>
<div>
<label for="showColumnHeader">Show Column Header</label>
<input type="checkbox" id="showColumnHeader" name="showColumnHeader" />
</div>
<div>
<label for="showRowHeader">Show Row Header</label>
<input type="checkbox" id="showRowHeader" name="showRowHeader" />
</div>
<div>
<label for="showValueWindow">Show Value Editor</label>
<input type="checkbox" id="showValueWindow" name="showValueWindow" />
</div>
<div>
<label for="numberOfColumns">Number Of Columns(minimum is 20 in this examples)</label>
<input type="text" id="numberOfColumns" name="numberOfColumns" />
</div>
<div>
<label for="numberOfRows">Number Of Rows</label>
<input type="text" id="numberOfRows" name="numberOfRows" />
</div>
<div>
<label for="dataParseUnit">Parsing Unit of Data</label>
<input type="text" id="dataParseUnit" name="dataParseUnit" />
</div>
<div>
<label for="showDefaultGrid">Show Default Grid Line</label>
<input type="checkbox" id="showDefaultGrid" name="showDefaultGrid" />
</div>
<div>
<label for="defaultGridLineColor">Default Grid Line Color</label>
<input type="text" id="defaultGridLineColor" name="defaultGridLineColor" />
</div>
<div>
<label for="numberOfFixedRows">Fixed Rows</label>
<input type="text" id="numberOfFixedRows" name="numberOfFixedRows" />
</div>
<div>
<label for="numberOfFixedColumns">Fixed Columns</label>
<input type="text" id="numberOfFixedColumns" name="numberOfFixedColumns" />
</div>
<div>
<input type="submit" value="Show" />
</div>
</form>
<ol class="feature-list">
<li> 데이터 용량 기준 : 50 X 20000 (컬럼 X 로우)
<br/> - 개발 PC 기준으로 한 로딩 시간은 약 25 ~ 30초(파싱 유닛을 500으로 설정시)
<br/> 파싱 유닛의 크기에 따라 ui 프리징이 발생한다.
</li>
<li> 데이터 파싱에 따른 UI 프리징 현상 최소화:
<br/> - 데이터 파싱 중에도 현재까지 파싱된 데이터에 대한 조작 가능
<br/> - 데이터 파싱 중지 가능
</li>
<li> jQueryUI 테마 지원. </li>
<li> Options :
<ul>
<li>(O) 제목 표시 및 숨김</li>
<li>(O) 열 헤더 라벨 표시 및 숨김</li>
<li>(O) 행 헤더 라벨 표시 및 숨김</li>
<li>(O) 셀 데이터 수정 창 표시 및 숨김</li>
<li>(O) 기본 그리드 라인 표시 및 숨김</li>
<li>(X) 정렬 가능 여부</li>
<li>(X) 수정 가능 여부</li>
</ul>
</li>
<li> 보기 :
<ul>
<li>(O) 데이터 로딩 프로그레스바 </li>
<li>(O) 데이터 로딩 중지.(현재까지 로딩된 데이터만 사용: 프로그레스바 클릭)</li>
<li>(O) 선택한 로우, 컬럼, 셀 강조</li>
<li>(O) 컬럼 정렬(마우스로 순서 변경): 그룹내 정렬, 그룹외 정렬 구분 됨</li>
<li>(O) 로우 정렬 (마우스로 순서 변경)</li>
<li>(O) 컬럼 너비 조정</li>
<li>(O) 로우 높이 조정</li>
<li>(O) 컬럼 그룹명 표시 </li>
<li>(X) 컬럼 그룹 편집(컬럼을 드래그 앤 드롭으로 추가 및 제거?)</li>
<li>(X) 컬럼 그룹 정렬(마우스로 순서 변경) </li>
<li>(X) 컬럼 그룹 너비 조정</li>
<li>(O) 컬럼 고정
<br/> 정렬 로직에 대한 재 작성이 필요. 가로 스크롤 후에 발생하는 수동 정렬시 고정 컬럼이 변경되지 않음.
<br/> 한번에 될 수 있도록 로직을 수정할 필요가 있음. 현재는 조금 씩 앞으로 컬럼을 이동하여서 고정할 수 있음.
</li>
<li>(X) Row 고정 : 필요할까?</li>
<li>(X) 열 헤더 좌/우 스크롤 버튼</li>
<li>(X) 행 헤더 상/하 스크롤 버튼</li>
<li>(X) 컬럼 정렬시(드래깅) 좌우 스크롤 버튼 hover 시 자동 스크롤</li>
<li>(X) 로우 정렬시(드래깅) 상하 스크롤 버튼 hover 시 자동 스크롤</li>
</ul>
</li>
<li> 선택 :
<ul>
<li>(O) 행 선택</li>
<li>(O) 열 선택</li>
<li>(O) 셀 선택</li>
<li>(O) Ctrl + 클릭하여 행, 열, 셀 추가 선택</li>
<li>(X) Shift + 클릭하여 행, 열, 셀 추가 선택</li>
<li>(X) 드래그한 영역으로 셀 선택</li>
</ul>
</li>
<li> 함수 :
<ul>
<li>(X) SUM</li>
</ul>
</li>
<li> 편집 :
<ul>
<li>(X) 복사 (Ctrl + C)</li>
<li>(X) 붙이기 (Ctrl + P)</li>
<li>(X) 현재 행 삭제</li>
<li>(X) 현재 열 삭제</li>
<li>(X) 선택한 행 삭제</li>
<li>(X) 선택한 열 삭제</li>
<li>(X) 셀 데이터 편집: 데이터 수정 창(상단 컬럼 헤더의 아래 줄)을 통한 수정</li>
<li>(X) 열 데이터 편집 팝업 API</li>
<li>(X) 셀 스타일 편집</li>
<li>(X) 열 스타일 편집</li>
<li>(X) 행 스타일 편집</li>
<li>(X) 셀 추가 생성</li>
<li>(X) 열 추가 생성</li>
<li>(X) 행 추가 생성</li>
</ul>
</li>
<li> 마우스
<ul>
<li>(O) 상/하 스크롤 </li>
<li>(O) 좌/우 스크롤 (Shift + 스크롤)</li>
</ul>
</li>
<li> 단축 키보드
<ul>
<li>(X) ESC : 파싱 중지 </li>
<li>(X) 위쪽 화살표</li>
<li>(X) 아랫쪽 화살표</li>
<li>(X) 오른쪽 화살표</li>
<li>(X) 왼쪽 화살표</li>
<li>(X) 페이지 업</li>
<li>(X) 페이지 다운</li>
<li>(X) 페이지 맨위</li>
<li>(X) 페이지 맨아래</li>
</ul>
</li>
<li> ISSUE
<ol>
<li>(X) 열, 행, 셀 선택시 스타일 지정하는 로직에 대한 성능 문제가 발생할 수 있다. 렌더링 관련 로직을 점검하자.
<br/>선택한 셀, 컬럼, 로우에 대한 정보를 직접 관리하는 것이 좋겠다.
</li>
<li>(O) 스크롤러 작동 어색. 제대로 다시 만들어야 할 것 같다.</li>
<li>(X) 파싱을 중단했을 경우 다시 재개 할 수 있는 방법이나 추가적인 파싱에 대한 로직 추가</li>
<li>(X) </li>
<li>(X) </li>
<li>(X) </li>
<li>(O) Multi instance</li>
</ol>
</li>
</ol>
<div id="sheet" width="786" height="512" title="1. Innerwave Spreadsheet 예제" class="ui-widget ui-corner-all"></div>
<div id="sheet2" width="786" height="512" title="1. Innerwave Spreadsheet 멀티 예제" class="ui-widget ui-corner-all"></div>
<script>
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function() {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
}
}());
// Place any jQuery/helper plugins in here.
</script>
<script src="lib/modernizr/modernizr.js"></script>
<script src="lib/jquery/jquery.js"></script>
<script src="lib/jquery-ui/jquery-ui.js"></script>
<script src="lib/jquery-mousewheel/jquery.mousewheel.js"></script>
<script src="js/iui-january.min.js"></script>
<script src="js/iui-scroller.min.js"></script>
<script>
function mkColumn(size) {
var columns = [];
for (var i = 0; i < size; i++) {
columns.push({
id: 'col' + i,
label: undefined, //i < 5 ? 'Col ' + (i + 1) : undefined,
width: 80,
className: 'sheet-column-text',
});
}
return columns;
}
function mkData(columns, rows) {
var data = [];
var row;
for (var i = 0; i < rows; i++) {
row = {};
row.id = 'row' + i;
// if (i % 2 !== 0) {
for (var j = 0, l = columns; j < l; j += 1) {
// TODO 컬럼 값에 데이터 뿐 아니라. 스패닝, 스타일(CSS) 등을 저장할 수 있도록 object 타입으로 수정할 필요가 있다.
/**
* var cell = {value: '', css: '', colspan:1, rowspan: 1, className:'spreadsheet-cell cell-format-text', formular:formular };
*/
row[ /*columnId*/ 'col' + j] = {
value: j + ', ' + i,
// rows: ['row' + i, 'row' + (i + 1)]
};
}
// }
data.push(row);
}
return data;
}
function drawSheet() {
$('select[name=themes]').val(options.themes);
$('input[name="showTitle"]').prop('checked', options.showTitle);
$('input[name="showColumnHeader"]').prop('checked', options.showColumnHeader);
$('input[name="showColumnGroup"]').prop('checked', options.showColumnGroup);
$('input[name="showRowHeader"]').prop('checked', options.showRowHeader);
$('input[name="showValueWindow"]').prop('checked', options.showValueWindow);
$('input[name="numberOfRows"]').val(options.numberOfRows);
$('input[name="numberOfColumns"]').val(options.numberOfColumns);
$('input[name="dataParseUnit"]').val(options.dataParseUnit);
$('input[name="numberOfFixedRows"]').val(options.numberOfFixedRows);
$('input[name="numberOfFixedColumns"]').val(options.numberOfFixedColumns);
$('input[name="showDefaultGrid"]').prop('checked', options.showDefaultGrid);
$('input[name="defaultGridLineColor"]').val(options.defaultGridLineColor);
var columns = mkColumn(options.numberOfColumns);
// columns[6].label = '일곱번째 컬럼명'
// 컬럼 그룹핑은 그룹 명을 동일하게 지정합니다.
// 그룹으로 묶을 컬럼은 붙어 있어야 합니다.
columns[0].group = '그룹 0';
columns[1].group = '그룹 1';
columns[2].group = '그룹 1';
columns[3].group = '그룹 1';
// columns[4].group = 'Group 2';
columns[5].group = 'Group 2';
columns[6].group = 'Group 2';
// columns[7].group = 'Group 3';
columns[8].group = 'Group 3';
columns[9].group = 'Group 3';
columns[10].group = 'Group 3';
// columns[20].group = 'Group 4';
columns[11].group = 'Group 4';
// columns[12].group = 'Group 4';
columns[13].group = 'Group 5';
columns[14].group = 'Group 5';
columns[15].group = 'Group 5';
var data = mkData(columns.length, options.numberOfRows);
var $uiProgressLabel = $('<div class="spreadsheet-progress-label">').text('Loading......');
var $uiProgressBar = $('<div class="spreadsheet-progress">')
.progressbar({
value: false,
change: function() {
$uiProgressLabel.text($uiProgressBar.progressbar("value") + "% plugin")
.css('left', ($uiProgressBar.width() - $uiProgressLabel.outerWidth()) / 2 + 'px');
},
complete: function() {
$uiProgressLabel.text("100%");
$uiProgressLabel.css('left', ($uiProgressBar.width() - $uiProgressLabel.outerWidth()) / 2 + 'px');
$uiProgressBar.hide('slow');
}
})
.append($uiProgressLabel);
var $sheet = $('#sheet').january({
// 태그에 속성으로 설정된 것보다 우선한다.
// 'width': 400,
// 'height': 300,
//'title' : 'test example',
'columns': columns,
// 'data': data, // 옵션으로 주입하면 모든 데이터를 파싱한 후 디스플레이한다.
'progressBar': $uiProgressBar,
// 'numberOfColumns': 100,
// 'numberOfRows': 500,
'dataParseUnit': options.dataParseUnit,
// 행 고정: 상단에 고정으로 보일 행의 갯수를 지정합니다.
// sheet.rows 상의 인덱스에 따릅니다.
'numberOfFixedRows': options.numberOfFixedRows,
// 열 고정 : 좌측에 고정할 열의 갯수를 지정합니다.
// sheet.columns의 인덱스 순서에 따릅니다.
'numberOfFixedColumns': options.numberOfFixedColumns,
'showTitle': options.showTitle,
'showRowHeaders': options.showRowHeader,
'showColumnGroups': options.showColumnGroup,
'showColumnHeaders': options.showColumnHeader,
'showValueWindow': options.showValueWindow,
'showDefaultGrid': options.showDefaultGrid,
'defaultGridLineColor': options.defaultGridLineColor,
'create': function(event, ui) {
// console.log('create complete');
//loadData(event, ui);
//$(this).spreadsheet('data', data);
}
});
// var $dialog = $('<div title="Display in Dialog">').dialog();
// $dialog.append($sheet);
// 위젯 생성 이후에 메소드를 호출하여 컬럼 생성
// $sheet.january('columns', columns);
// 위젯 생성 이후에 데이터 주입 ..
// 실시간으로 주입되는 데이터를 바로 바로 화면에서 볼 수 있다.
// 파싱한 데이터는 조작 가능하고 , 중단할 수 있다.
$sheet.january('data', data);
/*
options.showColumnGroup = false;
var columns2 = mkColumn(6);
var data2 = mkData(columns2.length, 500);
// 다중 인스턴스
var $sheet2 = $('#sheet2').january({
// 태그에 속성으로 설정된 것보다 우선한다.
// 'width': 400,
// 'height': 300,
//'title' : 'test example',
'columns': columns2,
// 'data': data, // 옵션으로 주입하면 모든 데이터를 파싱한 후 디스플레이한다.
// 'numberOfColumns': 100,
// 'numberOfRows': 500,
'dataParseUnit': options.dataParseUnit,
// 행 고정: 상단에 고정으로 보일 행의 갯수를 지정합니다.
// sheet.rows 상의 인덱스에 따릅니다.
'numberOfFixedRows': options.numberOfFixedRows,
// 열 고정 : 좌측에 고정할 열의 갯수를 지정합니다.
// sheet.columns의 인덱스 순서에 따릅니다.
'numberOfFixedColumns': options.numberOfFixedColumns,
'showTitle': options.showTitle,
'showRowHeaders': options.showRowHeader,
'showColumnGroups': options.showColumnGroup,
'showColumnHeaders': options.showColumnHeader,
'showValueWindow': options.showValueWindow,
'showDefaultGrid': options.showDefaultGrid,
'defaultGridLineColor': options.defaultGridLineColor
});
$sheet2.january('data', data2);
*/
}
window.onload = function() {
drawSheet();
}
</script>
</body>
</html>