element-ps 2.0.20 → 2.0.21
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.full.js +2 -41
- package/dist/index.full.min.js +5 -5
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +5 -5
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +2 -41
- package/es/components/affix/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +19 -82
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +82 -19
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/alert/index.mjs +2 -2
- package/es/components/alert/src/alert.mjs +33 -83
- package/es/components/alert/src/alert.mjs.map +1 -1
- package/es/components/alert/src/alert2.mjs +83 -33
- package/es/components/alert/src/alert2.mjs.map +1 -1
- package/es/components/autocomplete/index.d.ts +5 -5
- package/es/components/autocomplete/index.mjs +2 -2
- package/es/components/autocomplete/src/autocomplete.mjs +94 -58
- package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
- package/es/components/autocomplete/src/autocomplete2.mjs +58 -94
- package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
- package/es/components/avatar/index.mjs +2 -2
- package/es/components/avatar/src/avatar.mjs +29 -61
- package/es/components/avatar/src/avatar.mjs.map +1 -1
- package/es/components/avatar/src/avatar2.mjs +61 -29
- package/es/components/avatar/src/avatar2.mjs.map +1 -1
- package/es/components/calendar/index.mjs +2 -2
- package/es/components/calendar/src/calendar.mjs +9 -188
- package/es/components/calendar/src/calendar.mjs.map +1 -1
- package/es/components/calendar/src/calendar2.mjs +188 -9
- package/es/components/calendar/src/calendar2.mjs.map +1 -1
- package/es/components/calendar/src/date-table.mjs +27 -146
- package/es/components/calendar/src/date-table.mjs.map +1 -1
- package/es/components/calendar/src/date-table2.mjs +146 -27
- package/es/components/calendar/src/date-table2.mjs.map +1 -1
- package/es/components/carousel/index.mjs +4 -4
- package/es/components/carousel/src/carousel-item.mjs +7 -148
- package/es/components/carousel/src/carousel-item.mjs.map +1 -1
- package/es/components/carousel/src/carousel-item2.mjs +148 -7
- package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
- package/es/components/carousel/src/carousel.mjs +43 -201
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel2.mjs +201 -43
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/cascader-panel/src/config.mjs +1 -1
- package/es/components/cascader-panel/src/index.mjs +1 -1
- package/es/components/cascader-panel/src/menu.mjs +1 -1
- package/es/components/cascader-panel/src/node.mjs +200 -120
- package/es/components/cascader-panel/src/node.mjs.map +1 -1
- package/es/components/cascader-panel/src/node2.mjs +120 -200
- package/es/components/cascader-panel/src/node2.mjs.map +1 -1
- package/es/components/cascader-panel/src/store.mjs +1 -1
- package/es/components/collection/src/collection.mjs +1 -34
- package/es/components/collection/src/collection.mjs.map +1 -1
- package/es/components/divider/index.mjs +2 -2
- package/es/components/divider/src/divider.mjs +34 -17
- package/es/components/divider/src/divider.mjs.map +1 -1
- package/es/components/divider/src/divider2.mjs +17 -34
- package/es/components/divider/src/divider2.mjs.map +1 -1
- package/es/components/dropdown/index.d.ts +3 -3
- package/es/components/dropdown/src/dropdown-item-impl.mjs +3 -12
- package/es/components/dropdown/src/dropdown-item-impl.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown-item-impl.vue.d.ts +0 -3
- package/es/components/dropdown/src/dropdown.d.ts +1 -1
- package/es/components/dropdown/src/dropdown.vue.d.ts +3 -3
- package/es/components/form/index.mjs +4 -4
- package/es/components/form/src/form-item.mjs +177 -46
- package/es/components/form/src/form-item.mjs.map +1 -1
- package/es/components/form/src/form-item2.mjs +46 -177
- package/es/components/form/src/form-item2.mjs.map +1 -1
- package/es/components/form/src/form.mjs +40 -45
- package/es/components/form/src/form.mjs.map +1 -1
- package/es/components/form/src/form2.mjs +45 -40
- package/es/components/form/src/form2.mjs.map +1 -1
- package/es/components/image/index.mjs +2 -2
- package/es/components/image/src/image.mjs +170 -46
- package/es/components/image/src/image.mjs.map +1 -1
- package/es/components/image/src/image2.mjs +46 -170
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/image-viewer/index.mjs +2 -2
- package/es/components/image-viewer/src/image-viewer.mjs +31 -210
- package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer2.mjs +210 -31
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.mjs +23 -23
- package/es/components/input-number/index.mjs +2 -2
- package/es/components/input-number/src/input-number.mjs +46 -171
- package/es/components/input-number/src/input-number.mjs.map +1 -1
- package/es/components/input-number/src/input-number2.mjs +171 -46
- package/es/components/input-number/src/input-number2.mjs.map +1 -1
- package/es/components/menu/index.d.ts +3 -3
- package/es/components/menu/src/menu.d.ts +4 -4
- package/es/components/popover/index.d.ts +6 -6
- package/es/components/popover/src/index.vue.d.ts +3 -3
- package/es/components/popover/src/popover.d.ts +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/arrow.mjs +7 -31
- package/es/components/popper/src/arrow.mjs.map +1 -1
- package/es/components/popper/src/arrow2.mjs +31 -7
- package/es/components/popper/src/arrow2.mjs.map +1 -1
- package/es/components/radio/index.mjs +2 -2
- package/es/components/radio/src/radio-button.mjs +1 -1
- package/es/components/radio/src/radio-button2.mjs +1 -1
- package/es/components/radio/src/radio.mjs +62 -74
- package/es/components/radio/src/radio.mjs.map +1 -1
- package/es/components/radio/src/radio2.mjs +74 -62
- package/es/components/radio/src/radio2.mjs.map +1 -1
- package/es/components/rate/index.mjs +2 -2
- package/es/components/rate/src/rate.mjs +84 -169
- package/es/components/rate/src/rate.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs +169 -84
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/result/index.mjs +2 -2
- package/es/components/result/src/result.mjs +28 -73
- package/es/components/result/src/result.mjs.map +1 -1
- package/es/components/result/src/result2.mjs +73 -28
- package/es/components/result/src/result2.mjs.map +1 -1
- package/es/components/select/index.d.ts +5 -5
- package/es/components/select/src/select.vue.d.ts +5 -5
- package/es/components/select/src/useSelect.d.ts +5 -5
- package/es/components/select-v2/index.d.ts +10 -10
- package/es/components/select-v2/src/option-item.vue.d.ts +1 -1
- package/es/components/select-v2/src/select.vue.d.ts +5 -5
- package/es/components/select-v2/src/useSelect.d.ts +5 -5
- package/es/components/skeleton/index.mjs +4 -4
- package/es/components/skeleton/src/skeleton-item.mjs +18 -23
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +23 -18
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.mjs +22 -49
- package/es/components/skeleton/src/skeleton.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton2.mjs +49 -22
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/components/table/index.d.ts +1 -1
- package/es/components/table/src/filter-panel.vue.d.ts +5 -5
- package/es/components/table/src/table.vue.d.ts +1 -1
- package/es/components/tabs/index.mjs +3 -3
- package/es/components/tabs/src/tab-bar.mjs +76 -7
- package/es/components/tabs/src/tab-bar.mjs.map +1 -1
- package/es/components/tabs/src/tab-bar2.mjs +7 -76
- package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
- package/es/components/tabs/src/tab-nav.mjs +1 -1
- package/es/components/tabs/src/tab-pane.mjs +14 -60
- package/es/components/tabs/src/tab-pane.mjs.map +1 -1
- package/es/components/tabs/src/tab-pane2.mjs +60 -14
- package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
- package/es/components/time-picker/src/common/picker.vue.d.ts +5 -5
- package/es/components/tooltip/index.d.ts +3 -3
- package/es/components/tooltip/src/tooltip.d.ts +1 -1
- package/es/components/tooltip/src/tooltip.mjs +1 -1
- package/es/components/tooltip/src/tooltip.vue.d.ts +3 -3
- package/es/components/tooltip/src/trigger.vue.d.ts +3 -3
- package/es/components/tooltip-v2/index.mjs +2 -2
- package/es/components/tooltip-v2/src/arrow.mjs +22 -38
- package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
- package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
- package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +2 -2
- package/es/components/tooltip-v2/src/tooltip2.mjs +4 -4
- package/es/components/tooltip-v2/src/trigger.mjs +89 -11
- package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
- package/es/components/tooltip-v2/src/trigger2.mjs +11 -89
- package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
- package/es/components/upload/index.mjs +1 -1
- package/es/components/upload/src/upload-content.mjs +1 -1
- package/es/components/upload/src/upload-dragger.mjs +32 -11
- package/es/components/upload/src/upload-dragger.mjs.map +1 -1
- package/es/components/upload/src/upload-dragger2.mjs +11 -32
- package/es/components/upload/src/upload-dragger2.mjs.map +1 -1
- package/es/index.mjs +23 -23
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +19 -82
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +82 -19
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/alert/index.js +2 -2
- package/lib/components/alert/src/alert.js +33 -82
- package/lib/components/alert/src/alert.js.map +1 -1
- package/lib/components/alert/src/alert2.js +82 -33
- package/lib/components/alert/src/alert2.js.map +1 -1
- package/lib/components/autocomplete/index.d.ts +5 -5
- package/lib/components/autocomplete/index.js +2 -2
- package/lib/components/autocomplete/src/autocomplete.js +94 -58
- package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
- package/lib/components/autocomplete/src/autocomplete2.js +58 -94
- package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
- package/lib/components/avatar/index.js +2 -2
- package/lib/components/avatar/src/avatar.js +29 -61
- package/lib/components/avatar/src/avatar.js.map +1 -1
- package/lib/components/avatar/src/avatar2.js +61 -29
- package/lib/components/avatar/src/avatar2.js.map +1 -1
- package/lib/components/calendar/index.js +2 -2
- package/lib/components/calendar/src/calendar.js +9 -192
- package/lib/components/calendar/src/calendar.js.map +1 -1
- package/lib/components/calendar/src/calendar2.js +192 -9
- package/lib/components/calendar/src/calendar2.js.map +1 -1
- package/lib/components/calendar/src/date-table.js +30 -151
- package/lib/components/calendar/src/date-table.js.map +1 -1
- package/lib/components/calendar/src/date-table2.js +151 -30
- package/lib/components/calendar/src/date-table2.js.map +1 -1
- package/lib/components/carousel/index.js +4 -4
- package/lib/components/carousel/src/carousel-item.js +7 -148
- package/lib/components/carousel/src/carousel-item.js.map +1 -1
- package/lib/components/carousel/src/carousel-item2.js +148 -7
- package/lib/components/carousel/src/carousel-item2.js.map +1 -1
- package/lib/components/carousel/src/carousel.js +43 -201
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel2.js +201 -43
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/cascader-panel/src/config.js +1 -1
- package/lib/components/cascader-panel/src/index.js +1 -1
- package/lib/components/cascader-panel/src/menu.js +1 -1
- package/lib/components/cascader-panel/src/node.js +200 -121
- package/lib/components/cascader-panel/src/node.js.map +1 -1
- package/lib/components/cascader-panel/src/node2.js +121 -200
- package/lib/components/cascader-panel/src/node2.js.map +1 -1
- package/lib/components/cascader-panel/src/store.js +1 -1
- package/lib/components/collection/src/collection.js +0 -33
- package/lib/components/collection/src/collection.js.map +1 -1
- package/lib/components/divider/index.js +2 -2
- package/lib/components/divider/src/divider.js +34 -17
- package/lib/components/divider/src/divider.js.map +1 -1
- package/lib/components/divider/src/divider2.js +17 -34
- package/lib/components/divider/src/divider2.js.map +1 -1
- package/lib/components/dropdown/index.d.ts +3 -3
- package/lib/components/dropdown/src/dropdown-item-impl.js +1 -10
- package/lib/components/dropdown/src/dropdown-item-impl.js.map +1 -1
- package/lib/components/dropdown/src/dropdown-item-impl.vue.d.ts +0 -3
- package/lib/components/dropdown/src/dropdown.d.ts +1 -1
- package/lib/components/dropdown/src/dropdown.vue.d.ts +3 -3
- package/lib/components/form/index.js +4 -4
- package/lib/components/form/src/form-item.js +177 -47
- package/lib/components/form/src/form-item.js.map +1 -1
- package/lib/components/form/src/form-item2.js +47 -177
- package/lib/components/form/src/form-item2.js.map +1 -1
- package/lib/components/form/src/form.js +40 -45
- package/lib/components/form/src/form.js.map +1 -1
- package/lib/components/form/src/form2.js +45 -40
- package/lib/components/form/src/form2.js.map +1 -1
- package/lib/components/image/index.js +2 -2
- package/lib/components/image/src/image.js +170 -46
- package/lib/components/image/src/image.js.map +1 -1
- package/lib/components/image/src/image2.js +46 -170
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/image-viewer/index.js +2 -2
- package/lib/components/image-viewer/src/image-viewer.js +31 -210
- package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer2.js +210 -31
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.js +23 -23
- package/lib/components/input-number/index.js +2 -2
- package/lib/components/input-number/src/input-number.js +46 -171
- package/lib/components/input-number/src/input-number.js.map +1 -1
- package/lib/components/input-number/src/input-number2.js +171 -46
- package/lib/components/input-number/src/input-number2.js.map +1 -1
- package/lib/components/menu/index.d.ts +3 -3
- package/lib/components/menu/src/menu.d.ts +4 -4
- package/lib/components/popover/index.d.ts +6 -6
- package/lib/components/popover/src/index.vue.d.ts +3 -3
- package/lib/components/popover/src/popover.d.ts +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/arrow.js +7 -31
- package/lib/components/popper/src/arrow.js.map +1 -1
- package/lib/components/popper/src/arrow2.js +31 -7
- package/lib/components/popper/src/arrow2.js.map +1 -1
- package/lib/components/radio/index.js +2 -2
- package/lib/components/radio/src/radio-button.js +1 -1
- package/lib/components/radio/src/radio-button2.js +1 -1
- package/lib/components/radio/src/radio.js +64 -73
- package/lib/components/radio/src/radio.js.map +1 -1
- package/lib/components/radio/src/radio2.js +73 -64
- package/lib/components/radio/src/radio2.js.map +1 -1
- package/lib/components/rate/index.js +2 -2
- package/lib/components/rate/src/rate.js +84 -169
- package/lib/components/rate/src/rate.js.map +1 -1
- package/lib/components/rate/src/rate2.js +169 -84
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/result/index.js +2 -2
- package/lib/components/result/src/result.js +30 -73
- package/lib/components/result/src/result.js.map +1 -1
- package/lib/components/result/src/result2.js +73 -30
- package/lib/components/result/src/result2.js.map +1 -1
- package/lib/components/select/index.d.ts +5 -5
- package/lib/components/select/src/select.vue.d.ts +5 -5
- package/lib/components/select/src/useSelect.d.ts +5 -5
- package/lib/components/select-v2/index.d.ts +10 -10
- package/lib/components/select-v2/src/option-item.vue.d.ts +1 -1
- package/lib/components/select-v2/src/select.vue.d.ts +5 -5
- package/lib/components/select-v2/src/useSelect.d.ts +5 -5
- package/lib/components/skeleton/index.js +4 -4
- package/lib/components/skeleton/src/skeleton-item.js +18 -23
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item2.js +23 -18
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.js +22 -49
- package/lib/components/skeleton/src/skeleton.js.map +1 -1
- package/lib/components/skeleton/src/skeleton2.js +49 -22
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/components/table/index.d.ts +1 -1
- package/lib/components/table/src/filter-panel.vue.d.ts +5 -5
- package/lib/components/table/src/table.vue.d.ts +1 -1
- package/lib/components/tabs/index.js +3 -3
- package/lib/components/tabs/src/tab-bar.js +76 -7
- package/lib/components/tabs/src/tab-bar.js.map +1 -1
- package/lib/components/tabs/src/tab-bar2.js +7 -76
- package/lib/components/tabs/src/tab-bar2.js.map +1 -1
- package/lib/components/tabs/src/tab-nav.js +1 -1
- package/lib/components/tabs/src/tab-pane.js +14 -60
- package/lib/components/tabs/src/tab-pane.js.map +1 -1
- package/lib/components/tabs/src/tab-pane2.js +60 -14
- package/lib/components/tabs/src/tab-pane2.js.map +1 -1
- package/lib/components/time-picker/src/common/picker.vue.d.ts +5 -5
- package/lib/components/tooltip/index.d.ts +3 -3
- package/lib/components/tooltip/src/tooltip.d.ts +1 -1
- package/lib/components/tooltip/src/tooltip.js +1 -1
- package/lib/components/tooltip/src/tooltip.vue.d.ts +3 -3
- package/lib/components/tooltip/src/trigger.vue.d.ts +3 -3
- package/lib/components/tooltip-v2/index.js +2 -2
- package/lib/components/tooltip-v2/src/arrow.js +23 -38
- package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
- package/lib/components/tooltip-v2/src/arrow2.js +38 -23
- package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +2 -2
- package/lib/components/tooltip-v2/src/tooltip2.js +4 -4
- package/lib/components/tooltip-v2/src/trigger.js +89 -11
- package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
- package/lib/components/tooltip-v2/src/trigger2.js +11 -89
- package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
- package/lib/components/upload/index.js +1 -1
- package/lib/components/upload/src/upload-content.js +1 -1
- package/lib/components/upload/src/upload-dragger.js +32 -12
- package/lib/components/upload/src/upload-dragger.js.map +1 -1
- package/lib/components/upload/src/upload-dragger2.js +12 -32
- package/lib/components/upload/src/upload-dragger2.js.map +1 -1
- package/lib/index.js +23 -23
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,67 +1,35 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, renderSlot } from 'vue';
|
|
2
|
-
import { PsIcon } from '../../icon/index.mjs';
|
|
3
|
-
import '../../../hooks/index.mjs';
|
|
4
1
|
import '../../../utils/index.mjs';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { isNumber } from '@vueuse/core';
|
|
10
|
-
import { addUnit } from '../../../utils/dom/style.mjs';
|
|
2
|
+
import '../../../constants/index.mjs';
|
|
3
|
+
import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
|
|
4
|
+
import { componentSizes } from '../../../constants/size.mjs';
|
|
5
|
+
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
|
11
6
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return isNumber(size) ? {
|
|
37
|
-
"--el-avatar-size": addUnit(size)
|
|
38
|
-
} : void 0;
|
|
39
|
-
});
|
|
40
|
-
const fitStyle = computed(() => ({
|
|
41
|
-
objectFit: props.fit
|
|
42
|
-
}));
|
|
43
|
-
return (_ctx, _cache) => {
|
|
44
|
-
return openBlock(), createElementBlock("span", {
|
|
45
|
-
class: normalizeClass(unref(avatarClass)),
|
|
46
|
-
style: normalizeStyle(unref(sizeStyle))
|
|
47
|
-
}, [
|
|
48
|
-
(_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
|
|
49
|
-
key: 0,
|
|
50
|
-
src: _ctx.src,
|
|
51
|
-
alt: _ctx.alt,
|
|
52
|
-
srcset: _ctx.srcSet,
|
|
53
|
-
style: normalizeStyle(unref(fitStyle))
|
|
54
|
-
}, null, 12, _hoisted_1)) : _ctx.icon ? (openBlock(), createBlock(unref(PsIcon), { key: 1 }, {
|
|
55
|
-
default: withCtx(() => [
|
|
56
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
57
|
-
]),
|
|
58
|
-
_: 1
|
|
59
|
-
})) : renderSlot(_ctx.$slots, "default", { key: 2 })
|
|
60
|
-
], 6);
|
|
61
|
-
};
|
|
7
|
+
const avatarProps = buildProps({
|
|
8
|
+
size: {
|
|
9
|
+
type: [Number, String],
|
|
10
|
+
values: componentSizes,
|
|
11
|
+
default: "",
|
|
12
|
+
validator: (val) => typeof val === "number"
|
|
13
|
+
},
|
|
14
|
+
shape: {
|
|
15
|
+
type: String,
|
|
16
|
+
values: ["circle", "square"],
|
|
17
|
+
default: "circle"
|
|
18
|
+
},
|
|
19
|
+
icon: {
|
|
20
|
+
type: iconPropType
|
|
21
|
+
},
|
|
22
|
+
src: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
alt: String,
|
|
27
|
+
srcSet: String,
|
|
28
|
+
fit: {
|
|
29
|
+
type: definePropType(String),
|
|
30
|
+
default: "cover"
|
|
62
31
|
}
|
|
63
32
|
});
|
|
64
|
-
var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/avatar/src/avatar.vue"]]);
|
|
65
33
|
|
|
66
|
-
export {
|
|
34
|
+
export { avatarProps };
|
|
67
35
|
//# sourceMappingURL=avatar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.
|
|
1
|
+
{"version":3,"file":"avatar.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.ts"],"sourcesContent":["import { buildProps, definePropType, iconPropType } from '@element-ps/utils'\nimport { componentSizes } from '@element-ps/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type { ObjectFitProperty } from 'csstype'\nimport type Avatar from './avatar.vue'\n\nexport const avatarProps = buildProps({\n size: {\n type: [Number, String],\n values: componentSizes,\n default: '',\n validator: (val: unknown): val is number => typeof val === 'number',\n },\n shape: {\n type: String,\n values: ['circle', 'square'],\n default: 'circle',\n },\n icon: {\n type: iconPropType,\n },\n src: {\n type: String,\n default: '',\n },\n alt: String,\n srcSet: String,\n fit: {\n type: definePropType<ObjectFitProperty>(String),\n default: 'cover',\n },\n} as const)\nexport type AvatarProps = ExtractPropTypes<typeof avatarProps>\n\nexport type AvatarInstance = InstanceType<typeof Avatar>\n"],"names":[],"mappings":";;;;;;AAEY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,SAAS,EAAE,CAAC,GAAG,KAAK,OAAO,GAAG,KAAK,QAAQ;AAC/C,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAChC,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,CAAC;;;;"}
|
|
@@ -1,35 +1,67 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, renderSlot } from 'vue';
|
|
2
|
+
import { PsIcon } from '../../icon/index.mjs';
|
|
3
|
+
import '../../../hooks/index.mjs';
|
|
1
4
|
import '../../../utils/index.mjs';
|
|
2
|
-
import '
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { avatarProps } from './avatar.mjs';
|
|
6
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
7
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
8
|
+
import { isString } from '@vue/shared';
|
|
9
|
+
import { isNumber } from '@vueuse/core';
|
|
10
|
+
import { addUnit } from '../../../utils/dom/style.mjs';
|
|
6
11
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
const _hoisted_1 = ["src", "alt", "srcset"];
|
|
13
|
+
const __default__ = {
|
|
14
|
+
name: "PsAvatar"
|
|
15
|
+
};
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...__default__,
|
|
18
|
+
props: avatarProps,
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const ns = useNamespace("avatar");
|
|
22
|
+
const hasLoadError = ref(false);
|
|
23
|
+
const avatarClass = computed(() => {
|
|
24
|
+
const { size, icon, shape } = props;
|
|
25
|
+
const classList = [ns.b()];
|
|
26
|
+
if (isString(size))
|
|
27
|
+
classList.push(ns.m(size));
|
|
28
|
+
if (icon)
|
|
29
|
+
classList.push(ns.m("icon"));
|
|
30
|
+
if (shape)
|
|
31
|
+
classList.push(ns.m(shape));
|
|
32
|
+
return classList;
|
|
33
|
+
});
|
|
34
|
+
const sizeStyle = computed(() => {
|
|
35
|
+
const { size } = props;
|
|
36
|
+
return isNumber(size) ? {
|
|
37
|
+
"--el-avatar-size": addUnit(size)
|
|
38
|
+
} : void 0;
|
|
39
|
+
});
|
|
40
|
+
const fitStyle = computed(() => ({
|
|
41
|
+
objectFit: props.fit
|
|
42
|
+
}));
|
|
43
|
+
return (_ctx, _cache) => {
|
|
44
|
+
return openBlock(), createElementBlock("span", {
|
|
45
|
+
class: normalizeClass(unref(avatarClass)),
|
|
46
|
+
style: normalizeStyle(unref(sizeStyle))
|
|
47
|
+
}, [
|
|
48
|
+
(_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
|
|
49
|
+
key: 0,
|
|
50
|
+
src: _ctx.src,
|
|
51
|
+
alt: _ctx.alt,
|
|
52
|
+
srcset: _ctx.srcSet,
|
|
53
|
+
style: normalizeStyle(unref(fitStyle))
|
|
54
|
+
}, null, 12, _hoisted_1)) : _ctx.icon ? (openBlock(), createBlock(unref(PsIcon), { key: 1 }, {
|
|
55
|
+
default: withCtx(() => [
|
|
56
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
57
|
+
]),
|
|
58
|
+
_: 1
|
|
59
|
+
})) : renderSlot(_ctx.$slots, "default", { key: 2 })
|
|
60
|
+
], 6);
|
|
61
|
+
};
|
|
31
62
|
}
|
|
32
63
|
});
|
|
64
|
+
var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/avatar/src/avatar.vue"]]);
|
|
33
65
|
|
|
34
|
-
export {
|
|
66
|
+
export { Avatar as default };
|
|
35
67
|
//# sourceMappingURL=avatar2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar2.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.
|
|
1
|
+
{"version":3,"file":"avatar2.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.vue"],"sourcesContent":["<template>\n <span :class=\"avatarClass\" :style=\"sizeStyle\">\n <img\n v-if=\"(src || srcSet) && !hasLoadError\"\n :src=\"src\"\n :alt=\"alt\"\n :srcset=\"srcSet\"\n :style=\"fitStyle\"\n />\n <ps-icon v-else-if=\"icon\">\n <component :is=\"icon\" />\n </ps-icon>\n <slot v-else />\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\nimport { PsIcon } from '@element-ps/components/icon'\nimport { useNamespace } from '@element-ps/hooks'\nimport { addUnit, isNumber, isString } from '@element-ps/utils'\nimport { avatarProps } from './avatar'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'PsAvatar',\n})\n\nconst props = defineProps(avatarProps)\n\nconst ns = useNamespace('avatar')\n\nconst hasLoadError = ref(false)\n\nconst avatarClass = computed(() => {\n const { size, icon, shape } = props\n const classList = [ns.b()]\n if (isString(size)) classList.push(ns.m(size))\n if (icon) classList.push(ns.m('icon'))\n if (shape) classList.push(ns.m(shape))\n return classList\n})\n\nconst sizeStyle = computed(() => {\n const { size } = props\n return isNumber(size)\n ? ({\n '--el-avatar-size': addUnit(size),\n } as CSSProperties)\n : undefined\n})\n\nconst fitStyle = computed<CSSProperties>(() => ({\n objectFit: props.fit,\n}))\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,IAAA,MAAA,EAAA,GAAA,aAAA,QAAA,CAAA,CAAA;AAEA,IAAA,MAAA,YAAA,GAAA,IAAA,KAAA,CAAA,CAAA;AAEA,IAAA,MAAA,WAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,EAAA,IAAA,EAAA,IAAA,EAAA,KAAA,EAAA,GAAA,KAAA,CAAA;AACA,MAAA,MAAA,SAAA,GAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA;AACA,MAAA,IAAA,SAAA,IAAA,CAAA;AAAA,QAAA,SAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,MAAA,IAAA,IAAA;AAAA,QAAA,SAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA;AACA,MAAA,IAAA,KAAA;AAAA,QAAA,SAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AACA,MAAA,OAAA,SAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,SAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,EAAA,IAAA,EAAA,GAAA,KAAA,CAAA;AACA,MAAA,OAAA,QAAA,CAAA,IAAA,CACA,GAAA;AAAA,QACA,kBAAA,EAAA,QAAA,IAAA,CAAA;AAAA,OAEA,GAAA,KAAA,CAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,QAAA,GAAA,SAAA,OAAA;AAAA,MACA,WAAA,KAAA,CAAA,GAAA;AAAA,KACA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import Calendar from './src/
|
|
3
|
-
export { calendarProps } from './src/
|
|
2
|
+
import Calendar from './src/calendar2.mjs';
|
|
3
|
+
export { calendarProps } from './src/calendar.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const PsCalendar = withInstall(Calendar);
|
|
@@ -1,194 +1,15 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, toDisplayString, createVNode, withCtx, createTextVNode, createCommentVNode, createSlots, normalizeProps, guardReactiveProps, Fragment, renderList, createBlock } from 'vue';
|
|
2
|
-
import dayjs from 'dayjs';
|
|
3
|
-
import { PsButtonGroup, PsButton } from '../../button/index.mjs';
|
|
4
|
-
import '../../../hooks/index.mjs';
|
|
5
1
|
import '../../../utils/index.mjs';
|
|
6
|
-
import
|
|
7
|
-
import { calendarProps } from './calendar2.mjs';
|
|
8
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
9
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
10
|
-
import { useLocale } from '../../../hooks/use-locale/index.mjs';
|
|
11
|
-
import { debugWarn } from '../../../utils/error.mjs';
|
|
2
|
+
import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
|
|
12
3
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const props = __props;
|
|
21
|
-
const COMPONENT_NAME = "PsCalendar";
|
|
22
|
-
const ns = useNamespace("calendar");
|
|
23
|
-
const { t, lang } = useLocale();
|
|
24
|
-
const selectedDay = ref();
|
|
25
|
-
const now = dayjs().locale(lang.value);
|
|
26
|
-
const i18nDate = computed(() => {
|
|
27
|
-
const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
|
|
28
|
-
return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
|
|
29
|
-
});
|
|
30
|
-
const realSelectedDay = computed({
|
|
31
|
-
get() {
|
|
32
|
-
if (!props.modelValue)
|
|
33
|
-
return selectedDay.value;
|
|
34
|
-
return date.value;
|
|
35
|
-
},
|
|
36
|
-
set(val) {
|
|
37
|
-
if (!val)
|
|
38
|
-
return;
|
|
39
|
-
selectedDay.value = val;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
const date = computed(() => {
|
|
43
|
-
if (!props.modelValue) {
|
|
44
|
-
if (realSelectedDay.value) {
|
|
45
|
-
return realSelectedDay.value;
|
|
46
|
-
} else if (validatedRange.value.length) {
|
|
47
|
-
return validatedRange.value[0][0];
|
|
48
|
-
}
|
|
49
|
-
return now;
|
|
50
|
-
} else {
|
|
51
|
-
return dayjs(props.modelValue).locale(lang.value);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
const calculateValidatedDateRange = (startDayjs, endDayjs) => {
|
|
55
|
-
const firstDay = startDayjs.startOf("week");
|
|
56
|
-
const lastDay = endDayjs.endOf("week");
|
|
57
|
-
const firstMonth = firstDay.get("month");
|
|
58
|
-
const lastMonth = lastDay.get("month");
|
|
59
|
-
if (firstMonth === lastMonth) {
|
|
60
|
-
return [[firstDay, lastDay]];
|
|
61
|
-
} else if (firstMonth + 1 === lastMonth) {
|
|
62
|
-
const firstMonthLastDay = firstDay.endOf("month");
|
|
63
|
-
const lastMonthFirstDay = lastDay.startOf("month");
|
|
64
|
-
const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
|
|
65
|
-
const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
|
|
66
|
-
return [
|
|
67
|
-
[firstDay, firstMonthLastDay],
|
|
68
|
-
[lastMonthStartDay.startOf("week"), lastDay]
|
|
69
|
-
];
|
|
70
|
-
} else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
|
|
71
|
-
const firstMonthLastDay = firstDay.endOf("month");
|
|
72
|
-
const secondMonthFirstDay = firstDay.add(1, "month").startOf("month");
|
|
73
|
-
const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
|
|
74
|
-
const secondMonthLastDay = secondMonthStartDay.endOf("month");
|
|
75
|
-
const lastMonthFirstDay = lastDay.startOf("month");
|
|
76
|
-
const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
|
|
77
|
-
return [
|
|
78
|
-
[firstDay, firstMonthLastDay],
|
|
79
|
-
[secondMonthStartDay.startOf("week"), secondMonthLastDay],
|
|
80
|
-
[lastMonthStartDay.startOf("week"), lastDay]
|
|
81
|
-
];
|
|
82
|
-
} else {
|
|
83
|
-
debugWarn(COMPONENT_NAME, "start time and end time interval must not exceed two months");
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const validatedRange = computed(() => {
|
|
88
|
-
if (!props.range)
|
|
89
|
-
return [];
|
|
90
|
-
const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
|
|
91
|
-
const [startDayjs, endDayjs] = rangeArrDayjs;
|
|
92
|
-
if (startDayjs.isAfter(endDayjs)) {
|
|
93
|
-
debugWarn(COMPONENT_NAME, "end time should be greater than start time");
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
if (startDayjs.isSame(endDayjs, "month")) {
|
|
97
|
-
return calculateValidatedDateRange(startDayjs, endDayjs);
|
|
98
|
-
} else {
|
|
99
|
-
if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
|
|
100
|
-
debugWarn(COMPONENT_NAME, "start time and end time interval must not exceed two months");
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
return calculateValidatedDateRange(startDayjs, endDayjs);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
expose({
|
|
107
|
-
selectedDay: realSelectedDay,
|
|
108
|
-
calculateValidatedDateRange
|
|
109
|
-
});
|
|
110
|
-
return (_ctx, _cache) => {
|
|
111
|
-
return openBlock(), createElementBlock("div", {
|
|
112
|
-
class: normalizeClass(unref(ns).b())
|
|
113
|
-
}, [
|
|
114
|
-
createElementVNode("div", {
|
|
115
|
-
class: normalizeClass(unref(ns).e("header"))
|
|
116
|
-
}, [
|
|
117
|
-
renderSlot(_ctx.$slots, "header", { date: unref(i18nDate) }, () => [
|
|
118
|
-
createElementVNode("div", {
|
|
119
|
-
class: normalizeClass(unref(ns).e("title"))
|
|
120
|
-
}, toDisplayString(unref(i18nDate)), 3),
|
|
121
|
-
unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
|
|
122
|
-
key: 0,
|
|
123
|
-
class: normalizeClass(unref(ns).e("button-group"))
|
|
124
|
-
}, [
|
|
125
|
-
createVNode(unref(PsButtonGroup), null, {
|
|
126
|
-
default: withCtx(() => [
|
|
127
|
-
createVNode(unref(PsButton), { size: "small" }, {
|
|
128
|
-
default: withCtx(() => [
|
|
129
|
-
createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)
|
|
130
|
-
]),
|
|
131
|
-
_: 1
|
|
132
|
-
}),
|
|
133
|
-
createVNode(unref(PsButton), { size: "small" }, {
|
|
134
|
-
default: withCtx(() => [
|
|
135
|
-
createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)
|
|
136
|
-
]),
|
|
137
|
-
_: 1
|
|
138
|
-
}),
|
|
139
|
-
createVNode(unref(PsButton), { size: "small" }, {
|
|
140
|
-
default: withCtx(() => [
|
|
141
|
-
createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)
|
|
142
|
-
]),
|
|
143
|
-
_: 1
|
|
144
|
-
})
|
|
145
|
-
]),
|
|
146
|
-
_: 1
|
|
147
|
-
})
|
|
148
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
149
|
-
])
|
|
150
|
-
], 2),
|
|
151
|
-
unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
|
|
152
|
-
key: 0,
|
|
153
|
-
class: normalizeClass(unref(ns).e("body"))
|
|
154
|
-
}, [
|
|
155
|
-
createVNode(DateTable, {
|
|
156
|
-
date: unref(date),
|
|
157
|
-
"selected-day": unref(realSelectedDay)
|
|
158
|
-
}, createSlots({ _: 2 }, [
|
|
159
|
-
_ctx.$slots.dateCell ? {
|
|
160
|
-
name: "dateCell",
|
|
161
|
-
fn: withCtx((data) => [
|
|
162
|
-
renderSlot(_ctx.$slots, "dateCell", normalizeProps(guardReactiveProps(data)))
|
|
163
|
-
])
|
|
164
|
-
} : void 0
|
|
165
|
-
]), 1032, ["date", "selected-day"])
|
|
166
|
-
], 2)) : (openBlock(), createElementBlock("div", {
|
|
167
|
-
key: 1,
|
|
168
|
-
class: normalizeClass(unref(ns).e("body"))
|
|
169
|
-
}, [
|
|
170
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index) => {
|
|
171
|
-
return openBlock(), createBlock(DateTable, {
|
|
172
|
-
key: index,
|
|
173
|
-
date: range_[0],
|
|
174
|
-
"selected-day": unref(realSelectedDay),
|
|
175
|
-
range: range_,
|
|
176
|
-
"hide-header": index !== 0
|
|
177
|
-
}, createSlots({ _: 2 }, [
|
|
178
|
-
_ctx.$slots.dateCell ? {
|
|
179
|
-
name: "dateCell",
|
|
180
|
-
fn: withCtx((data) => [
|
|
181
|
-
renderSlot(_ctx.$slots, "dateCell", normalizeProps(guardReactiveProps(data)))
|
|
182
|
-
])
|
|
183
|
-
} : void 0
|
|
184
|
-
]), 1032, ["date", "selected-day", "range", "hide-header"]);
|
|
185
|
-
}), 128))
|
|
186
|
-
], 2))
|
|
187
|
-
], 2);
|
|
188
|
-
};
|
|
4
|
+
const calendarProps = buildProps({
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: Date
|
|
7
|
+
},
|
|
8
|
+
range: {
|
|
9
|
+
type: definePropType(Array),
|
|
10
|
+
validator: (range) => Array.isArray(range) && range.length === 2 && range.every((item) => item instanceof Date)
|
|
189
11
|
}
|
|
190
12
|
});
|
|
191
|
-
var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/calendar/src/calendar.vue"]]);
|
|
192
13
|
|
|
193
|
-
export {
|
|
14
|
+
export { calendarProps };
|
|
194
15
|
//# sourceMappingURL=calendar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.mjs","sources":["../../../../../../packages/components/calendar/src/calendar.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div :class=\"ns.e('header')\">\n <slot name=\"header\" :date=\"i18nDate\">\n <div :class=\"ns.e('title')\">{{ i18nDate }}</div>\n <div v-if=\"validatedRange.length === 0\" :class=\"ns.e('button-group')\">\n <ps-button-group>\n <ps-button size=\"small\">\n {{ t('el.datepicker.prevMonth') }}\n </ps-button>\n <ps-button size=\"small\">\n {{ t('el.datepicker.today') }}\n </ps-button>\n <ps-button size=\"small\">\n {{ t('el.datepicker.nextMonth') }}\n </ps-button>\n </ps-button-group>\n </div>\n </slot>\n </div>\n <div v-if=\"validatedRange.length === 0\" :class=\"ns.e('body')\">\n <date-table :date=\"date\" :selected-day=\"realSelectedDay\">\n <template v-if=\"$slots.dateCell\" #dateCell=\"data\">\n <slot name=\"dateCell\" v-bind=\"data\" />\n </template>\n </date-table>\n </div>\n <div v-else :class=\"ns.e('body')\">\n <date-table\n v-for=\"(range_, index) in validatedRange\"\n :key=\"index\"\n :date=\"range_[0]\"\n :selected-day=\"realSelectedDay\"\n :range=\"range_\"\n :hide-header=\"index !== 0\"\n >\n <template v-if=\"$slots.dateCell\" #dateCell=\"data\">\n <slot name=\"dateCell\" v-bind=\"data\" />\n </template>\n </date-table>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue'\nimport dayjs from 'dayjs'\nimport { PsButton, PsButtonGroup } from '@element-ps/components/button'\nimport { useLocale, useNamespace } from '@element-ps/hooks'\nimport { debugWarn } from '@element-ps/utils'\nimport DateTable from './date-table.vue'\nimport { calendarProps } from './calendar'\n\nimport type { ComputedRef } from 'vue'\nimport type { Dayjs } from 'dayjs'\n\nconst COMPONENT_NAME = 'PsCalendar'\n\ndefineOptions({\n name: 'PsCalendar',\n})\n\nconst props = defineProps(calendarProps)\n\nconst ns = useNamespace('calendar')\n\nconst { t, lang } = useLocale()\nconst selectedDay = ref<Dayjs>()\nconst now = dayjs().locale(lang.value)\n\nconst i18nDate = computed(() => {\n const pickedMonth = `el.datepicker.month${date.value.format('M')}`\n return `${date.value.year()} ${t('el.datepicker.year')} ${t(pickedMonth)}`\n})\n\nconst realSelectedDay = computed<Dayjs | undefined>({\n get() {\n if (!props.modelValue) return selectedDay.value\n return date.value\n },\n set(val) {\n if (!val) return\n selectedDay.value = val\n },\n})\n\nconst date: ComputedRef<Dayjs> = computed(() => {\n if (!props.modelValue) {\n if (realSelectedDay.value) {\n return realSelectedDay.value\n } else if (validatedRange.value.length) {\n return validatedRange.value[0][0]\n }\n return now\n } else {\n return dayjs(props.modelValue).locale(lang.value)\n }\n})\n\n// https://github.com/element-ps/element-ps/issues/3155\n// Calculate the validate date range according to the start and end dates\nconst calculateValidatedDateRange = (\n startDayjs: Dayjs,\n endDayjs: Dayjs\n): [Dayjs, Dayjs][] => {\n const firstDay = startDayjs.startOf('week')\n const lastDay = endDayjs.endOf('week')\n const firstMonth = firstDay.get('month')\n const lastMonth = lastDay.get('month')\n\n // Current mouth\n if (firstMonth === lastMonth) {\n return [[firstDay, lastDay]]\n }\n // Two adjacent months\n else if (firstMonth + 1 === lastMonth) {\n const firstMonthLastDay = firstDay.endOf('month')\n const lastMonthFirstDay = lastDay.startOf('month')\n\n // Whether the last day of the first month and the first day of the last month is in the same week\n const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, 'week')\n const lastMonthStartDay = isSameWeek\n ? lastMonthFirstDay.add(1, 'week')\n : lastMonthFirstDay\n\n return [\n [firstDay, firstMonthLastDay],\n [lastMonthStartDay.startOf('week'), lastDay],\n ]\n }\n // Three consecutive months (compatible: 2021-01-30 to 2021-02-28)\n else if (\n firstMonth + 2 === lastMonth ||\n (firstMonth + 1) % 11 === lastMonth\n ) {\n const firstMonthLastDay = firstDay.endOf('month')\n const secondMonthFirstDay = firstDay.add(1, 'month').startOf('month')\n\n // Whether the last day of the first month and the second month is in the same week\n const secondMonthStartDay = firstMonthLastDay.isSame(\n secondMonthFirstDay,\n 'week'\n )\n ? secondMonthFirstDay.add(1, 'week')\n : secondMonthFirstDay\n\n const secondMonthLastDay = secondMonthStartDay.endOf('month')\n const lastMonthFirstDay = lastDay.startOf('month')\n\n // Whether the last day of the second month and the last day of the last month is in the same week\n const lastMonthStartDay = secondMonthLastDay.isSame(\n lastMonthFirstDay,\n 'week'\n )\n ? lastMonthFirstDay.add(1, 'week')\n : lastMonthFirstDay\n\n return [\n [firstDay, firstMonthLastDay],\n [secondMonthStartDay.startOf('week'), secondMonthLastDay],\n [lastMonthStartDay.startOf('week'), lastDay],\n ]\n }\n // Other cases\n else {\n debugWarn(\n COMPONENT_NAME,\n 'start time and end time interval must not exceed two months'\n )\n return []\n }\n}\n\n// if range is valid, we get a two-digit array\nconst validatedRange = computed(() => {\n if (!props.range) return []\n const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value))\n const [startDayjs, endDayjs] = rangeArrDayjs\n if (startDayjs.isAfter(endDayjs)) {\n debugWarn(COMPONENT_NAME, 'end time should be greater than start time')\n return []\n }\n if (startDayjs.isSame(endDayjs, 'month')) {\n // same month\n return calculateValidatedDateRange(startDayjs, endDayjs)\n } else {\n // two months\n if (startDayjs.add(1, 'month').month() !== endDayjs.month()) {\n debugWarn(\n COMPONENT_NAME,\n 'start time and end time interval must not exceed two months'\n )\n return []\n }\n return calculateValidatedDateRange(startDayjs, endDayjs)\n }\n})\n\ndefineExpose({\n /** @description currently selected date */\n selectedDay: realSelectedDay,\n /** @description Calculate the validate date range according to the start and end dates */\n calculateValidatedDateRange,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAwDA,IAAA,MAAA,cAAA,GAAA,YAAA,CAAA;AAQA,IAAA,MAAA,EAAA,GAAA,aAAA,UAAA,CAAA,CAAA;AAEA,IAAA,MAAA,EAAA,CAAA,EAAA,IAAA,EAAA,GAAA,SAAA,EAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,EAAA,CAAA;AACA,IAAA,MAAA,GAAA,GAAA,KAAA,EAAA,CAAA,MAAA,CAAA,KAAA,KAAA,CAAA,CAAA;AAEA,IAAA,MAAA,QAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,WAAA,GAAA,CAAA,mBAAA,EAAA,IAAA,CAAA,KAA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AAA,EAAA,KAAA,EAAA,KAAA,QAAA,CAAA,KAAA,EAAA,EAAA;AACA,UAAA,SAAA,CACA,gBACA,6DACA,CAAA,CAAA;AACA,UAAA,OAAA,EAAA,CAAA;AAAA,SACA;AACA,QAAA,OAAA,2BAAA,CAAA,YAAA,QAAA,CAAA,CAAA;AAAA,OACA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,CAAA;AAAA,MAEA,WAAA,EAAA,eAAA;AAAA,MAEA,2BAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"calendar.mjs","sources":["../../../../../../packages/components/calendar/src/calendar.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-ps/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type Calendar from './calendar.vue'\n\nexport type CalendarDateType =\n | 'prev-month'\n | 'next-month'\n | 'prev-year'\n | 'next-year'\n | 'today'\n\nexport const calendarProps = buildProps({\n modelValue: {\n type: Date,\n },\n range: {\n type: definePropType<[Date, Date]>(Array),\n validator: (range: unknown): range is [Date, Date] =>\n Array.isArray(range) &&\n range.length === 2 &&\n range.every((item) => item instanceof Date),\n },\n} as const)\nexport type CalendarProps = ExtractPropTypes<typeof calendarProps>\n\nexport type CalendarInstance = InstanceType<typeof Calendar>\n"],"names":[],"mappings":";;;AACY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,IAAI;AACd,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,SAAS,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,YAAY,IAAI,CAAC;AACnH,GAAG;AACH,CAAC;;;;"}
|