Skip to content

Commit 290300c

Browse files
author
Mike Tschudi
committed
builder-2d setting demo
1 parent 16ce5f2 commit 290300c

File tree

5 files changed

+58
-4
lines changed

5 files changed

+58
-4
lines changed

builder-2d/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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
// Esri imports:
10+
import esri = require('esri');
11+
12+
interface Config {
13+
demoSetting: string
14+
}
15+
interface Setting {
16+
textNode?: HTMLInputElement
17+
config?: Config
18+
}
19+
20+
@declare(BaseWidgetSetting)
21+
class Setting {
22+
baseClass = 'my-widget-setting';
23+
24+
postCreate(args: any) {
25+
//the config object is passed in
26+
this.setConfig(this.config);
27+
};
28+
29+
setConfig(config: Config) {
30+
this.textNode.value = config.demoSetting;
31+
};
32+
33+
getConfig() {
34+
//WAB will get config object through this method
35+
return {
36+
demoSetting: this.textNode.value
37+
};
38+
};
39+
};
40+
41+
export = Setting;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.jimu-widget-demo-setting input{
2+
margin-left: 10px;
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)