@thinkpixellab-public/px-vue 3.0.1
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 +14 -0
- package/.prettierrc.js +10 -0
- package/LICENSE.md +9 -0
- package/README.md +83 -0
- package/assets/feather/activity.svg +1 -0
- package/assets/feather/airplay.svg +1 -0
- package/assets/feather/alert-circle.svg +1 -0
- package/assets/feather/alert-octagon.svg +1 -0
- package/assets/feather/alert-triangle.svg +1 -0
- package/assets/feather/align-center.svg +1 -0
- package/assets/feather/align-justify.svg +1 -0
- package/assets/feather/align-left.svg +1 -0
- package/assets/feather/align-right.svg +1 -0
- package/assets/feather/anchor.svg +1 -0
- package/assets/feather/aperture.svg +1 -0
- package/assets/feather/archive.svg +1 -0
- package/assets/feather/arrow-down-circle.svg +1 -0
- package/assets/feather/arrow-down-left.svg +1 -0
- package/assets/feather/arrow-down-right.svg +1 -0
- package/assets/feather/arrow-down.svg +1 -0
- package/assets/feather/arrow-left-circle.svg +1 -0
- package/assets/feather/arrow-left.svg +1 -0
- package/assets/feather/arrow-right-circle.svg +1 -0
- package/assets/feather/arrow-right.svg +1 -0
- package/assets/feather/arrow-up-circle.svg +1 -0
- package/assets/feather/arrow-up-left.svg +1 -0
- package/assets/feather/arrow-up-right.svg +1 -0
- package/assets/feather/arrow-up.svg +1 -0
- package/assets/feather/at-sign.svg +1 -0
- package/assets/feather/award.svg +1 -0
- package/assets/feather/bar-chart-2.svg +1 -0
- package/assets/feather/bar-chart.svg +1 -0
- package/assets/feather/battery-charging.svg +1 -0
- package/assets/feather/battery.svg +1 -0
- package/assets/feather/bell-off.svg +1 -0
- package/assets/feather/bell.svg +1 -0
- package/assets/feather/bluetooth.svg +1 -0
- package/assets/feather/bold.svg +1 -0
- package/assets/feather/book-open.svg +1 -0
- package/assets/feather/book.svg +1 -0
- package/assets/feather/bookmark.svg +1 -0
- package/assets/feather/box.svg +1 -0
- package/assets/feather/briefcase.svg +1 -0
- package/assets/feather/calendar.svg +1 -0
- package/assets/feather/camera-off.svg +1 -0
- package/assets/feather/camera.svg +1 -0
- package/assets/feather/cast.svg +1 -0
- package/assets/feather/check-circle.svg +1 -0
- package/assets/feather/check-square.svg +1 -0
- package/assets/feather/check.svg +1 -0
- package/assets/feather/chevron-down.svg +1 -0
- package/assets/feather/chevron-left.svg +1 -0
- package/assets/feather/chevron-right.svg +1 -0
- package/assets/feather/chevron-up.svg +1 -0
- package/assets/feather/chevrons-down.svg +1 -0
- package/assets/feather/chevrons-left.svg +1 -0
- package/assets/feather/chevrons-right.svg +1 -0
- package/assets/feather/chevrons-up.svg +1 -0
- package/assets/feather/chrome.svg +1 -0
- package/assets/feather/circle.svg +1 -0
- package/assets/feather/clipboard.svg +1 -0
- package/assets/feather/clock.svg +1 -0
- package/assets/feather/cloud-drizzle.svg +1 -0
- package/assets/feather/cloud-lightning.svg +1 -0
- package/assets/feather/cloud-off.svg +1 -0
- package/assets/feather/cloud-rain.svg +1 -0
- package/assets/feather/cloud-snow.svg +1 -0
- package/assets/feather/cloud.svg +1 -0
- package/assets/feather/code.svg +1 -0
- package/assets/feather/codepen.svg +1 -0
- package/assets/feather/codesandbox.svg +1 -0
- package/assets/feather/coffee.svg +1 -0
- package/assets/feather/columns.svg +1 -0
- package/assets/feather/command.svg +1 -0
- package/assets/feather/compass.svg +1 -0
- package/assets/feather/copy.svg +1 -0
- package/assets/feather/corner-down-left.svg +1 -0
- package/assets/feather/corner-down-right.svg +1 -0
- package/assets/feather/corner-left-down.svg +1 -0
- package/assets/feather/corner-left-up.svg +1 -0
- package/assets/feather/corner-right-down.svg +1 -0
- package/assets/feather/corner-right-up.svg +1 -0
- package/assets/feather/corner-up-left.svg +1 -0
- package/assets/feather/corner-up-right.svg +1 -0
- package/assets/feather/cpu.svg +1 -0
- package/assets/feather/credit-card.svg +1 -0
- package/assets/feather/crop.svg +1 -0
- package/assets/feather/crosshair.svg +1 -0
- package/assets/feather/database.svg +1 -0
- package/assets/feather/delete.svg +1 -0
- package/assets/feather/disc.svg +1 -0
- package/assets/feather/divide-circle.svg +1 -0
- package/assets/feather/divide-square.svg +1 -0
- package/assets/feather/divide.svg +1 -0
- package/assets/feather/dollar-sign.svg +1 -0
- package/assets/feather/download-cloud.svg +1 -0
- package/assets/feather/download.svg +1 -0
- package/assets/feather/dribbble.svg +1 -0
- package/assets/feather/droplet.svg +1 -0
- package/assets/feather/edit-2.svg +1 -0
- package/assets/feather/edit-3.svg +1 -0
- package/assets/feather/edit.svg +1 -0
- package/assets/feather/external-link.svg +1 -0
- package/assets/feather/eye-off.svg +1 -0
- package/assets/feather/eye.svg +1 -0
- package/assets/feather/facebook.svg +1 -0
- package/assets/feather/fast-forward.svg +1 -0
- package/assets/feather/feather.svg +1 -0
- package/assets/feather/figma.svg +1 -0
- package/assets/feather/file-minus.svg +1 -0
- package/assets/feather/file-plus.svg +1 -0
- package/assets/feather/file-text.svg +1 -0
- package/assets/feather/file.svg +1 -0
- package/assets/feather/film.svg +1 -0
- package/assets/feather/filter.svg +1 -0
- package/assets/feather/flag.svg +1 -0
- package/assets/feather/folder-minus.svg +1 -0
- package/assets/feather/folder-plus.svg +1 -0
- package/assets/feather/folder.svg +1 -0
- package/assets/feather/framer.svg +1 -0
- package/assets/feather/frown.svg +1 -0
- package/assets/feather/gift.svg +1 -0
- package/assets/feather/git-branch.svg +1 -0
- package/assets/feather/git-commit.svg +1 -0
- package/assets/feather/git-merge.svg +1 -0
- package/assets/feather/git-pull-request.svg +1 -0
- package/assets/feather/github.svg +1 -0
- package/assets/feather/gitlab.svg +1 -0
- package/assets/feather/globe.svg +1 -0
- package/assets/feather/grid.svg +1 -0
- package/assets/feather/hard-drive.svg +1 -0
- package/assets/feather/hash.svg +1 -0
- package/assets/feather/headphones.svg +1 -0
- package/assets/feather/heart.svg +1 -0
- package/assets/feather/help-circle.svg +1 -0
- package/assets/feather/hexagon.svg +1 -0
- package/assets/feather/home.svg +1 -0
- package/assets/feather/image.svg +1 -0
- package/assets/feather/inbox.svg +1 -0
- package/assets/feather/info.svg +1 -0
- package/assets/feather/instagram.svg +1 -0
- package/assets/feather/italic.svg +1 -0
- package/assets/feather/key.svg +1 -0
- package/assets/feather/layers.svg +1 -0
- package/assets/feather/layout.svg +1 -0
- package/assets/feather/life-buoy.svg +1 -0
- package/assets/feather/link-2.svg +1 -0
- package/assets/feather/link.svg +1 -0
- package/assets/feather/linkedin.svg +1 -0
- package/assets/feather/list.svg +1 -0
- package/assets/feather/loader.svg +1 -0
- package/assets/feather/lock.svg +1 -0
- package/assets/feather/log-in.svg +1 -0
- package/assets/feather/log-out.svg +1 -0
- package/assets/feather/mail.svg +1 -0
- package/assets/feather/map-pin.svg +1 -0
- package/assets/feather/map.svg +1 -0
- package/assets/feather/maximize-2.svg +1 -0
- package/assets/feather/maximize.svg +1 -0
- package/assets/feather/meh.svg +1 -0
- package/assets/feather/menu.svg +1 -0
- package/assets/feather/message-circle.svg +1 -0
- package/assets/feather/message-square.svg +1 -0
- package/assets/feather/mic-off.svg +1 -0
- package/assets/feather/mic.svg +1 -0
- package/assets/feather/minimize-2.svg +1 -0
- package/assets/feather/minimize.svg +1 -0
- package/assets/feather/minus-circle.svg +1 -0
- package/assets/feather/minus-square.svg +1 -0
- package/assets/feather/minus.svg +1 -0
- package/assets/feather/monitor.svg +1 -0
- package/assets/feather/moon.svg +1 -0
- package/assets/feather/more-horizontal.svg +1 -0
- package/assets/feather/more-vertical.svg +1 -0
- package/assets/feather/mouse-pointer.svg +1 -0
- package/assets/feather/move.svg +1 -0
- package/assets/feather/music.svg +1 -0
- package/assets/feather/navigation-2.svg +1 -0
- package/assets/feather/navigation.svg +1 -0
- package/assets/feather/octagon.svg +1 -0
- package/assets/feather/package.svg +1 -0
- package/assets/feather/paperclip.svg +1 -0
- package/assets/feather/pause-circle.svg +1 -0
- package/assets/feather/pause.svg +1 -0
- package/assets/feather/pen-tool.svg +1 -0
- package/assets/feather/percent.svg +1 -0
- package/assets/feather/phone-call.svg +1 -0
- package/assets/feather/phone-forwarded.svg +1 -0
- package/assets/feather/phone-incoming.svg +1 -0
- package/assets/feather/phone-missed.svg +1 -0
- package/assets/feather/phone-off.svg +1 -0
- package/assets/feather/phone-outgoing.svg +1 -0
- package/assets/feather/phone.svg +1 -0
- package/assets/feather/pie-chart.svg +1 -0
- package/assets/feather/play-circle.svg +1 -0
- package/assets/feather/play.svg +1 -0
- package/assets/feather/plus-circle.svg +1 -0
- package/assets/feather/plus-square.svg +1 -0
- package/assets/feather/plus.svg +1 -0
- package/assets/feather/pocket.svg +1 -0
- package/assets/feather/power.svg +1 -0
- package/assets/feather/printer.svg +1 -0
- package/assets/feather/radio.svg +1 -0
- package/assets/feather/refresh-ccw.svg +1 -0
- package/assets/feather/refresh-cw.svg +1 -0
- package/assets/feather/repeat.svg +1 -0
- package/assets/feather/rewind.svg +1 -0
- package/assets/feather/rotate-ccw.svg +1 -0
- package/assets/feather/rotate-cw.svg +1 -0
- package/assets/feather/rss.svg +1 -0
- package/assets/feather/save.svg +1 -0
- package/assets/feather/scissors.svg +1 -0
- package/assets/feather/search.svg +1 -0
- package/assets/feather/send.svg +1 -0
- package/assets/feather/server.svg +1 -0
- package/assets/feather/settings.svg +1 -0
- package/assets/feather/share-2.svg +1 -0
- package/assets/feather/share.svg +1 -0
- package/assets/feather/shield-off.svg +1 -0
- package/assets/feather/shield.svg +1 -0
- package/assets/feather/shopping-bag.svg +1 -0
- package/assets/feather/shopping-cart.svg +1 -0
- package/assets/feather/shuffle.svg +1 -0
- package/assets/feather/sidebar.svg +1 -0
- package/assets/feather/skip-back.svg +1 -0
- package/assets/feather/skip-forward.svg +1 -0
- package/assets/feather/slack.svg +1 -0
- package/assets/feather/slash.svg +1 -0
- package/assets/feather/sliders.svg +1 -0
- package/assets/feather/smartphone.svg +1 -0
- package/assets/feather/smile.svg +1 -0
- package/assets/feather/speaker.svg +1 -0
- package/assets/feather/square.svg +1 -0
- package/assets/feather/star.svg +1 -0
- package/assets/feather/stop-circle.svg +1 -0
- package/assets/feather/sun.svg +1 -0
- package/assets/feather/sunrise.svg +1 -0
- package/assets/feather/sunset.svg +1 -0
- package/assets/feather/table.svg +1 -0
- package/assets/feather/tablet.svg +1 -0
- package/assets/feather/tag.svg +1 -0
- package/assets/feather/target.svg +1 -0
- package/assets/feather/terminal.svg +1 -0
- package/assets/feather/thermometer.svg +1 -0
- package/assets/feather/thumbs-down.svg +1 -0
- package/assets/feather/thumbs-up.svg +1 -0
- package/assets/feather/toggle-left.svg +1 -0
- package/assets/feather/toggle-right.svg +1 -0
- package/assets/feather/tool.svg +1 -0
- package/assets/feather/trash-2.svg +1 -0
- package/assets/feather/trash.svg +1 -0
- package/assets/feather/trello.svg +1 -0
- package/assets/feather/trending-down.svg +1 -0
- package/assets/feather/trending-up.svg +1 -0
- package/assets/feather/triangle.svg +1 -0
- package/assets/feather/truck.svg +1 -0
- package/assets/feather/tv.svg +1 -0
- package/assets/feather/twitch.svg +1 -0
- package/assets/feather/twitter.svg +1 -0
- package/assets/feather/type.svg +1 -0
- package/assets/feather/umbrella.svg +1 -0
- package/assets/feather/underline.svg +1 -0
- package/assets/feather/unlock.svg +1 -0
- package/assets/feather/upload-cloud.svg +1 -0
- package/assets/feather/upload.svg +1 -0
- package/assets/feather/user-check.svg +1 -0
- package/assets/feather/user-minus.svg +1 -0
- package/assets/feather/user-plus.svg +1 -0
- package/assets/feather/user-x.svg +1 -0
- package/assets/feather/user.svg +1 -0
- package/assets/feather/users.svg +1 -0
- package/assets/feather/video-off.svg +1 -0
- package/assets/feather/video.svg +1 -0
- package/assets/feather/voicemail.svg +1 -0
- package/assets/feather/volume-1.svg +1 -0
- package/assets/feather/volume-2.svg +1 -0
- package/assets/feather/volume-x.svg +1 -0
- package/assets/feather/volume.svg +1 -0
- package/assets/feather/watch.svg +1 -0
- package/assets/feather/wifi-off.svg +1 -0
- package/assets/feather/wifi.svg +1 -0
- package/assets/feather/wind.svg +1 -0
- package/assets/feather/x-circle.svg +1 -0
- package/assets/feather/x-octagon.svg +1 -0
- package/assets/feather/x-square.svg +1 -0
- package/assets/feather/x.svg +1 -0
- package/assets/feather/youtube.svg +1 -0
- package/assets/feather/zap-off.svg +1 -0
- package/assets/feather/zap.svg +1 -0
- package/assets/feather/zoom-in.svg +1 -0
- package/assets/feather/zoom-out.svg +1 -0
- package/assets/icons/calendar.svg +6 -0
- package/assets/icons/check.svg +1 -0
- package/assets/icons/close-sm.svg +1 -0
- package/assets/icons/close.svg +1 -0
- package/assets/icons/copy.svg +1 -0
- package/assets/icons/dropdown.svg +8 -0
- package/assets/icons/invalid.svg +1 -0
- package/assets/icons/menu.svg +1 -0
- package/assets/icons/nav-next.svg +1 -0
- package/assets/icons/nav-prev.svg +1 -0
- package/assets/icons/sort-asc.svg +1 -0
- package/assets/icons/sort-desc.svg +1 -0
- package/assets/test/README.md +1 -0
- package/assets/test/trash.svg +8 -0
- package/babel.config.js +16 -0
- package/components/PxAspect.vue +127 -0
- package/components/PxAutoClamp.vue +75 -0
- package/components/PxBalancedText.vue +118 -0
- package/components/PxBase.vue +15 -0
- package/components/PxBaseDate.vue +27 -0
- package/components/PxBaseItems.vue +72 -0
- package/components/PxBaseItemsSelect.vue +230 -0
- package/components/PxBaseResize.vue +60 -0
- package/components/PxBaseToggle.vue +56 -0
- package/components/PxBaseVariants.vue +62 -0
- package/components/PxBaseVisible.vue +40 -0
- package/components/PxCalendar.vue +385 -0
- package/components/PxCard.vue +47 -0
- package/components/PxCardGrid.vue +386 -0
- package/components/PxClock.vue +510 -0
- package/components/PxCopyText.vue +78 -0
- package/components/PxDatePicker.vue +249 -0
- package/components/PxDropdown.vue +181 -0
- package/components/PxExpander.vue +46 -0
- package/components/PxFeatherIcon.vue +29 -0
- package/components/PxFeatherIconButton.vue +19 -0
- package/components/PxFit.vue +274 -0
- package/components/PxFlex.vue +93 -0
- package/components/PxFloat.vue +32 -0
- package/components/PxIcon.vue +43 -0
- package/components/PxIconButton.vue +115 -0
- package/components/PxIdUniquer.vue +59 -0
- package/components/PxModal.vue +365 -0
- package/components/PxNineGrid.vue +94 -0
- package/components/PxPivot.vue +207 -0
- package/components/PxPopup.vue +230 -0
- package/components/PxPortal.vue +138 -0
- package/components/PxPortalTarget.vue +25 -0
- package/components/PxProgressCircle.vue +73 -0
- package/components/PxRadioButton.vue +83 -0
- package/components/PxSideDrawer.vue +164 -0
- package/components/PxSlideTransition.vue +116 -0
- package/components/PxSlides.vue +217 -0
- package/components/PxStylesPreview.vue +129 -0
- package/components/PxSvg.vue +157 -0
- package/components/PxSwiper.vue +271 -0
- package/components/PxSwiperSlide.vue +42 -0
- package/components/PxSyncHeight.vue +137 -0
- package/components/PxTable.vue +323 -0
- package/components/PxTabs.vue +1 -0
- package/components/PxTextbox.vue +90 -0
- package/components/PxToggle.vue +125 -0
- package/components/PxToggleButton.vue +139 -0
- package/components/PxToggleButtonList.vue +131 -0
- package/components/PxTransitionExpand.vue +100 -0
- package/components/PxValidator.vue +431 -0
- package/components/PxVueTest.vue +761 -0
- package/components/README.md +0 -0
- package/dev/data/fruits.js +59 -0
- package/dev/data/random.js +13 -0
- package/dev/demos/Demo-PxBaseDrag.vue +94 -0
- package/dev/demos/Demo-PxCardGrid.vue +53 -0
- package/dev/demos/Demo-PxPivot.vue +58 -0
- package/dev/demos/Demo-PxSideDrawer.vue +72 -0
- package/dev/demos/Demo-PxSlideTransition.vue +86 -0
- package/dev/demos/Demo-PxSlides.vue +142 -0
- package/dev/demos/Demo-PxStylesPreview.vue +46 -0
- package/dev/demos/Demo-PxSwiper.vue +44 -0
- package/dev/demos/DemoPicker.vue +79 -0
- package/dev/dev.vue +56 -0
- package/dev/serve.js +17 -0
- package/package.json +45 -0
- package/plugins/common-client.js +13 -0
- package/plugins/common-lib.js +4 -0
- package/plugins/common.js +39 -0
- package/plugins/filters/aspect.js +14 -0
- package/plugins/filters/date.js +26 -0
- package/plugins/filters/kebab.js +9 -0
- package/plugins/filters/phone.js +7 -0
- package/plugins/filters/slug.js +26 -0
- package/plugins/filters/spacenator.js +11 -0
- package/plugins/filters/stringToItems.js +28 -0
- package/plugins/filters/striphtml.js +10 -0
- package/plugins/mixins/eventBus.js +23 -0
- package/px-styles.config.scss +12 -0
- package/styles/helpers.scss +14 -0
- package/styles/px.scss +6 -0
- package/utils/balanceText.js +123 -0
- package/utils/bem.js +99 -0
- package/utils/cardGrid.js +383 -0
- package/utils/cssStr.js +45 -0
- package/utils/drag.js +363 -0
- package/utils/fit.js +73 -0
- package/utils/tween.js +129 -0
- package/utils/utils.js +167 -0
- package/utils/variants.js +33 -0
- package/vue.config.js +12 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Complete date picker with optional modes for button and textbox input.
|
|
3
|
+
|
|
4
|
+
-->
|
|
5
|
+
<template>
|
|
6
|
+
<px-popup
|
|
7
|
+
:class="bem({ mode: mode, ...variantsMap })"
|
|
8
|
+
:tag="buttonMode ? 'button' : 'div'"
|
|
9
|
+
:trigger="buttonMode ? 'click' : null"
|
|
10
|
+
:modalAttrs="modalAttrs"
|
|
11
|
+
v-bind="popupProps"
|
|
12
|
+
ref="popup"
|
|
13
|
+
>
|
|
14
|
+
<!-- button mode -->
|
|
15
|
+
<span :class="bem('button-outer')" v-if="buttonMode">
|
|
16
|
+
{{ formatDate(dateValue) || placeholder }}
|
|
17
|
+
<px-icon :class="bem('icon')" :src="icon" :size="iconSize" v-if="icon" />
|
|
18
|
+
</span>
|
|
19
|
+
|
|
20
|
+
<!-- textbox mode -->
|
|
21
|
+
<div :class="bem('textbox-outer')" v-else>
|
|
22
|
+
<px-textbox
|
|
23
|
+
ref="textbox"
|
|
24
|
+
:value="textboxValue"
|
|
25
|
+
@focus="textboxFocus"
|
|
26
|
+
@input="textboxInput"
|
|
27
|
+
@keydown="textboxKeyDown"
|
|
28
|
+
@blur="textboxBlur"
|
|
29
|
+
></px-textbox>
|
|
30
|
+
<px-icon-button
|
|
31
|
+
v-if="icon"
|
|
32
|
+
:class="bem('icon-button')"
|
|
33
|
+
ref="textboxButton"
|
|
34
|
+
variant="basic accent-hover"
|
|
35
|
+
:src="icon"
|
|
36
|
+
:size="iconSize"
|
|
37
|
+
@click="textboxButtonClick"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<template #popup>
|
|
42
|
+
<div ref="dialog" :class="bem('dialog')">
|
|
43
|
+
<px-calendar :class="bem('calendar')" v-model="dateValue" />
|
|
44
|
+
<div :class="bem('clock')" v-if="clock">
|
|
45
|
+
<px-clock v-model="dateValue" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
</px-popup>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
import * as chrono from 'chrono-node';
|
|
54
|
+
import dateFormat from 'dateformat';
|
|
55
|
+
import PxBase from './PxBase.vue';
|
|
56
|
+
import PxBaseDate from './PxBaseDate.vue';
|
|
57
|
+
import PxBaseVariants from './PxBaseVariants.vue';
|
|
58
|
+
import PxCalendar from './PxCalendar.vue';
|
|
59
|
+
import PxClock from './PxClock.vue';
|
|
60
|
+
import PxIcon from './PxIcon.vue';
|
|
61
|
+
import PxIconButton from './PxIconButton.vue';
|
|
62
|
+
import PxPopup from './PxPopup.vue';
|
|
63
|
+
import PxTextbox from './PxTextbox.vue';
|
|
64
|
+
|
|
65
|
+
export default {
|
|
66
|
+
name: 'px-date-picker',
|
|
67
|
+
mixins: [PxBase, PxBaseDate, PxBaseVariants],
|
|
68
|
+
components: { PxPopup, PxCalendar, PxClock, PxIcon, PxTextbox, PxIconButton },
|
|
69
|
+
props: {
|
|
70
|
+
// button or textbox mode
|
|
71
|
+
mode: { type: String, default: 'button' },
|
|
72
|
+
|
|
73
|
+
// whether or not to also show the time picker
|
|
74
|
+
clock: { type: Boolean, default: false },
|
|
75
|
+
|
|
76
|
+
// date format options (see https://github.com/felixge/node-dateformat#mask-options)
|
|
77
|
+
format: { type: String, default: 'auto' },
|
|
78
|
+
|
|
79
|
+
// placeholder text (shown when date is null)
|
|
80
|
+
placeholder: { type: String, default: 'Select a date...' },
|
|
81
|
+
|
|
82
|
+
// icon to be displayed in the button / textbox to indiciate this is a picker
|
|
83
|
+
icon: { type: String, default: require('../assets/icons/calendar.svg') },
|
|
84
|
+
|
|
85
|
+
// the size of the icon
|
|
86
|
+
iconSize: { default: null },
|
|
87
|
+
|
|
88
|
+
// properties that get set on the popup object (see PxPopup for details)
|
|
89
|
+
popupProps: {
|
|
90
|
+
type: Object,
|
|
91
|
+
default: () => {
|
|
92
|
+
return {
|
|
93
|
+
placement: 'bottom-start',
|
|
94
|
+
setPopupMinWidth: false,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
data() {
|
|
100
|
+
return {
|
|
101
|
+
textboxFocused: false,
|
|
102
|
+
textboxEditValue: '',
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
computed: {
|
|
106
|
+
buttonMode() {
|
|
107
|
+
return this.mode == 'button';
|
|
108
|
+
},
|
|
109
|
+
textboxMode() {
|
|
110
|
+
return !this.buttonMode;
|
|
111
|
+
},
|
|
112
|
+
showPlaceholder() {
|
|
113
|
+
return !!this.dateValue;
|
|
114
|
+
},
|
|
115
|
+
textboxValue() {
|
|
116
|
+
return this.textboxFocused ? this.textboxEditValue : this.formatDate(this.dateValue);
|
|
117
|
+
},
|
|
118
|
+
modalAttrs() {
|
|
119
|
+
return {
|
|
120
|
+
autoFocusSelector: '.dp-selected',
|
|
121
|
+
autoFocusEnabled: this.buttonMode,
|
|
122
|
+
restoreFocusEnabled: this.buttonMode,
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
methods: {
|
|
127
|
+
formatDate(date) {
|
|
128
|
+
if (date) {
|
|
129
|
+
let format = this.format;
|
|
130
|
+
if (format == 'auto') {
|
|
131
|
+
format = 'm/d/yy hh:MM tt';
|
|
132
|
+
if (!this.clock) {
|
|
133
|
+
format = 'mediumDate';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return dateFormat(date, format);
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
},
|
|
141
|
+
textboxFocus() {
|
|
142
|
+
this.textboxFocused = true;
|
|
143
|
+
this.textboxEditValue = this.formatDate(this.dateValue);
|
|
144
|
+
this.$refs.popup.openPopup();
|
|
145
|
+
},
|
|
146
|
+
textboxInput(e) {
|
|
147
|
+
this.textboxEditValue = e.target.value;
|
|
148
|
+
this.$nextTick(() => {
|
|
149
|
+
let date = chrono.parseDate(this.textboxEditValue);
|
|
150
|
+
if (date) {
|
|
151
|
+
this.dateValue = date;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
textboxKeyDown(e) {
|
|
157
|
+
if (e.key == 'Enter') {
|
|
158
|
+
if (this.dateValue) {
|
|
159
|
+
this.textboxEditValue = this.formatDate(this.dateValue);
|
|
160
|
+
this.$refs.popup.closePopup();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
textboxBlur() {
|
|
165
|
+
this.textboxFocused = false;
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
let dialogFocus = this.$refs.dialog.contains(document.activeElement);
|
|
168
|
+
if (!dialogFocus) {
|
|
169
|
+
this.$refs.popup.closePopup();
|
|
170
|
+
}
|
|
171
|
+
}, 100);
|
|
172
|
+
},
|
|
173
|
+
textboxButtonClick() {
|
|
174
|
+
this.$refs.popup.openPopup();
|
|
175
|
+
this.$refs.textbox.$el.focus();
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<style lang="scss">
|
|
182
|
+
@use '../styles/px.scss' as *;
|
|
183
|
+
|
|
184
|
+
.px-date-picker {
|
|
185
|
+
$popup: get(
|
|
186
|
+
'controls:popup',
|
|
187
|
+
(
|
|
188
|
+
background-color: clr(page-bg),
|
|
189
|
+
border-radius: get('controls:border-radius'),
|
|
190
|
+
box-shadow: shadow(15),
|
|
191
|
+
font-size: get('controls:font-size'),
|
|
192
|
+
font-family: get('controls:font-family'),
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
&__dialog {
|
|
197
|
+
@include css-map($popup);
|
|
198
|
+
display: flex;
|
|
199
|
+
overflow: hidden;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@include bem(calendar) {
|
|
203
|
+
padding: sp(2);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// "default" variant
|
|
207
|
+
|
|
208
|
+
&--default {
|
|
209
|
+
&.px-date-picker--mode-button {
|
|
210
|
+
$dropdown-button: get('controls:dropdown:button', ());
|
|
211
|
+
@include button($dropdown-button);
|
|
212
|
+
justify-content: stretch;
|
|
213
|
+
|
|
214
|
+
// placeholder
|
|
215
|
+
@include bem(placeholder) {
|
|
216
|
+
$placeholder: get('controls:dropdown:placeholder', ());
|
|
217
|
+
$placeholder: control-placeholder-style($placeholder);
|
|
218
|
+
@include css-map($placeholder);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
&__button-outer {
|
|
223
|
+
display: inline-flex;
|
|
224
|
+
justify-content: space-between;
|
|
225
|
+
flex: 1;
|
|
226
|
+
align-items: center;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
&__icon {
|
|
230
|
+
margin-left: 1em;
|
|
231
|
+
margin-right: -0.1em;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&__textbox-outer {
|
|
235
|
+
position: relative;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&__icon-button {
|
|
239
|
+
@include center-y;
|
|
240
|
+
right: 0.5em;
|
|
241
|
+
z-index: 1;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.px-date-picker__clock {
|
|
246
|
+
background-color: gray(8);
|
|
247
|
+
padding: sp(1);
|
|
248
|
+
}
|
|
249
|
+
</style>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
Default variant style keys:
|
|
4
|
+
|
|
5
|
+
- controls:dropdown:button - style for the default button (that gets clicked to open the popup)
|
|
6
|
+
- controls:dropdown:popup - style for the outer container for the popup
|
|
7
|
+
- controls:dropdown:item - style for the individual clickable items in the popup
|
|
8
|
+
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<px-popup
|
|
13
|
+
:class="bem(variantsMap)"
|
|
14
|
+
:popupClass="[bem('popup', variantsMap), popupClass]"
|
|
15
|
+
:tag="'button'"
|
|
16
|
+
:trigger="'click'"
|
|
17
|
+
v-bind="popupProps"
|
|
18
|
+
ref="popup"
|
|
19
|
+
>
|
|
20
|
+
<slot name="selected" :item="selectedItem" :label="selectedLabel">
|
|
21
|
+
<span v-if="selectedLabel">{{ selectedLabel }}</span>
|
|
22
|
+
<span v-else :class="bem('placeholder')">{{ placeholder }}</span>
|
|
23
|
+
</slot>
|
|
24
|
+
<px-icon :class="bem('icon')" :src="icon" :size="iconSize" v-if="icon" />
|
|
25
|
+
|
|
26
|
+
<template #popup>
|
|
27
|
+
<button
|
|
28
|
+
v-for="item in items"
|
|
29
|
+
:key="getItemKey(item)"
|
|
30
|
+
:class="[
|
|
31
|
+
bem('item', {
|
|
32
|
+
selected: isItemSelected(item),
|
|
33
|
+
...variantsMap,
|
|
34
|
+
}),
|
|
35
|
+
itemClass,
|
|
36
|
+
]"
|
|
37
|
+
:variant="variant"
|
|
38
|
+
@click="itemClick(item)"
|
|
39
|
+
>
|
|
40
|
+
<slot name="item" :item="item" :checked="isItemSelected(item)">
|
|
41
|
+
{{ getItemLabel(item) }}
|
|
42
|
+
</slot>
|
|
43
|
+
</button>
|
|
44
|
+
</template>
|
|
45
|
+
</px-popup>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import PxPopup from './PxPopup.vue';
|
|
50
|
+
import PxBase from './PxBase.vue';
|
|
51
|
+
import PxBaseItemsSelect from './PxBaseItemsSelect.vue';
|
|
52
|
+
import PxBaseVariants from './PxBaseVariants.vue';
|
|
53
|
+
import PxIcon from './PxIcon.vue';
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: 'px-dropdown',
|
|
57
|
+
components: { PxPopup, PxIcon },
|
|
58
|
+
mixins: [PxBase, PxBaseItemsSelect, PxBaseVariants],
|
|
59
|
+
props: {
|
|
60
|
+
value: { default: null },
|
|
61
|
+
|
|
62
|
+
// text that will be displayed by default in the selected slot when no item has been selected
|
|
63
|
+
placeholder: { type: String, default: null },
|
|
64
|
+
|
|
65
|
+
// name of icon to be displayed when the button is in a checked state
|
|
66
|
+
icon: { type: String, default: require('../assets/icons/dropdown.svg') },
|
|
67
|
+
|
|
68
|
+
// the size of the icon
|
|
69
|
+
iconSize: { default: null },
|
|
70
|
+
|
|
71
|
+
// class set on each of the generated menu items
|
|
72
|
+
itemClass: { type: String, default: null },
|
|
73
|
+
|
|
74
|
+
// class set on the popup
|
|
75
|
+
popupClass: { type: String, default: null },
|
|
76
|
+
|
|
77
|
+
// properties that get set on the popup object (see PxPopup for details)
|
|
78
|
+
popupProps: {
|
|
79
|
+
type: Object,
|
|
80
|
+
default: () => {
|
|
81
|
+
return {
|
|
82
|
+
placement: 'bottom-start',
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
computed: {
|
|
89
|
+
allowMultiSelect() {
|
|
90
|
+
return false;
|
|
91
|
+
},
|
|
92
|
+
selectedItem() {
|
|
93
|
+
if (this.syncSelected) {
|
|
94
|
+
return this.getItem(this.syncSelected);
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
},
|
|
98
|
+
selectedLabel() {
|
|
99
|
+
return this.getItemLabel(this.selectedItem);
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
mounted() {
|
|
104
|
+
this.select;
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
itemClick(item) {
|
|
108
|
+
this.selectItemOnly(item);
|
|
109
|
+
this.$refs.popup.closePopup();
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<style lang="scss">
|
|
116
|
+
@use '../styles/px.scss' as *;
|
|
117
|
+
|
|
118
|
+
.px-dropdown {
|
|
119
|
+
@include bem(icon) {
|
|
120
|
+
margin-left: 0.5em;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// popup
|
|
124
|
+
|
|
125
|
+
$dropdown-popup: flat-merge(
|
|
126
|
+
get(
|
|
127
|
+
'controls:popup',
|
|
128
|
+
(
|
|
129
|
+
display: flex,
|
|
130
|
+
flex-direction: column,
|
|
131
|
+
background-color: clr(page-bg),
|
|
132
|
+
border-radius: get('controls:border-radius'),
|
|
133
|
+
box-shadow: shadow(15),
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
&__popup {
|
|
139
|
+
@include css-map($dropdown-popup);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// "default" variant
|
|
143
|
+
|
|
144
|
+
&--default {
|
|
145
|
+
$dropdown-button: flat-merge(
|
|
146
|
+
get('controls:dropdown:button', ()),
|
|
147
|
+
(
|
|
148
|
+
justify-content: space-between,
|
|
149
|
+
)
|
|
150
|
+
);
|
|
151
|
+
@include button($dropdown-button);
|
|
152
|
+
|
|
153
|
+
// placeholder
|
|
154
|
+
@include bem(placeholder) {
|
|
155
|
+
$placeholder: get('controls:dropdown:placeholder', ());
|
|
156
|
+
$placeholder: control-placeholder-style($placeholder);
|
|
157
|
+
@include css-map($placeholder);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__item--default {
|
|
162
|
+
$dropdown-item: flat-merge(
|
|
163
|
+
get('controls:dropdown:item', ()),
|
|
164
|
+
(
|
|
165
|
+
text-align: left,
|
|
166
|
+
justify-content: stretch,
|
|
167
|
+
border-radius: 0,
|
|
168
|
+
box-shadow: none,
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
@include button($dropdown-item);
|
|
172
|
+
|
|
173
|
+
// set transparent here instead of the mixin so that we
|
|
174
|
+
// keep the derived colors for other states
|
|
175
|
+
background-color: transparent;
|
|
176
|
+
color: inherit;
|
|
177
|
+
|
|
178
|
+
@include first-last-radius();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Describe this component...
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<div :class="bem()"></div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
name: 'px-expander',
|
|
11
|
+
// components: { Component },
|
|
12
|
+
|
|
13
|
+
props: {
|
|
14
|
+
expanded: { default: null },
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
data() {
|
|
18
|
+
return {
|
|
19
|
+
// create a data field that will mirror expanded
|
|
20
|
+
expandedValue: this.expanded,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
// computed: {},
|
|
25
|
+
|
|
26
|
+
watch: {
|
|
27
|
+
expanded(newVal) {
|
|
28
|
+
// update expandedValue when expanded changes
|
|
29
|
+
this.expandedValue = newVal;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
expandedValue(newVal) {
|
|
33
|
+
// emit update when expandedValue changes (enables .sync on parent)
|
|
34
|
+
this.$emit('update:expanded', newVal);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
// mounted() {},
|
|
38
|
+
// methods: {},
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<style lang="scss">
|
|
43
|
+
.px-expander {
|
|
44
|
+
// add styles here
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Describe this component...
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<px-icon
|
|
6
|
+
:src="featherSrc"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
v-on="$listeners"
|
|
9
|
+
:style="{ strokeWidth: strokeWidth }"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import PxIcon from './PxIcon.vue';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'px-feather-icon',
|
|
18
|
+
components: { PxIcon },
|
|
19
|
+
props: {
|
|
20
|
+
name: { type: String, default: 'smile' },
|
|
21
|
+
strokeWidth: { type: Number, default: null },
|
|
22
|
+
},
|
|
23
|
+
computed: {
|
|
24
|
+
featherSrc() {
|
|
25
|
+
return require(`../assets/feather/${this.name}.svg`);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<px-icon-button
|
|
3
|
+
:src="featherSrc"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
v-on="$listeners"
|
|
6
|
+
:style="{ strokeWidth: strokeWidth }"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import PxIconButton from './PxIconButton.vue';
|
|
12
|
+
import PxFeatherIcon from './PxFeatherIcon.vue';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: 'px-feather-icon',
|
|
16
|
+
mixins: [PxFeatherIcon],
|
|
17
|
+
components: { PxIconButton },
|
|
18
|
+
};
|
|
19
|
+
</script>
|