@gitlab/ui 48.1.2 → 48.2.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/base/datepicker/datepicker.js +16 -17
- package/package.json +1 -1
- package/src/components/base/avatar/avatar.stories.js +3 -3
- package/src/components/base/avatars_inline/avatars_inline.stories.js +5 -5
- package/src/components/base/datepicker/datepicker.spec.js +8 -0
- package/src/components/base/datepicker/datepicker.vue +16 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [48.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.1.2...v48.2.0) (2022-10-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **datepicker:** add public show method for datepicker ([adc2c8f](https://gitlab.com/gitlab-org/gitlab-ui/commit/adc2c8f53016efb253b003b02e6c354eb297ddb6))
|
|
7
|
+
|
|
1
8
|
## [48.1.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.1.1...v48.1.2) (2022-10-21)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -189,7 +189,7 @@ var script = {
|
|
|
189
189
|
|
|
190
190
|
computed: {
|
|
191
191
|
formattedDate() {
|
|
192
|
-
return
|
|
192
|
+
return 'calendar' in this && this.calendar.toString();
|
|
193
193
|
},
|
|
194
194
|
|
|
195
195
|
customTrigger() {
|
|
@@ -223,25 +223,25 @@ var script = {
|
|
|
223
223
|
},
|
|
224
224
|
watch: {
|
|
225
225
|
value(val) {
|
|
226
|
-
if (!areDatesEqual(val, this
|
|
227
|
-
this
|
|
226
|
+
if (!areDatesEqual(val, this.calendar.getDate())) {
|
|
227
|
+
this.calendar.setDate(val, true);
|
|
228
228
|
}
|
|
229
229
|
},
|
|
230
230
|
|
|
231
231
|
minDate(minDate) {
|
|
232
|
-
this
|
|
232
|
+
this.calendar.setMinDate(minDate);
|
|
233
233
|
},
|
|
234
234
|
|
|
235
235
|
maxDate(maxDate) {
|
|
236
|
-
this
|
|
236
|
+
this.calendar.setMaxDate(maxDate);
|
|
237
237
|
},
|
|
238
238
|
|
|
239
239
|
startRange(startRange) {
|
|
240
|
-
this
|
|
240
|
+
this.calendar.setStartRange(startRange);
|
|
241
241
|
},
|
|
242
242
|
|
|
243
243
|
endRange(endRange) {
|
|
244
|
-
this
|
|
244
|
+
this.calendar.setEndRange(endRange);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
},
|
|
@@ -295,18 +295,23 @@ var script = {
|
|
|
295
295
|
pikadayConfig.i18n = this.i18n;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
this
|
|
298
|
+
this.calendar = new Pikaday(pikadayConfig);
|
|
299
299
|
|
|
300
300
|
if (this.startOpened) {
|
|
301
|
-
this
|
|
301
|
+
this.calendar.show();
|
|
302
302
|
}
|
|
303
303
|
},
|
|
304
304
|
|
|
305
305
|
beforeDestroy() {
|
|
306
|
-
this
|
|
306
|
+
this.calendar.destroy();
|
|
307
307
|
},
|
|
308
308
|
|
|
309
309
|
methods: {
|
|
310
|
+
// is used to open datepicker programmatically
|
|
311
|
+
show() {
|
|
312
|
+
this.calendar.show();
|
|
313
|
+
},
|
|
314
|
+
|
|
310
315
|
selected(date) {
|
|
311
316
|
/**
|
|
312
317
|
* Emitted when a new date has been selected.
|
|
@@ -348,17 +353,11 @@ var script = {
|
|
|
348
353
|
onKeydown() {
|
|
349
354
|
if (this.textInput === '') {
|
|
350
355
|
const resetDate = this.minDate || null;
|
|
351
|
-
this
|
|
356
|
+
this.calendar.setDate(resetDate);
|
|
352
357
|
this.selected(resetDate);
|
|
353
358
|
}
|
|
354
359
|
}
|
|
355
360
|
|
|
356
|
-
},
|
|
357
|
-
// Vue3 will make this.$options shallow-readonly
|
|
358
|
-
// that means that in order to store anything in $options
|
|
359
|
-
// we need an object as a container
|
|
360
|
-
pikaday: {
|
|
361
|
-
calendar: null
|
|
362
361
|
}
|
|
363
362
|
};
|
|
364
363
|
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ export const Image = (args, { argTypes }) => ({
|
|
|
53
53
|
<gl-avatar
|
|
54
54
|
:size="size"
|
|
55
55
|
:shape="shape"
|
|
56
|
-
src="
|
|
56
|
+
src="./img/gitlab-summit-south-africa.jpg"
|
|
57
57
|
/>
|
|
58
58
|
`,
|
|
59
59
|
});
|
|
@@ -66,7 +66,7 @@ export const ResponsiveImage = (args, { argTypes }) => ({
|
|
|
66
66
|
<gl-avatar
|
|
67
67
|
:size="size"
|
|
68
68
|
:shape="shape"
|
|
69
|
-
src="
|
|
69
|
+
src="./img/gitlab-summit-south-africa.jpg"
|
|
70
70
|
/>
|
|
71
71
|
`,
|
|
72
72
|
});
|
|
@@ -97,7 +97,7 @@ export const WithTooltip = (args, { argTypes }) => ({
|
|
|
97
97
|
:size="size"
|
|
98
98
|
:shape="shape"
|
|
99
99
|
:title="tooltipText"
|
|
100
|
-
src="
|
|
100
|
+
src="./img/gitlab-summit-south-africa.jpg"
|
|
101
101
|
v-gl-tooltip="{ placement }"
|
|
102
102
|
/>
|
|
103
103
|
`,
|
|
@@ -3,11 +3,11 @@ import { avatarsInlineSizeOptions } from '../../../utils/constants';
|
|
|
3
3
|
import readme from './avatars_inline.md';
|
|
4
4
|
|
|
5
5
|
const defaultAvatars = [
|
|
6
|
-
{ src: '
|
|
7
|
-
{ src: '
|
|
8
|
-
{ src: '
|
|
9
|
-
{ src: '
|
|
10
|
-
{ src: '
|
|
6
|
+
{ src: './img/avatar_1.png', alt: 'Administrator’s user avatar' },
|
|
7
|
+
{ src: './img/avatar_2.png', alt: 'Ops Manager’s user avatar' },
|
|
8
|
+
{ src: './img/avatar_3.png', alt: 'Developer’s user avatar' },
|
|
9
|
+
{ src: './img/avatar_4.png', alt: 'Business Admin’s user avatar' },
|
|
10
|
+
{ src: './img/avatar_5.png', alt: 'Product designer’s user avatar' },
|
|
11
11
|
];
|
|
12
12
|
|
|
13
13
|
const generateProps = (
|
|
@@ -73,6 +73,14 @@ describe('datepicker component', () => {
|
|
|
73
73
|
expect(Pikaday.prototype.show).toHaveBeenCalled();
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
it('opens calendar when show method is called', () => {
|
|
77
|
+
const wrapper = mountWithOptions();
|
|
78
|
+
|
|
79
|
+
wrapper.vm.show();
|
|
80
|
+
|
|
81
|
+
expect(Pikaday.prototype.show).toHaveBeenCalled();
|
|
82
|
+
});
|
|
83
|
+
|
|
76
84
|
describe('when `ariaLabel` prop is passed', () => {
|
|
77
85
|
it('configures pikaday with the given label', () => {
|
|
78
86
|
const ariaLabel = 'Meaningful description';
|
|
@@ -179,7 +179,7 @@ export default {
|
|
|
179
179
|
},
|
|
180
180
|
computed: {
|
|
181
181
|
formattedDate() {
|
|
182
|
-
return
|
|
182
|
+
return 'calendar' in this && this.calendar.toString();
|
|
183
183
|
},
|
|
184
184
|
customTrigger() {
|
|
185
185
|
return isString(this.target) && this.target !== '';
|
|
@@ -207,21 +207,21 @@ export default {
|
|
|
207
207
|
},
|
|
208
208
|
watch: {
|
|
209
209
|
value(val) {
|
|
210
|
-
if (!areDatesEqual(val, this
|
|
211
|
-
this
|
|
210
|
+
if (!areDatesEqual(val, this.calendar.getDate())) {
|
|
211
|
+
this.calendar.setDate(val, true);
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
214
|
minDate(minDate) {
|
|
215
|
-
this
|
|
215
|
+
this.calendar.setMinDate(minDate);
|
|
216
216
|
},
|
|
217
217
|
maxDate(maxDate) {
|
|
218
|
-
this
|
|
218
|
+
this.calendar.setMaxDate(maxDate);
|
|
219
219
|
},
|
|
220
220
|
startRange(startRange) {
|
|
221
|
-
this
|
|
221
|
+
this.calendar.setStartRange(startRange);
|
|
222
222
|
},
|
|
223
223
|
endRange(endRange) {
|
|
224
|
-
this
|
|
224
|
+
this.calendar.setEndRange(endRange);
|
|
225
225
|
},
|
|
226
226
|
},
|
|
227
227
|
mounted() {
|
|
@@ -279,16 +279,21 @@ export default {
|
|
|
279
279
|
pikadayConfig.i18n = this.i18n;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
this
|
|
282
|
+
this.calendar = new Pikaday(pikadayConfig);
|
|
283
283
|
|
|
284
284
|
if (this.startOpened) {
|
|
285
|
-
this
|
|
285
|
+
this.calendar.show();
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
beforeDestroy() {
|
|
289
|
-
this
|
|
289
|
+
this.calendar.destroy();
|
|
290
290
|
},
|
|
291
291
|
methods: {
|
|
292
|
+
// is used to open datepicker programmatically
|
|
293
|
+
show() {
|
|
294
|
+
this.calendar.show();
|
|
295
|
+
},
|
|
296
|
+
|
|
292
297
|
selected(date) {
|
|
293
298
|
/**
|
|
294
299
|
* Emitted when a new date has been selected.
|
|
@@ -324,18 +329,11 @@ export default {
|
|
|
324
329
|
onKeydown() {
|
|
325
330
|
if (this.textInput === '') {
|
|
326
331
|
const resetDate = this.minDate || null;
|
|
327
|
-
this
|
|
332
|
+
this.calendar.setDate(resetDate);
|
|
328
333
|
this.selected(resetDate);
|
|
329
334
|
}
|
|
330
335
|
},
|
|
331
336
|
},
|
|
332
|
-
|
|
333
|
-
// Vue3 will make this.$options shallow-readonly
|
|
334
|
-
// that means that in order to store anything in $options
|
|
335
|
-
// we need an object as a container
|
|
336
|
-
pikaday: {
|
|
337
|
-
calendar: null,
|
|
338
|
-
},
|
|
339
337
|
};
|
|
340
338
|
</script>
|
|
341
339
|
|