Skip to content

Commit 3300c4b

Browse files
author
minjk-bl
committed
Numpy 1darr component
1 parent db1eb78 commit 3300c4b

File tree

10 files changed

+1355
-85
lines changed

10 files changed

+1355
-85
lines changed

css/m_library/numpyComponent.css

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
.vp-popup-frame .vp-option-page table.vp-option-table {
2+
width: 100%;
3+
}
4+
.vp-popup-frame .vp-option-page .vp-option-table select.var-multi, select.option-multi {
5+
height: 60px;
6+
}
7+
8+
/* Function Button */
9+
.vp-popup-frame #vp_functionList .vp_funcButton {
10+
background-color: white;
11+
padding: 3px 7px 3px 7px;
12+
margin-right: 5px;
13+
margin-bottom: 5px;
14+
border: 1px solid #535353;
15+
}
16+
.vp-popup-frame #vp_functionList .vp_funcButton:hover {
17+
background-color: lightgray;
18+
}
19+
.vp-popup-frame #vp_functionList .vp_funcButton.active {
20+
color: white;
21+
background-color: #535353;
22+
cursor: default;
23+
}
24+
25+
/* Input & Select Design */
26+
.vp-popup-frame .vp-input {
27+
height: 30px;
28+
background-color: #FFFFFF;
29+
box-sizing: border-box;
30+
padding: 0px 5px 0px 5px;
31+
}
32+
.vp-popup-frame .vp-select {
33+
height: 30px;
34+
background-color: #F5F5F5;
35+
box-sizing: border-box;
36+
/* select tag arrow */
37+
-webkit-appearance: none;
38+
-moz-appearance: none;
39+
appearance: none;
40+
padding: 0px 5px 0px 5px;
41+
cursor: pointer;
42+
}
43+
44+
/* Select Option Design */
45+
.vp-popup-frame .vp-select * {
46+
background-color: white;
47+
color: #696969;
48+
}
49+
50+
/* Input & Select Design - width m&s */
51+
.vp-popup-frame .vp-input.m,
52+
.vp-popup-frame .vp-select.m {
53+
width: 116px;
54+
}
55+
.vp-popup-frame .vp-input.s,
56+
.vp-popup-frame .vp-select.s {
57+
width: 55px;
58+
}
59+
60+
/* Range */
61+
.vp-popup-frame .vp-range {
62+
display: inline;
63+
width: 116px;
64+
}
65+
.vp-popup-frame .vp-textarea {
66+
border: 0.25px solid var(--border-gray-color);
67+
width: 100%;
68+
height: 100px;
69+
margin: 0px;
70+
}
71+
72+
/* Arrow Accordions */
73+
.vp-popup-frame .vp-option-page .vp-accordian-header {
74+
font-weight: bold;
75+
}
76+
.vp-popup-frame .vp-option-page .vp-arrow-right,
77+
.vp-popup-frame .vp-option-page .vp-arrow-down {
78+
background-repeat: no-repeat;
79+
}
80+
.vp-popup-frame .vp-option-page .vp-spread {
81+
min-height: 100px;
82+
}
83+
.vp-popup-frame .vp-option-page .vp-minimize {
84+
height: 25px;
85+
overflow: hidden;
86+
}
87+
.vp-popup-frame .vp-pandas-block {
88+
border-bottom: 1px solid darkgray;
89+
}
90+
91+
/* Prefix & Postfix Text Area */
92+
.vp-popup-frame #vp_prefixBox textarea,
93+
.vp-popup-frame #vp_postfixBox textarea {
94+
outline: none;
95+
resize: none;
96+
overflow: auto;
97+
}
98+
.no-selection {
99+
-webkit-touch-callout: none; /* iOS Safari */
100+
-webkit-user-select: none; /* Safari */
101+
-khtml-user-select: none; /* Konqueror HTML */
102+
-moz-user-select: none; /* Old versions of Firefox */
103+
-ms-user-select: none; /* Internet Explorer/Edge */
104+
user-select: none; /* Non-prefixed version, currently
105+
supported by Chrome, Edge, Opera and Firefox */
106+
}
107+
108+
/*
109+
* numpy style
110+
*/
111+
.vp-numpy-style-flex-row-center {
112+
display: flex;
113+
flex-direction: row;
114+
justify-content: center;
115+
}
116+
.vp-numpy-style-flex-row-wrap {
117+
display: flex;
118+
flex-direction: row;
119+
flex-flow: wrap;
120+
}
121+
.vp-numpy-style-flex-column {
122+
display: flex;
123+
flex-direction: column;
124+
}

data/libraries.json

Lines changed: 162 additions & 81 deletions
Large diffs are not rendered by default.

data/m_library/numpyLibrary.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
define([
2+
], function () {
3+
/**
4+
* name
5+
* library
6+
* description
7+
* code
8+
* options: [
9+
* {
10+
* name
11+
* label
12+
* [optional]
13+
* component :
14+
* - 1darr / 2darr / ndarr / scalar / param / dtype / tabblock
15+
* default
16+
* required
17+
* asParam
18+
* code
19+
* }
20+
* ]
21+
*/
22+
var NUMPY_LIBRARIES = {
23+
'np_array': {
24+
name: 'array',
25+
library: 'numpy',
26+
description: '',
27+
code: '${o0} = np.array(${i0}${dtype})',
28+
options: [
29+
{
30+
name: 'i0',
31+
label: 'Input Parameter',
32+
component: ['1darr', '2darr', 'scalar', 'param'],
33+
required: true
34+
},
35+
{
36+
name: 'o0',
37+
label: 'Allocate to',
38+
placeholder: 'New variable'
39+
},
40+
{
41+
name: 'dtype',
42+
label: 'Select Data Type',
43+
code: ', dtype=${dtype}',
44+
component: ['dtype']
45+
}
46+
]
47+
}
48+
};
49+
50+
return {
51+
NUMPY_LIBRARIES: NUMPY_LIBRARIES
52+
};
53+
54+
});

html/m_library/numpyComponent.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<body>
2+
<div class="vp-option-page">
3+
<div class="vp-accordian-container vp-require-box">
4+
<div class="vp-accordian vp-open"><span class="vp-indicator"></span><span class="vp-accordian-caption">Required Input & Output</span></div>
5+
<div id="vp_inputOutputBox" class="vp-accordian-box">
6+
<table class="vp-option-table vp-tbl-gap5">
7+
<colgroup><col width="30%"/><col width="*"/></colgroup>
8+
<tbody></tbody>
9+
</table>
10+
</div>
11+
</div>
12+
<div class="vp-accordian-container vp-option-box">
13+
<div class="vp-accordian vp-open"><span class="vp-indicator"></span><span class="vp-accordian-caption">Additional Options</span></div>
14+
<div id="vp_optionBox" class="vp-accordian-box">
15+
<table class="vp-option-table vp-tbl-gap5">
16+
<colgroup><col width="30%"/><col width="*"/></colgroup>
17+
<tbody></tbody>
18+
</table>
19+
</div>
20+
</div>
21+
</div>
22+
</body>

js/MainFrame.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ define([
326326
// if useAuto is true, use LibraryComponent to auto-generate page
327327
fileName = 'com/component/LibraryComponent';
328328
}
329+
if (menuConfig.useAutoV2) {
330+
// FIXME: must merge LibraryComponent and NumpyComponent
331+
fileName = 'com/component/NumpyComponent';
332+
}
329333
// add to menu list
330334
let filePath = 'vp_base/js/' + fileName;
331335
let menuArgIdx = loadMenuList.indexOf(filePath);

0 commit comments

Comments
 (0)