goodteditor-ui 1.0.75 → 2.0.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/.eslintrc.js +10 -8
- package/index.html +20 -0
- package/package.json +13 -33
- package/postcss.config.js +1 -0
- package/src/components/ui/Badge.vue +3 -2
- package/src/components/ui/ColorPicker/Alpha.vue +1 -0
- package/src/components/ui/ColorPicker/Colors.vue +2 -1
- package/src/components/ui/ColorPicker/Hue.vue +1 -0
- package/src/components/ui/ColorPicker/Saturation.vue +1 -0
- package/src/components/ui/ColorPicker.vue +5 -4
- package/src/components/ui/Datalist.vue +8 -7
- package/src/components/ui/DatePicker.vue +11 -10
- package/src/components/ui/FileSelector.vue +2 -1
- package/src/components/ui/Grid.vue +14 -9
- package/src/components/ui/Image.vue +4 -2
- package/src/components/ui/InputAutocomplete.vue +23 -22
- package/src/components/ui/InputColorPicker.vue +10 -9
- package/src/components/ui/InputDatePicker.vue +11 -10
- package/src/components/ui/InputTags.vue +14 -13
- package/src/components/ui/InputTimePicker.vue +10 -9
- package/src/components/ui/InputUnits.vue +5 -5
- package/src/components/ui/Lazy.vue +5 -4
- package/src/components/ui/Pagination.vue +5 -4
- package/src/components/ui/Paginator.vue +5 -4
- package/src/components/ui/Popover.vue +14 -9
- package/src/components/ui/Popup.vue +5 -4
- package/src/components/ui/ResponsiveContainer.vue +17 -10
- package/src/components/ui/Select.vue +19 -14
- package/src/components/ui/TimePicker.vue +6 -7
- package/src/components/ui/Tooltip.vue +4 -3
- package/src/components/ui/WysiwygEditor/WysiwygEditor.vue +11 -10
- package/src/components/ui/WysiwygEditor/extensions/font-size.js +1 -1
- package/src/components/ui/WysiwygEditor/extensions/formatting.js +1 -1
- package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +3 -3
- package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +3 -3
- package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +2 -2
- package/src/components/ui/WysiwygEditor/renders/Select.vue +2 -2
- package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +2 -2
- package/src/components/ui/WysiwygEditor/renders/components/Tooltip.vue +2 -1
- package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +1 -0
- package/src/components/ui/utils/FormComponent.js +36 -37
- package/src/main.js +2 -6
- package/vite.config.js +6 -0
- package/babel.config.js +0 -5
- package/vue.config.js +0 -8
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
-->
|
|
19
19
|
<slot
|
|
20
20
|
name="input"
|
|
21
|
-
v-bind="{ id: inputId, value, valueLabel, inputBinds, inputEvents }"
|
|
21
|
+
v-bind="{ id: inputId, value: modelValue, valueLabel, inputBinds, inputEvents }"
|
|
22
22
|
>
|
|
23
23
|
<input
|
|
24
24
|
:id="inputId"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
@slot Custom clear icon slot
|
|
35
35
|
@binding {Function} clear function that clears the value
|
|
36
36
|
-->
|
|
37
|
-
<slot name="clear" v-bind="{ clear }" v-if="
|
|
37
|
+
<slot name="clear" v-bind="{ clear }" v-if="modelValue && modelValue.length && allowClear">
|
|
38
38
|
<div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="clear">
|
|
39
39
|
<i class="mdi mdi-close"></i>
|
|
40
40
|
</div>
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</div>
|
|
50
50
|
</slot>
|
|
51
51
|
</div>
|
|
52
|
-
<ui-popover :show
|
|
52
|
+
<ui-popover v-model:show="popoverShow" v-bind="popoverOptions">
|
|
53
53
|
<date-picker
|
|
54
54
|
class="ui-input-date-picker-dp pull-left"
|
|
55
55
|
@change="onDpChange"
|
|
@@ -119,7 +119,7 @@ export default {
|
|
|
119
119
|
/**
|
|
120
120
|
* @model
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
modelValue: {
|
|
123
123
|
type: [String, Array],
|
|
124
124
|
default: '',
|
|
125
125
|
},
|
|
@@ -189,6 +189,7 @@ export default {
|
|
|
189
189
|
},
|
|
190
190
|
},
|
|
191
191
|
},
|
|
192
|
+
emits: ['clear', 'change', 'set-date'],
|
|
192
193
|
data() {
|
|
193
194
|
return {
|
|
194
195
|
date: null,
|
|
@@ -207,7 +208,7 @@ export default {
|
|
|
207
208
|
return !!this.datepicker.range;
|
|
208
209
|
},
|
|
209
210
|
valueLabel() {
|
|
210
|
-
return Array.isArray(this.
|
|
211
|
+
return Array.isArray(this.modelValue) ? this.modelValue.join(this.delimiter) : this.modelValue;
|
|
211
212
|
},
|
|
212
213
|
inputBinds() {
|
|
213
214
|
const { placeholder, readonly, editable } = this;
|
|
@@ -218,7 +219,7 @@ export default {
|
|
|
218
219
|
}
|
|
219
220
|
},
|
|
220
221
|
watch: {
|
|
221
|
-
|
|
222
|
+
modelValue: {
|
|
222
223
|
handler(val) {
|
|
223
224
|
this.inputValueRaw = val;
|
|
224
225
|
|
|
@@ -242,7 +243,7 @@ export default {
|
|
|
242
243
|
* Input event
|
|
243
244
|
* @property {String} date
|
|
244
245
|
*/
|
|
245
|
-
this.$emit('
|
|
246
|
+
this.$emit('update:modelValue', val ? [] : '');
|
|
246
247
|
}
|
|
247
248
|
},
|
|
248
249
|
methods: {
|
|
@@ -251,7 +252,7 @@ export default {
|
|
|
251
252
|
* Input event
|
|
252
253
|
* @property {String} date
|
|
253
254
|
*/
|
|
254
|
-
this.$emit('
|
|
255
|
+
this.$emit('update:modelValue', this.isRange ? [] : '');
|
|
255
256
|
/**
|
|
256
257
|
* Clear event
|
|
257
258
|
*/
|
|
@@ -280,7 +281,7 @@ export default {
|
|
|
280
281
|
* Input event
|
|
281
282
|
* @property {String} date
|
|
282
283
|
*/
|
|
283
|
-
this.$emit('
|
|
284
|
+
this.$emit('update:modelValue', model);
|
|
284
285
|
/**
|
|
285
286
|
* Change event
|
|
286
287
|
* @property {String|Array} value
|
|
@@ -314,7 +315,7 @@ export default {
|
|
|
314
315
|
* Input event
|
|
315
316
|
* @property {String} date
|
|
316
317
|
*/
|
|
317
|
-
this.$emit('
|
|
318
|
+
this.$emit('update:modelValue', model);
|
|
318
319
|
/**
|
|
319
320
|
* Change event
|
|
320
321
|
* @property {String|Array} value
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ui-input-tags form-elem" :class="cssClass" @focus="onRootFocus" tabindex="0">
|
|
3
|
-
<div class="ui-input-tags-tags" v-if="
|
|
3
|
+
<div class="ui-input-tags-tags" v-if="modelValue.length">
|
|
4
4
|
<!--
|
|
5
5
|
@slot Tag slot
|
|
6
6
|
@binding {String} tag tag
|
|
7
7
|
@binding {Function} remove remove tag function(tag)
|
|
8
8
|
-->
|
|
9
|
-
<slot name="tag" v-for="tag in
|
|
9
|
+
<slot name="tag" v-for="tag in modelValue" v-bind="{ tag, remove: removeTag }">
|
|
10
10
|
<ui-badge
|
|
11
11
|
class="ui-input-tags-badge mar-none mar-right-2 mar-bot-2 pull-left cursor-pointer"
|
|
12
12
|
:class="{ 'ui-input-tags-badge--selected': tagSelected === tag }"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<input
|
|
44
44
|
:id="inputId"
|
|
45
45
|
class="ui-input-tags-input w-100"
|
|
46
|
-
:class="{ 'mar-top-2':
|
|
46
|
+
:class="{ 'mar-top-2': modelValue.length }"
|
|
47
47
|
type="text"
|
|
48
48
|
tabindex="-1"
|
|
49
49
|
:value="newTag"
|
|
@@ -94,7 +94,7 @@ export default {
|
|
|
94
94
|
/**
|
|
95
95
|
* @model
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
modelValue: {
|
|
98
98
|
type: Array,
|
|
99
99
|
default() {
|
|
100
100
|
return [];
|
|
@@ -117,6 +117,7 @@ export default {
|
|
|
117
117
|
default: ',',
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
|
+
emits: ['change'],
|
|
120
121
|
data() {
|
|
121
122
|
return {
|
|
122
123
|
newTag: '',
|
|
@@ -143,18 +144,18 @@ export default {
|
|
|
143
144
|
},
|
|
144
145
|
addTag() {
|
|
145
146
|
let newTags = this.valueFilter(
|
|
146
|
-
this.
|
|
147
|
+
this.modelValue,
|
|
147
148
|
this.newTag.split(this.delimiter).map(tag => tag.trim())
|
|
148
149
|
);
|
|
149
150
|
if (!newTags.length) {
|
|
150
151
|
return;
|
|
151
152
|
}
|
|
152
|
-
let tags = [...this.
|
|
153
|
+
let tags = [...this.modelValue, ...newTags];
|
|
153
154
|
/**
|
|
154
155
|
* Input event
|
|
155
156
|
* @property {Array} tags
|
|
156
157
|
*/
|
|
157
|
-
this.$emit('
|
|
158
|
+
this.$emit('update:modelValue', tags);
|
|
158
159
|
/**
|
|
159
160
|
* Change event
|
|
160
161
|
* @property {Array} tags
|
|
@@ -166,12 +167,12 @@ export default {
|
|
|
166
167
|
* @param {string} tag
|
|
167
168
|
*/
|
|
168
169
|
removeTag(tag) {
|
|
169
|
-
let tags = this.
|
|
170
|
+
let tags = this.modelValue.filter(t => t !== tag);
|
|
170
171
|
/**
|
|
171
172
|
* Input event
|
|
172
173
|
* @property {Array} tags
|
|
173
174
|
*/
|
|
174
|
-
this.$emit('
|
|
175
|
+
this.$emit('update:modelValue', tags);
|
|
175
176
|
/**
|
|
176
177
|
* Change event
|
|
177
178
|
* @property {Array} tags
|
|
@@ -213,20 +214,20 @@ export default {
|
|
|
213
214
|
* @param {number} direction
|
|
214
215
|
*/
|
|
215
216
|
selectTag(direction = -1) {
|
|
216
|
-
const lastIndex = this.
|
|
217
|
+
const lastIndex = this.modelValue.length - 1;
|
|
217
218
|
let tagSelected = this.tagSelected;
|
|
218
219
|
|
|
219
220
|
if (tagSelected === null) {
|
|
220
|
-
tagSelected = this.
|
|
221
|
+
tagSelected = this.modelValue[lastIndex] ?? null;
|
|
221
222
|
} else {
|
|
222
|
-
let index = this.
|
|
223
|
+
let index = this.modelValue.findIndex((tag) => tag === tagSelected) + direction;
|
|
223
224
|
if (index > lastIndex) {
|
|
224
225
|
index = 0;
|
|
225
226
|
}
|
|
226
227
|
if (index < 0) {
|
|
227
228
|
index = lastIndex;
|
|
228
229
|
}
|
|
229
|
-
tagSelected = this.
|
|
230
|
+
tagSelected = this.modelValue[index];
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
if (tagSelected === null) {
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
@binding {Object} inputBinds input props (use v-bind)
|
|
16
16
|
@binding {Object} inputEvents input events (use v-on)
|
|
17
17
|
-->
|
|
18
|
-
<slot name="input" v-bind="{ id: inputId, value, inputBinds, inputEvents }">
|
|
18
|
+
<slot name="input" v-bind="{ id: inputId, value: modelValue, inputBinds, inputEvents }">
|
|
19
19
|
<input
|
|
20
20
|
:id="inputId"
|
|
21
21
|
class="ui-input-time-picker-input w-100"
|
|
22
22
|
type="text"
|
|
23
|
-
:value="
|
|
23
|
+
:value="modelValue"
|
|
24
24
|
v-bind="inputBinds"
|
|
25
25
|
v-on="inputEvents"
|
|
26
26
|
/>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
@slot Custom clear icon slot
|
|
31
31
|
@binding {Function} clear function that clears the value
|
|
32
32
|
-->
|
|
33
|
-
<slot name="clear" v-bind="{ clear }" v-if="
|
|
33
|
+
<slot name="clear" v-bind="{ clear }" v-if="modelValue && allowClear">
|
|
34
34
|
<div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="clear">
|
|
35
35
|
<i class="mdi mdi-close"></i>
|
|
36
36
|
</div>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</div>
|
|
46
46
|
</slot>
|
|
47
47
|
</div>
|
|
48
|
-
<ui-popover :show
|
|
48
|
+
<ui-popover v-model:show="popoverShow" v-bind="popoverOptions">
|
|
49
49
|
<time-picker
|
|
50
50
|
class="ui-input-time-picker-tp w-100"
|
|
51
51
|
:value="time"
|
|
@@ -168,6 +168,7 @@ export default {
|
|
|
168
168
|
default: true,
|
|
169
169
|
},
|
|
170
170
|
},
|
|
171
|
+
emits: ['change', 'clear'],
|
|
171
172
|
data() {
|
|
172
173
|
return {
|
|
173
174
|
time: null,
|
|
@@ -189,7 +190,7 @@ export default {
|
|
|
189
190
|
}
|
|
190
191
|
},
|
|
191
192
|
watch: {
|
|
192
|
-
|
|
193
|
+
modelValue: {
|
|
193
194
|
handler(val) {
|
|
194
195
|
this.time = this.toTime(val);
|
|
195
196
|
},
|
|
@@ -202,7 +203,7 @@ export default {
|
|
|
202
203
|
* Input event
|
|
203
204
|
* @property {String} time
|
|
204
205
|
*/
|
|
205
|
-
this.$emit('
|
|
206
|
+
this.$emit('update:modelValue', '');
|
|
206
207
|
/**
|
|
207
208
|
* Clear event
|
|
208
209
|
*/
|
|
@@ -218,7 +219,7 @@ export default {
|
|
|
218
219
|
* Input event
|
|
219
220
|
* @property {String} time
|
|
220
221
|
*/
|
|
221
|
-
this.$emit('
|
|
222
|
+
this.$emit('update:modelValue', data);
|
|
222
223
|
/**
|
|
223
224
|
* Change event
|
|
224
225
|
* @property {String} time
|
|
@@ -231,7 +232,7 @@ export default {
|
|
|
231
232
|
* Input event
|
|
232
233
|
* @property {String} time
|
|
233
234
|
*/
|
|
234
|
-
this.$emit('
|
|
235
|
+
this.$emit('update:modelValue', val);
|
|
235
236
|
},
|
|
236
237
|
onInputFocus(e) {
|
|
237
238
|
this.rootHasFocus = true;
|
|
@@ -246,7 +247,7 @@ export default {
|
|
|
246
247
|
* Input event
|
|
247
248
|
* @property {String} time
|
|
248
249
|
*/
|
|
249
|
-
this.$emit('
|
|
250
|
+
this.$emit('update:modelValue', data);
|
|
250
251
|
/**
|
|
251
252
|
* Change event
|
|
252
253
|
* @property {String} time
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
{{ model.unit }}
|
|
28
28
|
</span>
|
|
29
29
|
</div>
|
|
30
|
-
<ui-popover :show
|
|
30
|
+
<ui-popover v-model:show="popoverShow" v-bind="popoverOptions">
|
|
31
31
|
<ui-datalist
|
|
32
32
|
class="pull-left w-100"
|
|
33
33
|
ref="datalist"
|
|
34
34
|
v-bind="{ options: units, size }"
|
|
35
|
-
:cursorIndex
|
|
35
|
+
v-model:cursorIndex="dataListCursorIndex"
|
|
36
36
|
@select-option="onUnitChange"
|
|
37
37
|
>
|
|
38
38
|
<template #header>
|
|
@@ -90,7 +90,6 @@
|
|
|
90
90
|
padding: 0;
|
|
91
91
|
color: inherit;
|
|
92
92
|
background: transparent;
|
|
93
|
-
outline: none;
|
|
94
93
|
-moz-appearance: textfield;
|
|
95
94
|
&::-webkit-outer-spin-button,
|
|
96
95
|
&::-webkit-inner-spin-button {
|
|
@@ -141,6 +140,7 @@ export default {
|
|
|
141
140
|
default: `${Position.BOTTOM}-${Position.END}`,
|
|
142
141
|
},
|
|
143
142
|
},
|
|
143
|
+
emits: ['focus', 'change'],
|
|
144
144
|
data() {
|
|
145
145
|
return {
|
|
146
146
|
model: {
|
|
@@ -174,7 +174,7 @@ export default {
|
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
176
|
watch: {
|
|
177
|
-
|
|
177
|
+
modelValue: {
|
|
178
178
|
handler(v) {
|
|
179
179
|
const a = String(v).match(withUnitRegExp);
|
|
180
180
|
const [_, n, u] = a ?? [];
|
|
@@ -200,7 +200,7 @@ export default {
|
|
|
200
200
|
* Change event
|
|
201
201
|
* @property {String} value
|
|
202
202
|
*/
|
|
203
|
-
this.$emit('
|
|
203
|
+
this.$emit('update:modelValue', value);
|
|
204
204
|
},
|
|
205
205
|
emitChange() {
|
|
206
206
|
const value = this.isModelValid ? this.valuePrivate : '';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { h } from 'vue';
|
|
2
3
|
import { useIntersectionObserver } from './utils/Helpers';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
@@ -45,7 +46,7 @@ export default {
|
|
|
45
46
|
this.stopObserver = stop;
|
|
46
47
|
this.calcMinHeight();
|
|
47
48
|
},
|
|
48
|
-
|
|
49
|
+
beforeUnmount() {
|
|
49
50
|
if (this.stopObserver) {
|
|
50
51
|
this.stopObserver();
|
|
51
52
|
}
|
|
@@ -82,10 +83,10 @@ export default {
|
|
|
82
83
|
});
|
|
83
84
|
},
|
|
84
85
|
},
|
|
85
|
-
render(
|
|
86
|
+
render() {
|
|
86
87
|
const { tag, shouldRender, cssStyle: style } = this;
|
|
87
|
-
const { default: defaultSlot } = this.$
|
|
88
|
-
const children = shouldRender && defaultSlot ? defaultSlot() :
|
|
88
|
+
const { default: defaultSlot } = this.$slots;
|
|
89
|
+
const children = shouldRender && defaultSlot ? defaultSlot() : {};
|
|
89
90
|
return h(tag, { style }, children);
|
|
90
91
|
},
|
|
91
92
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ui-pagination">
|
|
3
|
-
<!--
|
|
3
|
+
<!--
|
|
4
4
|
@slot Custom before slot
|
|
5
5
|
@binding {Number} page page
|
|
6
6
|
@binding {Number} pages pages
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
@binding {Function} next selects next page
|
|
9
9
|
-->
|
|
10
10
|
<slot name="before" v-bind="{ page, pages, prev, next }"></slot>
|
|
11
|
-
<!--
|
|
11
|
+
<!--
|
|
12
12
|
@slot Page item slot
|
|
13
13
|
@binding {Number} page page
|
|
14
14
|
@binding {Number} index index
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
32
|
</slot>
|
|
33
|
-
<!--
|
|
33
|
+
<!--
|
|
34
34
|
@slot Custom after slot
|
|
35
35
|
@binding {Number} page page
|
|
36
36
|
@binding {Number} pages pages
|
|
@@ -71,6 +71,7 @@ export default {
|
|
|
71
71
|
default: 7,
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
+
emits: ['update:page', 'select', 'change'],
|
|
74
75
|
computed: {
|
|
75
76
|
pagesComputed() {
|
|
76
77
|
let arr = [];
|
|
@@ -118,7 +119,7 @@ export default {
|
|
|
118
119
|
*/
|
|
119
120
|
this.$emit('change', page);
|
|
120
121
|
/**
|
|
121
|
-
* Update page event
|
|
122
|
+
* Update page event
|
|
122
123
|
* @property {Number} page
|
|
123
124
|
*/
|
|
124
125
|
this.$emit('update:page', page);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ui-paginator">
|
|
3
|
-
<!--
|
|
3
|
+
<!--
|
|
4
4
|
@slot Page data slot
|
|
5
|
-
@binding {Number} page current page number
|
|
5
|
+
@binding {Number} page current page number
|
|
6
6
|
@binding {Number} pages total pages number
|
|
7
7
|
@binding {Array} pageData current page data
|
|
8
8
|
@binding {(n:number) => {}} setPage sets a new page
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
/**
|
|
26
|
-
* Current page (
|
|
26
|
+
* Current page (v-model supported)
|
|
27
27
|
*/
|
|
28
28
|
page: {
|
|
29
29
|
type: Number,
|
|
@@ -40,6 +40,7 @@ export default {
|
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
|
+
emits: ['update:page', 'change'],
|
|
43
44
|
data() {
|
|
44
45
|
return { currentPage: 1 };
|
|
45
46
|
},
|
|
@@ -68,7 +69,7 @@ export default {
|
|
|
68
69
|
setPage(page) {
|
|
69
70
|
this.currentPage = page;
|
|
70
71
|
/**
|
|
71
|
-
* Page change event
|
|
72
|
+
* Page change event
|
|
72
73
|
* @property {number} page
|
|
73
74
|
*/
|
|
74
75
|
this.$emit('update:page', page);
|
|
@@ -49,15 +49,15 @@ const Modifier = Object.freeze({
|
|
|
49
49
|
export default {
|
|
50
50
|
directives: {
|
|
51
51
|
'append-body': {
|
|
52
|
-
|
|
53
|
-
let { appendToBody } =
|
|
52
|
+
mounted(el, { instance }, { context }) {
|
|
53
|
+
let { appendToBody } = instance;
|
|
54
54
|
if (!appendToBody) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
const nt =
|
|
57
|
+
const nt = instance.$nextTick;
|
|
58
58
|
nt(() => nt(() => document.body.appendChild(el)));
|
|
59
59
|
},
|
|
60
|
-
|
|
60
|
+
unmounted(el) {
|
|
61
61
|
el.parentNode && el.parentNode.removeChild(el);
|
|
62
62
|
},
|
|
63
63
|
},
|
|
@@ -127,6 +127,7 @@ export default {
|
|
|
127
127
|
default: true
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
+
emits: ['update:show'],
|
|
130
131
|
data() {
|
|
131
132
|
return { cssStyle: {} };
|
|
132
133
|
},
|
|
@@ -184,17 +185,21 @@ export default {
|
|
|
184
185
|
created() {
|
|
185
186
|
this.popper = null;
|
|
186
187
|
},
|
|
187
|
-
|
|
188
|
+
beforeUnmount() {
|
|
188
189
|
this.handleReset();
|
|
189
190
|
},
|
|
190
191
|
methods: {
|
|
191
192
|
addEventListeners() {
|
|
192
|
-
|
|
193
|
-
|
|
193
|
+
this.controller = new AbortController();
|
|
194
|
+
const { signal } = this.controller;
|
|
195
|
+
window.addEventListener('blur', this.onWinBlur, { signal });
|
|
196
|
+
document.addEventListener('mousedown', this.onDocMouseDown, { signal });
|
|
194
197
|
},
|
|
195
198
|
removeEventListeners() {
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
if (this.controller != null) {
|
|
200
|
+
this.controller.abort();
|
|
201
|
+
this.controller = null;
|
|
202
|
+
}
|
|
198
203
|
},
|
|
199
204
|
calcStyle() {
|
|
200
205
|
const { zIndex, autoWidth, shouldRespondToPointerEvents } = this;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<div
|
|
26
26
|
class="popup-dialog-footer"
|
|
27
27
|
:class="{ 'pad-none': !usePadding }"
|
|
28
|
-
v-if="$
|
|
28
|
+
v-if="$slots.footer != null"
|
|
29
29
|
>
|
|
30
30
|
<!--
|
|
31
31
|
@slot Custom footer slot
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
export default {
|
|
60
60
|
props: {
|
|
61
61
|
/**
|
|
62
|
-
* Whether the popup is visible
|
|
62
|
+
* Whether the popup is visible
|
|
63
63
|
*/
|
|
64
64
|
visible: {
|
|
65
65
|
type: Boolean,
|
|
@@ -121,6 +121,7 @@ export default {
|
|
|
121
121
|
default: 'scroll-hide',
|
|
122
122
|
},
|
|
123
123
|
},
|
|
124
|
+
emits: ['close', 'update:visible'],
|
|
124
125
|
computed: {
|
|
125
126
|
dialogBodyClass() {
|
|
126
127
|
const { dialogBody, usePadding } = this;
|
|
@@ -146,7 +147,7 @@ export default {
|
|
|
146
147
|
immediate: true,
|
|
147
148
|
},
|
|
148
149
|
},
|
|
149
|
-
|
|
150
|
+
beforeUnmount() {
|
|
150
151
|
if (this.visibleBodyClass) {
|
|
151
152
|
document.body.classList.remove(this.visibleBodyClass);
|
|
152
153
|
}
|
|
@@ -158,7 +159,7 @@ export default {
|
|
|
158
159
|
*/
|
|
159
160
|
this.$emit('close');
|
|
160
161
|
/**
|
|
161
|
-
* Visibility update event
|
|
162
|
+
* Visibility update event
|
|
162
163
|
* @property {Boolean} visible
|
|
163
164
|
*/
|
|
164
165
|
this.$emit('update:visible', false);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { h } from 'vue';
|
|
2
3
|
import { debounce } from './utils/Helpers';
|
|
3
4
|
|
|
4
5
|
const ObserverManager = {
|
|
@@ -14,8 +15,11 @@ const ObserverManager = {
|
|
|
14
15
|
},
|
|
15
16
|
unregister(el) {
|
|
16
17
|
const { records } = this;
|
|
17
|
-
records.
|
|
18
|
-
|
|
18
|
+
if (records.has(el)) {
|
|
19
|
+
records.delete(el);
|
|
20
|
+
this.observer.unobserve(el);
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
if (!records.size) {
|
|
20
24
|
this.destroyObserver();
|
|
21
25
|
}
|
|
@@ -31,7 +35,7 @@ const ObserverManager = {
|
|
|
31
35
|
this.observer = new ResizeObserver(debounce(callback, 50));
|
|
32
36
|
},
|
|
33
37
|
destroyObserver() {
|
|
34
|
-
this.observer
|
|
38
|
+
this.observer?.disconnect?.();
|
|
35
39
|
this.observer = null;
|
|
36
40
|
},
|
|
37
41
|
};
|
|
@@ -70,27 +74,30 @@ export default {
|
|
|
70
74
|
},
|
|
71
75
|
mounted() {
|
|
72
76
|
const { $el: el } = this;
|
|
77
|
+
if (el.nodeType === Node.COMMENT_NODE) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
73
80
|
const fn = ({ contentRect }) => {
|
|
74
81
|
this.width = contentRect.width | 0;
|
|
75
82
|
this.height = contentRect.height | 0;
|
|
76
83
|
};
|
|
77
84
|
ObserverManager.register({ fn, el });
|
|
78
85
|
},
|
|
79
|
-
|
|
86
|
+
beforeUnmount() {
|
|
80
87
|
ObserverManager.unregister(this.$el);
|
|
81
88
|
},
|
|
82
|
-
render(
|
|
89
|
+
render() {
|
|
83
90
|
const { breakpoint, width, height } = this;
|
|
84
91
|
/*
|
|
85
92
|
@slot Page data slot
|
|
86
|
-
@binding {string} breakpoint breakpoint name
|
|
87
|
-
@binding {number} width current container width (px)
|
|
93
|
+
@binding {string} breakpoint breakpoint name
|
|
94
|
+
@binding {number} width current container width (px)
|
|
88
95
|
@binding {number} height current container height (px)
|
|
89
96
|
*/
|
|
90
|
-
const content = this.$
|
|
91
|
-
? this.$
|
|
97
|
+
const content = this.$slots.default?.() != null
|
|
98
|
+
? this.$slots.default({ breakpoint, width, height })
|
|
92
99
|
: null;
|
|
93
|
-
if (content
|
|
100
|
+
if (content?.length > 1) {
|
|
94
101
|
return h('div', 'Slot content should have one child');
|
|
95
102
|
}
|
|
96
103
|
return content;
|