quasar 2.2.0 → 2.2.4
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/api/QOptionGroup.json +36 -1
- package/dist/api/QRange.json +10 -3
- package/dist/api/QSeparator.json +1 -1
- package/dist/api/QSlider.json +10 -3
- package/dist/api/QTable.json +5 -0
- package/dist/api/QTree.json +6 -0
- package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/material-icons.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-themify.umd.prod.js +1 -1
- package/dist/icon-set/themify.umd.prod.js +1 -1
- package/dist/lang/ar.umd.prod.js +1 -1
- package/dist/lang/az-Latn.umd.prod.js +1 -1
- package/dist/lang/bg.umd.prod.js +1 -1
- package/dist/lang/bn.umd.prod.js +1 -1
- package/dist/lang/ca.umd.prod.js +1 -1
- package/dist/lang/cs.umd.prod.js +1 -1
- package/dist/lang/da.umd.prod.js +1 -1
- package/dist/lang/de.umd.prod.js +1 -1
- package/dist/lang/el.umd.prod.js +1 -1
- package/dist/lang/en-GB.umd.prod.js +1 -1
- package/dist/lang/en-US.umd.prod.js +1 -1
- package/dist/lang/eo.umd.prod.js +1 -1
- package/dist/lang/es.umd.prod.js +1 -1
- package/dist/lang/et.umd.prod.js +1 -1
- package/dist/lang/fa-IR.umd.prod.js +1 -1
- package/dist/lang/fa.umd.prod.js +1 -1
- package/dist/lang/fi.umd.prod.js +1 -1
- package/dist/lang/fr.umd.prod.js +1 -1
- package/dist/lang/gn.umd.prod.js +1 -1
- package/dist/lang/he.umd.prod.js +1 -1
- package/dist/lang/hr.umd.prod.js +1 -1
- package/dist/lang/hu.umd.prod.js +1 -1
- package/dist/lang/id.umd.prod.js +1 -1
- package/dist/lang/is.umd.prod.js +1 -1
- package/dist/lang/it.umd.prod.js +1 -1
- package/dist/lang/ja.umd.prod.js +1 -1
- package/dist/lang/km.umd.prod.js +1 -1
- package/dist/lang/ko-KR.umd.prod.js +1 -1
- package/dist/lang/kur-CKB.umd.prod.js +1 -1
- package/dist/lang/lt.umd.prod.js +1 -1
- package/dist/lang/lu.umd.prod.js +1 -1
- package/dist/lang/lv.umd.prod.js +1 -1
- package/dist/lang/ml.umd.prod.js +1 -1
- package/dist/lang/ms.umd.prod.js +1 -1
- package/dist/lang/nb-NO.umd.prod.js +1 -1
- package/dist/lang/nl.umd.prod.js +1 -1
- package/dist/lang/pl.umd.prod.js +1 -1
- package/dist/lang/pt-BR.umd.prod.js +1 -1
- package/dist/lang/pt.umd.prod.js +1 -1
- package/dist/lang/ro.umd.prod.js +1 -1
- package/dist/lang/ru.umd.prod.js +1 -1
- package/dist/lang/sk.umd.prod.js +1 -1
- package/dist/lang/sl.umd.prod.js +1 -1
- package/dist/lang/sr-CYR.umd.prod.js +1 -1
- package/dist/lang/sr.umd.prod.js +1 -1
- package/dist/lang/sv.umd.prod.js +1 -1
- package/dist/lang/ta.umd.prod.js +1 -1
- package/dist/lang/th.umd.prod.js +1 -1
- package/dist/lang/tr.umd.prod.js +1 -1
- package/dist/lang/ug.umd.prod.js +1 -1
- package/dist/lang/uk.umd.prod.js +1 -1
- package/dist/lang/vi.umd.prod.js +1 -1
- package/dist/lang/zh-CN.umd.prod.js +1 -1
- package/dist/lang/zh-TW.umd.prod.js +1 -1
- package/dist/quasar.cjs.prod.js +2 -2
- package/dist/quasar.css +51 -8
- package/dist/quasar.esm.prod.js +2 -2
- package/dist/quasar.prod.css +1 -1
- package/dist/quasar.rtl.css +118 -8
- package/dist/quasar.rtl.prod.css +1 -1
- package/dist/quasar.sass +43 -6
- package/dist/quasar.umd.js +341 -289
- package/dist/quasar.umd.prod.js +2 -2
- package/dist/ssr-directives/Morph.js +1 -1
- package/dist/types/index.d.ts +28 -8
- package/dist/vetur/quasar-attributes.json +10 -6
- package/dist/vetur/quasar-tags.json +1 -0
- package/dist/web-types/web-types.json +19 -11
- package/package.json +1 -1
- package/src/components/ajax-bar/QAjaxBar.js +3 -2
- package/src/components/avatar/QAvatar.js +3 -2
- package/src/components/badge/QBadge.js +3 -2
- package/src/components/banner/QBanner.js +3 -2
- package/src/components/bar/QBar.js +3 -2
- package/src/components/breadcrumbs/QBreadcrumbs.js +3 -2
- package/src/components/breadcrumbs/QBreadcrumbsEl.js +3 -2
- package/src/components/btn/QBtn.js +19 -21
- package/src/components/btn-dropdown/QBtnDropdown.js +3 -2
- package/src/components/btn-group/QBtnGroup.js +3 -2
- package/src/components/btn-toggle/QBtnToggle.js +3 -2
- package/src/components/card/QCard.js +3 -2
- package/src/components/card/QCardActions.js +3 -2
- package/src/components/card/QCardSection.js +3 -2
- package/src/components/carousel/QCarousel.js +3 -2
- package/src/components/carousel/QCarouselControl.js +3 -2
- package/src/components/carousel/QCarouselSlide.js +3 -2
- package/src/components/chat/QChatMessage.js +3 -2
- package/src/components/checkbox/QCheckbox.js +3 -2
- package/src/components/chip/QChip.js +3 -2
- package/src/components/circular-progress/QCircularProgress.js +3 -2
- package/src/components/color/QColor.js +3 -2
- package/src/components/date/QDate.js +5 -3
- package/src/components/dialog/QDialog.js +3 -2
- package/src/components/dialog-bottom-sheet/BottomSheet.js +3 -2
- package/src/components/dialog-plugin/DialogPlugin.js +3 -2
- package/src/components/drawer/QDrawer.js +6 -2
- package/src/components/editor/QEditor.js +3 -2
- package/src/components/expansion-item/QExpansionItem.js +3 -2
- package/src/components/fab/QFab.js +3 -2
- package/src/components/fab/QFabAction.js +3 -2
- package/src/components/field/QField.js +3 -3
- package/src/components/file/QFile.js +3 -2
- package/src/components/footer/QFooter.js +3 -2
- package/src/components/form/QForm.js +3 -2
- package/src/components/header/QHeader.js +3 -2
- package/src/components/icon/QIcon.js +4 -2
- package/src/components/img/QImg.js +5 -2
- package/src/components/infinite-scroll/QInfiniteScroll.js +3 -2
- package/src/components/inner-loading/QInnerLoading.js +3 -2
- package/src/components/input/QInput.js +3 -2
- package/src/components/intersection/QIntersection.js +3 -2
- package/src/components/item/QItem.js +3 -2
- package/src/components/item/QItemLabel.js +3 -2
- package/src/components/item/QItemSection.js +3 -2
- package/src/components/item/QList.js +3 -3
- package/src/components/knob/QKnob.js +3 -2
- package/src/components/layout/QLayout.js +3 -2
- package/src/components/linear-progress/QLinearProgress.js +3 -2
- package/src/components/markup-table/QMarkupTable.js +3 -2
- package/src/components/menu/QMenu.js +4 -3
- package/src/components/no-ssr/QNoSsr.js +3 -2
- package/src/components/option-group/QOptionGroup.js +4 -2
- package/src/components/option-group/QOptionGroup.json +24 -1
- package/src/components/page/QPage.js +3 -2
- package/src/components/page/QPageContainer.js +3 -2
- package/src/components/page-scroller/QPageScroller.js +4 -2
- package/src/components/page-sticky/QPageSticky.js +2 -3
- package/src/components/pagination/QPagination.js +3 -2
- package/src/components/parallax/QParallax.js +3 -2
- package/src/components/popup-edit/QPopupEdit.js +3 -2
- package/src/components/popup-proxy/QPopupProxy.js +4 -2
- package/src/components/pull-to-refresh/QPullToRefresh.js +3 -2
- package/src/components/radio/QRadio.js +3 -2
- package/src/components/range/QRange.js +4 -3
- package/src/components/range/QRange.json +7 -3
- package/src/components/rating/QRating.js +6 -5
- package/src/components/resize-observer/QResizeObserver.js +3 -2
- package/src/components/responsive/QResponsive.js +3 -2
- package/src/components/scroll-area/QScrollArea.js +3 -2
- package/src/components/scroll-observer/QScrollObserver.js +3 -2
- package/src/components/select/QSelect.js +11 -20
- package/src/components/separator/QSeparator.js +4 -2
- package/src/components/separator/QSeparator.json +1 -1
- package/src/components/skeleton/QSkeleton.js +3 -2
- package/src/components/slide-item/QSlideItem.js +3 -2
- package/src/components/slide-transition/QSlideTransition.js +4 -2
- package/src/components/slider/QSlider.js +4 -3
- package/src/components/slider/QSlider.json +7 -3
- package/src/components/slider/use-slider.js +7 -2
- package/src/components/space/QSpace.js +4 -2
- package/src/components/spinner/QSpinner.js +4 -2
- package/src/components/spinner/QSpinnerAudio.js +4 -2
- package/src/components/spinner/QSpinnerBall.js +4 -2
- package/src/components/spinner/QSpinnerBars.js +4 -2
- package/src/components/spinner/QSpinnerBox.js +4 -2
- package/src/components/spinner/QSpinnerClock.js +4 -2
- package/src/components/spinner/QSpinnerComment.js +4 -2
- package/src/components/spinner/QSpinnerCube.js +4 -2
- package/src/components/spinner/QSpinnerDots.js +4 -2
- package/src/components/spinner/QSpinnerFacebook.js +4 -2
- package/src/components/spinner/QSpinnerGears.js +4 -2
- package/src/components/spinner/QSpinnerGrid.js +4 -2
- package/src/components/spinner/QSpinnerHearts.js +4 -2
- package/src/components/spinner/QSpinnerHourglass.js +4 -2
- package/src/components/spinner/QSpinnerInfinity.js +4 -2
- package/src/components/spinner/QSpinnerIos.js +4 -2
- package/src/components/spinner/QSpinnerOrbit.js +4 -2
- package/src/components/spinner/QSpinnerOval.js +4 -2
- package/src/components/spinner/QSpinnerPie.js +4 -2
- package/src/components/spinner/QSpinnerPuff.js +4 -2
- package/src/components/spinner/QSpinnerRadio.js +4 -2
- package/src/components/spinner/QSpinnerRings.js +4 -2
- package/src/components/spinner/QSpinnerTail.js +4 -2
- package/src/components/splitter/QSplitter.js +3 -2
- package/src/components/stepper/QStep.js +3 -2
- package/src/components/stepper/QStepper.js +3 -2
- package/src/components/stepper/QStepperNavigation.js +3 -2
- package/src/components/stepper/StepHeader.js +12 -10
- package/src/components/tab-panels/QTabPanel.js +4 -2
- package/src/components/tab-panels/QTabPanels.js +3 -2
- package/src/components/table/QTable.js +4 -2
- package/src/components/table/QTable.json +1 -0
- package/src/components/table/QTd.js +3 -2
- package/src/components/table/QTh.js +3 -2
- package/src/components/table/QTr.js +3 -2
- package/src/components/tabs/QRouteTab.js +4 -2
- package/src/components/tabs/QTab.js +3 -3
- package/src/components/tabs/QTabs.js +4 -3
- package/src/components/tabs/use-tab.js +11 -9
- package/src/components/time/QTime.js +9 -9
- package/src/components/timeline/QTimeline.js +3 -2
- package/src/components/timeline/QTimelineEntry.js +3 -2
- package/src/components/toggle/QToggle.js +5 -2
- package/src/components/toolbar/QToolbar.js +3 -2
- package/src/components/toolbar/QToolbarTitle.js +3 -2
- package/src/components/tooltip/QTooltip.js +3 -2
- package/src/components/tree/QTree.js +12 -7
- package/src/components/tree/QTree.json +5 -0
- package/src/components/tree/QTree.sass +52 -4
- package/src/components/uploader/QUploaderAddTrigger.js +3 -2
- package/src/components/uploader/uploader-core.js +2 -7
- package/src/components/video/QVideo.js +4 -2
- package/src/components/virtual-scroll/QVirtualScroll.js +3 -2
- package/src/composables/private/use-file.js +8 -0
- package/src/composables/private/use-model-toggle.js +1 -1
- package/src/css/normalize.sass +0 -7
- package/src/directives/ClosePopup.js +3 -1
- package/src/directives/Intersection.js +3 -1
- package/src/directives/Morph.js +4 -1
- package/src/directives/Mutation.js +3 -1
- package/src/directives/Ripple.js +3 -1
- package/src/directives/Scroll.js +3 -1
- package/src/directives/ScrollFire.js +3 -1
- package/src/directives/TouchHold.js +4 -1
- package/src/directives/TouchPan.js +4 -1
- package/src/directives/TouchRepeat.js +4 -1
- package/src/directives/TouchSwipe.js +4 -1
- package/src/plugins/Notify.js +4 -3
- package/src/utils/create-uploader-component.js +3 -3
- package/src/utils/date.js +94 -61
- package/src/utils/private/create.js +4 -0
package/src/directives/Scroll.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createDirective } from '../utils/private/create.js'
|
|
1
2
|
import { getScrollTarget, getVerticalScrollPosition, getHorizontalScrollPosition } from '../utils/scroll.js'
|
|
2
3
|
import { listenOpts } from '../utils/event.js'
|
|
3
4
|
import getSSRProps from '../utils/private/noop-ssr-directive-transform.js'
|
|
@@ -14,7 +15,7 @@ function update (ctx, { value, oldValue }) {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export default __QUASAR_SSR_SERVER__
|
|
18
|
+
export default createDirective(__QUASAR_SSR_SERVER__
|
|
18
19
|
? { name: 'scroll', getSSRProps }
|
|
19
20
|
: {
|
|
20
21
|
name: 'scroll',
|
|
@@ -47,3 +48,4 @@ export default __QUASAR_SSR_SERVER__
|
|
|
47
48
|
delete el.__qscroll
|
|
48
49
|
}
|
|
49
50
|
}
|
|
51
|
+
)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createDirective } from '../utils/private/create.js'
|
|
1
2
|
import debounce from '../utils/debounce.js'
|
|
2
3
|
import { height, offset } from '../utils/dom.js'
|
|
3
4
|
import { getScrollTarget } from '../utils/scroll.js'
|
|
@@ -19,7 +20,7 @@ function update (ctx, { value, oldValue }) {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export default __QUASAR_SSR_SERVER__
|
|
23
|
+
export default createDirective(__QUASAR_SSR_SERVER__
|
|
23
24
|
? { name: 'scroll-fire', getSSRProps }
|
|
24
25
|
: {
|
|
25
26
|
name: 'scroll-fire',
|
|
@@ -63,3 +64,4 @@ export default __QUASAR_SSR_SERVER__
|
|
|
63
64
|
delete el.__qscrollfire
|
|
64
65
|
}
|
|
65
66
|
}
|
|
67
|
+
)
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { client } from '../plugins/Platform.js'
|
|
2
|
+
|
|
3
|
+
import { createDirective } from '../utils/private/create.js'
|
|
2
4
|
import { addEvt, cleanEvt, position, leftClick, stopAndPrevent, noop } from '../utils/event.js'
|
|
3
5
|
import { clearSelection } from '../utils/private/selection.js'
|
|
4
6
|
import getSSRProps from '../utils/private/noop-ssr-directive-transform.js'
|
|
5
7
|
|
|
6
|
-
export default __QUASAR_SSR_SERVER__
|
|
8
|
+
export default createDirective(__QUASAR_SSR_SERVER__
|
|
7
9
|
? { name: 'touch-hold', getSSRProps }
|
|
8
10
|
: {
|
|
9
11
|
name: 'touch-hold',
|
|
@@ -157,3 +159,4 @@ export default __QUASAR_SSR_SERVER__
|
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
}
|
|
162
|
+
)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { client } from '../plugins/Platform.js'
|
|
2
|
+
|
|
3
|
+
import { createDirective } from '../utils/private/create.js'
|
|
2
4
|
import { getModifierDirections, shouldStart } from '../utils/private/touch.js'
|
|
3
5
|
import { addEvt, cleanEvt, position, leftClick, prevent, stop, stopAndPrevent, preventDraggable, noop } from '../utils/event.js'
|
|
4
6
|
import { clearSelection } from '../utils/private/selection.js'
|
|
@@ -117,7 +119,7 @@ function getChanges (evt, ctx, isFinal) {
|
|
|
117
119
|
|
|
118
120
|
let uid = 0
|
|
119
121
|
|
|
120
|
-
export default __QUASAR_SSR_SERVER__
|
|
122
|
+
export default createDirective(__QUASAR_SSR_SERVER__
|
|
121
123
|
? { name: 'touch-pan', getSSRProps }
|
|
122
124
|
: {
|
|
123
125
|
name: 'touch-pan',
|
|
@@ -422,3 +424,4 @@ export default __QUASAR_SSR_SERVER__
|
|
|
422
424
|
}
|
|
423
425
|
}
|
|
424
426
|
}
|
|
427
|
+
)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { client } from '../plugins/Platform.js'
|
|
2
|
+
|
|
3
|
+
import { createDirective } from '../utils/private/create.js'
|
|
2
4
|
import { addEvt, cleanEvt, position, leftClick, stopAndPrevent, noop } from '../utils/event.js'
|
|
3
5
|
import { clearSelection } from '../utils/private/selection.js'
|
|
4
6
|
import { isKeyCode } from '../utils/private/key-composition.js'
|
|
@@ -25,7 +27,7 @@ function shouldEnd (evt, origin) {
|
|
|
25
27
|
|| Math.abs(top - origin.top) >= 7
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
export default __QUASAR_SSR_SERVER__
|
|
30
|
+
export default createDirective(__QUASAR_SSR_SERVER__
|
|
29
31
|
? { name: 'touch-repeat', getSSRProps }
|
|
30
32
|
: {
|
|
31
33
|
name: 'touch-repeat',
|
|
@@ -239,3 +241,4 @@ export default __QUASAR_SSR_SERVER__
|
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
}
|
|
244
|
+
)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { client } from '../plugins/Platform.js'
|
|
2
|
+
|
|
3
|
+
import { createDirective } from '../utils/private/create.js'
|
|
2
4
|
import { getModifierDirections, shouldStart } from '../utils/private/touch.js'
|
|
3
5
|
import { addEvt, cleanEvt, position, leftClick, stopAndPrevent, preventDraggable, noop } from '../utils/event.js'
|
|
4
6
|
import { clearSelection } from '../utils/private/selection.js'
|
|
@@ -20,7 +22,7 @@ function parseArg (arg) {
|
|
|
20
22
|
return data
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
export default __QUASAR_SSR_SERVER__
|
|
25
|
+
export default createDirective(__QUASAR_SSR_SERVER__
|
|
24
26
|
? { name: 'touch-swipe', getSSRProps }
|
|
25
27
|
: {
|
|
26
28
|
name: 'touch-swipe',
|
|
@@ -263,3 +265,4 @@ export default __QUASAR_SSR_SERVER__
|
|
|
263
265
|
}
|
|
264
266
|
}
|
|
265
267
|
}
|
|
268
|
+
)
|
package/src/plugins/Notify.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { h,
|
|
1
|
+
import { h, ref, markRaw, TransitionGroup } from 'vue'
|
|
2
2
|
|
|
3
3
|
import QAvatar from '../components/avatar/QAvatar.js'
|
|
4
4
|
import QIcon from '../components/icon/QIcon.js'
|
|
5
5
|
import QBtn from '../components/btn/QBtn.js'
|
|
6
6
|
import QSpinner from '../components/spinner/QSpinner.js'
|
|
7
7
|
|
|
8
|
+
import { createComponent } from '../utils/private/create.js'
|
|
8
9
|
import { noop } from '../utils/event.js'
|
|
9
10
|
import { createGlobalNode } from '../utils/private/global-nodes.js'
|
|
10
11
|
import { createChildApp } from '../install-quasar.js'
|
|
@@ -62,9 +63,9 @@ function logError (error, config) {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
function getComponent ($q) {
|
|
65
|
-
return
|
|
66
|
+
return createComponent({
|
|
66
67
|
name: 'QNotifications',
|
|
67
|
-
|
|
68
|
+
|
|
68
69
|
// hide App from Vue devtools
|
|
69
70
|
devtools: { hide: true },
|
|
70
71
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent } from 'vue'
|
|
2
|
-
|
|
3
1
|
import { coreProps, coreEmits, getRenderer } from '../components/uploader/uploader-core.js'
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
import { createComponent } from './private/create.js'
|
|
4
|
+
|
|
5
|
+
export default ({ name, props, emits, injectPlugin }) => createComponent({
|
|
6
6
|
name,
|
|
7
7
|
|
|
8
8
|
props: {
|
package/src/utils/date.js
CHANGED
|
@@ -161,6 +161,96 @@ function getDateLocale (paramDateLocale, langProps) {
|
|
|
161
161
|
)
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
function formatTimezone (offset, delimeter = '') {
|
|
165
|
+
const
|
|
166
|
+
sign = offset > 0 ? '-' : '+',
|
|
167
|
+
absOffset = Math.abs(offset),
|
|
168
|
+
hours = Math.floor(absOffset / 60),
|
|
169
|
+
minutes = absOffset % 60
|
|
170
|
+
|
|
171
|
+
return sign + pad(hours) + delimeter + pad(minutes)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function applyYearMonthDayChange (date, mod, sign) {
|
|
175
|
+
let
|
|
176
|
+
year = date.getFullYear(),
|
|
177
|
+
month = date.getMonth(),
|
|
178
|
+
day = date.getDate()
|
|
179
|
+
|
|
180
|
+
if (mod.years !== void 0) {
|
|
181
|
+
year += sign * mod.years
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (mod.months !== void 0) {
|
|
185
|
+
month += sign * mod.months
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (mod.days !== void 0) {
|
|
189
|
+
day += sign * mod.days
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
date.setDate(1)
|
|
193
|
+
date.setMonth(2)
|
|
194
|
+
|
|
195
|
+
date.setFullYear(year)
|
|
196
|
+
date.setMonth(month)
|
|
197
|
+
date.setDate(day)
|
|
198
|
+
|
|
199
|
+
return date
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function getChange (date, mod, sign) {
|
|
203
|
+
const
|
|
204
|
+
d = new Date(date),
|
|
205
|
+
t = mod.years !== void 0 || mod.months !== void 0 || mod.days !== void 0
|
|
206
|
+
? applyYearMonthDayChange(d, mod, sign)
|
|
207
|
+
: d
|
|
208
|
+
|
|
209
|
+
Object.keys(mod).forEach(key => {
|
|
210
|
+
if (key !== 'years' && key !== 'months' && key !== 'days') {
|
|
211
|
+
const op = capitalize(key)
|
|
212
|
+
t[ `set${ op }` ](t[ `get${ op }` ]() + sign * mod[ key ])
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
return t
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function applyYearMonthDay (date, mod, middle) {
|
|
220
|
+
const
|
|
221
|
+
year = mod.year !== void 0 ? mod.year : date[ `get${ middle }FullYear` ](),
|
|
222
|
+
month = mod.month !== void 0 ? mod.month - 1 : date[ `get${ middle }Month` ](),
|
|
223
|
+
maxDay = (new Date(year, month + 1, 0)).getDate(),
|
|
224
|
+
day = Math.min(maxDay, mod.date !== void 0 ? mod.date : date[ `get${ middle }Date` ]())
|
|
225
|
+
|
|
226
|
+
date[ `set${ middle }Date` ](1)
|
|
227
|
+
date[ `set${ middle }Month` ](2)
|
|
228
|
+
|
|
229
|
+
date[ `set${ middle }FullYear` ](year)
|
|
230
|
+
date[ `set${ middle }Month` ](month)
|
|
231
|
+
date[ `set${ middle }Date` ](day)
|
|
232
|
+
|
|
233
|
+
return date
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function adjustDate (date, mod, utc) {
|
|
237
|
+
const
|
|
238
|
+
middle = utc === true ? 'UTC' : '',
|
|
239
|
+
d = new Date(date),
|
|
240
|
+
t = mod.year !== void 0 || mod.month !== void 0 || mod.date !== void 0
|
|
241
|
+
? applyYearMonthDay(d, mod, middle)
|
|
242
|
+
: d
|
|
243
|
+
|
|
244
|
+
Object.keys(mod).forEach(key => {
|
|
245
|
+
if (key !== 'year' && key !== 'month' && key !== 'date') {
|
|
246
|
+
const op = key.charAt(0).toUpperCase() + key.slice(1)
|
|
247
|
+
t[ `set${ middle }${ op }` ](mod[ key ])
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
return t
|
|
252
|
+
}
|
|
253
|
+
|
|
164
254
|
export function extractDate (str, mask, dateLocale) {
|
|
165
255
|
const d = __splitDate(str, mask, dateLocale)
|
|
166
256
|
|
|
@@ -178,7 +268,7 @@ export function extractDate (str, mask, dateLocale) {
|
|
|
178
268
|
|
|
179
269
|
return d.timezoneOffset === null || d.timezoneOffset === tzOffset
|
|
180
270
|
? date
|
|
181
|
-
: getChange(date, { minutes: d.timezoneOffset - tzOffset },
|
|
271
|
+
: getChange(date, { minutes: d.timezoneOffset - tzOffset }, 1)
|
|
182
272
|
}
|
|
183
273
|
|
|
184
274
|
export function __splitDate (str, mask, dateLocale, calendar, defaultModel) {
|
|
@@ -313,49 +403,12 @@ export function __splitDate (str, mask, dateLocale, calendar, defaultModel) {
|
|
|
313
403
|
}
|
|
314
404
|
}
|
|
315
405
|
|
|
316
|
-
date.dateHash = date.year + '/' + pad(date.month) + '/' + pad(date.day)
|
|
406
|
+
date.dateHash = pad(date.year, 6) + '/' + pad(date.month) + '/' + pad(date.day)
|
|
317
407
|
date.timeHash = pad(date.hour) + ':' + pad(date.minute) + ':' + pad(date.second) + tzString
|
|
318
408
|
|
|
319
409
|
return date
|
|
320
410
|
}
|
|
321
411
|
|
|
322
|
-
function formatTimezone (offset, delimeter = '') {
|
|
323
|
-
const
|
|
324
|
-
sign = offset > 0 ? '-' : '+',
|
|
325
|
-
absOffset = Math.abs(offset),
|
|
326
|
-
hours = Math.floor(absOffset / 60),
|
|
327
|
-
minutes = absOffset % 60
|
|
328
|
-
|
|
329
|
-
return sign + pad(hours) + delimeter + pad(minutes)
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function setMonth (date, newMonth /* 1-based */) {
|
|
333
|
-
const
|
|
334
|
-
test = new Date(date.getFullYear(), newMonth, 0, 0, 0, 0, 0),
|
|
335
|
-
days = test.getDate()
|
|
336
|
-
|
|
337
|
-
date.setMonth(newMonth - 1, Math.min(days, date.getDate()))
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function getChange (date, mod, add) {
|
|
341
|
-
const
|
|
342
|
-
t = new Date(date),
|
|
343
|
-
sign = (add ? 1 : -1)
|
|
344
|
-
|
|
345
|
-
Object.keys(mod).forEach(key => {
|
|
346
|
-
if (key === 'months') {
|
|
347
|
-
setMonth(t, t.getMonth() + 1 + sign * mod.months)
|
|
348
|
-
return
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
const op = key === 'years'
|
|
352
|
-
? 'FullYear'
|
|
353
|
-
: capitalize(key === 'days' ? 'date' : key)
|
|
354
|
-
t[ `set${ op }` ](t[ `get${ op }` ]() + sign * mod[ key ])
|
|
355
|
-
})
|
|
356
|
-
return t
|
|
357
|
-
}
|
|
358
|
-
|
|
359
412
|
export function isValid (date) {
|
|
360
413
|
return typeof date === 'number'
|
|
361
414
|
? true
|
|
@@ -413,30 +466,10 @@ export function isBetweenDates (date, from, to, opts = {}) {
|
|
|
413
466
|
}
|
|
414
467
|
|
|
415
468
|
export function addToDate (date, mod) {
|
|
416
|
-
return getChange(date, mod,
|
|
469
|
+
return getChange(date, mod, 1)
|
|
417
470
|
}
|
|
418
471
|
export function subtractFromDate (date, mod) {
|
|
419
|
-
return getChange(date, mod,
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
export function adjustDate (date, mod, utc) {
|
|
423
|
-
const
|
|
424
|
-
t = new Date(date),
|
|
425
|
-
prefix = `set${ utc === true ? 'UTC' : '' }`
|
|
426
|
-
|
|
427
|
-
Object.keys(mod).forEach(key => {
|
|
428
|
-
if (key === 'month') {
|
|
429
|
-
setMonth(t, mod.month)
|
|
430
|
-
return
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
const op = key === 'year'
|
|
434
|
-
? 'FullYear'
|
|
435
|
-
: key.charAt(0).toUpperCase() + key.slice(1)
|
|
436
|
-
t[ `${ prefix }${ op }` ](mod[ key ])
|
|
437
|
-
})
|
|
438
|
-
|
|
439
|
-
return t
|
|
472
|
+
return getChange(date, mod, -1)
|
|
440
473
|
}
|
|
441
474
|
|
|
442
475
|
export function startOfDate (date, unit, utc) {
|