Skip to content

Commit 4bcc566

Browse files
committed
builder 3D - include settings pages
parallel changes from #12
1 parent db29c4d commit 4bcc566

File tree

7 files changed

+68
-4
lines changed

7 files changed

+68
-4
lines changed

builder-3d/widgets/MyWidget/manifest.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"hasStyle": true,
1717
"hasConfig": true,
1818
"hasUIFile": true,
19-
"hasSettingPage": false,
20-
"hasSettingUIFile": false,
21-
"hasSettingLocale": false,
22-
"hasSettingStyle": false,
19+
"hasSettingPage": true,
20+
"hasSettingUIFile": true,
21+
"hasSettingLocale": true,
22+
"hasSettingStyle": true,
2323
"IsController": false
2424
}
2525
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
<label>${nls.configText}</label><input data-dojo-attach-point="textNode">
3+
</div>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// JIMU (WAB) imports:
2+
3+
/// <amd-dependency path="jimu/BaseWidgetSetting" name="BaseWidgetSetting" />
4+
declare var BaseWidgetSetting: any; // there is no ts definition of BaseWidgetSetting (yet!)
5+
6+
// DeclareDecorator - to enable us to export this module with Dojo's "declare()" syntax so WAB can load it:
7+
import declare from "../support/declareDecorator";
8+
9+
interface Config {
10+
demoSetting: string
11+
}
12+
interface Setting {
13+
textNode?: HTMLInputElement
14+
config?: Config
15+
}
16+
17+
@declare(BaseWidgetSetting)
18+
class Setting {
19+
baseClass = 'my-widget-setting';
20+
21+
postCreate(args: any) {
22+
//the config object is passed in
23+
this.setConfig(this.config);
24+
};
25+
26+
setConfig(config: Config) {
27+
this.textNode.value = config.demoSetting;
28+
};
29+
30+
getConfig() {
31+
//WAB will get config object through this method
32+
return {
33+
demoSetting: this.textNode.value
34+
};
35+
};
36+
};
37+
38+
export = Setting;

builder-3d/widgets/MyWidget/setting/css/style.css

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder-3d/widgets/MyWidget/setting/css/style.css.map

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.jimu-widget-setting.my-widget-setting input{
2+
margin-left: 20px;
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
define({
2+
root: ({
3+
configText: "Set config text:"
4+
})
5+
// add supported locales below:
6+
// , "zh-cn": true
7+
});

0 commit comments

Comments
 (0)