-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproperties.js
246 lines (237 loc) · 5.2 KB
/
properties.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/**
* E-mergo Divider Property Panel definition
*
* @param {Object} qlik Qlik's core API
* @param {Object} util E-mergo utility functions
* @param {Object} docs E-mergo documentation functions
* @param {String} qext Extension QEXT data
* @return {Object} Extension Property Panel definition
*/
define([
"qlik",
"./util/util",
"./docs/docs",
"text!./qs-emergo-divider.qext"
], function( qlik, util, docs, qext ) {
/**
* Holds the QEXT data
*
* @type {Object}
*/
var qext = JSON.parse(qext),
/**
* Holds the reference to the current app's API
*
* @type {Object}
*/
app = qlik.currApp(),
/**
* Holds the app's current theme data
*
* @type {Object}
*/
currTheme,
/**
* Holds the settings definition of the appearance sub-panel
*
* @type {Object}
*/
appearance = {
uses: "settings",
items: {
general: {
show: false
},
selections: {
show: false
},
divider: {
label: "Divider",
component: "items",
items: {
orientation: {
label: "Orientation",
ref: "props.orientation",
type: "string",
component: "buttongroup",
options: [{
label: "Horizontal",
value: "horizontal"
}, {
label: "Vertical",
value: "vertical"
}],
defaultValue: "vertical"
},
alignment: {
label: "Alignment",
ref: "props.alignment",
type: "string",
component: "buttongroup",
options: [{
label: "Start",
value: "start"
}, {
label: "Center",
value: "center"
}, {
label: "End",
value: "end"
}],
defaultValue: "center"
},
width: {
label: "Width",
ref: "props.width",
type: "number",
component: "slider",
min: 1,
max: 30,
step: 1,
defaultValue: 1
},
borderStyle: {
label: "Border style",
ref: "props.borderStyle",
type: "string",
component: "dropdown",
options: [{
label: "Dashed",
value: "dashed"
}, {
label: "Dotted",
value: "dotted"
}, {
label: "Double",
value: "double"
}, {
label: "Groove",
value: "groove"
}, {
label: "Inset",
value: "inset"
}, {
label: "Outset",
value: "outset"
}, {
label: "Ridge",
value: "ridge"
}, {
label: "Solid",
value: "solid"
}],
defaultValue: "solid"
},
borderRadius: {
label: "Border radius",
ref: "props.borderRadius",
type: "number",
component: "slider",
min: 0,
max: 100,
step: 1,
defaultValue: 0
},
styleType: {
label: "Color",
type: "string",
component: "buttongroup",
ref: "props.styleType",
options: [{
label: "Picker",
value: "color"
}, {
label: "Expression",
value: "colorExpression"
}],
defaultValue: "style"
},
color: {
translation: "Picker",
type: "object",
component: "color-picker",
ref: "props.color",
dualOutput: true,
defaultValue: function() {
return {
index: -1,
color: currTheme && currTheme.properties.dataColors ? currTheme.properties.dataColors.primaryColor : "#000000"
};
},
show: function( layout ) {
return "color" === layout.props.styleType;
}
},
colorExpression: {
// label: "Expression",
type: "string",
expression: "optional",
ref: "props.colorExpression",
defaultValue: "",
show: function( layout ) {
return "colorExpression" === layout.props.styleType;
}
}
}
}
}
},
/**
* Holds the settings definition of the about sub-panel
*
* @type {Object}
*/
about = {
label: function() {
return "About ".concat(qext.title);
},
type: "items",
items: {
author: {
label: "This Qlik Sense extension is developed by E-mergo.",
component: "text"
},
version: {
label: function() {
return "Version: ".concat(qext.version);
},
component: "text"
},
description: {
label: "Please refer to the accompanying documentation page for a detailed description of this extension and its features.",
component: "text"
},
help: {
label: "Open documentation",
component: "button",
action: function( props ) {
util.requireMarkdownMimetype().finally( function() {
var readmeFile = window.requirejs.toUrl("extensions/".concat(props.qInfo.qType, "/README.md"));
require(["text!".concat(readmeFile)], function( readme ) {
docs.showModal(readme, qext);
});
});
}
}
}
};
// Find the appprops object and subscribe to layout changes
// This listener remains running in memory without end, but it is only
// created once for all instances of this extension.
app.getObject("AppPropsList").then( function( obj ) {
obj.layoutSubscribe( function() {
// Set the current theme
app.theme.getApplied().then( function( theme ) {
currTheme = theme;
});
});
});
return {
type: "items",
component: "accordion",
items: {
appearance: appearance,
about: about
}
};
});