Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd51c78

Browse files
author
minjk-bl
committed
Add ml mode to DataSelector
1 parentc42729b commitfd51c78

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

‎visualpython/js/com/component/DataSelector.js‎

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ define([
5050
super._init();
5151

5252
this.prop={
53-
type:'data',// selector type : data / column
53+
type:'data',// selector type : data / column / ml
5454
pageThis:null,// target's page object
5555
id:'',// target id
5656
value:null,// pre-defined value
5757
withPopup:true,// with filter button to show simple subset popup
5858
finish:null,// callback after selection (value, dtype)
5959
select:null,// callback after selection from suggestInput (value, dtype)
6060
allowDataType:null,// list of allowed data types
61+
dataCategory:null,// list of data category (use it for ml categories)
6162
// additional options
6263
boxClasses:'',
6364
classes:'',
@@ -71,9 +72,20 @@ define([
7172
// If null, define default allow data type
7273
if(!this.prop.allowDataType){
7374
// default allow data types
74-
this.prop.allowDataType=[
75-
'DataFrame','Series','ndarray','list','dict'
76-
]
75+
if(this.prop.type==='ml'){
76+
this.prop.allowDataType=vpConfig.getMLDataTypes();
77+
}else{
78+
this.prop.allowDataType=[
79+
'DataFrame','Series','ndarray','list','dict'
80+
]
81+
}
82+
}
83+
if(!this.prop.dataCategory){
84+
if(this.prop.type==='ml'){
85+
this.prop.dataCategory=vpConfig.getMLCategories();
86+
}else{
87+
this.prop.dataCategory=this.prop.allowDataType;
88+
}
7789
}
7890

7991
this.state={
@@ -282,7 +294,11 @@ define([
282294
that.renderVariableBox(that._varList.filter(obj=>!that.prop.allowDataType.includes(obj.dtype)));
283295
}else{
284296
// filter variable list
285-
that.renderVariableBox(that._varList.filter(obj=>obj.dtype==type));
297+
if(that.prop.type==='ml'){
298+
that.renderVariableBox(that._varList.filter(obj=>vpConfig.getMLDataDict(type).includes(obj.dtype)));
299+
}else{
300+
that.renderVariableBox(that._varList.filter(obj=>obj.dtype==type));
301+
}
286302
}
287303

288304
});
@@ -530,7 +546,7 @@ define([
530546
letvarTags=newcom_String();
531547
lettypes=[
532548
'All',
533-
...this.prop.allowDataType,
549+
...this.prop.dataCategory,
534550
'Others'
535551
];
536552
// Add Data Types to filter
@@ -551,10 +567,17 @@ define([
551567
letthat=this;
552568
letvarTags=newcom_String();
553569
varTags=newcom_String();
554-
varList&&varList.forEach((obj,idx)=>{
555-
varTags.appendFormatLine('<div class="{0} {1}" title="{2}" data-type="{3}">{4}</div>'
556-
,'vp-ds-var-item',(that.state.data==obj.value?'selected':''),obj.dtype,obj.dtype,obj.label);
557-
});
570+
if(this.prop.type==='ml'){
571+
varList&&varList.forEach((obj,idx)=>{
572+
varTags.appendFormatLine('<div class="{0} {1}" title="{2}" data-type="{3}">{4}<span class="vp-gray-text"> | {5}</span></div>'
573+
,'vp-ds-var-item',(that.state.data==obj.value?'selected':''),obj.dtype,obj.dtype,obj.label,obj.dtype);
574+
});
575+
}else{
576+
varList&&varList.forEach((obj,idx)=>{
577+
varTags.appendFormatLine('<div class="{0} {1}" title="{2}" data-type="{3}">{4}</div>'
578+
,'vp-ds-var-item',(that.state.data==obj.value?'selected':''),obj.dtype,obj.dtype,obj.label);
579+
});
580+
}
558581
$(this.wrapSelector('.vp-ds-variable-box')).html(varTags.toString());
559582

560583
// focus on selected item

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp