|
14 | 14 |
|
15 | 15 | /* TODOs:
|
16 | 16 | * - Loading Animation (Spinner)
|
17 |
| - * - Implement preloadContent for async and iframe content types. |
18 | 17 | * - Implement slideLeft animation
|
19 |
| - * - Implement functionality to skip a certain amount of steps |
20 | 18 | * - Add insert and remove step method
|
21 | 19 | */
|
22 | 20 |
|
23 | 21 |
|
24 | 22 | /* Planed Features:
|
25 | 23 | * - Progress bar
|
26 | 24 | * - Advanced Accessibility support (WAI-ARIA)
|
| 25 | + * - Implement preloadContent for async and iframe content types. |
| 26 | + * - Implement functionality to skip a certain amount of steps |
27 | 27 | */
|
28 | 28 |
|
29 | 29 | (function ($)
|
|
219 | 219 | enableAllSteps: false, /* If true, all steps are ebable from the begining (all steps are clickable) */
|
220 | 220 | enableKeyNavigation: true,
|
221 | 221 | enablePagination: true,
|
222 |
| - blockPaginationForFields: true, |
| 222 | + suppressPaginationOnFocus: true, /* Suppress pagination if a form field is focused (within the current wizard) */ |
223 | 223 | enableContentCache: true,
|
224 | 224 | enableFinishButton: true,
|
225 | 225 | preloadContent: false, /* Not yet implemented */
|
|
381 | 381 | **/
|
382 | 382 | $.fn.steps.insert = function (index, step)
|
383 | 383 | {
|
| 384 | + /*var wizard = $(this); |
| 385 | + var state = wizard.data("state"); |
| 386 | +
|
| 387 | + if (index < 0 || index > state.Count) |
| 388 | + { |
| 389 | + throw new Error("Index out of range."); |
| 390 | + }*/ |
| 391 | + |
384 | 392 | // State must be modified
|
385 | 393 | throw new Error("Not yet implemented!");
|
386 | 394 | };
|
|
424 | 432 | $this.keyup(function (event)
|
425 | 433 | {
|
426 | 434 | var wizard = $(this);
|
427 |
| - if (wizard.data("options").blockPaginationForFields && $(":focus", wizard).is(":input")) |
| 435 | + if (wizard.data("options").suppressPaginationOnFocus && $(":focus", wizard).is(":input")) |
428 | 436 | {
|
429 | 437 | event.preventDefault();
|
430 | 438 | return false;
|
|
909 | 917 | };
|
910 | 918 | }
|
911 | 919 |
|
| 920 | + /** |
| 921 | + * Gets a valid enum value by checking an specific enum key or value. |
| 922 | + * |
| 923 | + * @private |
| 924 | + * @methodName getValidEnumValue |
| 925 | + * @param enumType Type of enum |
| 926 | + * @param keyOrValue Key or value to check for |
| 927 | + */ |
| 928 | + function getValidEnumValue(enumType, keyOrValue) |
| 929 | + { |
| 930 | + validateArgument("enumType", enumType); |
| 931 | + validateArgument("keyOrValue", keyOrValue); |
| 932 | + |
| 933 | + // Is key |
| 934 | + if (typeof keyOrValue === "string") |
| 935 | + { |
| 936 | + var value = enumType[keyOrValue]; |
| 937 | + if (value === undefined) |
| 938 | + { |
| 939 | + throw new Error("The enum key \"" + keyOrValue + "\" does not exist."); |
| 940 | + } |
| 941 | + |
| 942 | + return value; |
| 943 | + } |
| 944 | + // Is value |
| 945 | + else if (typeof keyOrValue === "number") |
| 946 | + { |
| 947 | + for (var key in enumType) |
| 948 | + { |
| 949 | + if (enumType[key] === keyOrValue) |
| 950 | + { |
| 951 | + return keyOrValue; |
| 952 | + } |
| 953 | + } |
| 954 | + |
| 955 | + throw new Error("Invalid enum value \"" + keyOrValue + "\"."); |
| 956 | + } |
| 957 | + // Type is not supported |
| 958 | + else |
| 959 | + { |
| 960 | + throw new Error("Invalid key or value type."); |
| 961 | + } |
| 962 | + } |
| 963 | + |
| 964 | + /** |
| 965 | + * Checks an argument for null or undefined and throws an error if one check applies. |
| 966 | + * |
| 967 | + * @private |
| 968 | + * @method validateArgument |
| 969 | + * @param {String} argumentName The name of the given argument |
| 970 | + * @param {Object} argumentValue The argument itself |
| 971 | + */ |
| 972 | + function validateArgument(argumentName, argumentValue) |
| 973 | + { |
| 974 | + if (argumentValue == null) |
| 975 | + { |
| 976 | + throw new Error("The argument \"" + argumentName + "\" is null or undefined."); |
| 977 | + } |
| 978 | + } |
912 | 979 |
|
913 | 980 | /**
|
914 |
| - * Creates an unique id and adds this to the corresponding wizard instance. |
915 |
| - * |
916 |
| - * @private |
917 |
| - * @method createUniqueId |
918 |
| - * @param {Object} wizard A jQuery wizard object |
919 |
| - */ |
| 981 | + * Creates an unique id and adds this to the corresponding wizard instance. |
| 982 | + * |
| 983 | + * @private |
| 984 | + * @method createUniqueId |
| 985 | + * @param {Object} wizard A jQuery wizard object |
| 986 | + */ |
920 | 987 | function createUniqueId(wizard)
|
921 | 988 | {
|
922 | 989 | if (wizard.data("uid") === undefined)
|
|
926 | 993 | }
|
927 | 994 |
|
928 | 995 | /**
|
929 |
| - * Retrieves the unique id from the given wizard instance. |
930 |
| - * |
931 |
| - * @private |
932 |
| - * @method getUniqueId |
933 |
| - * @param {Object} wizard A jQuery wizard object |
934 |
| - * @return {String} Returns the unique for the given wizard |
935 |
| - */ |
| 996 | + * Retrieves the unique id from the given wizard instance. |
| 997 | + * |
| 998 | + * @private |
| 999 | + * @method getUniqueId |
| 1000 | + * @param {Object} wizard A jQuery wizard object |
| 1001 | + * @return {String} Returns the unique for the given wizard |
| 1002 | + */ |
936 | 1003 | function getUniqueId(wizard)
|
937 | 1004 | {
|
938 | 1005 | return wizard.data("uid");
|
|
0 commit comments