-
-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathcreateGroup.js
More file actions
63 lines (51 loc) · 2.88 KB
/
createGroup.js
File metadata and controls
63 lines (51 loc) · 2.88 KB
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
define([
'nbextensions/visualpython/src/common/StringBuilder'
, './api.js'
, './constData.js'
, './createBlockBtn.js'
, './api_list.js'
, 'nbextensions/visualpython/src/common/constant'
], function ( sb, api, constData, createBlockBtn, api_list, vpConst ) {
var CreateGroup = function(blockContainerThis, id, name, container, level = 0, open = false) {
this.blockContainerThis = blockContainerThis;
this.id = id;
this.name = name;
this.container = container;
this.level = level;
this.open = open; // default open : false
this.createGroupBtnDom = null;
this.render();
}
CreateGroup.prototype.getId = function() { return this.id; }
CreateGroup.prototype.getName = function() { return this.name; }
CreateGroup.prototype.setId = function(id) { this.id = id; }
CreateGroup.prototype.setName = function(name) { this.name = name; }
CreateGroup.prototype.getGroupMainDom = function() { return this.createGroupBtnDom; }
CreateGroup.prototype.setGroupMainDom = function(createGroupBtnDom) {
this.createGroupBtnDom = createGroupBtnDom;
}
CreateGroup.prototype.render = function() {
var sbCreateGroupBtn = new sb.StringBuilder();
sbCreateGroupBtn.appendFormatLine('<div class="{0} {1}">', 'vp-block-blocktab-group-box', this.open? '': 'vp-apiblock-minimize');
sbCreateGroupBtn.appendFormatLine('<div class="{0}"', 'vp-apiblock-tab-navigation-node-block-title vp-accordion-header');
sbCreateGroupBtn.appendLine(' style="justify-content: flex-start;">');
sbCreateGroupBtn.appendFormatLine('<div class="{0} {1}">', 'vp-apiblock-panel-area-vertical-btn', this.open? 'vp-apiblock-arrow-up': 'vp-apiblock-arrow-down');
sbCreateGroupBtn.appendFormatLine('<span class="{0}"></span>', 'vp-accordion-indicator');
sbCreateGroupBtn.appendLine('</div>');
sbCreateGroupBtn.appendFormatLine('<span class="{0}"', 'vp-block-blocktab-name vp-block-blocktab-name-title vp-accordion-caption');
sbCreateGroupBtn.appendFormatLine(' style="font-size: 14px;" title="{0}">{1}</span>', this.getName(), this.getName());
sbCreateGroupBtn.appendLine('</div>');
sbCreateGroupBtn.appendFormatLine('<div class="{0} {1} {2}">'
, 'vp-apiblock-group-list'
, 'vp-apiblock-left-tab-' + this.getId()
, 'vp-apiblock-style-column-row-wrap');
sbCreateGroupBtn.appendLine('</div>');
sbCreateGroupBtn.appendLine('</div>');
var createBlockContainer = $(this.container);
var createGroupBtnDom = $(sbCreateGroupBtn.toString());
this.setGroupMainDom(createGroupBtnDom);
createBlockContainer.append(createGroupBtnDom);
this.createGroupBtnDom = createGroupBtnDom;
}
return CreateGroup;
});