quasar-ui-sellmate-ui-kit 3.2.14 → 3.2.16
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/dist/index.common.js +2 -2
- package/dist/index.css +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.min.css +1 -1
- package/dist/index.rtl.css +1 -1
- package/dist/index.rtl.min.css +1 -1
- package/dist/index.umd.js +32 -22
- package/dist/index.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/components/SDate.vue +25 -15
- package/src/components/SDropdown.vue +1 -3
- package/src/components/SPagination.vue +2 -0
- package/src/components/STable.vue +1 -1
- package/src/components/__tests__/SInput.test.js +42 -0
- package/src/components/__tests__/SInputCounter.test.js +30 -0
- package/src/components/__tests__/SInputNumber.test.js +32 -0
package/package.json
CHANGED
package/src/components/SDate.vue
CHANGED
|
@@ -326,10 +326,10 @@
|
|
|
326
326
|
const toMenuRef = ref(null);
|
|
327
327
|
const wrapperInputRef = ref(null);
|
|
328
328
|
const menuModel = ref({
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
329
|
+
single: false,
|
|
330
|
+
from: false,
|
|
331
|
+
to: false,
|
|
332
|
+
});
|
|
333
333
|
|
|
334
334
|
function resetDate(key) {
|
|
335
335
|
const todayDate = date.formatDate(new Date(), 'YYYY-MM-DD');
|
|
@@ -356,12 +356,14 @@
|
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
if (props.dateRangeLimit === -1) {
|
|
360
|
+
dateModel.value.to = todayDate;
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
|
|
359
364
|
const fromDate = new Date(dateModel.value.from);
|
|
360
365
|
const toDate = new Date(todayDate);
|
|
361
|
-
const monthDifference =
|
|
362
|
-
- fromDate.getMonth()
|
|
363
|
-
+ 12 * (toDate.getFullYear() - fromDate.getFullYear());
|
|
364
|
-
|
|
366
|
+
const monthDifference = date.getDateDiff(fromDate, toDate, 'months');
|
|
365
367
|
if (monthDifference >= props.dateRangeLimit) {
|
|
366
368
|
dateModel.value.from = date.formatDate(
|
|
367
369
|
date.subtractFromDate(toDate, { month: props.dateRangeLimit }),
|
|
@@ -383,10 +385,12 @@
|
|
|
383
385
|
function optionsFn(day) {
|
|
384
386
|
if (props.noLimit) return true;
|
|
385
387
|
|
|
386
|
-
const minDate =
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
const minDate =
|
|
389
|
+
props.minMaxDate.minDate &&
|
|
390
|
+
date.formatDate(new Date(props.minMaxDate.minDate), 'YYYY/MM/DD');
|
|
391
|
+
const maxDate =
|
|
392
|
+
props.minMaxDate.maxDate &&
|
|
393
|
+
date.formatDate(new Date(props.minMaxDate.maxDate), 'YYYY/MM/DD');
|
|
390
394
|
|
|
391
395
|
if (minDate && maxDate) {
|
|
392
396
|
return minDate <= day && day <= maxDate;
|
|
@@ -407,7 +411,6 @@
|
|
|
407
411
|
if (props.noLimit) {
|
|
408
412
|
return true;
|
|
409
413
|
}
|
|
410
|
-
|
|
411
414
|
const dayTo = date.formatDate(dateModel.value.to, 'YYYY/MM/DD');
|
|
412
415
|
let maxFromDate = dayTo
|
|
413
416
|
? date.formatDate(
|
|
@@ -446,6 +449,9 @@
|
|
|
446
449
|
}
|
|
447
450
|
|
|
448
451
|
function optionsEndFn(day) {
|
|
452
|
+
if (props.noLimit && props.dateRangeLimit === -1) {
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
449
455
|
const dayFrom = date.formatDate(dateModel.value.from, 'YYYY/MM/DD');
|
|
450
456
|
|
|
451
457
|
let maxToDate = dayFrom
|
|
@@ -491,7 +497,9 @@
|
|
|
491
497
|
function settingFromDate() {
|
|
492
498
|
menuModel.value.from = false;
|
|
493
499
|
triggerValidation();
|
|
494
|
-
|
|
500
|
+
if (props.noLimit && props.dateRangeLimit === -1) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
495
503
|
if (props.noLimit && !!props.dateRangeLimit) {
|
|
496
504
|
const fromDate = new Date(dateModel.value.from);
|
|
497
505
|
const monthsLater = new Date(fromDate).setMonth(
|
|
@@ -509,7 +517,9 @@
|
|
|
509
517
|
function settingToDate() {
|
|
510
518
|
menuModel.value.to = false;
|
|
511
519
|
triggerValidation();
|
|
512
|
-
|
|
520
|
+
if (props.noLimit && props.dateRangeLimit === -1) {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
513
523
|
// FIXME: 종료 일자는 보통 시작 일자에 의해 제한 되기 때문에
|
|
514
524
|
// 종료 일자가 시작 일자를 제한하는 경우는 없을 것으로 보임, 추후 확인 후 삭제
|
|
515
525
|
if (props.noLimit && !!props.dateRangeLimit) {
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
:icon-right="arrowDownIcon"
|
|
11
11
|
menu-anchor="bottom start"
|
|
12
12
|
menu-self="top start"
|
|
13
|
-
class="s-dropdown"
|
|
14
13
|
:class="{
|
|
15
14
|
's-dropdown-xs': size === 'xs',
|
|
16
15
|
's-dropdown-sm': size === 'sm',
|
|
@@ -18,7 +17,7 @@
|
|
|
18
17
|
's-dropdown-lg': size === 'lg',
|
|
19
18
|
}"
|
|
20
19
|
>
|
|
21
|
-
<q-menu :class="menuClass" class="s-dropdown-menu" :offset="[0, 4]">
|
|
20
|
+
<q-menu :class="menuClass" fit class="s-dropdown-menu" :offset="[0, 4]">
|
|
22
21
|
<template v-for="(opt, i) in options" :key="i">
|
|
23
22
|
<q-item
|
|
24
23
|
:clickable="opt.disable === undefined || opt.disable === false"
|
|
@@ -49,7 +48,6 @@
|
|
|
49
48
|
name: 'SDropdown',
|
|
50
49
|
components: {
|
|
51
50
|
QBtn,
|
|
52
|
-
QMenu,
|
|
53
51
|
QItem,
|
|
54
52
|
QItemSection,
|
|
55
53
|
QItemLabel,
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
v-if="paginationModel.rowsPerPage !== 0 && ((!hideBottom && pagesNumber > 1) || showBottom)"
|
|
105
105
|
v-model="paginationModel.page"
|
|
106
106
|
:lastPage="pagesNumber"
|
|
107
|
-
class="
|
|
107
|
+
class="bg-Grey_Lighten-6 s-border-radius-sm s-border-top-none s-border-Grey_Lighten-3"
|
|
108
108
|
@update:modelValue="updatePagination"
|
|
109
109
|
/>
|
|
110
110
|
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import SInput from '../SInput.vue';
|
|
5
|
+
|
|
6
|
+
installQuasarPlugin()
|
|
7
|
+
|
|
8
|
+
describe('SInput.vue', () => {
|
|
9
|
+
it('mounted', () => {
|
|
10
|
+
const wrapper = mount(SInput, {
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: '',
|
|
13
|
+
label: 'label',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
expect(wrapper.classes('s-input')).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('input 값 정상 입력하는지', async () => {
|
|
19
|
+
const inputModel = 'new value';
|
|
20
|
+
const wrapper = mount(SInput, {
|
|
21
|
+
props: {
|
|
22
|
+
modelValue: '',
|
|
23
|
+
label: 'label',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
await wrapper.setProps({ modelValue: inputModel });
|
|
28
|
+
expect(wrapper.vm.model).to.equal(inputModel);
|
|
29
|
+
});
|
|
30
|
+
it('insideLabel 정상적으로 들어가는 지', async () => {
|
|
31
|
+
const insideLabel = 'insideLabel';
|
|
32
|
+
const wrapper = mount(SInput, {
|
|
33
|
+
props: {
|
|
34
|
+
modelValue: '',
|
|
35
|
+
label: 'label',
|
|
36
|
+
insideLabel,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
expect(wrapper.props().insideLabel).toBe(insideLabel);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import SInputCounter from '../SInputCounter.vue';
|
|
5
|
+
|
|
6
|
+
installQuasarPlugin()
|
|
7
|
+
|
|
8
|
+
describe('SInputCounter.vue', () => {
|
|
9
|
+
it('mounted', () => {
|
|
10
|
+
const wrapper = mount(SInputCounter, {
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: '',
|
|
13
|
+
label: 'label',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
expect(wrapper.classes('s-input-counter')).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('counter up', () => {
|
|
19
|
+
const wrapper = mount(SInputCounter, {
|
|
20
|
+
props: {
|
|
21
|
+
modelValue: 0,
|
|
22
|
+
label: 'label',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
// TODOS: 방법을 찾아야 할 거 같음 카운터 동작 구조를 모르겠음
|
|
26
|
+
});
|
|
27
|
+
it('counter down', () => {
|
|
28
|
+
// TODOS: 방법을 찾아야 할 거 같음 카운터 동작 구조를 모르겠음
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import SInputNumber from '../SInputNumber.vue';
|
|
5
|
+
|
|
6
|
+
installQuasarPlugin()
|
|
7
|
+
|
|
8
|
+
describe('SInputNumber.vue', () => {
|
|
9
|
+
it('mounted', () => {
|
|
10
|
+
const wrapper = mount(SInputNumber, {
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: '',
|
|
13
|
+
label: 'label',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
expect(wrapper.classes('s-input-number')).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('숫자만 입력되는지', async () => {
|
|
19
|
+
const wrapper = mount(SInputNumber, {
|
|
20
|
+
props: {
|
|
21
|
+
modelValue: '',
|
|
22
|
+
label: 'label',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
await wrapper.setProps({ modelValue: '10000' });
|
|
27
|
+
expect(Number(wrapper.vm.inputNumberValue)).to.equal(10000);
|
|
28
|
+
|
|
29
|
+
await wrapper.setProps({ modelValue: '가나다라' });
|
|
30
|
+
expect(Number(wrapper.vm.inputNumberValue)).toBeNaN();
|
|
31
|
+
});
|
|
32
|
+
});
|