-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
233 lines (208 loc) · 9 KB
/
index.html
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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>StripToastr Test PlayGround</title>
<script id="sap-ui-bootstrap" src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" data-sap-ui-libs="sap.m, ui5lab/striptoastr" data-sap-ui-xx-bindingSyntax="complex" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-preload="async" data-sap-ui-accessibility="false"
data-sap-ui-resourceroots='{"ui5lab":"./dist/ui5lab"}'>
</script>
<style type="text/css">
.newButton.sapMBtn {
margin-left: 0.25rem;
}
.stripToastr.sapMMsgStrip {
margin-bottom: 0.75rem!important;
width: 300px;
-moz-box-shadow: 0 0 12px #999;
-webkit-box-shadow: 0 0 12px #999;
box-shadow: 0 0 12px #999;
-webkit-transition: opacity 1s;
transition: opacity 1s;
}
</style>
<script>
sap.ui.getCore().attachInitEvent(function() {
sap.ui.require([
"ui5lab/striptoastr/StripToastr", "sap/m/Link", "sap/m/Button", "sap/m/Input", "sap/m/ComboBox",
"sap/m/Label", "sap/m/CheckBox", "sap/ui/core/Item", "sap/ui/layout/VerticalLayout", "sap/ui/layout/HorizontalLayout", "sap/ui/layout/form/SimpleForm"
], function(StripToastr, Link, Button, Input, ComboBox, Label, CheckBox, Item,
VerticalLayout, HorizontalLayout, SimpleForm) {
var oLast = null;
var oTextLabel = new Label({
text: "Text"
});
var oTextInput = new Input({
value: "text to display",
placeholder: "Enter text"
});
var oTimeOutLabel = new Label({
text: "Time Out"
});
var oTimeOutInput = new Input({
value: 5000,
type: "Number",
placeholder: "Duration"
});
var oTypeLabel = new Label({
text: "Type"
});
var oTypeComboBox = new ComboBox({
items: ["Error", "Warning", "Information", "Success"].map(function(item) {
return {
key: item,
text: item
};
}),
selectedKey: "Error"
});
var oPositionLabel = new Label({
text: "Position"
});
var oPositionComboBox = new ComboBox({
items: ["begin top", "begin center", "begin bottom", "left top", "left center", "left bottom",
"center top", "center center", "center bottom", "right top", "right center", "right bottom",
"end top", "end center", "end bottom"
].map(function(item) {
return {
key: item,
text: item
};
}),
selectedKey: "right top"
});
var oCustomIconLabel = new Label({
text: "Custom Icon"
});
var oCustomIconInput = new Input({
placeholder: "eg. sap-icon://locked"
});
var oShowIconCB = new CheckBox({
text: "Show Icon",
selected: true
});
var oShowCloseButtonCB = new CheckBox({
text: "Show Close Button",
selected: true
});
var oNewestFirstCB = new CheckBox({
text: "Newest On Top",
selected: false
});
var oShowBtn = new Button({
text: "Show",
type: "Accept",
press: function() {
var oData = {
text: oTextInput.getValue(),
type: oTypeComboBox.getSelectedKey(),
position: oPositionComboBox.getSelectedKey(),
showIcon: oShowIconCB.getSelected(),
customIcon: oCustomIconInput.getValue(),
newestFirst: oNewestFirstCB.getSelected(),
showCloseButton: oShowCloseButtonCB.getSelected(),
timeOut: parseInt(oTimeOutInput.getValue(), 10)
};
fnShowToast(oData);
}
});
var oClearBtn = new Button({
text: "Clear All",
type: "Reject",
press: function() {
StripToastr.clear();
}
}).addStyleClass("newButton");
var oClearLastBtn = new Button({
text: "Clear Last",
type: "Reject",
press: function() {
StripToastr.clear(oLast);
}
}).addStyleClass("newButton");
var aToasts = [{
text: "Error with default icon and close button",
type: "Error",
}, {
text: "Warning with default icon and close button",
type: "Warning",
}, {
text: "Success with default icon and close button",
type: "Success",
timeOut: 8000
}, {
text: "Information with default icon.",
type: "Information",
timeOut: 9000
}, {
text: "Information with custom icon",
type: "Information",
showIcon: true,
customIcon: "sap-icon://locked",
timeOut: 8900
}, {
text: "Error with link",
type: "Error",
showCloseButton: true,
link: new Link({
text: "Fork Me On Github",
target: "_blank",
href: "https://github.com/jasper07/StripToastr"
}),
timeOut: 10000
}];
var fnShowToast = function(options) {
oLast = StripToastr.notify(options);
return oLast;
};
var i = 0;
var fnDelayToast = function() {
if (i === aToasts.length) {
return;
}
window.setTimeout(function() {
fnShowToast(aToasts[i]);
i++;
fnDelayToast();
}, 1100);
};
var oSimpleForm = new SimpleForm({
editable: true,
layout: "ResponsiveGridLayout",
labelSpanL: 3,
labelSpanM: 3,
emptySpanL: 4,
emptySpanM: 4,
columnsL: 1,
columnsM: 1,
content: [new sap.ui.core.Title({
text: "Add/Remove message"
}),
oTextLabel, oTextInput, oTypeLabel, oTypeComboBox, oPositionLabel, oPositionComboBox,
oCustomIconLabel, oCustomIconInput, oTimeOutLabel, oTimeOutInput,
new sap.m.Label(),
oShowIconCB, new Label(), oShowCloseButtonCB, new Label(), oNewestFirstCB,
new Label(),
new HorizontalLayout({
content: [oShowBtn, oClearBtn, oClearLastBtn]
})
]
});
var oPage = new sap.m.Page({
title: "StripToastr Test PlayGround",
content: [oSimpleForm]
});
var app = new sap.m.App("myApp", {
initialPage: oPage
});
app.addPage(oPage).placeAt("content");
fnDelayToast();
});
});
</script>
</head>
<body class="sapUiBody"></body>
<div id="content"></div>
<a href="https://github.com/jasper07/StripToastr"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
</html>