lforms 29.3.1 → 33.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +264 -0
- package/README.md +97 -14
- package/changed-features.md +99 -0
- package/dist/lforms/LICENSE.md +70 -0
- package/dist/lforms/README.md +121 -0
- package/dist/lforms/fhir/R4/lformsFHIR.min.js +2 -0
- package/dist/lforms/fhir/R4/lformsFHIR.min.js.map +1 -0
- package/dist/lforms/fhir/STU3/lformsFHIR.min.js +2 -0
- package/dist/lforms/fhir/STU3/lformsFHIR.min.js.map +1 -0
- package/dist/lforms/fhir/lformsFHIRAll.min.js +2 -0
- package/dist/lforms/fhir/lformsFHIRAll.min.js.map +1 -0
- package/dist/lforms/webcomponent/assets/lib/zone.min.js +134 -0
- package/dist/lforms/webcomponent/down_arrow_gray_10_10.png +0 -0
- package/dist/lforms/webcomponent/favicon.ico +0 -0
- package/dist/lforms/webcomponent/index.html +9 -0
- package/dist/lforms/webcomponent/lhc-forms.js +2472 -0
- package/dist/lforms/webcomponent/magnifying_glass.png +0 -0
- package/dist/lforms/webcomponent/main.js +2465 -0
- package/dist/lforms/webcomponent/main.js.map +1 -0
- package/dist/lforms/webcomponent/polyfills.js +2 -0
- package/dist/lforms/webcomponent/polyfills.js.map +1 -0
- package/dist/lforms/webcomponent/runtime.js +2 -0
- package/dist/lforms/webcomponent/runtime.js.map +1 -0
- package/dist/lforms/webcomponent/scripts.js +3 -0
- package/dist/lforms/webcomponent/scripts.js.map +1 -0
- package/dist/lforms/webcomponent/styles.css +3 -0
- package/dist/lforms/webcomponent/styles.css.map +1 -0
- package/form_definition.md +381 -0
- package/package.json +94 -88
- package/r4-support.md +147 -0
- package/sdc-support.md +127 -0
- package/app/.npmignore +0 -3
- package/app/images/blank.gif +0 -0
- package/app/images/signal-stop.png +0 -0
- package/app/index.html +0 -10
- package/app/lforms.js +0 -56
- package/app/lforms.tpl.js +0 -964
- package/app/scripts/angular-packages.js +0 -11
- package/app/scripts/bootstrap-decorators.js +0 -31
- package/app/scripts/bower-index.js +0 -14
- package/app/scripts/fhir/R4/export.js +0 -33
- package/app/scripts/fhir/R4/fhirRequire.js +0 -36
- package/app/scripts/fhir/R4/lformsFHIR.js +0 -27260
- package/app/scripts/fhir/R4/sdc-export.js +0 -455
- package/app/scripts/fhir/R4/sdc-import.js +0 -483
- package/app/scripts/fhir/STU3/export.js +0 -27
- package/app/scripts/fhir/STU3/fhirRequire.js +0 -36
- package/app/scripts/fhir/STU3/lformsFHIR.js +0 -27291
- package/app/scripts/fhir/STU3/sdc-export.js +0 -493
- package/app/scripts/fhir/STU3/sdc-import.js +0 -494
- package/app/scripts/fhir/diagnostic-report.js +0 -707
- package/app/scripts/fhir/export-common.js +0 -209
- package/app/scripts/fhir/expression-processor.js +0 -670
- package/app/scripts/fhir/extensions/rendering-style.js +0 -23
- package/app/scripts/fhir/fhir-common.js +0 -3
- package/app/scripts/fhir/obs-prepop.mjs +0 -97
- package/app/scripts/fhir/runtime-common.js +0 -33
- package/app/scripts/fhir/sdc-common.js +0 -334
- package/app/scripts/fhir/sdc-export-common.js +0 -1046
- package/app/scripts/fhir/sdc-import-common.js +0 -1343
- package/app/scripts/fhir/versions.js +0 -8
- package/app/scripts/index.js +0 -20
- package/app/scripts/lforms-config.js +0 -12
- package/app/scripts/lforms-constants.js +0 -10
- package/app/scripts/lforms-controllers.js +0 -1196
- package/app/scripts/lforms-directives.js +0 -424
- package/app/scripts/lforms-index.js +0 -20
- package/app/scripts/lib/cross_browser.js +0 -21
- package/app/scripts/lib/lforms-data.js +0 -3591
- package/app/scripts/lib/lforms-hl7.js +0 -525
- package/app/scripts/lib/lforms-util.js +0 -1122
- package/app/scripts/lib/lforms-validate.js +0 -277
- package/app/scripts/lib/polyfill.js +0 -81
- package/app/scripts/themeList.js +0 -17
- package/app/styles/lforms.css +0 -1219
- package/app/styles/redmond-theme/README.txt +0 -2
- package/app/styles/redmond-theme/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_217bc0_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_2e83ff_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_469bdd_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_6da8d5_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_d8e7f3_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_f9bd01_256x240.png +0 -0
- package/app/styles/redmond-theme/jquery-ui.css +0 -1311
- package/app/styles/redmond-theme/jquery-ui.min.css +0 -7
- package/app/styles/redmond-theme/theme.css +0 -443
- package/app/styles/themes.css +0 -1541
- package/app/styles/themes.css.map +0 -9
- package/app/styles/themes.scss +0 -411
- package/app/version.json +0 -1
- package/app/views/partials/attachment.html +0 -38
- package/app/views/partials/field-answers.html +0 -67
- package/app/views/partials/field-units.html +0 -24
- package/app/views/partials/form-controls.html +0 -19
- package/app/views/partials/form-header.html +0 -35
- package/app/views/partials/form-options.html +0 -50
- package/app/views/partials/form-title.html +0 -20
- package/app/views/partials/form-view.html +0 -13
- package/app/views/partials/item-options.html +0 -48
- package/app/views/partials/item.html +0 -126
- package/app/views/partials/itemPrefixAndText.html +0 -4
- package/app/views/partials/layout-horizontal.html +0 -156
- package/app/views/partials/layout-matrix.html +0 -145
- package/app/views/partials/popover-content.html +0 -1
- package/app/views/partials/repeating-button.html +0 -16
- package/app/views/partials/table-item.html +0 -30
- package/app/views/partials/template-table.html +0 -69
- package/app/views/partials/uib-popover-templates/uib-popover-template.html +0 -13
- package/app/views/partials/uib-popover-templates/uib-popover.html +0 -11
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A package to process user data validations in LForms
|
|
3
|
-
*/
|
|
4
|
-
var LForms = require('../../lforms.js');
|
|
5
|
-
|
|
6
|
-
LForms.Validations = {
|
|
7
|
-
// supported keys in restrictions
|
|
8
|
-
_restrictionKeys : [
|
|
9
|
-
"minExclusive",
|
|
10
|
-
"minInclusive",
|
|
11
|
-
"maxExclusive",
|
|
12
|
-
"maxInclusive",
|
|
13
|
-
"totalDigits", // not used
|
|
14
|
-
"fractionDigits", // not used
|
|
15
|
-
"length",
|
|
16
|
-
"minLength",
|
|
17
|
-
"maxLength",
|
|
18
|
-
"enumeration", // not used
|
|
19
|
-
"whiteSpace", // not used
|
|
20
|
-
"pattern"
|
|
21
|
-
],
|
|
22
|
-
|
|
23
|
-
// supported data types
|
|
24
|
-
_dataTypes : [
|
|
25
|
-
"BL", // not fully supported yet
|
|
26
|
-
"INT",
|
|
27
|
-
"REAL",
|
|
28
|
-
"ST",
|
|
29
|
-
"TX", // long text
|
|
30
|
-
"BIN", // not supported yet
|
|
31
|
-
"DT", // complex type
|
|
32
|
-
"DTM", // complex type, not supported yet
|
|
33
|
-
"TM", // complex type
|
|
34
|
-
"CNE", // complex type
|
|
35
|
-
"CWE", // complex type
|
|
36
|
-
"RTO", // complex type, not supported yet
|
|
37
|
-
"QTY", // complex type
|
|
38
|
-
"NR", // complex type
|
|
39
|
-
"YEAR", // sub-type of "ST"
|
|
40
|
-
"MONTH", // sub-type of "ST"
|
|
41
|
-
"DAY", // sub-type of "ST"
|
|
42
|
-
"URL", // sub-type of "ST"
|
|
43
|
-
"EMAIL", // sub-type of "ST"
|
|
44
|
-
"PHONE", // sub-type of "ST"
|
|
45
|
-
"" // for header, no input field
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
_errorMessages: {
|
|
49
|
-
"BL": "must be a boolean (true/false).", // not fully supported
|
|
50
|
-
"INT": "must be an integer number.",
|
|
51
|
-
"REAL": "must be a decimal number.",
|
|
52
|
-
"ST": "must be a string value.", // not needed
|
|
53
|
-
"TX": "must be a text value.", // not needed
|
|
54
|
-
"BIN": "must be a binary value.", // not supported
|
|
55
|
-
"DT": "must be a date value.", // not used, handled by lf-date directive
|
|
56
|
-
"DTM": "must be a date and time value.", // not supported
|
|
57
|
-
"TM": "must be a time value.",
|
|
58
|
-
"CNE": "must be a value from the answer list.", // not used, handled by the autocomplete-lhc directive
|
|
59
|
-
"CWE": "must be a value from the answer list or a user supplied value.", // not used, handled by the autocomplete-lhc directive
|
|
60
|
-
"RTO": "must be a ratio value.", // not supported
|
|
61
|
-
"QTY": "must be a decimal number",
|
|
62
|
-
"NR": "must be two numeric values separated by a ^. One value can be omitted, but not the ^.",
|
|
63
|
-
"YEAR": "must be a numeric value of year.",
|
|
64
|
-
"MONTH": "must be a numeric value of month.",
|
|
65
|
-
"DAY": "must be a numeric value of day.",
|
|
66
|
-
"URL": "must be a valid URL.",
|
|
67
|
-
"EMAIL": "must be a valid email address.",
|
|
68
|
-
"PHONE": "must be a valid phone number."
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Returns false if the item requires a value but does not have one, and true otherwise
|
|
73
|
-
* @param required a flag that indicates if the value is required
|
|
74
|
-
* @param value the user input value
|
|
75
|
-
* @param errors the error messages array that returns
|
|
76
|
-
* @returns {boolean}
|
|
77
|
-
*/
|
|
78
|
-
checkRequired: function(required, value, errors) {
|
|
79
|
-
var ret = true;
|
|
80
|
-
if (required &&
|
|
81
|
-
(value === undefined || value === null || value === '' ||
|
|
82
|
-
(angular.isArray(value) && value.length ===0))) {
|
|
83
|
-
ret = false;
|
|
84
|
-
errors.push("requires a value");
|
|
85
|
-
}
|
|
86
|
-
return ret;
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Check if value is of the specified data type
|
|
92
|
-
* @param dataType the specified data type
|
|
93
|
-
* @param value the user input value
|
|
94
|
-
* @param errors the error messages array that returns
|
|
95
|
-
* @returns {boolean}
|
|
96
|
-
*/
|
|
97
|
-
checkDataType: function(dataType, value, errors) {
|
|
98
|
-
|
|
99
|
-
var valid = true;
|
|
100
|
-
if (value !== undefined && value !== null && value !=="") {
|
|
101
|
-
switch(dataType) {
|
|
102
|
-
case "BL":
|
|
103
|
-
if (value !== true && value !== false) {
|
|
104
|
-
valid = false;
|
|
105
|
-
}
|
|
106
|
-
break;
|
|
107
|
-
case "INT":
|
|
108
|
-
var regex = /^(\+|-)?\d+$/;
|
|
109
|
-
valid = regex.test(value);
|
|
110
|
-
break;
|
|
111
|
-
case "REAL":
|
|
112
|
-
case "QTY":
|
|
113
|
-
var regex = /^(\+|-)?\d+(\.\d+)?$/;
|
|
114
|
-
valid = regex.test(value);
|
|
115
|
-
break;
|
|
116
|
-
case "PHONE":
|
|
117
|
-
var regex = /(((^\s*(\d\d){0,1}\s*(-?|\.)\s*(\(?\d\d\d\)?\s*(-?|\.?)){0,1}\s*\d\d\d\s*(-?|\.?)\s*\d{4}\b)|(^\s*\+\(?(\d{1,4}\)?(-?|\.?))(\s*\(?\d{2,}\)?\s*(-?|\.?)\s*\d{2,}\s*(-?|\.?)(\s*\d*\s*(-|\.?)){0,3})))(\s*(x|ext|X)\s*\d+){0,1}$)/;
|
|
118
|
-
valid = regex.test(value);
|
|
119
|
-
break;
|
|
120
|
-
case "EMAIL":
|
|
121
|
-
var regex = /^\s*((\w+)(\.\w+)*)@((\w+)(\.\w+)+)$/;
|
|
122
|
-
valid = regex.test(value);
|
|
123
|
-
break;
|
|
124
|
-
case "URL":
|
|
125
|
-
var regex = /^(https?|ftp):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?$/;
|
|
126
|
-
valid = regex.test(value);
|
|
127
|
-
break;
|
|
128
|
-
case "TM": // time
|
|
129
|
-
var regex = /^\s*(((\d|[0-1]\d|2[0-4]):([0-5]\d))|(\d|0\d|1[0-2]):([0-5]\d)\s*([aApP][mM]))\s*$/;
|
|
130
|
-
valid = regex.test(value);
|
|
131
|
-
break;
|
|
132
|
-
case "YEAR":
|
|
133
|
-
var regex = /^\d{1,4}$/;
|
|
134
|
-
valid = regex.test(value);
|
|
135
|
-
break;
|
|
136
|
-
case "MONTH":
|
|
137
|
-
var regex =/^(0?[1-9]|1[012])$/;
|
|
138
|
-
valid = regex.test(value);
|
|
139
|
-
break;
|
|
140
|
-
case "DAY":
|
|
141
|
-
var regex = /^(0?[1-9]|[12]\d|3[01])$/;
|
|
142
|
-
valid = regex.test(value);
|
|
143
|
-
break;
|
|
144
|
-
case "NR":
|
|
145
|
-
var regex = /^(\-?\d+(\.\d*)?)?\s*\^\s*(\-?\d+(\.\d*)?)?$/;
|
|
146
|
-
valid = regex.test(value);
|
|
147
|
-
break;
|
|
148
|
-
case "DT": // date, handled by date directive
|
|
149
|
-
valid = LForms.Util.isValidDate(value);
|
|
150
|
-
break;
|
|
151
|
-
case "ST": // not needed
|
|
152
|
-
case "DTM": // dataTime, handled by the datetime directive (datetime picker)
|
|
153
|
-
case "RTO": // TBD
|
|
154
|
-
case "CNE": // answers list with no exception, handled by autocomplete directive
|
|
155
|
-
case "CWE": // answers list with exception, handled by autocomplete directive
|
|
156
|
-
default :
|
|
157
|
-
valid = true;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (angular.isArray(errors) && !valid) {
|
|
162
|
-
errors.push(this._errorMessages[dataType]);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return valid;
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Check the value against a list of the restrictions
|
|
170
|
-
* @param restrictions a hash of the restrictions and their values
|
|
171
|
-
* @param value the user input value
|
|
172
|
-
* @param errors the error messages array that returns
|
|
173
|
-
* @returns {boolean}
|
|
174
|
-
*/
|
|
175
|
-
checkRestrictions: function(restrictions, value, errors) {
|
|
176
|
-
|
|
177
|
-
var allValid = true;
|
|
178
|
-
if (value !== undefined && value !== null && value !=="") {
|
|
179
|
-
for (var key in restrictions) {
|
|
180
|
-
var valid = true;
|
|
181
|
-
var keyValue = restrictions[key];
|
|
182
|
-
switch(key) {
|
|
183
|
-
case "minExclusive":
|
|
184
|
-
if (parseFloat(value) > parseFloat(keyValue)) {
|
|
185
|
-
valid = true;
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
valid = false;
|
|
189
|
-
errors.push("must be a value greater than " + keyValue + ".");
|
|
190
|
-
}
|
|
191
|
-
break;
|
|
192
|
-
case "minInclusive":
|
|
193
|
-
if (parseFloat(value) >= parseFloat(keyValue)) {
|
|
194
|
-
valid = true;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
valid = false;
|
|
198
|
-
errors.push("must be a value greater than or equal to " + keyValue+ ".");
|
|
199
|
-
}
|
|
200
|
-
break;
|
|
201
|
-
case "maxExclusive":
|
|
202
|
-
if (parseFloat(value) < parseFloat(keyValue)) {
|
|
203
|
-
valid = true;
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
valid = false;
|
|
207
|
-
errors.push("must be a value less than " + keyValue+ ".");
|
|
208
|
-
}
|
|
209
|
-
break;
|
|
210
|
-
case "maxInclusive":
|
|
211
|
-
if (parseFloat(value) <= parseFloat(keyValue)) {
|
|
212
|
-
valid = true;
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
valid = false;
|
|
216
|
-
errors.push("must be a value less than or equal to " + keyValue+ ".");
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
case "totalDigits":
|
|
220
|
-
// TBD
|
|
221
|
-
break;
|
|
222
|
-
case "fractionDigits":
|
|
223
|
-
// TBD
|
|
224
|
-
break;
|
|
225
|
-
case "length":
|
|
226
|
-
if (value.length == parseInt(keyValue)) {
|
|
227
|
-
valid = true;
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
valid = false;
|
|
231
|
-
errors.push("must have a total length of " + keyValue+ ".");
|
|
232
|
-
}
|
|
233
|
-
break;
|
|
234
|
-
case "maxLength":
|
|
235
|
-
if (value.length <= parseInt(keyValue)) {
|
|
236
|
-
valid = true;
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
valid = false;
|
|
240
|
-
errors.push("must have a total length less than or equal to " + keyValue+ ".");
|
|
241
|
-
}
|
|
242
|
-
break;
|
|
243
|
-
case "minLength":
|
|
244
|
-
if (value.length >= parseInt(keyValue)) {
|
|
245
|
-
valid = true;
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
valid = false;
|
|
249
|
-
errors.push("must have a total length greater than or equal to " + keyValue+ ".");
|
|
250
|
-
}
|
|
251
|
-
break;
|
|
252
|
-
case "pattern":
|
|
253
|
-
// the "\" in the pattern string should have been escaped
|
|
254
|
-
var indexOfFirst = keyValue.indexOf("/");
|
|
255
|
-
var indexOfLast = keyValue.lastIndexOf("/");
|
|
256
|
-
// get the pattern and the flag
|
|
257
|
-
var pattern = keyValue.slice(indexOfFirst+1, indexOfLast);
|
|
258
|
-
var flags = keyValue.slice(indexOfLast+1);
|
|
259
|
-
var regex = new RegExp(pattern, flags);
|
|
260
|
-
if (regex.test(value)) {
|
|
261
|
-
valid = true;
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
valid = false;
|
|
265
|
-
errors.push("must match a RegExp pattern of " + keyValue+ ".");
|
|
266
|
-
}
|
|
267
|
-
break;
|
|
268
|
-
default:
|
|
269
|
-
valid = true;
|
|
270
|
-
}
|
|
271
|
-
allValid = allValid && valid;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return allValid;
|
|
276
|
-
}
|
|
277
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// HTML5 polyfills
|
|
2
|
-
|
|
3
|
-
// Polyill for Object.assign
|
|
4
|
-
//import 'core-js/features/object/assign'; // adds about 8k; use Mozilla's
|
|
5
|
-
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
6
|
-
if (typeof Object.assign !== 'function') {
|
|
7
|
-
// Must be writable: true, enumerable: false, configurable: true
|
|
8
|
-
Object.defineProperty(Object, "assign", {
|
|
9
|
-
value: function assign(target, varArgs) { // .length of function is 2
|
|
10
|
-
'use strict';
|
|
11
|
-
if (target === null || target === undefined) {
|
|
12
|
-
throw new TypeError('Cannot convert undefined or null to object');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
var to = Object(target);
|
|
16
|
-
|
|
17
|
-
for (var index = 1; index < arguments.length; index++) {
|
|
18
|
-
var nextSource = arguments[index];
|
|
19
|
-
|
|
20
|
-
if (nextSource !== null && nextSource !== undefined) {
|
|
21
|
-
for (var nextKey in nextSource) {
|
|
22
|
-
// Avoid bugs when hasOwnProperty is shadowed
|
|
23
|
-
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
24
|
-
to[nextKey] = nextSource[nextKey];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return to;
|
|
30
|
-
},
|
|
31
|
-
writable: true,
|
|
32
|
-
configurable: true
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Polyfill for String.repeat
|
|
37
|
-
// Taken from
|
|
38
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
|
|
39
|
-
if (!String.prototype.repeat) {
|
|
40
|
-
String.prototype.repeat = function(count) {
|
|
41
|
-
'use strict';
|
|
42
|
-
if (this == null) {
|
|
43
|
-
throw new TypeError('can\'t convert ' + this + ' to object');
|
|
44
|
-
}
|
|
45
|
-
var str = '' + this;
|
|
46
|
-
count = +count;
|
|
47
|
-
if (count != count) {
|
|
48
|
-
count = 0;
|
|
49
|
-
}
|
|
50
|
-
if (count < 0) {
|
|
51
|
-
throw new RangeError('repeat count must be non-negative');
|
|
52
|
-
}
|
|
53
|
-
if (count == Infinity) {
|
|
54
|
-
throw new RangeError('repeat count must be less than infinity');
|
|
55
|
-
}
|
|
56
|
-
count = Math.floor(count);
|
|
57
|
-
if (str.length == 0 || count == 0) {
|
|
58
|
-
return '';
|
|
59
|
-
}
|
|
60
|
-
// Ensuring count is a 31-bit integer allows us to heavily optimize the
|
|
61
|
-
// main part. But anyway, most current (August 2014) browsers can't handle
|
|
62
|
-
// strings 1 << 28 chars or longer, so:
|
|
63
|
-
if (str.length * count >= 1 << 28) {
|
|
64
|
-
throw new RangeError('repeat count must not overflow maximum string size');
|
|
65
|
-
}
|
|
66
|
-
var rpt = '';
|
|
67
|
-
for (;;) {
|
|
68
|
-
if ((count & 1) == 1) {
|
|
69
|
-
rpt += str;
|
|
70
|
-
}
|
|
71
|
-
count >>>= 1;
|
|
72
|
-
if (count == 0) {
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
str += str;
|
|
76
|
-
}
|
|
77
|
-
// Could we try:
|
|
78
|
-
// return Array(count + 1).join(this);
|
|
79
|
-
return rpt;
|
|
80
|
-
}
|
|
81
|
-
}
|
package/app/scripts/themeList.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Defines the list of available themes shown on the test pages.
|
|
2
|
-
// Yes, it is a global variable, but it is just for the test pages.
|
|
3
|
-
window.themeList = {
|
|
4
|
-
defaultValue: "Default",
|
|
5
|
-
listItems: [
|
|
6
|
-
{text: "Default"},
|
|
7
|
-
{text: "Green", code: "green"},
|
|
8
|
-
{text: "MC", code: "mc"},
|
|
9
|
-
{text: "Cyan", code: "cyan"},
|
|
10
|
-
{text: "Teal", code: "teal"},
|
|
11
|
-
{text: "Coffee", code: "coffee"},
|
|
12
|
-
{text: "Spring", code: "spring"},
|
|
13
|
-
{text: "Summer", code: "summer"},
|
|
14
|
-
{text: "Fall", code: "fall"},
|
|
15
|
-
{text: "Winter", code: "winter"}
|
|
16
|
-
]
|
|
17
|
-
};
|