@gitlab/ui 94.2.0 → 94.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 +7 -0
- package/dist/components/experimental/duo/chat/duo_chat.js +1 -2
- package/dist/vendor/bootstrap-vue/src/components/badge/index.js +0 -10
- package/dist/vendor/bootstrap-vue/src/components/breadcrumb/index.js +0 -14
- package/dist/vendor/bootstrap-vue/src/components/button/index.js +0 -14
- package/dist/vendor/bootstrap-vue/src/components/button-group/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/components/collapse/index.js +0 -14
- package/dist/vendor/bootstrap-vue/src/components/dropdown/index.js +0 -34
- package/dist/vendor/bootstrap-vue/src/components/form/index.js +0 -20
- package/dist/vendor/bootstrap-vue/src/components/form-checkbox/index.js +0 -16
- package/dist/vendor/bootstrap-vue/src/components/form-group/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/components/form-input/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -14
- package/dist/vendor/bootstrap-vue/src/components/form-select/index.js +0 -17
- package/dist/vendor/bootstrap-vue/src/components/form-textarea/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/components/index.js +1 -49
- package/dist/vendor/bootstrap-vue/src/components/input-group/index.js +0 -18
- package/dist/vendor/bootstrap-vue/src/components/layout/index.js +0 -12
- package/dist/vendor/bootstrap-vue/src/components/link/index.js +0 -10
- package/dist/vendor/bootstrap-vue/src/components/modal/index.js +0 -19
- package/dist/vendor/bootstrap-vue/src/components/nav/index.js +0 -21
- package/dist/vendor/bootstrap-vue/src/components/navbar/index.js +0 -20
- package/dist/vendor/bootstrap-vue/src/components/popover/index.js +0 -14
- package/dist/vendor/bootstrap-vue/src/components/progress/index.js +0 -12
- package/dist/vendor/bootstrap-vue/src/components/table/index.js +0 -38
- package/dist/vendor/bootstrap-vue/src/components/tabs/index.js +0 -12
- package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +1 -1
- package/dist/vendor/bootstrap-vue/src/components/tooltip/index.js +0 -14
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -2
- package/dist/vendor/bootstrap-vue/src/constants/env.js +1 -2
- package/dist/vendor/bootstrap-vue/src/constants/regex.js +1 -3
- package/dist/vendor/bootstrap-vue/src/directives/modal/index.js +0 -10
- package/dist/vendor/bootstrap-vue/src/directives/toggle/index.js +0 -10
- package/dist/vendor/bootstrap-vue/src/directives/tooltip/index.js +0 -10
- package/dist/vendor/bootstrap-vue/src/directives/visible/index.js +0 -10
- package/dist/vendor/bootstrap-vue/src/index.js +1 -38
- package/dist/vendor/bootstrap-vue/src/utils/object.js +1 -3
- package/dist/vendor/bootstrap-vue/src/utils/warn.js +2 -17
- package/package.json +1 -1
- package/src/components/experimental/duo/chat/duo_chat.vue +0 -10
- package/src/vendor/bootstrap-vue/src/components/badge/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/badge/index.js +1 -6
- package/src/vendor/bootstrap-vue/src/components/breadcrumb/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/breadcrumb/index.js +1 -6
- package/src/vendor/bootstrap-vue/src/components/button/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/button/index.js +1 -11
- package/src/vendor/bootstrap-vue/src/components/button-group/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/button-group/index.js +1 -9
- package/src/vendor/bootstrap-vue/src/components/collapse/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/collapse/index.js +1 -8
- package/src/vendor/bootstrap-vue/src/components/dropdown/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/dropdown/index.js +0 -25
- package/src/vendor/bootstrap-vue/src/components/form/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/form/index.js +1 -15
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/index.js +1 -13
- package/src/vendor/bootstrap-vue/src/components/form-group/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/form-group/index.js +1 -9
- package/src/vendor/bootstrap-vue/src/components/form-input/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/form-input/index.js +1 -9
- package/src/vendor/bootstrap-vue/src/components/form-radio/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/form-radio/index.js +1 -11
- package/src/vendor/bootstrap-vue/src/components/form-select/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/form-select/index.js +1 -13
- package/src/vendor/bootstrap-vue/src/components/form-textarea/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/form-textarea/index.js +1 -9
- package/src/vendor/bootstrap-vue/src/components/index.js +1 -50
- package/src/vendor/bootstrap-vue/src/components/input-group/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/input-group/index.js +1 -19
- package/src/vendor/bootstrap-vue/src/components/layout/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/layout/index.js +1 -9
- package/src/vendor/bootstrap-vue/src/components/link/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/link/index.js +1 -6
- package/src/vendor/bootstrap-vue/src/components/modal/README.md +0 -8
- package/src/vendor/bootstrap-vue/src/components/modal/index.d.ts +2 -5
- package/src/vendor/bootstrap-vue/src/components/modal/index.js +1 -11
- package/src/vendor/bootstrap-vue/src/components/modal/package.json +0 -3
- package/src/vendor/bootstrap-vue/src/components/nav/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/nav/index.js +1 -17
- package/src/vendor/bootstrap-vue/src/components/nav/package.json +0 -3
- package/src/vendor/bootstrap-vue/src/components/navbar/index.d.ts +1 -4
- package/src/vendor/bootstrap-vue/src/components/navbar/index.js +1 -17
- package/src/vendor/bootstrap-vue/src/components/navbar/package.json +0 -5
- package/src/vendor/bootstrap-vue/src/components/popover/README.md +1 -46
- package/src/vendor/bootstrap-vue/src/components/popover/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/popover/index.js +1 -8
- package/src/vendor/bootstrap-vue/src/components/popover/package.json +1 -4
- package/src/vendor/bootstrap-vue/src/components/progress/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/progress/index.js +1 -9
- package/src/vendor/bootstrap-vue/src/components/table/README.md +3 -15
- package/src/vendor/bootstrap-vue/src/components/table/index.d.ts +1 -7
- package/src/vendor/bootstrap-vue/src/components/table/index.js +0 -33
- package/src/vendor/bootstrap-vue/src/components/table/package.json +0 -4
- package/src/vendor/bootstrap-vue/src/components/tabs/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/tabs/index.js +1 -9
- package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +1 -1
- package/src/vendor/bootstrap-vue/src/components/tooltip/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/components/tooltip/index.js +1 -8
- package/src/vendor/bootstrap-vue/src/components/tooltip/package.json +0 -3
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -1
- package/src/vendor/bootstrap-vue/src/constants/env.js +0 -1
- package/src/vendor/bootstrap-vue/src/constants/regex.js +0 -3
- package/src/vendor/bootstrap-vue/src/directives/modal/index.d.ts +1 -4
- package/src/vendor/bootstrap-vue/src/directives/modal/index.js +1 -6
- package/src/vendor/bootstrap-vue/src/directives/toggle/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/directives/toggle/index.js +1 -6
- package/src/vendor/bootstrap-vue/src/directives/tooltip/README.md +0 -1
- package/src/vendor/bootstrap-vue/src/directives/tooltip/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/directives/tooltip/index.js +1 -6
- package/src/vendor/bootstrap-vue/src/directives/visible/index.d.ts +1 -5
- package/src/vendor/bootstrap-vue/src/directives/visible/index.js +1 -6
- package/src/vendor/bootstrap-vue/src/icons/icons.js +1 -4
- package/src/vendor/bootstrap-vue/src/index.d.ts +0 -3
- package/src/vendor/bootstrap-vue/src/index.js +2 -45
- package/src/vendor/bootstrap-vue/src/utils/config.spec.js +2 -2
- package/src/vendor/bootstrap-vue/src/utils/object.js +0 -2
- package/src/vendor/bootstrap-vue/src/utils/warn.js +1 -16
- package/translations.js +0 -2
- package/dist/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal.js +0 -279
- package/dist/vendor/bootstrap-vue/src/directives/hover/hover.js +0 -61
- package/dist/vendor/bootstrap-vue/src/directives/hover/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/directives/index.js +0 -23
- package/dist/vendor/bootstrap-vue/src/directives/popover/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/directives/popover/popover.js +0 -265
- package/dist/vendor/bootstrap-vue/src/directives/scrollspy/helpers/bv-scrollspy.class.js +0 -404
- package/dist/vendor/bootstrap-vue/src/directives/scrollspy/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/directives/scrollspy/scrollspy.js +0 -112
- package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal.js +0 -279
- package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal.spec.js +0 -178
- package/src/vendor/bootstrap-vue/src/directives/hover/README.md +0 -87
- package/src/vendor/bootstrap-vue/src/directives/hover/hover.js +0 -54
- package/src/vendor/bootstrap-vue/src/directives/hover/hover.spec.js +0 -49
- package/src/vendor/bootstrap-vue/src/directives/hover/index.d.ts +0 -11
- package/src/vendor/bootstrap-vue/src/directives/hover/index.js +0 -8
- package/src/vendor/bootstrap-vue/src/directives/hover/package.json +0 -13
- package/src/vendor/bootstrap-vue/src/directives/index.d.ts +0 -13
- package/src/vendor/bootstrap-vue/src/directives/index.js +0 -22
- package/src/vendor/bootstrap-vue/src/directives/popover/README.md +0 -648
- package/src/vendor/bootstrap-vue/src/directives/popover/index.d.ts +0 -11
- package/src/vendor/bootstrap-vue/src/directives/popover/index.js +0 -8
- package/src/vendor/bootstrap-vue/src/directives/popover/package.json +0 -111
- package/src/vendor/bootstrap-vue/src/directives/popover/popover.js +0 -275
- package/src/vendor/bootstrap-vue/src/directives/popover/popover.spec.js +0 -129
- package/src/vendor/bootstrap-vue/src/directives/scrollspy/README.md +0 -411
- package/src/vendor/bootstrap-vue/src/directives/scrollspy/helpers/bv-scrollspy.class.js +0 -480
- package/src/vendor/bootstrap-vue/src/directives/scrollspy/index.d.ts +0 -11
- package/src/vendor/bootstrap-vue/src/directives/scrollspy/index.js +0 -8
- package/src/vendor/bootstrap-vue/src/directives/scrollspy/package.json +0 -38
- package/src/vendor/bootstrap-vue/src/directives/scrollspy/scrollspy.js +0 -117
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { NAME_MSG_BOX, NAME_MODAL } from '../../../constants/components';
|
|
2
|
-
import { HOOK_EVENT_NAME_DESTROYED, EVENT_NAME_HIDDEN, HOOK_EVENT_NAME_BEFORE_DESTROY, EVENT_NAME_HIDE } from '../../../constants/events';
|
|
3
|
-
import { useParentMixin } from '../../../mixins/use-parent';
|
|
4
|
-
import { concat } from '../../../utils/array';
|
|
5
|
-
import { getComponentConfig } from '../../../utils/config';
|
|
6
|
-
import { requestAF } from '../../../utils/dom';
|
|
7
|
-
import { getRootActionEventName } from '../../../utils/events';
|
|
8
|
-
import { isFunction, isUndefined } from '../../../utils/inspect';
|
|
9
|
-
import { keys, omit, hasOwnProperty, defineProperty, assign, defineProperties, readonlyDescriptor } from '../../../utils/object';
|
|
10
|
-
import { pluginFactory } from '../../../utils/plugins';
|
|
11
|
-
import { warn, warnNoPromiseSupport, warnNotClient } from '../../../utils/warn';
|
|
12
|
-
import { createNewChildComponent } from '../../../utils/create-new-child-component';
|
|
13
|
-
import { getEventRoot } from '../../../utils/get-event-root';
|
|
14
|
-
import { props, BModal } from '../modal';
|
|
15
|
-
|
|
16
|
-
// Plugin for adding `$bvModal` property to all Vue instances
|
|
17
|
-
|
|
18
|
-
// --- Constants ---
|
|
19
|
-
|
|
20
|
-
const PROP_NAME = '$bvModal';
|
|
21
|
-
const PROP_NAME_PRIV = '_bv__modal';
|
|
22
|
-
|
|
23
|
-
// Base modal props that are allowed
|
|
24
|
-
// Some may be ignored or overridden on some message boxes
|
|
25
|
-
// Prop ID is allowed, but really only should be used for testing
|
|
26
|
-
// We need to add it in explicitly as it comes from the `idMixin`
|
|
27
|
-
const BASE_PROPS = ['id', ...keys(omit(props, ['busy', 'lazy', 'noStacking', 'static', 'visible']))];
|
|
28
|
-
|
|
29
|
-
// Fallback event resolver (returns undefined)
|
|
30
|
-
const defaultResolver = () => {};
|
|
31
|
-
|
|
32
|
-
// Map prop names to modal slot names
|
|
33
|
-
const propsToSlots = {
|
|
34
|
-
msgBoxContent: 'default',
|
|
35
|
-
title: 'modal-title',
|
|
36
|
-
okTitle: 'modal-ok',
|
|
37
|
-
cancelTitle: 'modal-cancel'
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// --- Helper methods ---
|
|
41
|
-
|
|
42
|
-
// Method to filter only recognized props that are not undefined
|
|
43
|
-
const filterOptions = options => {
|
|
44
|
-
return BASE_PROPS.reduce((memo, key) => {
|
|
45
|
-
if (!isUndefined(options[key])) {
|
|
46
|
-
memo[key] = options[key];
|
|
47
|
-
}
|
|
48
|
-
return memo;
|
|
49
|
-
}, {});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// Method to install `$bvModal` VM injection
|
|
53
|
-
const plugin = Vue => {
|
|
54
|
-
// Create a private sub-component that extends BModal
|
|
55
|
-
// which self-destructs after hidden
|
|
56
|
-
// @vue/component
|
|
57
|
-
const BMsgBox = Vue.extend({
|
|
58
|
-
name: NAME_MSG_BOX,
|
|
59
|
-
extends: BModal,
|
|
60
|
-
mixins: [useParentMixin],
|
|
61
|
-
destroyed() {
|
|
62
|
-
// Make sure we not in document any more
|
|
63
|
-
if (this.$el && this.$el.parentNode) {
|
|
64
|
-
this.$el.parentNode.removeChild(this.$el);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
mounted() {
|
|
68
|
-
// Self destruct handler
|
|
69
|
-
const handleDestroy = () => {
|
|
70
|
-
this.$nextTick(() => {
|
|
71
|
-
// In a `requestAF()` to release control back to application
|
|
72
|
-
requestAF(() => {
|
|
73
|
-
this.$destroy();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
// Self destruct if parent destroyed
|
|
78
|
-
this.bvParent.$once(HOOK_EVENT_NAME_DESTROYED, handleDestroy);
|
|
79
|
-
// Self destruct after hidden
|
|
80
|
-
this.$once(EVENT_NAME_HIDDEN, handleDestroy);
|
|
81
|
-
// Self destruct on route change
|
|
82
|
-
/* istanbul ignore if */
|
|
83
|
-
if (this.$router && this.$route) {
|
|
84
|
-
// Destroy ourselves if route changes
|
|
85
|
-
/* istanbul ignore next */
|
|
86
|
-
this.$once(HOOK_EVENT_NAME_BEFORE_DESTROY, this.$watch('$router', handleDestroy));
|
|
87
|
-
}
|
|
88
|
-
// Show the `BMsgBox`
|
|
89
|
-
this.show();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
// Method to generate the on-demand modal message box
|
|
94
|
-
// Returns a promise that resolves to a value returned by the resolve
|
|
95
|
-
const asyncMsgBox = function (parent, props) {
|
|
96
|
-
let resolver = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultResolver;
|
|
97
|
-
if (warnNotClient(PROP_NAME) || warnNoPromiseSupport(PROP_NAME)) {
|
|
98
|
-
/* istanbul ignore next */
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
// Create an instance of `BMsgBox` component
|
|
102
|
-
// We set parent as the local VM so these modals can emit events on
|
|
103
|
-
// the app `$root`, as needed by things like tooltips and popovers
|
|
104
|
-
// And it helps to ensure `BMsgBox` is destroyed when parent is destroyed
|
|
105
|
-
const msgBox = createNewChildComponent(parent, BMsgBox, {
|
|
106
|
-
// Preset the prop values
|
|
107
|
-
propsData: {
|
|
108
|
-
...filterOptions(getComponentConfig(NAME_MODAL)),
|
|
109
|
-
// Defaults that user can override
|
|
110
|
-
hideHeaderClose: true,
|
|
111
|
-
hideHeader: !(props.title || props.titleHtml),
|
|
112
|
-
// Add in (filtered) user supplied props
|
|
113
|
-
...omit(props, keys(propsToSlots)),
|
|
114
|
-
// Props that can't be overridden
|
|
115
|
-
lazy: false,
|
|
116
|
-
busy: false,
|
|
117
|
-
visible: false,
|
|
118
|
-
noStacking: false,
|
|
119
|
-
noEnforceFocus: false
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
// Convert certain props to scoped slots
|
|
123
|
-
keys(propsToSlots).forEach(prop => {
|
|
124
|
-
if (!isUndefined(props[prop])) {
|
|
125
|
-
// Can be a string, or array of VNodes.
|
|
126
|
-
// Alternatively, user can use HTML version of prop to pass an HTML string.
|
|
127
|
-
msgBox.$slots[propsToSlots[prop]] = concat(props[prop]);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
// Return a promise that resolves when hidden, or rejects on destroyed
|
|
131
|
-
return new Promise((resolve, reject) => {
|
|
132
|
-
let resolved = false;
|
|
133
|
-
msgBox.$once(HOOK_EVENT_NAME_DESTROYED, () => {
|
|
134
|
-
if (!resolved) {
|
|
135
|
-
/* istanbul ignore next */
|
|
136
|
-
reject(new Error('BootstrapVue MsgBox destroyed before resolve'));
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
msgBox.$on(EVENT_NAME_HIDE, bvModalEvent => {
|
|
140
|
-
if (!bvModalEvent.defaultPrevented) {
|
|
141
|
-
const result = resolver(bvModalEvent);
|
|
142
|
-
// If resolver didn't cancel hide, we resolve
|
|
143
|
-
if (!bvModalEvent.defaultPrevented) {
|
|
144
|
-
resolved = true;
|
|
145
|
-
resolve(result);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
// Create a mount point (a DIV) and mount the msgBo which will trigger it to show
|
|
150
|
-
const div = document.createElement('div');
|
|
151
|
-
document.body.appendChild(div);
|
|
152
|
-
msgBox.$mount(div);
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
// Private utility method to open a user defined message box and returns a promise.
|
|
157
|
-
// Not to be used directly by consumers, as this method may change calling syntax
|
|
158
|
-
const makeMsgBox = function (parent, content) {
|
|
159
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
160
|
-
let resolver = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
161
|
-
if (!content || warnNoPromiseSupport(PROP_NAME) || warnNotClient(PROP_NAME) || !isFunction(resolver)) {
|
|
162
|
-
/* istanbul ignore next */
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
return asyncMsgBox(parent, {
|
|
166
|
-
...filterOptions(options),
|
|
167
|
-
msgBoxContent: content
|
|
168
|
-
}, resolver);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
// BvModal instance class
|
|
172
|
-
class BvModal {
|
|
173
|
-
constructor(vm) {
|
|
174
|
-
// Assign the new properties to this instance
|
|
175
|
-
assign(this, {
|
|
176
|
-
_vm: vm,
|
|
177
|
-
_root: getEventRoot(vm)
|
|
178
|
-
});
|
|
179
|
-
// Set these properties as read-only and non-enumerable
|
|
180
|
-
defineProperties(this, {
|
|
181
|
-
_vm: readonlyDescriptor(),
|
|
182
|
-
_root: readonlyDescriptor()
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// --- Instance methods ---
|
|
187
|
-
|
|
188
|
-
// Show modal with the specified ID args are for future use
|
|
189
|
-
show(id) {
|
|
190
|
-
if (id && this._root) {
|
|
191
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
192
|
-
args[_key - 1] = arguments[_key];
|
|
193
|
-
}
|
|
194
|
-
this._root.$emit(getRootActionEventName(NAME_MODAL, 'show'), id, ...args);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Hide modal with the specified ID args are for future use
|
|
199
|
-
hide(id) {
|
|
200
|
-
if (id && this._root) {
|
|
201
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
202
|
-
args[_key2 - 1] = arguments[_key2];
|
|
203
|
-
}
|
|
204
|
-
this._root.$emit(getRootActionEventName(NAME_MODAL, 'hide'), id, ...args);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// The following methods require Promise support!
|
|
209
|
-
// IE 11 and others do not support Promise natively, so users
|
|
210
|
-
// should have a Polyfill loaded (which they need anyways for IE 11 support)
|
|
211
|
-
|
|
212
|
-
// Open a message box with OK button only and returns a promise
|
|
213
|
-
msgBoxOk(message) {
|
|
214
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
215
|
-
// Pick the modal props we support from options
|
|
216
|
-
const props = {
|
|
217
|
-
...options,
|
|
218
|
-
// Add in overrides and our content prop
|
|
219
|
-
okOnly: true,
|
|
220
|
-
okDisabled: false,
|
|
221
|
-
hideFooter: false,
|
|
222
|
-
msgBoxContent: message
|
|
223
|
-
};
|
|
224
|
-
return makeMsgBox(this._vm, message, props, () => {
|
|
225
|
-
// Always resolve to true for OK
|
|
226
|
-
return true;
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Open a message box modal with OK and CANCEL buttons
|
|
231
|
-
// and returns a promise
|
|
232
|
-
msgBoxConfirm(message) {
|
|
233
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
234
|
-
// Set the modal props we support from options
|
|
235
|
-
const props = {
|
|
236
|
-
...options,
|
|
237
|
-
// Add in overrides and our content prop
|
|
238
|
-
okOnly: false,
|
|
239
|
-
okDisabled: false,
|
|
240
|
-
cancelDisabled: false,
|
|
241
|
-
hideFooter: false
|
|
242
|
-
};
|
|
243
|
-
return makeMsgBox(this._vm, message, props, bvModalEvent => {
|
|
244
|
-
const trigger = bvModalEvent.trigger;
|
|
245
|
-
return trigger === 'ok' ? true : trigger === 'cancel' ? false : null;
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Add our instance mixin
|
|
251
|
-
Vue.mixin({
|
|
252
|
-
beforeCreate() {
|
|
253
|
-
// Because we need access to `$root` for `$emits`, and VM for parenting,
|
|
254
|
-
// we have to create a fresh instance of `BvModal` for each VM
|
|
255
|
-
this[PROP_NAME_PRIV] = new BvModal(this);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
// Define our read-only `$bvModal` instance property
|
|
260
|
-
// Placed in an if just in case in HMR mode
|
|
261
|
-
if (!hasOwnProperty(Vue.prototype, PROP_NAME)) {
|
|
262
|
-
defineProperty(Vue.prototype, PROP_NAME, {
|
|
263
|
-
get() {
|
|
264
|
-
/* istanbul ignore next */
|
|
265
|
-
if (!this || !this[PROP_NAME_PRIV]) {
|
|
266
|
-
warn(`"${PROP_NAME}" must be accessed from a Vue instance "this" context.`, NAME_MODAL);
|
|
267
|
-
}
|
|
268
|
-
return this[PROP_NAME_PRIV];
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
const BVModalPlugin = /*#__PURE__*/pluginFactory({
|
|
274
|
-
plugins: {
|
|
275
|
-
plugin
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
export { BVModalPlugin };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { IS_BROWSER } from '../../constants/env';
|
|
2
|
-
import { EVENT_OPTIONS_NO_CAPTURE } from '../../constants/events';
|
|
3
|
-
import { eventOnOff } from '../../utils/events';
|
|
4
|
-
import { isFunction } from '../../utils/inspect';
|
|
5
|
-
|
|
6
|
-
// v-b-hover directive
|
|
7
|
-
|
|
8
|
-
// --- Constants ---
|
|
9
|
-
|
|
10
|
-
const PROP = '__BV_hover_handler__';
|
|
11
|
-
const MOUSEENTER = 'mouseenter';
|
|
12
|
-
const MOUSELEAVE = 'mouseleave';
|
|
13
|
-
|
|
14
|
-
// --- Helper methods ---
|
|
15
|
-
|
|
16
|
-
const createListener = handler => {
|
|
17
|
-
const listener = event => {
|
|
18
|
-
handler(event.type === MOUSEENTER, event);
|
|
19
|
-
};
|
|
20
|
-
listener.fn = handler;
|
|
21
|
-
return listener;
|
|
22
|
-
};
|
|
23
|
-
const updateListeners = (on, el, listener) => {
|
|
24
|
-
eventOnOff(on, el, MOUSEENTER, listener, EVENT_OPTIONS_NO_CAPTURE);
|
|
25
|
-
eventOnOff(on, el, MOUSELEAVE, listener, EVENT_OPTIONS_NO_CAPTURE);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// --- Directive bind/unbind/update handler ---
|
|
29
|
-
|
|
30
|
-
const directive = (el, _ref) => {
|
|
31
|
-
let {
|
|
32
|
-
value: handler = null
|
|
33
|
-
} = _ref;
|
|
34
|
-
if (IS_BROWSER) {
|
|
35
|
-
const listener = el[PROP];
|
|
36
|
-
const hasListener = isFunction(listener);
|
|
37
|
-
const handlerChanged = !(hasListener && listener.fn === handler);
|
|
38
|
-
if (hasListener && handlerChanged) {
|
|
39
|
-
updateListeners(false, el, listener);
|
|
40
|
-
delete el[PROP];
|
|
41
|
-
}
|
|
42
|
-
if (isFunction(handler) && handlerChanged) {
|
|
43
|
-
el[PROP] = createListener(handler);
|
|
44
|
-
updateListeners(true, el, el[PROP]);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// VBHover directive
|
|
50
|
-
|
|
51
|
-
const VBHover = {
|
|
52
|
-
bind: directive,
|
|
53
|
-
componentUpdated: directive,
|
|
54
|
-
unbind(el) {
|
|
55
|
-
directive(el, {
|
|
56
|
-
value: null
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { VBHover };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { pluginFactory } from '../utils/plugins';
|
|
2
|
-
import { VBHoverPlugin } from './hover';
|
|
3
|
-
import { VBModalPlugin } from './modal';
|
|
4
|
-
import { VBPopoverPlugin } from './popover';
|
|
5
|
-
import { VBScrollspyPlugin } from './scrollspy';
|
|
6
|
-
import { VBTogglePlugin } from './toggle';
|
|
7
|
-
import { VBTooltipPlugin } from './tooltip';
|
|
8
|
-
import { VBVisiblePlugin } from './visible';
|
|
9
|
-
|
|
10
|
-
// Main plugin for installing all directive plugins
|
|
11
|
-
const directivesPlugin = /*#__PURE__*/pluginFactory({
|
|
12
|
-
plugins: {
|
|
13
|
-
VBHoverPlugin,
|
|
14
|
-
VBModalPlugin,
|
|
15
|
-
VBPopoverPlugin,
|
|
16
|
-
VBScrollspyPlugin,
|
|
17
|
-
VBTogglePlugin,
|
|
18
|
-
VBTooltipPlugin,
|
|
19
|
-
VBVisiblePlugin
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export { directivesPlugin };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VBPopover } from './popover';
|
|
2
|
-
export { VBPopover } from './popover';
|
|
3
|
-
import { pluginFactory } from '../../utils/plugins';
|
|
4
|
-
|
|
5
|
-
const VBPopoverPlugin = /*#__PURE__*/pluginFactory({
|
|
6
|
-
directives: {
|
|
7
|
-
VBPopover
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export { VBPopoverPlugin };
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { NAME_POPOVER } from '../../constants/components';
|
|
2
|
-
import { IS_BROWSER } from '../../constants/env';
|
|
3
|
-
import { EVENT_NAME_SHOW } from '../../constants/events';
|
|
4
|
-
import { concat } from '../../utils/array';
|
|
5
|
-
import { getComponentConfig } from '../../utils/config';
|
|
6
|
-
import { getScopeId } from '../../utils/get-scope-id';
|
|
7
|
-
import { identity } from '../../utils/identity';
|
|
8
|
-
import { getInstanceFromDirective } from '../../utils/get-instance-from-directive';
|
|
9
|
-
import { isFunction, isString, isNumber, isPlainObject, isUndefined, isUndefinedOrNull } from '../../utils/inspect';
|
|
10
|
-
import { looseEqual } from '../../utils/loose-equal';
|
|
11
|
-
import { toInteger } from '../../utils/number';
|
|
12
|
-
import { keys } from '../../utils/object';
|
|
13
|
-
import { createNewChildComponent } from '../../utils/create-new-child-component';
|
|
14
|
-
import { BVPopover } from '../../components/popover/helpers/bv-popover';
|
|
15
|
-
import { nextTick } from '../../vue';
|
|
16
|
-
|
|
17
|
-
// Key which we use to store tooltip object on element
|
|
18
|
-
const BV_POPOVER = '__BV_Popover__';
|
|
19
|
-
|
|
20
|
-
// Default trigger
|
|
21
|
-
const DefaultTrigger = 'click';
|
|
22
|
-
|
|
23
|
-
// Valid event triggers
|
|
24
|
-
const validTriggers = {
|
|
25
|
-
focus: true,
|
|
26
|
-
hover: true,
|
|
27
|
-
click: true,
|
|
28
|
-
blur: true,
|
|
29
|
-
manual: true
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// Directive modifier test regular expressions. Pre-compile for performance
|
|
33
|
-
const htmlRE = /^html$/i;
|
|
34
|
-
const noFadeRE = /^nofade$/i;
|
|
35
|
-
const placementRE = /^(auto|top(left|right)?|bottom(left|right)?|left(top|bottom)?|right(top|bottom)?)$/i;
|
|
36
|
-
const boundaryRE = /^(window|viewport|scrollParent)$/i;
|
|
37
|
-
const delayRE = /^d\d+$/i;
|
|
38
|
-
const delayShowRE = /^ds\d+$/i;
|
|
39
|
-
const delayHideRE = /^dh\d+$/i;
|
|
40
|
-
const offsetRE = /^o-?\d+$/i;
|
|
41
|
-
const variantRE = /^v-.+$/i;
|
|
42
|
-
const spacesRE = /\s+/;
|
|
43
|
-
|
|
44
|
-
// Build a Popover config based on bindings (if any)
|
|
45
|
-
// Arguments and modifiers take precedence over passed value config object
|
|
46
|
-
const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to test */{
|
|
47
|
-
// We start out with a basic config
|
|
48
|
-
let config = {
|
|
49
|
-
title: undefined,
|
|
50
|
-
content: undefined,
|
|
51
|
-
trigger: '',
|
|
52
|
-
// Default set below if needed
|
|
53
|
-
placement: 'right',
|
|
54
|
-
fallbackPlacement: 'flip',
|
|
55
|
-
container: false,
|
|
56
|
-
// Default of body
|
|
57
|
-
animation: true,
|
|
58
|
-
offset: 0,
|
|
59
|
-
disabled: false,
|
|
60
|
-
id: null,
|
|
61
|
-
html: false,
|
|
62
|
-
delay: getComponentConfig(NAME_POPOVER, 'delay', 50),
|
|
63
|
-
boundary: String(getComponentConfig(NAME_POPOVER, 'boundary', 'scrollParent')),
|
|
64
|
-
boundaryPadding: toInteger(getComponentConfig(NAME_POPOVER, 'boundaryPadding', 5), 0),
|
|
65
|
-
variant: getComponentConfig(NAME_POPOVER, 'variant'),
|
|
66
|
-
customClass: getComponentConfig(NAME_POPOVER, 'customClass')
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// Process `bindings.value`
|
|
70
|
-
if (isString(bindings.value) || isNumber(bindings.value)) {
|
|
71
|
-
// Value is popover content (html optionally supported)
|
|
72
|
-
config.content = bindings.value;
|
|
73
|
-
} else if (isFunction(bindings.value)) {
|
|
74
|
-
// Content generator function
|
|
75
|
-
config.content = bindings.value;
|
|
76
|
-
} else if (isPlainObject(bindings.value)) {
|
|
77
|
-
// Value is config object, so merge
|
|
78
|
-
config = {
|
|
79
|
-
...config,
|
|
80
|
-
...bindings.value
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// If argument, assume element ID of container element
|
|
85
|
-
if (bindings.arg) {
|
|
86
|
-
// Element ID specified as arg
|
|
87
|
-
// We must prepend '#' to become a CSS selector
|
|
88
|
-
config.container = `#${bindings.arg}`;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// If title is not provided, try title attribute
|
|
92
|
-
if (isUndefined(config.title)) {
|
|
93
|
-
// Try attribute
|
|
94
|
-
const data = vnode.data || {};
|
|
95
|
-
config.title = data.attrs && !isUndefinedOrNull(data.attrs.title) ? data.attrs.title : undefined;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Normalize delay
|
|
99
|
-
if (!isPlainObject(config.delay)) {
|
|
100
|
-
config.delay = {
|
|
101
|
-
show: toInteger(config.delay, 0),
|
|
102
|
-
hide: toInteger(config.delay, 0)
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Process modifiers
|
|
107
|
-
keys(bindings.modifiers).forEach(mod => {
|
|
108
|
-
if (htmlRE.test(mod)) {
|
|
109
|
-
// Title/content allows HTML
|
|
110
|
-
config.html = true;
|
|
111
|
-
} else if (noFadeRE.test(mod)) {
|
|
112
|
-
// No animation
|
|
113
|
-
config.animation = false;
|
|
114
|
-
} else if (placementRE.test(mod)) {
|
|
115
|
-
// Placement of popover
|
|
116
|
-
config.placement = mod;
|
|
117
|
-
} else if (boundaryRE.test(mod)) {
|
|
118
|
-
// Boundary of popover
|
|
119
|
-
mod = mod === 'scrollparent' ? 'scrollParent' : mod;
|
|
120
|
-
config.boundary = mod;
|
|
121
|
-
} else if (delayRE.test(mod)) {
|
|
122
|
-
// Delay value
|
|
123
|
-
const delay = toInteger(mod.slice(1), 0);
|
|
124
|
-
config.delay.show = delay;
|
|
125
|
-
config.delay.hide = delay;
|
|
126
|
-
} else if (delayShowRE.test(mod)) {
|
|
127
|
-
// Delay show value
|
|
128
|
-
config.delay.show = toInteger(mod.slice(2), 0);
|
|
129
|
-
} else if (delayHideRE.test(mod)) {
|
|
130
|
-
// Delay hide value
|
|
131
|
-
config.delay.hide = toInteger(mod.slice(2), 0);
|
|
132
|
-
} else if (offsetRE.test(mod)) {
|
|
133
|
-
// Offset value, negative allowed
|
|
134
|
-
config.offset = toInteger(mod.slice(1), 0);
|
|
135
|
-
} else if (variantRE.test(mod)) {
|
|
136
|
-
// Variant
|
|
137
|
-
config.variant = mod.slice(2) || null;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
// Special handling of event trigger modifiers trigger is
|
|
142
|
-
// a space separated list
|
|
143
|
-
const selectedTriggers = {};
|
|
144
|
-
|
|
145
|
-
// Parse current config object trigger
|
|
146
|
-
concat(config.trigger || '').filter(identity).join(' ').trim().toLowerCase().split(spacesRE).forEach(trigger => {
|
|
147
|
-
if (validTriggers[trigger]) {
|
|
148
|
-
selectedTriggers[trigger] = true;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// Parse modifiers for triggers
|
|
153
|
-
keys(bindings.modifiers).forEach(mod => {
|
|
154
|
-
mod = mod.toLowerCase();
|
|
155
|
-
if (validTriggers[mod]) {
|
|
156
|
-
// If modifier is a valid trigger
|
|
157
|
-
selectedTriggers[mod] = true;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// Sanitize triggers
|
|
162
|
-
config.trigger = keys(selectedTriggers).join(' ');
|
|
163
|
-
if (config.trigger === 'blur') {
|
|
164
|
-
// Blur by itself is useless, so convert it to 'focus'
|
|
165
|
-
config.trigger = 'focus';
|
|
166
|
-
}
|
|
167
|
-
if (!config.trigger) {
|
|
168
|
-
// Use default trigger
|
|
169
|
-
config.trigger = DefaultTrigger;
|
|
170
|
-
}
|
|
171
|
-
return config;
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
// Add or update Popover on our element
|
|
175
|
-
const applyPopover = (el, bindings, vnode) => {
|
|
176
|
-
if (!IS_BROWSER) {
|
|
177
|
-
/* istanbul ignore next */
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const config = parseBindings(bindings, vnode);
|
|
181
|
-
if (!el[BV_POPOVER]) {
|
|
182
|
-
const parent = getInstanceFromDirective(vnode, bindings);
|
|
183
|
-
el[BV_POPOVER] = createNewChildComponent(parent, BVPopover, {
|
|
184
|
-
// Add the parent's scoped style attribute data
|
|
185
|
-
_scopeId: getScopeId(parent, undefined)
|
|
186
|
-
});
|
|
187
|
-
el[BV_POPOVER].__bv_prev_data__ = {};
|
|
188
|
-
el[BV_POPOVER].$on(EVENT_NAME_SHOW, () => /* istanbul ignore next: for now */{
|
|
189
|
-
// Before showing the popover, we update the title
|
|
190
|
-
// and content if they are functions
|
|
191
|
-
const data = {};
|
|
192
|
-
if (isFunction(config.title)) {
|
|
193
|
-
data.title = config.title(el);
|
|
194
|
-
}
|
|
195
|
-
if (isFunction(config.content)) {
|
|
196
|
-
data.content = config.content(el);
|
|
197
|
-
}
|
|
198
|
-
if (keys(data).length > 0) {
|
|
199
|
-
el[BV_POPOVER].updateData(data);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
const data = {
|
|
204
|
-
title: config.title,
|
|
205
|
-
content: config.content,
|
|
206
|
-
triggers: config.trigger,
|
|
207
|
-
placement: config.placement,
|
|
208
|
-
fallbackPlacement: config.fallbackPlacement,
|
|
209
|
-
variant: config.variant,
|
|
210
|
-
customClass: config.customClass,
|
|
211
|
-
container: config.container,
|
|
212
|
-
boundary: config.boundary,
|
|
213
|
-
delay: config.delay,
|
|
214
|
-
offset: config.offset,
|
|
215
|
-
noFade: !config.animation,
|
|
216
|
-
id: config.id,
|
|
217
|
-
disabled: config.disabled,
|
|
218
|
-
html: config.html
|
|
219
|
-
};
|
|
220
|
-
const oldData = el[BV_POPOVER].__bv_prev_data__;
|
|
221
|
-
el[BV_POPOVER].__bv_prev_data__ = data;
|
|
222
|
-
if (!looseEqual(data, oldData)) {
|
|
223
|
-
// We only update the instance if data has changed
|
|
224
|
-
const newData = {
|
|
225
|
-
target: el
|
|
226
|
-
};
|
|
227
|
-
keys(data).forEach(prop => {
|
|
228
|
-
// We only pass data properties that have changed
|
|
229
|
-
if (data[prop] !== oldData[prop]) {
|
|
230
|
-
// If title/content is a function, we execute it here
|
|
231
|
-
newData[prop] = (prop === 'title' || prop === 'content') && isFunction(data[prop]) ? /* istanbul ignore next */data[prop](el) : data[prop];
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
el[BV_POPOVER].updateData(newData);
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
// Remove Popover from our element
|
|
239
|
-
const removePopover = el => {
|
|
240
|
-
if (el[BV_POPOVER]) {
|
|
241
|
-
el[BV_POPOVER].$destroy();
|
|
242
|
-
el[BV_POPOVER] = null;
|
|
243
|
-
}
|
|
244
|
-
delete el[BV_POPOVER];
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
// Export our directive
|
|
248
|
-
const VBPopover = {
|
|
249
|
-
bind(el, bindings, vnode) {
|
|
250
|
-
applyPopover(el, bindings, vnode);
|
|
251
|
-
},
|
|
252
|
-
// We use `componentUpdated` here instead of `update`, as the former
|
|
253
|
-
// waits until the containing component and children have finished updating
|
|
254
|
-
componentUpdated(el, bindings, vnode) {
|
|
255
|
-
// Performed in a `$nextTick()` to prevent endless render/update loops
|
|
256
|
-
nextTick(() => {
|
|
257
|
-
applyPopover(el, bindings, vnode);
|
|
258
|
-
});
|
|
259
|
-
},
|
|
260
|
-
unbind(el) {
|
|
261
|
-
removePopover(el);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
export { VBPopover };
|