@atlassian/aui 9.3.21 → 9.3.23
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/LICENSE.md +1 -1
- package/README.md +7 -9
- package/dist/aui/aui-css-deprecations.js +1 -1
- package/dist/aui/aui-css-deprecations.js.map +1 -1
- package/dist/aui/aui-prototyping-browserfocus.css +1 -353
- package/dist/aui/aui-prototyping-darkmode.css +1 -262
- package/dist/aui/aui-prototyping.css +10 -10
- package/dist/aui/aui-prototyping.js +7 -7
- package/dist/aui/aui-prototyping.js.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.css +10 -10
- package/dist/aui/aui-prototyping.nodeps.js +9 -9
- package/dist/aui/aui-prototyping.nodeps.js.map +1 -1
- package/entry/aui.batch.components.js +21 -21
- package/entry/aui.batch.page.js +3 -3
- package/entry/aui.batch.patterns.js +20 -20
- package/entry/aui.batch.prototyping.js +3 -11
- package/entry/aui.component.nav.js +1 -1
- package/entry/aui.component.progressbar.js +4 -1
- package/entry/aui.side-effects.js +2 -2
- package/entry/behaviours/aui.behaviour.format.js +1 -1
- package/entry/behaviours/aui.behaviour.i18n.js +1 -1
- package/entry/behaviours/aui.behaviour.keyboard-shortcuts.js +1 -1
- package/entry/behaviours/aui.behaviour.progressive-data-set.js +1 -1
- package/entry/behaviours/aui.behaviour.version.js +1 -1
- package/entry/deprecated/aui.component.inline-dialog1.js +1 -1
- package/package.json +3 -7
- package/src/js/aui/alphanum.js +1 -1
- package/src/js/aui/banner.js +2 -2
- package/src/js/aui/blanket.js +7 -11
- package/src/js/aui/button.js +5 -5
- package/src/js/aui/checkbox-multiselect.js +79 -76
- package/src/js/aui/clone.js +1 -1
- package/src/js/aui/close-button.js +2 -6
- package/src/js/aui/contain-dropdown.js +5 -5
- package/src/js/aui/contains.js +1 -1
- package/src/js/aui/cookie.js +12 -16
- package/src/js/aui/date-picker.js +84 -69
- package/src/js/aui/debounce.js +5 -8
- package/src/js/aui/dialog.js +206 -172
- package/src/js/aui/dialog2.js +9 -8
- package/src/js/aui/dropdown2.js +211 -181
- package/src/js/aui/escape-html.js +2 -2
- package/src/js/aui/escape.js +1 -1
- package/src/js/aui/event.js +4 -8
- package/src/js/aui/expander.js +9 -7
- package/src/js/aui/flag.js +15 -17
- package/src/js/aui/focus-manager.js +19 -18
- package/src/js/aui/form-notification.js +14 -13
- package/src/js/aui/form-validation/basic-validators.js +39 -30
- package/src/js/aui/form-validation/validator-register.js +9 -5
- package/src/js/aui/form-validation.js +17 -14
- package/src/js/aui/format.js +9 -6
- package/src/js/aui/forms/create-forms-component-body.js +6 -9
- package/src/js/aui/forms/custom-checkbox.js +2 -6
- package/src/js/aui/forms/custom-radio.js +2 -6
- package/src/js/aui/forms.js +4 -8
- package/src/js/aui/header-async.js +1 -1
- package/src/js/aui/header.js +2 -2
- package/src/js/aui/i18n.js +2 -5
- package/src/js/aui/index-of.js +1 -1
- package/src/js/aui/inline-dialog.js +171 -117
- package/src/js/aui/inline-dialog2.js +60 -50
- package/src/js/aui/internal/add-id.js +1 -1
- package/src/js/aui/internal/alignment.js +57 -49
- package/src/js/aui/internal/amdify.js +0 -1
- package/src/js/aui/internal/animation.js +2 -5
- package/src/js/aui/internal/attributes.js +2 -3
- package/src/js/aui/internal/browser.js +5 -6
- package/src/js/aui/internal/constants.js +1 -3
- package/src/js/aui/internal/deduplicateIDs.js +8 -7
- package/src/js/aui/internal/deprecation/deprecated-adg2-icons.js +132 -132
- package/src/js/aui/internal/deprecation.js +53 -31
- package/src/js/aui/internal/detect-children-change.js +3 -2
- package/src/js/aui/internal/elements.js +2 -5
- package/src/js/aui/internal/enforcer.js +11 -13
- package/src/js/aui/internal/globalize.js +3 -3
- package/src/js/aui/internal/has-touch.js +1 -2
- package/src/js/aui/internal/header/create-header.js +54 -28
- package/src/js/aui/internal/i18n/aui.js +8 -5
- package/src/js/aui/internal/i18n/aui_af.js +31 -31
- package/src/js/aui/internal/i18n/aui_ar.js +31 -31
- package/src/js/aui/internal/i18n/aui_ar_DZ.js +31 -31
- package/src/js/aui/internal/i18n/aui_az.js +31 -31
- package/src/js/aui/internal/i18n/aui_bg.js +31 -31
- package/src/js/aui/internal/i18n/aui_bs.js +31 -31
- package/src/js/aui/internal/i18n/aui_ca.js +31 -31
- package/src/js/aui/internal/i18n/aui_cs.js +31 -31
- package/src/js/aui/internal/i18n/aui_da.js +31 -31
- package/src/js/aui/internal/i18n/aui_de.js +31 -31
- package/src/js/aui/internal/i18n/aui_el.js +31 -31
- package/src/js/aui/internal/i18n/aui_en_AU.js +31 -31
- package/src/js/aui/internal/i18n/aui_en_GB.js +31 -31
- package/src/js/aui/internal/i18n/aui_en_NZ.js +31 -31
- package/src/js/aui/internal/i18n/aui_eo.js +31 -31
- package/src/js/aui/internal/i18n/aui_es.js +31 -31
- package/src/js/aui/internal/i18n/aui_et.js +31 -31
- package/src/js/aui/internal/i18n/aui_eu.js +31 -31
- package/src/js/aui/internal/i18n/aui_fa.js +31 -31
- package/src/js/aui/internal/i18n/aui_fi.js +31 -31
- package/src/js/aui/internal/i18n/aui_fo.js +31 -31
- package/src/js/aui/internal/i18n/aui_fr.js +31 -31
- package/src/js/aui/internal/i18n/aui_fr_CH.js +31 -31
- package/src/js/aui/internal/i18n/aui_gl.js +31 -31
- package/src/js/aui/internal/i18n/aui_he.js +31 -31
- package/src/js/aui/internal/i18n/aui_hr.js +31 -31
- package/src/js/aui/internal/i18n/aui_hu.js +31 -31
- package/src/js/aui/internal/i18n/aui_hy.js +31 -31
- package/src/js/aui/internal/i18n/aui_id.js +31 -31
- package/src/js/aui/internal/i18n/aui_is.js +31 -31
- package/src/js/aui/internal/i18n/aui_it.js +31 -31
- package/src/js/aui/internal/i18n/aui_ja.js +31 -31
- package/src/js/aui/internal/i18n/aui_ko.js +31 -31
- package/src/js/aui/internal/i18n/aui_kz.js +31 -31
- package/src/js/aui/internal/i18n/aui_lt.js +31 -31
- package/src/js/aui/internal/i18n/aui_lv.js +31 -31
- package/src/js/aui/internal/i18n/aui_ml.js +31 -31
- package/src/js/aui/internal/i18n/aui_ms.js +31 -31
- package/src/js/aui/internal/i18n/aui_nl.js +31 -31
- package/src/js/aui/internal/i18n/aui_no.js +31 -31
- package/src/js/aui/internal/i18n/aui_pl.js +31 -31
- package/src/js/aui/internal/i18n/aui_pt.js +31 -31
- package/src/js/aui/internal/i18n/aui_pt_BR.js +31 -31
- package/src/js/aui/internal/i18n/aui_rm.js +31 -31
- package/src/js/aui/internal/i18n/aui_ro.js +31 -31
- package/src/js/aui/internal/i18n/aui_ru.js +31 -31
- package/src/js/aui/internal/i18n/aui_sk.js +31 -31
- package/src/js/aui/internal/i18n/aui_sl.js +31 -31
- package/src/js/aui/internal/i18n/aui_sq.js +31 -31
- package/src/js/aui/internal/i18n/aui_sr.js +31 -31
- package/src/js/aui/internal/i18n/aui_sr_SR.js +31 -31
- package/src/js/aui/internal/i18n/aui_sv.js +31 -31
- package/src/js/aui/internal/i18n/aui_ta.js +31 -31
- package/src/js/aui/internal/i18n/aui_th.js +31 -31
- package/src/js/aui/internal/i18n/aui_tj.js +31 -31
- package/src/js/aui/internal/i18n/aui_tr.js +31 -31
- package/src/js/aui/internal/i18n/aui_uk.js +31 -31
- package/src/js/aui/internal/i18n/aui_vi.js +31 -31
- package/src/js/aui/internal/i18n/aui_zh_CN.js +31 -31
- package/src/js/aui/internal/i18n/aui_zh_HK.js +31 -31
- package/src/js/aui/internal/i18n/aui_zh_TW.js +31 -31
- package/src/js/aui/internal/log.js +2 -6
- package/src/js/aui/internal/mediaQuery.js +2 -3
- package/src/js/aui/internal/select/option.js +3 -3
- package/src/js/aui/internal/select/suggestion-model.js +1 -1
- package/src/js/aui/internal/select/suggestions-model.js +4 -5
- package/src/js/aui/internal/select/suggestions-view.js +17 -12
- package/src/js/aui/internal/state.js +2 -3
- package/src/js/aui/is-clipped.js +2 -2
- package/src/js/aui/key-code.js +1 -1
- package/src/js/aui/label.js +6 -6
- package/src/js/aui/layer.js +100 -98
- package/src/js/aui/messages.js +51 -38
- package/src/js/aui/navigation.js +7 -9
- package/src/js/aui/on-text-resize.js +7 -5
- package/src/js/aui/params.js +11 -8
- package/src/js/aui/polyfills/custom-event.js +7 -7
- package/src/js/aui/polyfills/placeholder.js +4 -4
- package/src/js/aui/populate-parameters.js +4 -4
- package/src/js/aui/progress-indicator.js +35 -27
- package/src/js/aui/progressive-data-set.js +13 -8
- package/src/js/aui/query-input.js +1 -1
- package/src/js/aui/restful-table/class-names.js +1 -1
- package/src/js/aui/restful-table/data-keys.js +1 -1
- package/src/js/aui/restful-table/edit-row.js +63 -63
- package/src/js/aui/restful-table/entry-model.js +6 -13
- package/src/js/aui/restful-table/event-handlers.js +4 -8
- package/src/js/aui/restful-table/event-names.js +1 -1
- package/src/js/aui/restful-table/row.js +41 -23
- package/src/js/aui/restful-table.js +101 -72
- package/src/js/aui/result-set.js +5 -5
- package/src/js/aui/results-list.js +3 -3
- package/src/js/aui/select.js +65 -49
- package/src/js/aui/select2.js +14 -6
- package/src/js/aui/sidebar.js +81 -51
- package/src/js/aui/spin.js +61 -49
- package/src/js/aui/spinner.js +11 -12
- package/src/js/aui/tables-sortable.js +21 -10
- package/src/js/aui/tabs.js +108 -77
- package/src/js/aui/to-init.js +1 -1
- package/src/js/aui/toggle.js +55 -43
- package/src/js/aui/tooltip.js +32 -31
- package/src/js/aui/trigger.js +20 -18
- package/src/js/aui/truncating-progressive-data-set.js +1 -1
- package/src/js/aui/unbind-text-resize.js +1 -1
- package/src/js/aui/unique-id.js +1 -1
- package/src/js/aui/when-i-type.js +66 -39
- package/src/js/aui-css-deprecations.js +50 -50
- package/src/js/jquery/jquery.hotkeys.js +124 -49
- package/src/js/jquery/jquery.moveto.js +18 -12
- package/src/less/adg-fancy-file-input.less +2 -3
- package/src/less/adg-header-quicksearch.less +4 -1
- package/src/less/adg-iconfont.less +242 -242
- package/src/less/adgs-icons.less +262 -262
- package/src/less/aui-appheader.less +10 -6
- package/src/less/aui-buttons.less +6 -5
- package/src/less/aui-date-picker.less +9 -6
- package/src/less/aui-experimental-expander.less +8 -8
- package/src/less/aui-experimental-labels.less +4 -3
- package/src/less/aui-experimental-progress-indicator.less +10 -4
- package/src/less/aui-experimental-progress-tracker.less +9 -6
- package/src/less/aui-experimental-restfultable.less +11 -3
- package/src/less/aui-experimental-tables-sortable.less +5 -3
- package/src/less/aui-experimental-tooltip.less +1 -1
- package/src/less/aui-link.less +0 -1
- package/src/less/aui-lozenge.less +6 -3
- package/src/less/aui-navigation.less +13 -13
- package/src/less/aui-page-layout.less +3 -4
- package/src/less/aui-page-typography.less +8 -3
- package/src/less/aui-reset.less +22 -6
- package/src/less/aui-select2.less +11 -8
- package/src/less/aui-sidebar-badges.less +1 -2
- package/src/less/aui-sidebar-config.less +7 -2
- package/src/less/aui-sidebar-grouping.less +16 -6
- package/src/less/aui-sidebar-navigation.less +7 -5
- package/src/less/aui-sidebar-skeleton.less +4 -3
- package/src/less/aui-skip-link.less +2 -1
- package/src/less/aui-spinner.less +2 -2
- package/src/less/aui-toggle.less +2 -2
- package/src/less/aui-toolbar2.less +1 -1
- package/src/less/checkbox-multiselect.less +13 -13
- package/src/less/dialog.less +3 -3
- package/src/less/dialog2.less +12 -11
- package/src/less/dropdown2-temp.css +4 -4
- package/src/less/dropdown2.less +3 -3
- package/src/less/form-notification.less +10 -6
- package/src/less/forms-current.less +6 -5
- package/src/less/forms-legacy.less +4 -2
- package/src/less/forms-radios-and-checkboxes.less +9 -11
- package/src/less/forms.less +2 -4
- package/src/less/iconfont-mixin.less +7 -4
- package/src/less/imports/aui-theme/adg/adg-colors.less +40 -40
- package/src/less/imports/aui-theme/adg/adg-neutral-dark.less +20 -20
- package/src/less/imports/aui-theme/adg/adg-neutral-light.less +20 -20
- package/src/less/imports/aui-theme/components/buttons.less +5 -1
- package/src/less/imports/aui-theme/components/dropdown.less +3 -1
- package/src/less/imports/aui-theme/components/form-notification.less +2 -1
- package/src/less/imports/aui-theme/components/forms.less +16 -1
- package/src/less/imports/aui-theme/components/inline-dialog2.less +1 -1
- package/src/less/imports/aui-theme/components/navigation.less +3 -3
- package/src/less/imports/aui-theme/components/progress-tracker.less +6 -2
- package/src/less/imports/aui-theme/components/tables.less +3 -2
- package/src/less/imports/aui-theme/components/toggle.less +8 -3
- package/src/less/imports/aui-theme/core/colors.less +12 -4
- package/src/less/imports/aui-theme/core/icons.less +22 -22
- package/src/less/imports/aui-theme/core/text.less +6 -3
- package/src/less/imports/mixins/dropdown2-trigger-chevron-icon.less +0 -1
- package/src/less/imports/mixins/focus.less +12 -4
- package/src/less/imports/mixins/media-queries.less +2 -2
- package/src/less/imports/mixins/shadows.less +3 -1
- package/src/less/imports/mixins/tab-indicator.less +2 -2
- package/src/less/imports/mixins.less +11 -4
- package/src/less/inline-dialog.less +21 -19
- package/src/less/layer.less +0 -2
- package/src/less/messages.less +2 -1
- package/src/less/single-select.less +14 -9
- package/src/less/tables.less +3 -2
- package/src/less/tabs.less +4 -3
- package/entry/token-themes-generated/npm/aui-prototyping-design-tokens-base-themes.css +0 -797
- package/entry/token-themes-generated/npm/aui-prototyping-design-tokens-base-themes.js +0 -26
- package/entry/token-themes-generated/npm/aui-prototyping-design-tokens-theme-import-map.js +0 -51
- package/entry/token-themes-generated/npm/themes/dark-future.js +0 -7
- package/entry/token-themes-generated/npm/themes/dark-new-input-border.js +0 -7
- package/entry/token-themes-generated/npm/themes/dark.js +0 -395
- package/entry/token-themes-generated/npm/themes/legacy-dark.js +0 -395
- package/entry/token-themes-generated/npm/themes/legacy-light.js +0 -395
- package/entry/token-themes-generated/npm/themes/light-future.js +0 -7
- package/entry/token-themes-generated/npm/themes/light-new-input-border.js +0 -7
- package/entry/token-themes-generated/npm/themes/light.js +0 -395
- package/entry/token-themes-generated/npm/themes/shape.js +0 -15
- package/entry/token-themes-generated/npm/themes/spacing.js +0 -27
- package/entry/token-themes-generated/npm/themes/typography-adg3.js +0 -50
- package/entry/token-themes-generated/npm/themes/typography-minor3.js +0 -41
package/src/js/aui/dialog.js
CHANGED
|
@@ -23,8 +23,8 @@ const ZINDEX_DIALOG_1 = 2600; // see also dialog.less
|
|
|
23
23
|
* </pre>
|
|
24
24
|
* @param options {object} [optional] Permitted options and defaults are as follows:
|
|
25
25
|
* width (800), height (600), keypressListener (closes dialog on ESC).
|
|
26
|
-
*/
|
|
27
|
-
function createPopup
|
|
26
|
+
*/
|
|
27
|
+
function createPopup(options) {
|
|
28
28
|
var defaults = {
|
|
29
29
|
width: 800,
|
|
30
30
|
height: 600,
|
|
@@ -33,14 +33,14 @@ function createPopup (options) {
|
|
|
33
33
|
if (e.keyCode === keyCode.ESCAPE && popup.is(':visible')) {
|
|
34
34
|
res.hide();
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
37
|
};
|
|
38
38
|
// for backwards-compatibility
|
|
39
39
|
if (typeof options !== 'object') {
|
|
40
40
|
options = {
|
|
41
41
|
width: arguments[0],
|
|
42
42
|
height: arguments[1],
|
|
43
|
-
id: arguments[2]
|
|
43
|
+
id: arguments[2],
|
|
44
44
|
};
|
|
45
45
|
options = $.extend({}, options, arguments[3]);
|
|
46
46
|
}
|
|
@@ -54,22 +54,25 @@ function createPopup (options) {
|
|
|
54
54
|
var highestZIndex = ZINDEX_DIALOG_1;
|
|
55
55
|
$('.aui-dialog').each(function () {
|
|
56
56
|
var currentPopup = $(this);
|
|
57
|
-
highestZIndex =
|
|
57
|
+
highestZIndex =
|
|
58
|
+
currentPopup.css('z-index') > highestZIndex
|
|
59
|
+
? currentPopup.css('z-index')
|
|
60
|
+
: highestZIndex;
|
|
58
61
|
});
|
|
59
62
|
|
|
60
|
-
var applySize = (function _applySize
|
|
61
|
-
options.width =
|
|
62
|
-
options.height =
|
|
63
|
+
var applySize = (function _applySize(width, height) {
|
|
64
|
+
options.width = width = width || options.width;
|
|
65
|
+
options.height = height = height || options.height;
|
|
63
66
|
|
|
64
67
|
popup.css({
|
|
65
|
-
marginTop: -Math.round(height / 2) + 'px',
|
|
66
|
-
marginLeft: -Math.round(width / 2) + 'px',
|
|
67
|
-
width: width,
|
|
68
|
-
height: height,
|
|
69
|
-
'z-index': parseInt(highestZIndex,10) + 2
|
|
68
|
+
'marginTop': -Math.round(height / 2) + 'px',
|
|
69
|
+
'marginLeft': -Math.round(width / 2) + 'px',
|
|
70
|
+
'width': width,
|
|
71
|
+
'height': height,
|
|
72
|
+
'z-index': parseInt(highestZIndex, 10) + 2, //+ 2 so that the shadow can be shown on +1 (underneath the popup but above everything else)
|
|
70
73
|
});
|
|
71
74
|
return _applySize;
|
|
72
|
-
}(options.width, options.height)
|
|
75
|
+
})(options.width, options.height);
|
|
73
76
|
|
|
74
77
|
$('body').append(popup);
|
|
75
78
|
|
|
@@ -80,7 +83,7 @@ function createPopup (options) {
|
|
|
80
83
|
* Popup object
|
|
81
84
|
* @class Popup
|
|
82
85
|
* @static
|
|
83
|
-
|
|
86
|
+
*/
|
|
84
87
|
|
|
85
88
|
//blanket for reference further down
|
|
86
89
|
var blanket = $('.aui-blanket');
|
|
@@ -102,14 +105,17 @@ function createPopup (options) {
|
|
|
102
105
|
return focusItem(options.focusSelector, element);
|
|
103
106
|
}
|
|
104
107
|
var defaultFocusSelector = ':input:visible:enabled:first';
|
|
105
|
-
if (focusItem(defaultFocusSelector, $('.dialog-page-body', element))) {
|
|
106
|
-
|
|
108
|
+
if (focusItem(defaultFocusSelector, $('.dialog-page-body', element))) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (focusItem(defaultFocusSelector, $('.dialog-button-panel', element))) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
107
114
|
|
|
108
115
|
focusItem(defaultFocusSelector, $('.dialog-page-menu', element));
|
|
109
116
|
};
|
|
110
117
|
|
|
111
118
|
var res = {
|
|
112
|
-
|
|
113
119
|
changeSize: function (w, h) {
|
|
114
120
|
if ((w && w != options.width) || (h && h != options.height)) {
|
|
115
121
|
applySize(w, h);
|
|
@@ -120,18 +126,17 @@ function createPopup (options) {
|
|
|
120
126
|
/**
|
|
121
127
|
* Shows the popup
|
|
122
128
|
* @method show
|
|
123
|
-
|
|
129
|
+
*/
|
|
124
130
|
show: function () {
|
|
125
|
-
|
|
126
131
|
var show = function () {
|
|
127
132
|
$(document)
|
|
128
133
|
.off('keydown', options.keypressListener)
|
|
129
134
|
.on('keydown', options.keypressListener);
|
|
130
135
|
dim();
|
|
131
136
|
blanket = $('.aui-blanket');
|
|
132
|
-
if (blanket.length !== 0 && options.closeOnOutsideClick){
|
|
137
|
+
if (blanket.length !== 0 && options.closeOnOutsideClick) {
|
|
133
138
|
blanket.on('click', function () {
|
|
134
|
-
if (popup.is(':visible')){
|
|
139
|
+
if (popup.is(':visible')) {
|
|
135
140
|
res.hide();
|
|
136
141
|
}
|
|
137
142
|
});
|
|
@@ -148,7 +153,7 @@ function createPopup (options) {
|
|
|
148
153
|
/**
|
|
149
154
|
* Hides the popup.
|
|
150
155
|
* @method hide
|
|
151
|
-
|
|
156
|
+
*/
|
|
152
157
|
hide: function () {
|
|
153
158
|
$(document).unbind('keydown', options.keypressListener);
|
|
154
159
|
blanket.unbind();
|
|
@@ -172,12 +177,12 @@ function createPopup (options) {
|
|
|
172
177
|
/**
|
|
173
178
|
* jQuery object, representing popup DOM element
|
|
174
179
|
* @property element
|
|
175
|
-
|
|
180
|
+
*/
|
|
176
181
|
element: popup,
|
|
177
182
|
/**
|
|
178
183
|
* Removes popup elements from the DOM
|
|
179
184
|
* @method remove
|
|
180
|
-
|
|
185
|
+
*/
|
|
181
186
|
remove: function () {
|
|
182
187
|
popup.remove();
|
|
183
188
|
this.element = null;
|
|
@@ -185,12 +190,12 @@ function createPopup (options) {
|
|
|
185
190
|
/**
|
|
186
191
|
* disables the popup
|
|
187
192
|
* @method disable
|
|
188
|
-
|
|
193
|
+
*/
|
|
189
194
|
disable: function () {
|
|
190
|
-
if (!this.disabled){
|
|
195
|
+
if (!this.disabled) {
|
|
191
196
|
this.popupBlanket = $("<div class='dialog-blanket'> </div>").css({
|
|
192
197
|
height: popup.height(),
|
|
193
|
-
width: popup.width()
|
|
198
|
+
width: popup.width(),
|
|
194
199
|
});
|
|
195
200
|
popup.append(this.popupBlanket);
|
|
196
201
|
this.disabled = true;
|
|
@@ -199,14 +204,14 @@ function createPopup (options) {
|
|
|
199
204
|
/**
|
|
200
205
|
* enables the popup if it is disabled
|
|
201
206
|
* @method enable
|
|
202
|
-
|
|
207
|
+
*/
|
|
203
208
|
enable: function () {
|
|
204
209
|
if (this.disabled) {
|
|
205
210
|
this.disabled = false;
|
|
206
211
|
this.popupBlanket.remove();
|
|
207
212
|
this.popupBlanket = null;
|
|
208
213
|
}
|
|
209
|
-
}
|
|
214
|
+
},
|
|
210
215
|
};
|
|
211
216
|
|
|
212
217
|
return res;
|
|
@@ -222,7 +227,7 @@ var Dialog = (function () {
|
|
|
222
227
|
* @param onclick {function} [optional] click event handler
|
|
223
228
|
* @param className {string} [optional] class name
|
|
224
229
|
* @private
|
|
225
|
-
|
|
230
|
+
*/
|
|
226
231
|
function Button(page, label, onclick, className) {
|
|
227
232
|
if (!page.buttonpanel) {
|
|
228
233
|
page.addButtonPanel();
|
|
@@ -252,14 +257,14 @@ var Dialog = (function () {
|
|
|
252
257
|
* @param onclick {function} [optional] click event handler
|
|
253
258
|
* @param className {string} [optional] class name
|
|
254
259
|
* @private
|
|
255
|
-
|
|
260
|
+
*/
|
|
256
261
|
function Link(page, label, onclick, className, url) {
|
|
257
262
|
if (!page.buttonpanel) {
|
|
258
263
|
page.addButtonPanel();
|
|
259
264
|
}
|
|
260
265
|
|
|
261
266
|
//if no url is given use # as default
|
|
262
|
-
if (!url){
|
|
267
|
+
if (!url) {
|
|
263
268
|
url = '#';
|
|
264
269
|
}
|
|
265
270
|
|
|
@@ -280,13 +285,13 @@ var Dialog = (function () {
|
|
|
280
285
|
page.button[this.id] = this;
|
|
281
286
|
}
|
|
282
287
|
|
|
283
|
-
function itemMove
|
|
288
|
+
function itemMove(leftOrRight, target) {
|
|
284
289
|
var dir = leftOrRight == 'left' ? -1 : 1;
|
|
285
290
|
return function (step) {
|
|
286
291
|
var dtarget = this.page[target];
|
|
287
|
-
if (this.id != (
|
|
288
|
-
dir *=
|
|
289
|
-
dtarget[this.id + dir].item[
|
|
292
|
+
if (this.id != (dir == 1 ? dtarget.length - 1 : 0)) {
|
|
293
|
+
dir *= step || 1;
|
|
294
|
+
dtarget[this.id + dir].item[dir < 0 ? 'before' : 'after'](this.item);
|
|
290
295
|
dtarget.splice(this.id, 1);
|
|
291
296
|
dtarget.splice(this.id + dir, 0, this);
|
|
292
297
|
for (var i = 0, ii = dtarget.length; i < ii; i++) {
|
|
@@ -314,7 +319,7 @@ var Dialog = (function () {
|
|
|
314
319
|
* @method moveLeft
|
|
315
320
|
* @param step {number} how many items to move, default is 1
|
|
316
321
|
* @return {object} button
|
|
317
|
-
|
|
322
|
+
*/
|
|
318
323
|
Button.prototype.moveUp = Button.prototype.moveLeft = itemMove('left', 'button');
|
|
319
324
|
/**
|
|
320
325
|
* Moves item right in the hierarchy
|
|
@@ -322,12 +327,12 @@ var Dialog = (function () {
|
|
|
322
327
|
* @method moveRight
|
|
323
328
|
* @param step {number} how many items to move, default is 1
|
|
324
329
|
* @return {object} button
|
|
325
|
-
|
|
330
|
+
*/
|
|
326
331
|
Button.prototype.moveDown = Button.prototype.moveRight = itemMove('right', 'button');
|
|
327
332
|
/**
|
|
328
333
|
* Removes item
|
|
329
334
|
* @method remove
|
|
330
|
-
|
|
335
|
+
*/
|
|
331
336
|
Button.prototype.remove = itemRemove('button');
|
|
332
337
|
|
|
333
338
|
/**
|
|
@@ -336,7 +341,7 @@ var Dialog = (function () {
|
|
|
336
341
|
* @param label {string} [optional] label of the button
|
|
337
342
|
* @return {string} label, if nothing is passed in
|
|
338
343
|
* @return {object} jQuery button object, if label is passed in
|
|
339
|
-
|
|
344
|
+
*/
|
|
340
345
|
Button.prototype.html = function (label) {
|
|
341
346
|
return this.item.html(label);
|
|
342
347
|
};
|
|
@@ -345,7 +350,7 @@ var Dialog = (function () {
|
|
|
345
350
|
* @method onclick
|
|
346
351
|
* @param onclick {function} [optional] new event handler, that is going to replace the old one
|
|
347
352
|
* @return {function} existing event handler if new one is undefined
|
|
348
|
-
|
|
353
|
+
*/
|
|
349
354
|
Button.prototype.onclick = function (onclick) {
|
|
350
355
|
let self = this;
|
|
351
356
|
if (typeof onclick === 'undefined') {
|
|
@@ -373,7 +378,7 @@ var Dialog = (function () {
|
|
|
373
378
|
* @param className {string} [optional] HTML class name
|
|
374
379
|
* @param panelButtonId {string} the unique id that will be put on the button element for this panel.
|
|
375
380
|
* @private
|
|
376
|
-
|
|
381
|
+
*/
|
|
377
382
|
var Panel = function (page, title, reference, className, panelButtonId) {
|
|
378
383
|
if (!(reference instanceof $)) {
|
|
379
384
|
reference = $(reference);
|
|
@@ -389,7 +394,10 @@ var Dialog = (function () {
|
|
|
389
394
|
}
|
|
390
395
|
|
|
391
396
|
this.item = $('<li></li>').append(this.button).addClass('page-menu-item');
|
|
392
|
-
this.body = $('<div></div>')
|
|
397
|
+
this.body = $('<div></div>')
|
|
398
|
+
.append(reference)
|
|
399
|
+
.addClass('dialog-panel-body')
|
|
400
|
+
.css('height', page.dialog.height + 'px');
|
|
393
401
|
this.padding = DEFAULT_PADDING;
|
|
394
402
|
if (className) {
|
|
395
403
|
this.body.addClass(className);
|
|
@@ -405,13 +413,13 @@ var Dialog = (function () {
|
|
|
405
413
|
cur = page.panel[page.curtab];
|
|
406
414
|
cur.body.hide();
|
|
407
415
|
cur.item.removeClass('selected');
|
|
408
|
-
|
|
416
|
+
typeof cur.onblur === 'function' && cur.onblur();
|
|
409
417
|
}
|
|
410
418
|
page.curtab = tab.id;
|
|
411
419
|
tab.body.show();
|
|
412
420
|
tab.item.addClass('selected');
|
|
413
|
-
|
|
414
|
-
|
|
421
|
+
typeof tab.onselect === 'function' && tab.onselect();
|
|
422
|
+
typeof page.ontabchange === 'function' && page.ontabchange(tab, cur);
|
|
415
423
|
};
|
|
416
424
|
if (!this.button.click) {
|
|
417
425
|
logger.log('atlassian-dialog:Panel:constructor - this.button.click false');
|
|
@@ -429,7 +437,7 @@ var Dialog = (function () {
|
|
|
429
437
|
/**
|
|
430
438
|
* Selects current panel
|
|
431
439
|
* @method select
|
|
432
|
-
|
|
440
|
+
*/
|
|
433
441
|
Panel.prototype.select = function () {
|
|
434
442
|
this.button.click();
|
|
435
443
|
};
|
|
@@ -439,7 +447,7 @@ var Dialog = (function () {
|
|
|
439
447
|
* @method moveLeft
|
|
440
448
|
* @param step {number} how many items to move, default is 1
|
|
441
449
|
* @return {object} panel
|
|
442
|
-
|
|
450
|
+
*/
|
|
443
451
|
Panel.prototype.moveUp = Panel.prototype.moveLeft = itemMove('left', 'panel');
|
|
444
452
|
/**
|
|
445
453
|
* Moves item right in the hierarchy
|
|
@@ -447,12 +455,12 @@ var Dialog = (function () {
|
|
|
447
455
|
* @method moveRight
|
|
448
456
|
* @param step {number} how many items to move, default is 1
|
|
449
457
|
* @return {object} panel
|
|
450
|
-
|
|
458
|
+
*/
|
|
451
459
|
Panel.prototype.moveDown = Panel.prototype.moveRight = itemMove('right', 'panel');
|
|
452
460
|
/**
|
|
453
461
|
* Removes item
|
|
454
462
|
* @method remove
|
|
455
|
-
|
|
463
|
+
*/
|
|
456
464
|
Panel.prototype.remove = itemRemove('panel');
|
|
457
465
|
/**
|
|
458
466
|
* Getter and setter of inner HTML of the panel
|
|
@@ -460,7 +468,7 @@ var Dialog = (function () {
|
|
|
460
468
|
* @param html {string} HTML source to set up
|
|
461
469
|
* @return {object} panel
|
|
462
470
|
* @return {string} current HTML source
|
|
463
|
-
|
|
471
|
+
*/
|
|
464
472
|
Panel.prototype.html = function (html) {
|
|
465
473
|
if (html) {
|
|
466
474
|
this.body.html(html);
|
|
@@ -475,7 +483,7 @@ var Dialog = (function () {
|
|
|
475
483
|
* @param padding {number} padding in pixels
|
|
476
484
|
* @return {object} panel
|
|
477
485
|
* @see DEFAULT_PADDING
|
|
478
|
-
|
|
486
|
+
*/
|
|
479
487
|
Panel.prototype.setPadding = function (padding) {
|
|
480
488
|
if (!isNaN(+padding)) {
|
|
481
489
|
this.body.css('padding', +padding);
|
|
@@ -496,13 +504,15 @@ var Dialog = (function () {
|
|
|
496
504
|
* @param dialog {object} dialog object
|
|
497
505
|
* @param className {string} [optional] HTML class name
|
|
498
506
|
* @private
|
|
499
|
-
|
|
507
|
+
*/
|
|
500
508
|
var Page = function (dialog, className) {
|
|
501
509
|
this.dialog = dialog;
|
|
502
510
|
this.id = dialog.page.length;
|
|
503
511
|
this.element = $('<div></div>').addClass('dialog-components');
|
|
504
512
|
this.body = $('<div></div>').addClass('dialog-page-body');
|
|
505
|
-
this.menu = $('<ul></ul>')
|
|
513
|
+
this.menu = $('<ul></ul>')
|
|
514
|
+
.addClass('dialog-page-menu')
|
|
515
|
+
.css('height', dialog.height + 'px');
|
|
506
516
|
this.body.append(this.menu);
|
|
507
517
|
this.curtab;
|
|
508
518
|
this.panel = [];
|
|
@@ -517,11 +527,11 @@ var Dialog = (function () {
|
|
|
517
527
|
/**
|
|
518
528
|
* Size updater for contents of the page. For internal use
|
|
519
529
|
* @method recalcSize
|
|
520
|
-
|
|
530
|
+
*/
|
|
521
531
|
Page.prototype.recalcSize = function () {
|
|
522
532
|
var headerHeight = this.header ? HEADER_HEIGHT : 0;
|
|
523
533
|
var buttonHeight = this.buttonpanel ? BUTTONS_HEIGHT : 0;
|
|
524
|
-
for (var i = this.panel.length; i--;) {
|
|
534
|
+
for (var i = this.panel.length; i--; ) {
|
|
525
535
|
var dialogComponentsHeight = this.dialog.height - headerHeight - buttonHeight;
|
|
526
536
|
this.panel[i].body.css('height', dialogComponentsHeight);
|
|
527
537
|
this.menu.css('height', dialogComponentsHeight);
|
|
@@ -545,7 +555,7 @@ var Dialog = (function () {
|
|
|
545
555
|
* @param className {string} [optional] HTML class name
|
|
546
556
|
* @param panelButtonId {string} [optional] The unique id for the panel's button.
|
|
547
557
|
* @return {object} the page
|
|
548
|
-
|
|
558
|
+
*/
|
|
549
559
|
Page.prototype.addPanel = function (title, reference, className, panelButtonId) {
|
|
550
560
|
new Panel(this, title, reference, className, panelButtonId);
|
|
551
561
|
this.recalcSize();
|
|
@@ -557,12 +567,14 @@ var Dialog = (function () {
|
|
|
557
567
|
* @param title {string} panel title
|
|
558
568
|
* @param className {string} [optional] CSS class name
|
|
559
569
|
* @return {object} the page
|
|
560
|
-
|
|
570
|
+
*/
|
|
561
571
|
Page.prototype.addHeader = function (title, className) {
|
|
562
572
|
if (this.header) {
|
|
563
573
|
this.header.remove();
|
|
564
574
|
}
|
|
565
|
-
this.header =
|
|
575
|
+
this.header = $('<h2></h2>')
|
|
576
|
+
.text(title || '')
|
|
577
|
+
.addClass('dialog-title');
|
|
566
578
|
className && this.header.addClass(className);
|
|
567
579
|
this.element.prepend(this.header);
|
|
568
580
|
this.recalcSize();
|
|
@@ -575,7 +587,7 @@ var Dialog = (function () {
|
|
|
575
587
|
* @param onclick {function} [optional] click event handler
|
|
576
588
|
* @param className {string} [optional] class name
|
|
577
589
|
* @return {object} the page
|
|
578
|
-
|
|
590
|
+
*/
|
|
579
591
|
Page.prototype.addButton = function (label, onclick, className) {
|
|
580
592
|
new Button(this, label, onclick, className);
|
|
581
593
|
this.recalcSize();
|
|
@@ -588,7 +600,7 @@ var Dialog = (function () {
|
|
|
588
600
|
* @param onclick {function} [optional] click event handler
|
|
589
601
|
* @param className {string} [optional] class name
|
|
590
602
|
* @return {object} the page
|
|
591
|
-
|
|
603
|
+
*/
|
|
592
604
|
Page.prototype.addLink = function (label, onclick, className, url) {
|
|
593
605
|
new Link(this, label, onclick, className, url);
|
|
594
606
|
this.recalcSize();
|
|
@@ -600,7 +612,7 @@ var Dialog = (function () {
|
|
|
600
612
|
* @method gotoPanel
|
|
601
613
|
* @param panel {object} panel object
|
|
602
614
|
* @param panel {number} id of the panel
|
|
603
|
-
|
|
615
|
+
*/
|
|
604
616
|
Page.prototype.gotoPanel = function (panel) {
|
|
605
617
|
this.panel[panel.id || panel].select();
|
|
606
618
|
};
|
|
@@ -608,34 +620,32 @@ var Dialog = (function () {
|
|
|
608
620
|
* Returns current panel on the page
|
|
609
621
|
* @method getCurrentPanel
|
|
610
622
|
* @return panel {object} the panel
|
|
611
|
-
|
|
623
|
+
*/
|
|
612
624
|
Page.prototype.getCurrentPanel = function () {
|
|
613
625
|
return this.panel[this.curtab];
|
|
614
626
|
};
|
|
615
627
|
/**
|
|
616
628
|
* Hides the page
|
|
617
629
|
* @method hide
|
|
618
|
-
|
|
630
|
+
*/
|
|
619
631
|
Page.prototype.hide = function () {
|
|
620
632
|
this.element.hide();
|
|
621
633
|
};
|
|
622
634
|
/**
|
|
623
635
|
* Shows the page, if it was hidden
|
|
624
636
|
* @method show
|
|
625
|
-
|
|
637
|
+
*/
|
|
626
638
|
Page.prototype.show = function () {
|
|
627
639
|
this.element.show();
|
|
628
640
|
};
|
|
629
641
|
/**
|
|
630
642
|
* Removes the page
|
|
631
643
|
* @method remove
|
|
632
|
-
|
|
644
|
+
*/
|
|
633
645
|
Page.prototype.remove = function () {
|
|
634
646
|
this.element.remove();
|
|
635
647
|
};
|
|
636
648
|
|
|
637
|
-
|
|
638
|
-
|
|
639
649
|
/**
|
|
640
650
|
* Constructor for a Dialog. A Dialog is a popup which consists of Pages, where each Page can consist of Panels,
|
|
641
651
|
* Buttons and a Header. The dialog must be constructed in page order as it has a current page state. For example,
|
|
@@ -663,8 +673,8 @@ var Dialog = (function () {
|
|
|
663
673
|
* @param width {number} dialog width in pixels, or an object containing the Dialog parameters
|
|
664
674
|
* @param height {number} dialog height in pixels
|
|
665
675
|
* @param id {number} [optional] dialog id
|
|
666
|
-
|
|
667
|
-
function Dialog
|
|
676
|
+
*/
|
|
677
|
+
function Dialog(width, height, id) {
|
|
668
678
|
var options = {};
|
|
669
679
|
if (!+width) {
|
|
670
680
|
options = Object(width);
|
|
@@ -678,7 +688,7 @@ var Dialog = (function () {
|
|
|
678
688
|
options = $.extend({}, options, {
|
|
679
689
|
width: this.width,
|
|
680
690
|
height: this.height,
|
|
681
|
-
id: this.id
|
|
691
|
+
id: this.id,
|
|
682
692
|
});
|
|
683
693
|
this.popup = createPopup(options);
|
|
684
694
|
|
|
@@ -687,8 +697,7 @@ var Dialog = (function () {
|
|
|
687
697
|
this.curpage = 0;
|
|
688
698
|
|
|
689
699
|
new Page(this);
|
|
690
|
-
}
|
|
691
|
-
|
|
700
|
+
}
|
|
692
701
|
|
|
693
702
|
/**
|
|
694
703
|
* Method for adding header to the current page
|
|
@@ -696,7 +705,7 @@ var Dialog = (function () {
|
|
|
696
705
|
* @param title {string} panel title
|
|
697
706
|
* @param className {string} [optional] HTML class name
|
|
698
707
|
* @return {object} the dialog
|
|
699
|
-
|
|
708
|
+
*/
|
|
700
709
|
Dialog.prototype.addHeader = function (title, className) {
|
|
701
710
|
this.page[this.curpage].addHeader(title, className);
|
|
702
711
|
return this;
|
|
@@ -708,7 +717,7 @@ var Dialog = (function () {
|
|
|
708
717
|
* @param onclick {function} [optional] click event handler
|
|
709
718
|
* @param className {string} [optional] class name
|
|
710
719
|
* @return {object} the dialog
|
|
711
|
-
|
|
720
|
+
*/
|
|
712
721
|
Dialog.prototype.addButton = function (label, onclick, className) {
|
|
713
722
|
this.page[this.curpage].addButton(label, onclick, className);
|
|
714
723
|
return this;
|
|
@@ -721,47 +730,45 @@ var Dialog = (function () {
|
|
|
721
730
|
* @param onclick {function} [optional] click event handler
|
|
722
731
|
* @param className {string} [optional] class name
|
|
723
732
|
* @return {object} the dialog
|
|
724
|
-
|
|
733
|
+
*/
|
|
725
734
|
Dialog.prototype.addLink = function (label, onclick, className, url) {
|
|
726
735
|
this.page[this.curpage].addLink(label, onclick, className, url);
|
|
727
736
|
return this;
|
|
728
737
|
};
|
|
729
738
|
|
|
730
739
|
/**
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
740
|
+
* Method for adding a submit button to the current page
|
|
741
|
+
* @method addSubmit
|
|
742
|
+
* @param label {string} link label
|
|
743
|
+
* @param onclick {function} [optional] click event handler
|
|
744
|
+
* @return {object} the dialog
|
|
745
|
+
*/
|
|
737
746
|
Dialog.prototype.addSubmit = function (label, onclick) {
|
|
738
747
|
this.page[this.curpage].addButton(label, onclick, 'button-panel-submit-button');
|
|
739
748
|
return this;
|
|
740
749
|
};
|
|
741
750
|
|
|
742
751
|
/**
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
752
|
+
* Method for adding a cancel link to the current page
|
|
753
|
+
* @method addCancel
|
|
754
|
+
* @param label {string} link label
|
|
755
|
+
* @param onclick {function} [optional] click event handler
|
|
756
|
+
* @return {object} the dialog
|
|
757
|
+
*/
|
|
749
758
|
Dialog.prototype.addCancel = function (label, onclick) {
|
|
750
759
|
this.page[this.curpage].addLink(label, onclick, 'button-panel-cancel-link');
|
|
751
760
|
return this;
|
|
752
761
|
};
|
|
753
762
|
|
|
754
|
-
|
|
755
763
|
/**
|
|
756
764
|
* Method for adding new button panel to the current page
|
|
757
765
|
* @return {object} the dialog
|
|
758
|
-
|
|
766
|
+
*/
|
|
759
767
|
Dialog.prototype.addButtonPanel = function () {
|
|
760
768
|
this.page[this.curpage].addButtonPanel();
|
|
761
769
|
return this;
|
|
762
770
|
};
|
|
763
771
|
|
|
764
|
-
|
|
765
772
|
/**
|
|
766
773
|
* Method for adding new panel to the current page.
|
|
767
774
|
* @method addPanel
|
|
@@ -770,7 +777,7 @@ var Dialog = (function () {
|
|
|
770
777
|
* @param className {string} [optional] HTML class name
|
|
771
778
|
* @param panelButtonId {String} [optional] The unique id for the panel's button.
|
|
772
779
|
* @return {object} the dialog
|
|
773
|
-
|
|
780
|
+
*/
|
|
774
781
|
Dialog.prototype.addPanel = function (title, reference, className, panelButtonId) {
|
|
775
782
|
this.page[this.curpage].addPanel(title, reference, className, panelButtonId);
|
|
776
783
|
return this;
|
|
@@ -780,7 +787,7 @@ var Dialog = (function () {
|
|
|
780
787
|
* @method addPage
|
|
781
788
|
* @param className {string} [optional] HTML class name
|
|
782
789
|
* @return {object} the dialog
|
|
783
|
-
|
|
790
|
+
*/
|
|
784
791
|
Dialog.prototype.addPage = function (className) {
|
|
785
792
|
new Page(this, className);
|
|
786
793
|
this.page[this.curpage].hide();
|
|
@@ -791,7 +798,7 @@ var Dialog = (function () {
|
|
|
791
798
|
* Making next page in hierarchy visible and active
|
|
792
799
|
* @method nextPage
|
|
793
800
|
* @return {object} the dialog
|
|
794
|
-
|
|
801
|
+
*/
|
|
795
802
|
Dialog.prototype.nextPage = function () {
|
|
796
803
|
this.page[this.curpage++].hide();
|
|
797
804
|
if (this.curpage >= this.page.length) {
|
|
@@ -804,7 +811,7 @@ var Dialog = (function () {
|
|
|
804
811
|
* Making previous page in hierarchy visible and active
|
|
805
812
|
* @method prevPage
|
|
806
813
|
* @return {object} the dialog
|
|
807
|
-
|
|
814
|
+
*/
|
|
808
815
|
Dialog.prototype.prevPage = function () {
|
|
809
816
|
this.page[this.curpage--].hide();
|
|
810
817
|
if (this.curpage < 0) {
|
|
@@ -818,7 +825,7 @@ var Dialog = (function () {
|
|
|
818
825
|
* @method gotoPage
|
|
819
826
|
* @param num {number} page id
|
|
820
827
|
* @return {object} the dialog
|
|
821
|
-
|
|
828
|
+
*/
|
|
822
829
|
Dialog.prototype.gotoPage = function (num) {
|
|
823
830
|
this.page[this.curpage].hide();
|
|
824
831
|
this.curpage = num;
|
|
@@ -836,9 +843,9 @@ var Dialog = (function () {
|
|
|
836
843
|
* @param pageorpanelId {number} page id or panel id
|
|
837
844
|
* @param panelId {number} panel id
|
|
838
845
|
* @return {object} the internal Panel object
|
|
839
|
-
|
|
846
|
+
*/
|
|
840
847
|
Dialog.prototype.getPanel = function (pageorpanelId, panelId) {
|
|
841
|
-
var pageid =
|
|
848
|
+
var pageid = panelId == null ? this.curpage : pageorpanelId;
|
|
842
849
|
if (panelId == null) {
|
|
843
850
|
panelId = pageorpanelId;
|
|
844
851
|
}
|
|
@@ -849,7 +856,7 @@ var Dialog = (function () {
|
|
|
849
856
|
* @method getPage
|
|
850
857
|
* @param pageid {number} page id
|
|
851
858
|
* @return {object} the internal Page Object
|
|
852
|
-
|
|
859
|
+
*/
|
|
853
860
|
Dialog.prototype.getPage = function (pageid) {
|
|
854
861
|
return this.page[pageid];
|
|
855
862
|
};
|
|
@@ -857,7 +864,7 @@ var Dialog = (function () {
|
|
|
857
864
|
* Returns current panel at the current page
|
|
858
865
|
* @method getCurrentPanel
|
|
859
866
|
* @return {object} the internal Panel object
|
|
860
|
-
|
|
867
|
+
*/
|
|
861
868
|
Dialog.prototype.getCurrentPanel = function () {
|
|
862
869
|
return this.page[this.curpage].getCurrentPanel();
|
|
863
870
|
};
|
|
@@ -868,7 +875,7 @@ var Dialog = (function () {
|
|
|
868
875
|
* @param pageorpanel {object} panel object or page object
|
|
869
876
|
* @param panel {object} panel object
|
|
870
877
|
* @param panel {number} id of the panel
|
|
871
|
-
|
|
878
|
+
*/
|
|
872
879
|
Dialog.prototype.gotoPanel = function (pageorpanel, panel) {
|
|
873
880
|
if (panel != null) {
|
|
874
881
|
var pageid = pageorpanel.id || pageorpanel;
|
|
@@ -881,35 +888,35 @@ var Dialog = (function () {
|
|
|
881
888
|
* Shows the dialog, if it is not visible
|
|
882
889
|
* @method show
|
|
883
890
|
* @return {object} the dialog
|
|
884
|
-
|
|
891
|
+
*/
|
|
885
892
|
Dialog.prototype.show = function () {
|
|
886
893
|
this.popup.show();
|
|
887
|
-
trigger('show.dialog', {dialog: this});
|
|
894
|
+
trigger('show.dialog', { dialog: this });
|
|
888
895
|
return this;
|
|
889
896
|
};
|
|
890
897
|
/**
|
|
891
898
|
* Hides the dialog, if it was visible
|
|
892
899
|
* @method hide
|
|
893
900
|
* @return {object} the dialog
|
|
894
|
-
|
|
901
|
+
*/
|
|
895
902
|
Dialog.prototype.hide = function () {
|
|
896
903
|
this.popup.hide();
|
|
897
|
-
trigger('hide.dialog', {dialog: this});
|
|
904
|
+
trigger('hide.dialog', { dialog: this });
|
|
898
905
|
return this;
|
|
899
906
|
};
|
|
900
907
|
/**
|
|
901
908
|
* Removes the dialog elements from the DOM
|
|
902
909
|
* @method remove
|
|
903
|
-
|
|
910
|
+
*/
|
|
904
911
|
Dialog.prototype.remove = function () {
|
|
905
912
|
this.popup.hide();
|
|
906
913
|
this.popup.remove();
|
|
907
|
-
trigger('remove.dialog', {dialog: this});
|
|
914
|
+
trigger('remove.dialog', { dialog: this });
|
|
908
915
|
};
|
|
909
916
|
/**
|
|
910
917
|
* Disables the dialog if enabled
|
|
911
918
|
* @method disable
|
|
912
|
-
|
|
919
|
+
*/
|
|
913
920
|
Dialog.prototype.disable = function () {
|
|
914
921
|
this.popup.disable();
|
|
915
922
|
return this;
|
|
@@ -917,7 +924,7 @@ var Dialog = (function () {
|
|
|
917
924
|
/**
|
|
918
925
|
* Enables the dialog if disabled
|
|
919
926
|
* @method disable
|
|
920
|
-
|
|
927
|
+
*/
|
|
921
928
|
Dialog.prototype.enable = function () {
|
|
922
929
|
this.popup.enable();
|
|
923
930
|
return this;
|
|
@@ -935,77 +942,102 @@ var Dialog = (function () {
|
|
|
935
942
|
Dialog.prototype.get = function (query) {
|
|
936
943
|
var coll = [];
|
|
937
944
|
var dialog = this;
|
|
938
|
-
var nameExp = '#([^"][^ ]*|"[^"]*")';
|
|
939
|
-
var indexExp = ':(\\d+)';
|
|
945
|
+
var nameExp = '#([^"][^ ]*|"[^"]*")'; // a name is a hash followed by either a bare word or quoted string
|
|
946
|
+
var indexExp = ':(\\d+)'; // an index is a colon followed by some digits
|
|
940
947
|
var typeExp = 'page|panel|button|header'; // one of the allowed types
|
|
941
|
-
var selectorExp =
|
|
942
|
-
'(
|
|
943
|
-
'
|
|
948
|
+
var selectorExp =
|
|
949
|
+
'(?:' + // a selector is either ...
|
|
950
|
+
'(' +
|
|
951
|
+
typeExp +
|
|
952
|
+
')(?:' +
|
|
953
|
+
nameExp +
|
|
954
|
+
'|' +
|
|
955
|
+
indexExp +
|
|
956
|
+
')?' + // a type optionally followed by either #name or :index
|
|
957
|
+
'|' +
|
|
958
|
+
nameExp + // or just a #name
|
|
944
959
|
')';
|
|
945
|
-
var queryRE = new RegExp(
|
|
946
|
-
'
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
960
|
+
var queryRE = new RegExp(
|
|
961
|
+
'(?:^|,)' + // a comma or at the start of the line
|
|
962
|
+
'\\s*' +
|
|
963
|
+
selectorExp + // optional space and a selector
|
|
964
|
+
'(?:\\s+' +
|
|
965
|
+
selectorExp +
|
|
966
|
+
')?' + // optionally, followed by some space and a second selector
|
|
967
|
+
'\\s*(?=,|$)',
|
|
968
|
+
'ig'
|
|
969
|
+
); // followed by, but not including, a comma or the end of the string
|
|
970
|
+
(query + '').replace(
|
|
971
|
+
queryRE,
|
|
972
|
+
function (all, name, title, id, justtitle, name2, title2, id2, justtitle2) {
|
|
955
973
|
name = name && name.toLowerCase();
|
|
956
|
-
|
|
957
|
-
id
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
974
|
+
var pages = [];
|
|
975
|
+
if (name == 'page' && dialog.page[id]) {
|
|
976
|
+
pages.push(dialog.page[id]);
|
|
977
|
+
name = name2;
|
|
978
|
+
name = name && name.toLowerCase();
|
|
979
|
+
title = title2;
|
|
980
|
+
id = id2;
|
|
981
|
+
justtitle = justtitle2;
|
|
982
|
+
} else {
|
|
983
|
+
pages = dialog.page;
|
|
984
|
+
}
|
|
985
|
+
title = title && (title + '').replace(/"/g, '');
|
|
986
|
+
title2 = title2 && (title2 + '').replace(/"/g, '');
|
|
987
|
+
justtitle = justtitle && (justtitle + '').replace(/"/g, '');
|
|
988
|
+
justtitle2 = justtitle2 && (justtitle2 + '').replace(/"/g, '');
|
|
989
|
+
if (name || justtitle) {
|
|
990
|
+
for (var i = pages.length; i--; ) {
|
|
991
|
+
if (justtitle || (name == 'panel' && (title || (!title && id == null)))) {
|
|
992
|
+
for (var j = pages[i].panel.length; j--; ) {
|
|
993
|
+
if (
|
|
994
|
+
pages[i].panel[j].button.html() == justtitle ||
|
|
995
|
+
pages[i].panel[j].button.html() == title ||
|
|
996
|
+
(name == 'panel' && !title && id == null)
|
|
997
|
+
) {
|
|
998
|
+
coll.push(pages[i].panel[j]);
|
|
999
|
+
}
|
|
972
1000
|
}
|
|
973
1001
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1002
|
+
if (justtitle || (name == 'button' && (title || (!title && id == null)))) {
|
|
1003
|
+
for (var j = pages[i].button.length; j--; ) {
|
|
1004
|
+
if (
|
|
1005
|
+
pages[i].button[j].item.html() == justtitle ||
|
|
1006
|
+
pages[i].button[j].item.html() == title ||
|
|
1007
|
+
(name == 'button' && !title && id == null)
|
|
1008
|
+
) {
|
|
1009
|
+
coll.push(pages[i].button[j]);
|
|
1010
|
+
}
|
|
979
1011
|
}
|
|
980
1012
|
}
|
|
1013
|
+
if (pages[i][name] && pages[i][name][id]) {
|
|
1014
|
+
coll.push(pages[i][name][id]);
|
|
1015
|
+
}
|
|
1016
|
+
if (name == 'header' && pages[i].header) {
|
|
1017
|
+
coll.push(pages[i].header);
|
|
1018
|
+
}
|
|
981
1019
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
}
|
|
985
|
-
if (name == 'header' && pages[i].header) {
|
|
986
|
-
coll.push(pages[i].header);
|
|
987
|
-
}
|
|
1020
|
+
} else {
|
|
1021
|
+
coll = coll.concat(pages);
|
|
988
1022
|
}
|
|
989
|
-
} else {
|
|
990
|
-
coll = coll.concat(pages);
|
|
991
1023
|
}
|
|
992
|
-
|
|
1024
|
+
);
|
|
993
1025
|
var res = {
|
|
994
|
-
length: coll.length
|
|
1026
|
+
length: coll.length,
|
|
995
1027
|
};
|
|
996
|
-
for (var i = coll.length; i--;) {
|
|
1028
|
+
for (var i = coll.length; i--; ) {
|
|
997
1029
|
res[i] = coll[i];
|
|
998
1030
|
for (var method in coll[i]) {
|
|
999
1031
|
if (!(method in res)) {
|
|
1000
1032
|
(function (m) {
|
|
1001
1033
|
res[m] = function () {
|
|
1002
|
-
for (var j = this.length; j--;) {
|
|
1034
|
+
for (var j = this.length; j--; ) {
|
|
1003
1035
|
if (typeof this[j][m] === 'function') {
|
|
1004
1036
|
this[j][m].apply(this[j], arguments);
|
|
1005
1037
|
}
|
|
1006
1038
|
}
|
|
1007
1039
|
};
|
|
1008
|
-
}(method)
|
|
1040
|
+
})(method);
|
|
1009
1041
|
}
|
|
1010
1042
|
}
|
|
1011
1043
|
}
|
|
@@ -1019,17 +1051,21 @@ var Dialog = (function () {
|
|
|
1019
1051
|
*/
|
|
1020
1052
|
Dialog.prototype.updateHeight = function () {
|
|
1021
1053
|
var height = 0;
|
|
1022
|
-
var maxDialogHeight =
|
|
1054
|
+
var maxDialogHeight =
|
|
1055
|
+
$(window).height() - HEADER_HEIGHT - BUTTONS_HEIGHT - MIN_DIALOG_VERTICAL_BUFFER * 2;
|
|
1023
1056
|
for (var i = 0; this.getPanel(i); i++) {
|
|
1024
|
-
if (
|
|
1057
|
+
if (
|
|
1058
|
+
this.getPanel(i).body.css({ height: 'auto', display: 'block' }).outerHeight() >
|
|
1059
|
+
height
|
|
1060
|
+
) {
|
|
1025
1061
|
height = Math.min(maxDialogHeight, this.getPanel(i).body.outerHeight());
|
|
1026
1062
|
}
|
|
1027
1063
|
if (i !== this.page[this.curpage].curtab) {
|
|
1028
|
-
this.getPanel(i).body.css({display: 'none'});
|
|
1064
|
+
this.getPanel(i).body.css({ display: 'none' });
|
|
1029
1065
|
}
|
|
1030
1066
|
}
|
|
1031
1067
|
for (i = 0; this.getPanel(i); i++) {
|
|
1032
|
-
this.getPanel(i).body.css({height: height || this.height});
|
|
1068
|
+
this.getPanel(i).body.css({ height: height || this.height });
|
|
1033
1069
|
}
|
|
1034
1070
|
this.page[0].menu.height(height);
|
|
1035
1071
|
this.height = height + HEADER_HEIGHT + BUTTONS_HEIGHT + 1;
|
|
@@ -1042,7 +1078,9 @@ var Dialog = (function () {
|
|
|
1042
1078
|
* @method isMaximised
|
|
1043
1079
|
*/
|
|
1044
1080
|
Dialog.prototype.isMaximised = function () {
|
|
1045
|
-
return
|
|
1081
|
+
return (
|
|
1082
|
+
this.popup.element.outerHeight() >= $(window).height() - MIN_DIALOG_VERTICAL_BUFFER * 2
|
|
1083
|
+
);
|
|
1046
1084
|
};
|
|
1047
1085
|
|
|
1048
1086
|
/**
|
|
@@ -1062,21 +1100,17 @@ var Dialog = (function () {
|
|
|
1062
1100
|
};
|
|
1063
1101
|
|
|
1064
1102
|
return Dialog;
|
|
1065
|
-
|
|
1066
|
-
}());
|
|
1103
|
+
})();
|
|
1067
1104
|
|
|
1068
1105
|
Dialog = deprecate.construct(Dialog, 'Dialog constructor', {
|
|
1069
|
-
alternativeName: 'Dialog2'
|
|
1106
|
+
alternativeName: 'Dialog2',
|
|
1070
1107
|
});
|
|
1071
1108
|
|
|
1072
1109
|
createPopup = deprecate.construct(createPopup, 'Dialog popup constructor', {
|
|
1073
|
-
alternatveName: 'Dialog2'
|
|
1110
|
+
alternatveName: 'Dialog2',
|
|
1074
1111
|
});
|
|
1075
1112
|
|
|
1076
1113
|
globalize('Dialog', Dialog);
|
|
1077
1114
|
globalize('popup', createPopup);
|
|
1078
1115
|
|
|
1079
|
-
export {
|
|
1080
|
-
Dialog,
|
|
1081
|
-
createPopup as popup
|
|
1082
|
-
};
|
|
1116
|
+
export { Dialog, createPopup as popup };
|