@opentinyvue/vue-renderless 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +16 -0
- package/action-menu/index.js +59 -0
- package/action-menu/vue.js +38 -0
- package/action-sheet/index.js +96 -0
- package/action-sheet/vue.js +66 -0
- package/alert/index.js +83 -0
- package/alert/vue.js +54 -0
- package/amount/index.js +306 -0
- package/amount/vue.js +208 -0
- package/anchor/index.js +192 -0
- package/anchor/vue.js +68 -0
- package/area/index.js +102 -0
- package/area/vue.js +32 -0
- package/async-flowchart/index.js +79 -0
- package/async-flowchart/vue.js +40 -0
- package/autocomplete/index.js +183 -0
- package/autocomplete/vue.js +151 -0
- package/autonavi-map/index.js +18 -0
- package/avatar/index.js +30 -0
- package/avatar/vue.js +22 -0
- package/badge/index.js +25 -0
- package/badge/vue.js +24 -0
- package/baidu-map/index.js +18 -0
- package/base-select/index.js +1450 -0
- package/base-select/vue.js +555 -0
- package/breadcrumb/index.js +15 -0
- package/breadcrumb/vue.js +22 -0
- package/breadcrumb-item/index.js +21 -0
- package/breadcrumb-item/vue.js +21 -0
- package/bulletin-board/index.js +25 -0
- package/bulletin-board/vue.js +30 -0
- package/button/index.js +27 -0
- package/button/vue.js +37 -0
- package/button-group/index.js +38 -0
- package/button-group/vue.js +39 -0
- package/calendar/index.js +160 -0
- package/calendar/vue.js +113 -0
- package/calendar-bar/index.js +509 -0
- package/calendar-bar/vue.js +161 -0
- package/calendar-view/index.js +606 -0
- package/calendar-view/vue.js +305 -0
- package/card/index.js +99 -0
- package/card/vue.js +72 -0
- package/card-group/vue.js +19 -0
- package/card-template/index.js +31 -0
- package/card-template/vue.js +22 -0
- package/carousel/index.js +289 -0
- package/carousel/vue.js +199 -0
- package/carousel-item/index.js +97 -0
- package/carousel-item/vue.js +74 -0
- package/cascader/index.js +546 -0
- package/cascader/vue.js +260 -0
- package/cascader-menu/index.js +42 -0
- package/cascader-menu/vue.js +26 -0
- package/cascader-mobile/index.js +316 -0
- package/cascader-mobile/vue.js +109 -0
- package/cascader-node/index.js +58 -0
- package/cascader-node/vue.js +41 -0
- package/cascader-panel/index.js +301 -0
- package/cascader-panel/node.js +136 -0
- package/cascader-panel/store.js +72 -0
- package/cascader-panel/vue.js +157 -0
- package/cascader-select/column-index.js +158 -0
- package/cascader-select/column.js +123 -0
- package/cascader-select/index.js +48 -0
- package/cascader-select/usePicker.js +252 -0
- package/cascader-select/useTouch.js +65 -0
- package/cascader-select/vue.js +64 -0
- package/cascader-view/index.js +363 -0
- package/cascader-view/vue.js +130 -0
- package/cell/vue.js +17 -0
- package/chart-bar/index.js +222 -0
- package/chart-boxplot/index.js +130 -0
- package/chart-candle/index.js +183 -0
- package/chart-core/deps/constants.js +131 -0
- package/chart-core/deps/numerify.js +244 -0
- package/chart-core/deps/utils.js +202 -0
- package/chart-core/index.js +473 -0
- package/chart-core/modules/animation.js +12 -0
- package/chart-core/modules/extend.js +48 -0
- package/chart-core/modules/mark.js +11 -0
- package/chart-core/vue.js +93 -0
- package/chart-funnel/index.js +76 -0
- package/chart-gauge/index.js +81 -0
- package/chart-graph/index.js +27 -0
- package/chart-heatmap/index.js +168 -0
- package/chart-line/index.js +166 -0
- package/chart-liquidfill/index.js +54 -0
- package/chart-map/index.js +118 -0
- package/chart-pie/index.js +146 -0
- package/chart-radar/index.js +105 -0
- package/chart-sankey/index.js +80 -0
- package/chart-scatter/index.js +173 -0
- package/chart-sunburst/index.js +28 -0
- package/chart-tree/index.js +65 -0
- package/chart-waterfall/index.js +99 -0
- package/chart-wordcloud/index.js +60 -0
- package/checkbox/index.js +147 -0
- package/checkbox/vue.js +120 -0
- package/checkbox-button/index.js +68 -0
- package/checkbox-button/vue.js +79 -0
- package/checkbox-group/index.js +7 -0
- package/checkbox-group/vue.js +29 -0
- package/chunk-G2ADBYYC.js +37 -0
- package/col/index.js +104 -0
- package/col/vue.js +25 -0
- package/collapse/index.js +36 -0
- package/collapse/vue.js +27 -0
- package/collapse-item/index.js +42 -0
- package/collapse-item/vue.js +40 -0
- package/color-picker/index.js +30 -0
- package/color-picker/utils/color.js +377 -0
- package/color-picker/utils/hsv-to-rgb.js +59 -0
- package/color-picker/vue.js +71 -0
- package/color-select-panel/alpha-select/index.js +71 -0
- package/color-select-panel/alpha-select/vue.js +43 -0
- package/color-select-panel/hue-select/index.js +57 -0
- package/color-select-panel/hue-select/vue.js +40 -0
- package/color-select-panel/index.js +243 -0
- package/color-select-panel/sv-select/index.js +68 -0
- package/color-select-panel/sv-select/vue.js +32 -0
- package/color-select-panel/utils/color.js +365 -0
- package/color-select-panel/utils/getClientXY.js +54 -0
- package/color-select-panel/utils/use-drag.js +38 -0
- package/color-select-panel/vue.js +63 -0
- package/column-list-group/index.js +0 -0
- package/column-list-group/vue.js +14 -0
- package/column-list-item/index.js +80 -0
- package/column-list-item/vue.js +55 -0
- package/common/array.js +115 -0
- package/common/bigInt.js +315 -0
- package/common/browser.js +81 -0
- package/common/calendar/calendar.js +97 -0
- package/common/dataset/index.js +99 -0
- package/common/date.js +354 -0
- package/common/decimal.js +155 -0
- package/common/deps/ResizeObserver.js +456 -0
- package/common/deps/after-leave.js +27 -0
- package/common/deps/clickoutside.js +75 -0
- package/common/deps/date-util.js +255 -0
- package/common/deps/date.js +286 -0
- package/common/deps/debounce.js +8 -0
- package/common/deps/dom.js +217 -0
- package/common/deps/eSpaceCtrl.js +304 -0
- package/common/deps/fastdom/async.js +41 -0
- package/common/deps/fastdom/index.js +9 -0
- package/common/deps/fastdom/sandbox.js +53 -0
- package/common/deps/fastdom/singleton.js +88 -0
- package/common/deps/fullscreen/apis.js +143 -0
- package/common/deps/fullscreen/screenfull.js +165 -0
- package/common/deps/infinite-scroll.js +176 -0
- package/common/deps/memorize.js +124 -0
- package/common/deps/observe-visibility.js +106 -0
- package/common/deps/popper.js +613 -0
- package/common/deps/popup-manager.js +205 -0
- package/common/deps/repeat-click.js +29 -0
- package/common/deps/resize-event.js +39 -0
- package/common/deps/scroll-into-view.js +29 -0
- package/common/deps/scrollbar-width.js +33 -0
- package/common/deps/throttle.js +45 -0
- package/common/deps/touch-emulator.js +103 -0
- package/common/deps/touch.js +37 -0
- package/common/deps/tree-model/node.js +475 -0
- package/common/deps/tree-model/tree-store.js +312 -0
- package/common/deps/tree-model/util.js +24 -0
- package/common/deps/upload-ajax.js +81 -0
- package/common/deps/useEventListener.js +54 -0
- package/common/deps/useInstanceSlots.js +22 -0
- package/common/deps/useRect.js +25 -0
- package/common/deps/useRelation.js +89 -0
- package/common/deps/useTouch.js +68 -0
- package/common/deps/useUserAgent.js +16 -0
- package/common/deps/useWindowSize.js +23 -0
- package/common/deps/vue-emitter.js +34 -0
- package/common/deps/vue-popper.js +177 -0
- package/common/deps/vue-popup.js +138 -0
- package/common/event.js +46 -0
- package/common/form/const.js +10 -0
- package/common/function.js +28 -0
- package/common/global.js +11 -0
- package/common/index.js +259 -0
- package/common/object.js +227 -0
- package/common/prop-util.js +43 -0
- package/common/runtime.js +79 -0
- package/common/string.js +417 -0
- package/common/type.js +66 -0
- package/common/validate/index.js +10 -0
- package/common/validate/messages.js +65 -0
- package/common/validate/rules/enum.js +12 -0
- package/common/validate/rules/index.js +18 -0
- package/common/validate/rules/pattern.js +20 -0
- package/common/validate/rules/range.js +52 -0
- package/common/validate/rules/required.js +11 -0
- package/common/validate/rules/type.js +100 -0
- package/common/validate/rules/whitespace.js +10 -0
- package/common/validate/schema.js +290 -0
- package/common/validate/util.js +211 -0
- package/common/validate/validations/array.js +22 -0
- package/common/validate/validations/date.js +31 -0
- package/common/validate/validations/enum.js +22 -0
- package/common/validate/validations/float.js +22 -0
- package/common/validate/validations/index.js +46 -0
- package/common/validate/validations/integer.js +22 -0
- package/common/validate/validations/method.js +21 -0
- package/common/validate/validations/number.js +25 -0
- package/common/validate/validations/pattern.js +21 -0
- package/common/validate/validations/required.js +11 -0
- package/common/validate/validations/string.js +33 -0
- package/common/validate/validations/type.js +29 -0
- package/company/index.js +41 -0
- package/company/vue.js +29 -0
- package/container/index.js +100 -0
- package/container/vue.js +47 -0
- package/country/index.js +40 -0
- package/country/vue.js +30 -0
- package/crop/index.js +170 -0
- package/crop/vue.js +183 -0
- package/currency/index.js +127 -0
- package/currency/vue.js +46 -0
- package/date-panel/index.js +485 -0
- package/date-panel/vue.js +221 -0
- package/date-picker/index.js +267 -0
- package/date-picker/vue.js +123 -0
- package/date-picker-mobile/index.js +308 -0
- package/date-picker-mobile/vue.js +111 -0
- package/date-picker-mobile/year-month.js +53 -0
- package/date-range/index.js +443 -0
- package/date-range/vue.js +195 -0
- package/date-table/index.js +362 -0
- package/date-table/vue.js +77 -0
- package/dept/index.js +230 -0
- package/dept/vue.js +102 -0
- package/dialog-box/index.js +283 -0
- package/dialog-box/vue.js +184 -0
- package/dialog-select/index.js +475 -0
- package/dialog-select/vue.js +143 -0
- package/divider/index.js +47 -0
- package/divider/vue.js +30 -0
- package/drawer/index.js +143 -0
- package/drawer/vue.js +67 -0
- package/drop-roles/index.js +54 -0
- package/drop-roles/vue.js +30 -0
- package/drop-times/index.js +22 -0
- package/drop-times/vue.js +24 -0
- package/dropdown/index.js +228 -0
- package/dropdown/vue.js +77 -0
- package/dropdown-item/index.js +138 -0
- package/dropdown-item/mf.js +76 -0
- package/dropdown-item/vue.js +116 -0
- package/dropdown-menu/index.js +178 -0
- package/dropdown-menu/vue.js +66 -0
- package/dynamic-scroller/index.js +117 -0
- package/dynamic-scroller/vue.js +88 -0
- package/dynamic-scroller-item/index.js +147 -0
- package/dynamic-scroller-item/vue.js +92 -0
- package/espace/index.js +110 -0
- package/espace/vue.js +38 -0
- package/exception/index.js +5 -0
- package/exception/vue.js +17 -0
- package/fall-menu/index.js +100 -0
- package/fall-menu/vue.js +79 -0
- package/file-upload/index.js +2208 -0
- package/file-upload/vue.js +339 -0
- package/filter/index.js +132 -0
- package/filter/tag-group.js +43 -0
- package/filter/vue.js +71 -0
- package/filter-bar/index.js +9 -0
- package/filter-bar/vue.js +16 -0
- package/filter-box/index.js +18 -0
- package/filter-box/vue.js +22 -0
- package/filter-panel/index.js +42 -0
- package/filter-panel/vue.js +33 -0
- package/float-button/index.js +42 -0
- package/float-button/vue.js +101 -0
- package/floatbar/index.js +13 -0
- package/floatbar/vue.js +14 -0
- package/floating-button/index.js +119 -0
- package/floating-button/vue.js +53 -0
- package/flowchart/index.js +1252 -0
- package/flowchart/node.js +61 -0
- package/flowchart/vue.js +109 -0
- package/fluent-editor/index.js +702 -0
- package/fluent-editor/options.js +300 -0
- package/fluent-editor/vue.js +192 -0
- package/form/index.js +209 -0
- package/form/vue.js +104 -0
- package/form-item/index.js +403 -0
- package/form-item/vue.js +166 -0
- package/fullscreen/index.js +113 -0
- package/fullscreen/vue.js +65 -0
- package/grid/core/index.js +7 -0
- package/grid/core/interceptor.js +43 -0
- package/grid/core/storeMap.js +23 -0
- package/grid/plugins/export.js +141 -0
- package/grid/plugins/exportExcel.js +502 -0
- package/grid/plugins/header.js +59 -0
- package/grid/plugins/resize.js +65 -0
- package/grid/static/array/arrayEach.js +16 -0
- package/grid/static/array/arrayIndexOf.js +15 -0
- package/grid/static/array/eachTree.js +28 -0
- package/grid/static/array/every.js +6 -0
- package/grid/static/array/filterTree.js +21 -0
- package/grid/static/array/find.js +7 -0
- package/grid/static/array/findTree.js +35 -0
- package/grid/static/array/helperCreateIterateHandle.js +51 -0
- package/grid/static/array/helperCreateTreeFunc.js +20 -0
- package/grid/static/array/includes.js +7 -0
- package/grid/static/array/lastArrayEach.js +10 -0
- package/grid/static/array/map.js +24 -0
- package/grid/static/array/mapTree.js +29 -0
- package/grid/static/array/slice.js +14 -0
- package/grid/static/array/sortBy.js +67 -0
- package/grid/static/array/sum.js +29 -0
- package/grid/static/array/toArray.js +7 -0
- package/grid/static/array/toTreeArray.js +22 -0
- package/grid/static/base/clear.js +48 -0
- package/grid/static/base/clone.js +12 -0
- package/grid/static/base/destructuring.js +22 -0
- package/grid/static/base/each.js +13 -0
- package/grid/static/base/eqNull.js +8 -0
- package/grid/static/base/findIndexOf.js +14 -0
- package/grid/static/base/get.js +46 -0
- package/grid/static/base/has.js +61 -0
- package/grid/static/base/hasOwnProp.js +6 -0
- package/grid/static/base/helperCreateGetObjects.js +30 -0
- package/grid/static/base/helperCreateInInObjectString.js +11 -0
- package/grid/static/base/helperCreateInTypeof.js +9 -0
- package/grid/static/base/helperCreateIndexOf.js +22 -0
- package/grid/static/base/helperCreateiterateIndexOf.js +22 -0
- package/grid/static/base/helperDefaultCompare.js +8 -0
- package/grid/static/base/helperDeleteProperty.js +12 -0
- package/grid/static/base/helperEqualCompare.js +58 -0
- package/grid/static/base/helperGetHGSKeys.js +9 -0
- package/grid/static/base/indexOf.js +7 -0
- package/grid/static/base/isArray.js +7 -0
- package/grid/static/base/isBoolean.js +6 -0
- package/grid/static/base/isDate.js +7 -0
- package/grid/static/base/isEmpty.js +12 -0
- package/grid/static/base/isEqual.js +11 -0
- package/grid/static/base/isFunction.js +6 -0
- package/grid/static/base/isNaN.js +7 -0
- package/grid/static/base/isNull.js +6 -0
- package/grid/static/base/isNumber.js +6 -0
- package/grid/static/base/isObject.js +6 -0
- package/grid/static/base/isPlainObject.js +6 -0
- package/grid/static/base/isRegExp.js +7 -0
- package/grid/static/base/isSet.js +7 -0
- package/grid/static/base/isString.js +6 -0
- package/grid/static/base/isUndefined.js +6 -0
- package/grid/static/base/keys.js +7 -0
- package/grid/static/base/lastEach.js +13 -0
- package/grid/static/base/remove.js +44 -0
- package/grid/static/base/set.js +47 -0
- package/grid/static/base/toJSONString.js +6 -0
- package/grid/static/base/toStringJSON.js +18 -0
- package/grid/static/base/uniqueId.js +7 -0
- package/grid/static/browse/browse.js +57 -0
- package/grid/static/function/property.js +7 -0
- package/grid/static/function/throttle.js +47 -0
- package/grid/static/index.js +111 -0
- package/grid/static/number/helperCreateToNumber.js +14 -0
- package/grid/static/number/toNumber.js +7 -0
- package/grid/static/object/assign.js +41 -0
- package/grid/static/object/extend.js +7 -0
- package/grid/static/object/lastObjectEach.js +12 -0
- package/grid/static/object/objectEach.js +15 -0
- package/grid/static/object/objectMap.js +24 -0
- package/grid/static/object/values.js +17 -0
- package/grid/static/static/staticDocument.js +7 -0
- package/grid/static/static/staticHGKeyRE.js +6 -0
- package/grid/static/static/staticParseInt.js +6 -0
- package/grid/static/static/staticStrUndefined.js +6 -0
- package/grid/static/static/staticWindow.js +7 -0
- package/grid/static/string/template.js +14 -0
- package/grid/static/string/toString.js +16 -0
- package/grid/utils/column.js +73 -0
- package/grid/utils/common.js +136 -0
- package/grid/utils/dom.js +224 -0
- package/grid/utils/event.js +40 -0
- package/grid/utils/index.js +8 -0
- package/grid-select/index.js +82 -0
- package/grid-select/vue.js +30 -0
- package/guide/index.js +185 -0
- package/guide/vue.js +38 -0
- package/hrapprover/index.js +95 -0
- package/hrapprover/vue.js +57 -0
- package/image/index.js +135 -0
- package/image/vue.js +111 -0
- package/image-viewer/index.js +681 -0
- package/image-viewer/vue.js +237 -0
- package/index-bar/index.js +66 -0
- package/index-bar/vue.js +73 -0
- package/index-bar-anchor/vue.js +16 -0
- package/input/index.js +413 -0
- package/input/vue.js +353 -0
- package/ip-address/index.js +271 -0
- package/ip-address/vue.js +143 -0
- package/label/index.js +56 -0
- package/label/vue.js +26 -0
- package/layout/vue.js +7 -0
- package/link/index.js +9 -0
- package/link/vue.js +20 -0
- package/link-menu/index.js +104 -0
- package/link-menu/vue.js +95 -0
- package/list/index.js +13 -0
- package/list/vue.js +17 -0
- package/load-list/index.js +43 -0
- package/load-list/vue.js +69 -0
- package/loading/index.js +30 -0
- package/loading/vue.js +32 -0
- package/locales/index.js +82 -0
- package/locales/vue.js +28 -0
- package/logon-user/index.js +20 -0
- package/logon-user/vue.js +19 -0
- package/logout/index.js +84 -0
- package/logout/vue.js +18 -0
- package/mask/index.js +13 -0
- package/mask/vue.js +18 -0
- package/menu/index.js +140 -0
- package/menu/vue.js +99 -0
- package/menu-node/index.js +12 -0
- package/menu-node/vue.js +42 -0
- package/milestone/index.js +123 -0
- package/milestone/vue.js +46 -0
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/mini-picker/index.js +165 -0
- package/mini-picker/vue.js +122 -0
- package/modal/index.js +716 -0
- package/modal/vue.js +122 -0
- package/month-range/index.js +134 -0
- package/month-range/vue.js +88 -0
- package/month-table/index.js +194 -0
- package/month-table/vue.js +50 -0
- package/multi-select/index.js +394 -0
- package/multi-select/vue.js +113 -0
- package/multi-select-item/index.js +23 -0
- package/multi-select-item/vue.js +31 -0
- package/nav-menu/index.js +508 -0
- package/nav-menu/vue.js +153 -0
- package/notify/index.js +69 -0
- package/notify/vue.js +63 -0
- package/numeric/index.js +397 -0
- package/numeric/vue.js +153 -0
- package/option/index.js +67 -0
- package/option/vue.js +132 -0
- package/option-group/index.js +28 -0
- package/option-group/vue.js +45 -0
- package/package.json +41 -0
- package/pager/index.js +409 -0
- package/pager/vue.js +155 -0
- package/pager-item/index.js +107 -0
- package/pager-item/vue.js +44 -0
- package/panel/index.js +24 -0
- package/panel/vue.js +20 -0
- package/picker/index.js +1119 -0
- package/picker/mb.js +47 -0
- package/picker/timezone.js +1174 -0
- package/picker/vue.js +291 -0
- package/picker-column/index.js +215 -0
- package/picker-column/vue.js +104 -0
- package/pop-upload/index.js +174 -0
- package/pop-upload/vue.js +165 -0
- package/popconfirm/index.js +38 -0
- package/popconfirm/vue.js +35 -0
- package/popeditor/index.js +709 -0
- package/popeditor/vue.js +223 -0
- package/popover/index.js +207 -0
- package/popover/vue.js +165 -0
- package/popup/index.js +101 -0
- package/popup/vue.js +69 -0
- package/progress/index.js +151 -0
- package/progress/vue.js +87 -0
- package/pull-refresh/index.js +123 -0
- package/pull-refresh/vue.js +76 -0
- package/pull-refresh-mobile-first/index.js +243 -0
- package/pull-refresh-mobile-first/vue.js +116 -0
- package/qr-code/index.js +54 -0
- package/qr-code/vue.js +31 -0
- package/quarter-panel/index.js +61 -0
- package/quarter-panel/vue.js +46 -0
- package/query-builder/index.js +9 -0
- package/query-builder/vue.js +18 -0
- package/radio/index.js +74 -0
- package/radio/vue.js +56 -0
- package/radio-button/index.js +61 -0
- package/radio-button/vue.js +60 -0
- package/radio-group/index.js +49 -0
- package/radio-group/vue.js +34 -0
- package/rate/index.js +223 -0
- package/rate/vue.js +131 -0
- package/record/index.js +300 -0
- package/record/vue.js +61 -0
- package/recycle-scroller/index.js +486 -0
- package/recycle-scroller/vue.js +141 -0
- package/rich-text/clipboard.js +54 -0
- package/rich-text/index.js +205 -0
- package/rich-text/module/file-upload.js +107 -0
- package/rich-text/module/image-drop.js +63 -0
- package/rich-text/module/image-upload.js +89 -0
- package/rich-text/options.js +141 -0
- package/rich-text/table-module.js +383 -0
- package/rich-text/vue.js +104 -0
- package/rich-text-editor/index.js +234 -0
- package/rich-text-editor/vue.js +297 -0
- package/river/index.js +371 -0
- package/river/river.js +352 -0
- package/river/vue.js +77 -0
- package/roles/index.js +58 -0
- package/roles/vue.js +27 -0
- package/row/index.js +18 -0
- package/row/vue.js +25 -0
- package/scroll-text/index.js +19 -0
- package/scroll-text/vue.js +22 -0
- package/scrollbar/index.js +99 -0
- package/scrollbar/vue-bar.js +42 -0
- package/scrollbar/vue.js +35 -0
- package/search/index.js +97 -0
- package/search/vue.js +99 -0
- package/select/index.js +1847 -0
- package/select/vue.js +642 -0
- package/select-dropdown/index.js +76 -0
- package/select-dropdown/vue.js +146 -0
- package/select-mobile/index.js +124 -0
- package/select-mobile/vue.js +67 -0
- package/select-view/index.js +156 -0
- package/select-view/vue.js +79 -0
- package/selected-box/index.js +220 -0
- package/selected-box/vue.js +102 -0
- package/signature/index.js +241 -0
- package/signature/vue.js +88 -0
- package/skeleton/index.js +14 -0
- package/skeleton/vue.js +15 -0
- package/skeleton-item/vue.js +15 -0
- package/slider/index.js +527 -0
- package/slider/vue.js +200 -0
- package/slider-button/index.js +50 -0
- package/slider-button/vue.js +41 -0
- package/slider-button-group/index.js +52 -0
- package/slider-button-group/slide-button.js +142 -0
- package/slider-button-group/vue.js +71 -0
- package/split/index.js +135 -0
- package/split/vue.js +95 -0
- package/standard-list-item/index.js +38 -0
- package/standard-list-item/vue.js +24 -0
- package/statistic/index.js +32 -0
- package/statistic/vue.js +20 -0
- package/steps/index.js +61 -0
- package/steps/slide-bar.js +129 -0
- package/steps/vue.js +35 -0
- package/sticky/index.js +89 -0
- package/sticky/vue.js +74 -0
- package/switch/index.js +36 -0
- package/switch/vue.js +42 -0
- package/tab-bar/index.js +57 -0
- package/tab-bar/vue.js +19 -0
- package/tab-dropdown/index.js +12 -0
- package/tab-dropdown/vue.js +20 -0
- package/tab-item/index.js +22 -0
- package/tab-item/vue.js +30 -0
- package/tab-item-mf/index.js +0 -0
- package/tab-item-mf/vue.js +27 -0
- package/tab-nav/index.js +348 -0
- package/tab-nav/vue.js +105 -0
- package/tabbar/index.js +61 -0
- package/tabbar/vue.js +62 -0
- package/tabbar-item/index.js +48 -0
- package/tabbar-item/vue.js +34 -0
- package/table/index.js +77 -0
- package/table/vue.js +42 -0
- package/tabs/index.js +213 -0
- package/tabs/vue.js +116 -0
- package/tabs-mf/index.js +286 -0
- package/tabs-mf/vue-bar.js +50 -0
- package/tabs-mf/vue-nav-item.js +23 -0
- package/tabs-mf/vue-nav.js +44 -0
- package/tabs-mf/vue-swipe.js +20 -0
- package/tabs-mf/vue.js +100 -0
- package/tabs-mf/wheel.js +77 -0
- package/tag/index.js +20 -0
- package/tag/vue.js +24 -0
- package/tag-group/index.js +38 -0
- package/tag-group/vue.js +36 -0
- package/tall-storage/index.js +141 -0
- package/tall-storage/vue-storage-box.js +19 -0
- package/tall-storage/vue.js +30 -0
- package/text-popup/index.js +55 -0
- package/text-popup/vue.js +32 -0
- package/time/index.js +89 -0
- package/time/vue.js +87 -0
- package/time-line/index.js +91 -0
- package/time-line/vue.js +52 -0
- package/time-line-new/index.js +53 -0
- package/time-line-new/vue.js +41 -0
- package/time-panel/index.js +133 -0
- package/time-panel/scrollIntoView.js +25 -0
- package/time-panel/vue.js +82 -0
- package/time-picker-mobile/index.js +58 -0
- package/time-picker-mobile/vue.js +42 -0
- package/time-range/index.js +147 -0
- package/time-range/vue.js +90 -0
- package/time-spinner/index.js +221 -0
- package/time-spinner/vue.js +111 -0
- package/timeline-item/index.js +92 -0
- package/timeline-item/vue.js +55 -0
- package/toast/index.js +7 -0
- package/toast/vue.js +19 -0
- package/toggle-menu/index.js +85 -0
- package/toggle-menu/vue.js +86 -0
- package/tooltip/index.js +175 -0
- package/tooltip/vue.js +123 -0
- package/top-box/index.js +48 -0
- package/top-box/vue.js +61 -0
- package/transfer/index.js +219 -0
- package/transfer/vue.js +64 -0
- package/transfer-panel/index.js +275 -0
- package/transfer-panel/vue.js +152 -0
- package/tree/index.js +796 -0
- package/tree/vue.js +288 -0
- package/tree-menu/index.js +170 -0
- package/tree-menu/vue.js +117 -0
- package/tree-node/index.js +279 -0
- package/tree-node/vue.js +150 -0
- package/tree-select/index.js +118 -0
- package/tree-select/vue.js +35 -0
- package/types/action-menu.type.d.ts +129 -0
- package/types/action-sheet.type.d.ts +119 -0
- package/types/alert.type.d.ts +134 -0
- package/types/amount.type.d.ts +169 -0
- package/types/anchor.type.d.ts +91 -0
- package/types/area.type.d.ts +135 -0
- package/types/async-flowchart.type.d.ts +72 -0
- package/types/autocomplete.type.d.ts +204 -0
- package/types/autonavi-map.type.d.ts +2 -0
- package/types/avatar.type.d.ts +2 -0
- package/types/badge.type.d.ts +84 -0
- package/types/baidu-map.type.d.ts +2 -0
- package/types/breadcrumb-item.type.d.ts +33 -0
- package/types/breadcrumb.type.d.ts +59 -0
- package/types/bulletin-board.type.d.ts +2 -0
- package/types/button-group.type.d.ts +90 -0
- package/types/button.type.d.ts +120 -0
- package/types/calendar-bar.type.d.ts +2 -0
- package/types/calendar.type.d.ts +2 -0
- package/types/card-group.type.d.ts +2 -0
- package/types/card-template.type.d.ts +2 -0
- package/types/card.type.d.ts +2 -0
- package/types/carousel-item.type.d.ts +2 -0
- package/types/carousel.type.d.ts +2 -0
- package/types/cascader-menu.type.d.ts +48 -0
- package/types/cascader-mobile.type.d.ts +2 -0
- package/types/cascader-node.type.d.ts +56 -0
- package/types/cascader-panel.type-8f58e628.d.ts +241 -0
- package/types/cascader-panel.type.d.ts +3 -0
- package/types/cascader-select.type.d.ts +2 -0
- package/types/cascader.type.d.ts +330 -0
- package/types/cell.type.d.ts +2 -0
- package/types/chart-bar.type.d.ts +2 -0
- package/types/chart-boxplot.type.d.ts +2 -0
- package/types/chart-candle.type.d.ts +2 -0
- package/types/chart-core.type.d.ts +2 -0
- package/types/chart-funnel.type.d.ts +2 -0
- package/types/chart-gauge.type.d.ts +2 -0
- package/types/chart-graph.type.d.ts +2 -0
- package/types/chart-heatmap.type.d.ts +2 -0
- package/types/chart-line.type.d.ts +2 -0
- package/types/chart-liquidfill.type.d.ts +2 -0
- package/types/chart-map.type.d.ts +2 -0
- package/types/chart-pie.type.d.ts +2 -0
- package/types/chart-radar.type.d.ts +2 -0
- package/types/chart-sankey.type.d.ts +2 -0
- package/types/chart-scatter.type.d.ts +2 -0
- package/types/chart-sunburst.type.d.ts +2 -0
- package/types/chart-tree.type.d.ts +2 -0
- package/types/chart-waterfall.type.d.ts +2 -0
- package/types/chart-wordcloud.type.d.ts +2 -0
- package/types/checkbox-button.type.d.ts +2 -0
- package/types/checkbox-group.type.d.ts +2 -0
- package/types/checkbox.type.d.ts +169 -0
- package/types/col.type.d.ts +2 -0
- package/types/collapse-item.type.d.ts +63 -0
- package/types/collapse.type.d.ts +73 -0
- package/types/color-picker.type.d.ts +5 -0
- package/types/color-select-panel.type.d.ts +27 -0
- package/types/column-list-group.type.d.ts +2 -0
- package/types/column-list-item.type.d.ts +2 -0
- package/types/common.type.d.ts +2 -0
- package/types/company.type.d.ts +2 -0
- package/types/container.type.d.ts +2 -0
- package/types/country.type.d.ts +2 -0
- package/types/credit-card-form.type.d.ts +2 -0
- package/types/credit-card.type.d.ts +2 -0
- package/types/crop.type.d.ts +2 -0
- package/types/currency.type.d.ts +2 -0
- package/types/date-panel.type.d.ts +2 -0
- package/types/date-picker-mobile.type.d.ts +2 -0
- package/types/date-picker.type.d.ts +256 -0
- package/types/date-range.type.d.ts +2 -0
- package/types/date-table.type.d.ts +151 -0
- package/types/dept.type.d.ts +2 -0
- package/types/detail-page.type.d.ts +2 -0
- package/types/dialog-box.type.d.ts +270 -0
- package/types/dialog-select.type.d.ts +2 -0
- package/types/divider.type.d.ts +94 -0
- package/types/drawer.type.d.ts +146 -0
- package/types/drop-roles.type.d.ts +2 -0
- package/types/drop-times.type.d.ts +2 -0
- package/types/dropdown-item.type-c9badbc1.d.ts +336 -0
- package/types/dropdown-item.type.d.ts +4 -0
- package/types/dropdown-menu.type.d.ts +4 -0
- package/types/dropdown.type.d.ts +145 -0
- package/types/dynamic-scroller-item.type.d.ts +2 -0
- package/types/dynamic-scroller.type.d.ts +2 -0
- package/types/espace.type.d.ts +2 -0
- package/types/exception.type.d.ts +2 -0
- package/types/fall-menu.type.d.ts +96 -0
- package/types/file-upload.type.d.ts +3 -0
- package/types/filter-bar.type.d.ts +2 -0
- package/types/filter-box.type.d.ts +2 -0
- package/types/filter-panel.type.d.ts +2 -0
- package/types/filter.type.d.ts +2 -0
- package/types/float-button.type.d.ts +123 -0
- package/types/floatbar.type.d.ts +45 -0
- package/types/floating-button.type.d.ts +2 -0
- package/types/flowchart.type.d.ts +2 -0
- package/types/form-item.type.d.ts +3 -0
- package/types/form.type-4e0ec0a1.d.ts +421 -0
- package/types/form.type.d.ts +3 -0
- package/types/fullscreen.type.d.ts +2 -0
- package/types/grid.type.d.ts +2 -0
- package/types/guide.type.d.ts +2 -0
- package/types/hrapprover.type.d.ts +2 -0
- package/types/image-viewer.type.d.ts +2 -0
- package/types/image.type.d.ts +184 -0
- package/types/index-a975a7a2.d.ts +54 -0
- package/types/index-bar-anchor.type.d.ts +2 -0
- package/types/index-bar.type.d.ts +2 -0
- package/types/input.type.d.ts +330 -0
- package/types/ip-address.type.d.ts +156 -0
- package/types/label.type.d.ts +81 -0
- package/types/layout.type.d.ts +2 -0
- package/types/link-menu.type.d.ts +2 -0
- package/types/link.type.d.ts +48 -0
- package/types/list.type.d.ts +2 -0
- package/types/load-list.type.d.ts +58 -0
- package/types/loading.type.d.ts +97 -0
- package/types/locales.type.d.ts +2 -0
- package/types/logon-user.type.d.ts +2 -0
- package/types/logout.type.d.ts +2 -0
- package/types/milestone.type.d.ts +170 -0
- package/types/mind-map.type.d.ts +20 -0
- package/types/mini-picker.type.d.ts +2 -0
- package/types/modal.type.d.ts +292 -0
- package/types/month-range.type.d.ts +2 -0
- package/types/month-table.type.d.ts +2 -0
- package/types/multi-select.type.d.ts +2 -0
- package/types/nav-menu.type.d.ts +125 -0
- package/types/notify.type.d.ts +2 -0
- package/types/numeric.type.d.ts +312 -0
- package/types/option-group.type.d.ts +2 -0
- package/types/option.type.d.ts +2 -0
- package/types/pager-item.type.d.ts +2 -0
- package/types/pager.type.d.ts +180 -0
- package/types/panel.type.d.ts +2 -0
- package/types/picker-column.type.d.ts +2 -0
- package/types/picker.type.d.ts +216 -0
- package/types/pop-upload.type.d.ts +2 -0
- package/types/popconfirm.type.d.ts +95 -0
- package/types/popeditor.type.d.ts +279 -0
- package/types/popover.type.d.ts +164 -0
- package/types/popup.type.d.ts +2 -0
- package/types/progress.type.d.ts +218 -0
- package/types/pull-refresh.type.d.ts +2 -0
- package/types/query-builder.type.d.ts +2 -0
- package/types/radio-button.type.d.ts +90 -0
- package/types/radio-group.type.d.ts +71 -0
- package/types/radio.type.d.ts +99 -0
- package/types/rate.type.d.ts +237 -0
- package/types/record.type.d.ts +2 -0
- package/types/recycle-scroller.type.d.ts +2 -0
- package/types/river.type.d.ts +2 -0
- package/types/roles.type.d.ts +2 -0
- package/types/row.type.d.ts +2 -0
- package/types/scroll-text.type.d.ts +2 -0
- package/types/scrollbar.type.d.ts +2 -0
- package/types/search.type.d.ts +129 -0
- package/types/select-dropdown.type.d.ts +2 -0
- package/types/select-mobile.type.d.ts +2 -0
- package/types/select-view.type.d.ts +2 -0
- package/types/select.type.d.ts +2 -0
- package/types/selected-box.type.d.ts +2 -0
- package/types/shared.type.d.ts +178 -0
- package/types/skeleton-item.type.d.ts +38 -0
- package/types/skeleton.type.d.ts +45 -0
- package/types/slide-bar.type.d.ts +2 -0
- package/types/slider-button-group.type.d.ts +2 -0
- package/types/slider-button.type.d.ts +2 -0
- package/types/slider.type.d.ts +246 -0
- package/types/split.type.d.ts +2 -0
- package/types/standard-list-item.type.d.ts +2 -0
- package/types/statistic.type.d.ts +52 -0
- package/types/steps.type.d.ts +95 -0
- package/types/switch.type.d.ts +117 -0
- package/types/tab-bar.type.d.ts +43 -0
- package/types/tab-dropdown.type.d.ts +2 -0
- package/types/tab-item-mf.type.d.ts +2 -0
- package/types/tab-item.type.d.ts +70 -0
- package/types/tab-nav.type.d.ts +112 -0
- package/types/tabbar-item.type.d.ts +2 -0
- package/types/tabbar.type.d.ts +2 -0
- package/types/table.type.d.ts +2 -0
- package/types/tabs-mf.type.d.ts +2 -0
- package/types/tabs.type.d.ts +161 -0
- package/types/tag-group.type.d.ts +65 -0
- package/types/tag.type.d.ts +67 -0
- package/types/tall-storage.type.d.ts +2 -0
- package/types/text-popup.type.d.ts +2 -0
- package/types/time-line.type-9fb16096.d.ts +327 -0
- package/types/time-line.type.d.ts +4 -0
- package/types/time-panel.type.d.ts +2 -0
- package/types/time-picker-mobile.type.d.ts +2 -0
- package/types/time-range.type.d.ts +2 -0
- package/types/time-spinner.type.d.ts +2 -0
- package/types/time.type.d.ts +2 -0
- package/types/timeline-item.type.d.ts +4 -0
- package/types/toast.type.d.ts +63 -0
- package/types/toggle-menu.type.d.ts +2 -0
- package/types/tooltip.type.d.ts +185 -0
- package/types/top-box.type.d.ts +2 -0
- package/types/transfer-panel.type.d.ts +2 -0
- package/types/transfer.type.d.ts +186 -0
- package/types/tree-menu.type.d.ts +242 -0
- package/types/tree-node.type.d.ts +2 -0
- package/types/tree.type.d.ts +2 -0
- package/types/upload-dragger.type.d.ts +50 -0
- package/types/upload-list.type-eaf82b7a.d.ts +1213 -0
- package/types/upload-list.type.d.ts +3 -0
- package/types/upload.type.d.ts +3 -0
- package/types/user-account.type.d.ts +2 -0
- package/types/user-contact.type.d.ts +128 -0
- package/types/user-head-group.type.d.ts +2 -0
- package/types/user-head.type.d.ts +151 -0
- package/types/user-link.type.d.ts +2 -0
- package/types/user.type.d.ts +2 -0
- package/types/watermark.type.d.ts +33 -0
- package/types/wheel.type.d.ts +2 -0
- package/types/wizard.type.d.ts +96 -0
- package/types/year-range.type.d.ts +2 -0
- package/types/year-table.type.d.ts +2 -0
- package/upload/index.js +405 -0
- package/upload/vue.js +81 -0
- package/upload-dragger/index.js +72 -0
- package/upload-dragger/vue.js +26 -0
- package/upload-list/index.js +256 -0
- package/upload-list/vue.js +128 -0
- package/user/index.js +532 -0
- package/user/vue.js +76 -0
- package/user-account/index.js +18 -0
- package/user-account/vue.js +22 -0
- package/user-contact/index.js +57 -0
- package/user-contact/vue.js +29 -0
- package/user-head/index.js +73 -0
- package/user-head/vue.js +39 -0
- package/user-head-group/index.js +20 -0
- package/user-head-group/vue.js +30 -0
- package/user-link/index.js +42 -0
- package/user-link/vue.js +42 -0
- package/virtual-scroll-box/index.js +294 -0
- package/virtual-scroll-box/vue.js +43 -0
- package/virtual-tree/index.js +168 -0
- package/virtual-tree/vue.js +53 -0
- package/watermark/index.js +213 -0
- package/watermark/vue.js +27 -0
- package/wheel/index.js +165 -0
- package/wheel/vue.js +79 -0
- package/wizard/index.js +107 -0
- package/wizard/vue.js +48 -0
- package/year-range/index.js +125 -0
- package/year-range/vue.js +88 -0
- package/year-table/index.js +185 -0
- package/year-table/vue.js +43 -0
package/picker/index.js
ADDED
|
@@ -0,0 +1,1119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-G2ADBYYC.js";
|
|
5
|
+
import { toDate, getDateWithNewTimezone, getStrTimezone, getLocalTimezone } from "../common/date";
|
|
6
|
+
import { isNumber, isDate } from "../common/type";
|
|
7
|
+
import userPopper from "../common/deps/vue-popper";
|
|
8
|
+
import { DATEPICKER } from "../common";
|
|
9
|
+
import { formatDate, parseDate, isDateObject, getWeekNumber, prevDate, nextDate } from "../common/deps/date-util";
|
|
10
|
+
import { extend } from "../common/object";
|
|
11
|
+
import globalTimezone from "./timezone";
|
|
12
|
+
const iso8601Reg = /^\d{4}-\d{2}-\d{2}(.)\d{2}:\d{2}:\d{2}(.+)$/;
|
|
13
|
+
const getPanel = ({
|
|
14
|
+
DatePanel,
|
|
15
|
+
DateRangePanel,
|
|
16
|
+
MonthRangePanel,
|
|
17
|
+
YearRangePanel,
|
|
18
|
+
TimePanel,
|
|
19
|
+
TimeRangePanel,
|
|
20
|
+
QuarterPanel,
|
|
21
|
+
TimeSelect
|
|
22
|
+
}) => (type) => {
|
|
23
|
+
if (type === DATEPICKER.DateRange || type === DATEPICKER.DateTimeRange) {
|
|
24
|
+
return DateRangePanel;
|
|
25
|
+
} else if (type === DATEPICKER.MonthRange) {
|
|
26
|
+
return MonthRangePanel;
|
|
27
|
+
} else if (type === DATEPICKER.YearRange) {
|
|
28
|
+
return YearRangePanel;
|
|
29
|
+
} else if (type === DATEPICKER.TimeRange) {
|
|
30
|
+
return TimeRangePanel;
|
|
31
|
+
} else if (type === DATEPICKER.Time) {
|
|
32
|
+
return TimePanel;
|
|
33
|
+
} else if (type === DATEPICKER.TimeSelect) {
|
|
34
|
+
return TimeSelect;
|
|
35
|
+
} else if (type === DATEPICKER.Quarter) {
|
|
36
|
+
return QuarterPanel;
|
|
37
|
+
}
|
|
38
|
+
return DatePanel;
|
|
39
|
+
};
|
|
40
|
+
const watchMobileVisible = ({ api, props, state, nextTick }) => ([dateMobileVisible, timeMobileVisible]) => {
|
|
41
|
+
if (dateMobileVisible || timeMobileVisible) {
|
|
42
|
+
state.valueOnOpen = Array.isArray(props.modelValue) ? [...props.modelValue] : props.modelValue;
|
|
43
|
+
} else {
|
|
44
|
+
nextTick(() => {
|
|
45
|
+
api.emitChange(props.modelValue);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const watchPickerVisible = ({ api, vm, dispatch, emit, props, state, nextTick }) => (value) => {
|
|
50
|
+
if (props.readonly || state.pickerDisabled || state.isMobileScreen)
|
|
51
|
+
return;
|
|
52
|
+
if (value) {
|
|
53
|
+
api.showPicker();
|
|
54
|
+
state.valueOnOpen = Array.isArray(props.modelValue) ? [...props.modelValue] : props.modelValue;
|
|
55
|
+
} else {
|
|
56
|
+
api.hidePicker();
|
|
57
|
+
nextTick(() => {
|
|
58
|
+
api.emitChange(props.modelValue);
|
|
59
|
+
});
|
|
60
|
+
state.userInput = null;
|
|
61
|
+
if (props.validateEvent) {
|
|
62
|
+
dispatch("FormItem", "form.blur");
|
|
63
|
+
}
|
|
64
|
+
if (props.changeOnConfirm && !valueEquals(props.modelValue, state.oldValue)) {
|
|
65
|
+
emit("update:modelValue", state.oldValue);
|
|
66
|
+
}
|
|
67
|
+
emit("blur", vm);
|
|
68
|
+
api.blur();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const getValueEmpty = (props) => () => {
|
|
72
|
+
const modelValue = props.modelValue;
|
|
73
|
+
if (Array.isArray(modelValue)) {
|
|
74
|
+
for (let i = 0, len = modelValue.length; i < len; i++) {
|
|
75
|
+
if (modelValue[i]) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
if (modelValue) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
};
|
|
86
|
+
const getMode = ({ state }) => () => {
|
|
87
|
+
if (state.type === DATEPICKER.Week) {
|
|
88
|
+
return DATEPICKER.Week;
|
|
89
|
+
} else if (state.type === DATEPICKER.Month) {
|
|
90
|
+
return DATEPICKER.Month;
|
|
91
|
+
} else if ([DATEPICKER.Year, DATEPICKER.Years, DATEPICKER.YearRange].includes(state.type)) {
|
|
92
|
+
return state.type;
|
|
93
|
+
} else if (state.type === DATEPICKER.Dates) {
|
|
94
|
+
return DATEPICKER.Dates;
|
|
95
|
+
}
|
|
96
|
+
return DATEPICKER.Day;
|
|
97
|
+
};
|
|
98
|
+
const formatAsFormatAndType = ({ api }) => (value, customFormat, type, formatObj) => {
|
|
99
|
+
if (!value)
|
|
100
|
+
return null;
|
|
101
|
+
const formatter = (api.typeValueResolveMap()[type] || api.typeValueResolveMap().default).formatter;
|
|
102
|
+
const format = customFormat || DATEPICKER.DateFormats[type];
|
|
103
|
+
return formatter(value, format, formatObj);
|
|
104
|
+
};
|
|
105
|
+
const displayValue = ({ api, props, state }) => () => {
|
|
106
|
+
const formatObj = {
|
|
107
|
+
rangeSeparator: props.rangeSeparator
|
|
108
|
+
};
|
|
109
|
+
const formattedValue = api.formatAsFormatAndType(state.parsedValue, state.format, state.type, formatObj);
|
|
110
|
+
if (Array.isArray(state.userInput)) {
|
|
111
|
+
return [
|
|
112
|
+
state.userInput[0] || formattedValue && formattedValue[0] || "",
|
|
113
|
+
state.userInput[1] || formattedValue && formattedValue[1] || ""
|
|
114
|
+
];
|
|
115
|
+
} else if (state.userInput !== null) {
|
|
116
|
+
return state.userInput;
|
|
117
|
+
} else if (formattedValue) {
|
|
118
|
+
return [DATEPICKER.Dates, DATEPICKER.Years].includes(state.type) ? formattedValue.join(", ") : formattedValue;
|
|
119
|
+
}
|
|
120
|
+
return "";
|
|
121
|
+
};
|
|
122
|
+
const parseAsFormatAndType = ({ api }) => (value, customFormat, type, rangeSeparator = "-") => {
|
|
123
|
+
if (!value) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const parser = (api.typeValueResolveMap()[type] || api.typeValueResolveMap().default).parser;
|
|
127
|
+
const format = customFormat || DATEPICKER.DateFormats[type];
|
|
128
|
+
return parser(value, format, rangeSeparator);
|
|
129
|
+
};
|
|
130
|
+
const parsedValue = ({ api, props, state, t }) => () => {
|
|
131
|
+
if (!props.modelValue) {
|
|
132
|
+
return props.modelValue;
|
|
133
|
+
}
|
|
134
|
+
if (state.type === DATEPICKER.TimeSelect) {
|
|
135
|
+
return props.modelValue;
|
|
136
|
+
}
|
|
137
|
+
const valueIsDateObject = isDateObject(props.modelValue) || Array.isArray(props.modelValue) && props.modelValue.every(isDateObject);
|
|
138
|
+
const { from, to, isServiceTimezone, timezoneOffset } = state.timezone;
|
|
139
|
+
if (valueIsDateObject && !isServiceTimezone) {
|
|
140
|
+
return props.modelValue;
|
|
141
|
+
}
|
|
142
|
+
if (state.valueFormat) {
|
|
143
|
+
let date = props.modelValue;
|
|
144
|
+
if (isServiceTimezone) {
|
|
145
|
+
if (Array.isArray(date)) {
|
|
146
|
+
date = [].concat(date).map((item) => {
|
|
147
|
+
return isDate(item) ? formatDate(item, state.valueFormat, t) : item;
|
|
148
|
+
});
|
|
149
|
+
} else {
|
|
150
|
+
if (state.valueFormat !== DATEPICKER.TimesTamp) {
|
|
151
|
+
date = formatDate(date, state.valueFormat, t);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const result = api.parseAsFormatAndType(date, state.valueFormat, state.type, props.rangeSeparator);
|
|
156
|
+
if (Array.isArray(result)) {
|
|
157
|
+
return result.map((date2) => getDateWithNewTimezone(date2, from, to, timezoneOffset));
|
|
158
|
+
}
|
|
159
|
+
return getDateWithNewTimezone(result || props.modelValue, from, to, timezoneOffset);
|
|
160
|
+
}
|
|
161
|
+
const trans = (value) => typeof value === "string" || isNumber(value) ? toDate(value) : value;
|
|
162
|
+
const values = [].concat(props.modelValue).map((val) => getDateWithNewTimezone(trans(val), from, to, timezoneOffset));
|
|
163
|
+
return values.length > 1 ? values : values[0];
|
|
164
|
+
};
|
|
165
|
+
const getTimezone = ({ props, utils }) => () => {
|
|
166
|
+
const { dbTimezone, timezone, isutc8, type = "date", iso8601, timezoneOffset } = props;
|
|
167
|
+
const setting = utils.getDateFormat && utils.getDateFormat();
|
|
168
|
+
const { DbTimezone, Timezone, TimezoneOffset } = setting || {};
|
|
169
|
+
const cur = getLocalTimezone();
|
|
170
|
+
const isTzNumber = (z) => typeof z === "number" && z >= -12 && z <= 14;
|
|
171
|
+
if (!~type.indexOf("datetime")) {
|
|
172
|
+
return { from: cur, to: cur };
|
|
173
|
+
}
|
|
174
|
+
let serveTimezone = isTzNumber(dbTimezone) ? dbTimezone : isTzNumber(DbTimezone) ? DbTimezone : cur;
|
|
175
|
+
let clientTimezone = isTzNumber(timezone) ? timezone : isTzNumber(Timezone) ? Timezone : cur;
|
|
176
|
+
let clientTimezoneOffset = isNumber(timezoneOffset) ? timezoneOffset : isNumber(TimezoneOffset) ? TimezoneOffset : 0;
|
|
177
|
+
const value = props.modelValue;
|
|
178
|
+
const str = (Array.isArray(value) ? value[0] : value) || "";
|
|
179
|
+
const match = typeof str === "string" && str.match(/(-|\+)(\d{2}):?(\d{2})$/);
|
|
180
|
+
if ((iso8601 || setting) && match) {
|
|
181
|
+
serveTimezone = getStrTimezone(str);
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
from: serveTimezone,
|
|
185
|
+
to: isutc8 ? 8 : clientTimezone,
|
|
186
|
+
isServiceTimezone: !!setting,
|
|
187
|
+
timezoneOffset: clientTimezoneOffset
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
const nullOrString = (value) => {
|
|
191
|
+
const arr = Array.isArray(value) ? value : [value];
|
|
192
|
+
return arr.every((val) => !val && !isNumber(val) || typeof val === "string");
|
|
193
|
+
};
|
|
194
|
+
const getValueFormat = ({ props, utils }) => {
|
|
195
|
+
const { valueFormat, iso8601, modelValue: value, type = "date" } = props;
|
|
196
|
+
const setting = utils.getDateFormat && utils.getDateFormat();
|
|
197
|
+
let suffix = "";
|
|
198
|
+
let separator = " ";
|
|
199
|
+
if (!valueFormat && ~type.indexOf("datetime") && (iso8601 || setting) && nullOrString(value)) {
|
|
200
|
+
const str = (Array.isArray(value) ? value[0] : value) || "";
|
|
201
|
+
const match = str.match(iso8601Reg);
|
|
202
|
+
if (match && match.length === 3) {
|
|
203
|
+
suffix = match[2] || "";
|
|
204
|
+
separator = match[1];
|
|
205
|
+
}
|
|
206
|
+
return `yyyy-MM-dd${separator}HH:mm:ss${suffix}`;
|
|
207
|
+
}
|
|
208
|
+
return valueFormat;
|
|
209
|
+
};
|
|
210
|
+
const dateFormatter = ({ t }) => (value, format) => {
|
|
211
|
+
if (format === DATEPICKER.TimesTamp) {
|
|
212
|
+
return value.getTime();
|
|
213
|
+
}
|
|
214
|
+
return formatDate(value, format, t);
|
|
215
|
+
};
|
|
216
|
+
const dateParser = ({ t, props }) => (text, format) => {
|
|
217
|
+
if (format === DATEPICKER.TimesTamp) {
|
|
218
|
+
return new Date(Number(text));
|
|
219
|
+
}
|
|
220
|
+
const value = props.autoFormat ? formatText({ text, format }) : text;
|
|
221
|
+
return parseDate(value, format, t);
|
|
222
|
+
};
|
|
223
|
+
const rangeFormatter = (api) => (value, format) => {
|
|
224
|
+
if (Array.isArray(value) && value.length === 2) {
|
|
225
|
+
const start = value[0];
|
|
226
|
+
const end = value[1];
|
|
227
|
+
if (start && end) {
|
|
228
|
+
return [api.dateFormatter(start, format), api.dateFormatter(end, format)];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return "";
|
|
232
|
+
};
|
|
233
|
+
const rangeParser = (api) => (array, format, separator) => {
|
|
234
|
+
if (!Array.isArray(array)) {
|
|
235
|
+
array = array.split(separator);
|
|
236
|
+
}
|
|
237
|
+
if (array.length === 2) {
|
|
238
|
+
const range1 = array[0];
|
|
239
|
+
const range2 = array[1];
|
|
240
|
+
return [api.dateParser(range1, format), api.dateParser(range2, format)];
|
|
241
|
+
}
|
|
242
|
+
return [];
|
|
243
|
+
};
|
|
244
|
+
const getWeekData = (value) => {
|
|
245
|
+
const valueday = new Date(value).getDay();
|
|
246
|
+
let newDate = new Date(value);
|
|
247
|
+
if (valueday >= 2) {
|
|
248
|
+
newDate.setTime(new Date(value).getTime() - (valueday - 1) * 864e5);
|
|
249
|
+
} else if (valueday === 0) {
|
|
250
|
+
newDate.setTime(new Date(value).getTime() + (valueday + 1) * 864e5);
|
|
251
|
+
}
|
|
252
|
+
return newDate;
|
|
253
|
+
};
|
|
254
|
+
const getDefaultOfTypeValueResolveMap = () => ({
|
|
255
|
+
formatter(value) {
|
|
256
|
+
return value ? String(value) : "";
|
|
257
|
+
},
|
|
258
|
+
parser(text) {
|
|
259
|
+
return text === void 0 || text === "" ? null : text;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
const getWeekOfTypeValueResolveMap = ({ t, props, api }) => ({
|
|
263
|
+
formatter(value, format, formatObj) {
|
|
264
|
+
const weekDate = getWeekData(value);
|
|
265
|
+
let week = getWeekNumber(weekDate);
|
|
266
|
+
let month = weekDate.getMonth();
|
|
267
|
+
const trueDate = new Date(weekDate);
|
|
268
|
+
const { rangeSeparator = "-", type = "format" } = formatObj;
|
|
269
|
+
if (week === 1 && month === 11) {
|
|
270
|
+
trueDate.setHours(0, 0, 0, 0);
|
|
271
|
+
trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
|
|
272
|
+
}
|
|
273
|
+
let date;
|
|
274
|
+
if (type === "format" && !/W/.test(format)) {
|
|
275
|
+
const { start, end } = getWeekRange(value, format, t, props.pickerOptions);
|
|
276
|
+
date = `${start} ${rangeSeparator} ${end}`;
|
|
277
|
+
} else {
|
|
278
|
+
date = formatDate(trueDate, format, t);
|
|
279
|
+
date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? "0" + week : week) : date.replace(/W/, week);
|
|
280
|
+
}
|
|
281
|
+
return date;
|
|
282
|
+
},
|
|
283
|
+
parser(text, format) {
|
|
284
|
+
return api.typeValueResolveMap().date.parser(text, format);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
const getWeekRange = (value, format, t, pickerOptions) => {
|
|
288
|
+
const firstDayOfWeek = pickerOptions && pickerOptions.firstDayOfWeek ? pickerOptions.firstDayOfWeek : 7;
|
|
289
|
+
const dayOffset = (value.getDay() - firstDayOfWeek + 7) % 7;
|
|
290
|
+
const startDate = prevDate(value, dayOffset);
|
|
291
|
+
const endDate = nextDate(startDate, 6);
|
|
292
|
+
const start = formatDate(startDate, format, t);
|
|
293
|
+
const end = formatDate(endDate, format, t);
|
|
294
|
+
return {
|
|
295
|
+
start,
|
|
296
|
+
end
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
const getNumberOfTypeValueResolveMap = () => ({
|
|
300
|
+
formatter(value) {
|
|
301
|
+
return value ? String(value) : "";
|
|
302
|
+
},
|
|
303
|
+
parser(text) {
|
|
304
|
+
let result = Number(text);
|
|
305
|
+
return !isNaN(text) ? result : null;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
const getDatesOfTypeValueResolveMap = (api) => ({
|
|
309
|
+
formatter(value, format) {
|
|
310
|
+
return value.map((date) => api.dateFormatter(date, format));
|
|
311
|
+
},
|
|
312
|
+
parser(value, format) {
|
|
313
|
+
return (typeof value === "string" ? value.split(", ") : value).map(
|
|
314
|
+
(date) => date instanceof Date ? date : api.dateParser(date, format)
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
const typeValueResolveMap = ({ api, props, t }) => () => ({
|
|
319
|
+
default: getDefaultOfTypeValueResolveMap(),
|
|
320
|
+
week: getWeekOfTypeValueResolveMap({ t, props, api }),
|
|
321
|
+
date: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
322
|
+
datetime: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
323
|
+
daterange: { formatter: api.rangeFormatter, parser: api.rangeParser },
|
|
324
|
+
monthrange: { formatter: api.rangeFormatter, parser: api.rangeParser },
|
|
325
|
+
datetimerange: { formatter: api.rangeFormatter, parser: api.rangeParser },
|
|
326
|
+
timerange: { formatter: api.rangeFormatter, parser: api.rangeParser },
|
|
327
|
+
time: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
328
|
+
month: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
329
|
+
year: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
330
|
+
years: getDatesOfTypeValueResolveMap(api),
|
|
331
|
+
yearrange: getDatesOfTypeValueResolveMap(api),
|
|
332
|
+
number: getNumberOfTypeValueResolveMap(),
|
|
333
|
+
dates: getDatesOfTypeValueResolveMap(api),
|
|
334
|
+
quarter: {
|
|
335
|
+
formatter: (value) => `${value.getFullYear()}-Q${DATEPICKER.MonthQuarterMap[value.getMonth()]}`,
|
|
336
|
+
parser: api.dateParser
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
const firstInputId = ({ props, state }) => () => {
|
|
340
|
+
const obj = {};
|
|
341
|
+
let id;
|
|
342
|
+
if (state.ranged) {
|
|
343
|
+
id = props.id && props.id[0];
|
|
344
|
+
} else {
|
|
345
|
+
id = props.id;
|
|
346
|
+
}
|
|
347
|
+
if (id) {
|
|
348
|
+
obj.id = id;
|
|
349
|
+
}
|
|
350
|
+
return obj;
|
|
351
|
+
};
|
|
352
|
+
const secondInputId = ({ props, state }) => () => {
|
|
353
|
+
const obj = {};
|
|
354
|
+
let id;
|
|
355
|
+
if (state.ranged) {
|
|
356
|
+
id = props.id && props.id[1];
|
|
357
|
+
}
|
|
358
|
+
if (id) {
|
|
359
|
+
obj.id = id;
|
|
360
|
+
}
|
|
361
|
+
return obj;
|
|
362
|
+
};
|
|
363
|
+
const focus = ({ api, props, vm }) => () => !props.isRange ? vm.$refs.reference.querySelector("input").focus() : api.handleFocus();
|
|
364
|
+
const blur = (state) => () => state.refInput.forEach((input) => input.blur());
|
|
365
|
+
const parseValue = ({ api, props, state }) => (value) => {
|
|
366
|
+
const isParsed = isDateObject(value) || Array.isArray(value) && value.every(isDateObject);
|
|
367
|
+
if (state.valueFormat && !isParsed) {
|
|
368
|
+
return api.parseAsFormatAndType(value, state.valueFormat, state.type, props.rangeSeparator) || value;
|
|
369
|
+
}
|
|
370
|
+
return value;
|
|
371
|
+
};
|
|
372
|
+
const formatToValue = ({ api, state }) => (date) => {
|
|
373
|
+
const isFormattable = isDateObject(date) || Array.isArray(date) && date.every(isDateObject);
|
|
374
|
+
if (state.valueFormat && isFormattable) {
|
|
375
|
+
return api.formatAsFormatAndType(date, state.valueFormat, state.type, {
|
|
376
|
+
type: "value-format"
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
return date;
|
|
380
|
+
};
|
|
381
|
+
const parseString = ({ api, state }) => (value) => {
|
|
382
|
+
const type = Array.isArray(value) ? state.type : state.type.replace(DATEPICKER.Range, "");
|
|
383
|
+
return api.parseAsFormatAndType(value, state.format, type);
|
|
384
|
+
};
|
|
385
|
+
const formatToString = ({ api, state }) => (value) => {
|
|
386
|
+
const type = Array.isArray(value) ? state.type : state.type.replace(DATEPICKER.Range, "");
|
|
387
|
+
return api.formatAsFormatAndType(value, state.format, type);
|
|
388
|
+
};
|
|
389
|
+
const handleMouseEnter = ({ props, state }) => () => {
|
|
390
|
+
if (props.readonly || state.pickerDisabled) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
if (!state.valueIsEmpty && props.clearable) {
|
|
394
|
+
state.showClose = true;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
const handleInput = ({ state, props, api }) => (val, event) => {
|
|
398
|
+
event = val.target ? val : event;
|
|
399
|
+
if (props.autoFormat) {
|
|
400
|
+
const value = api.formatInputValue({ event, prevValue: state.displayValue });
|
|
401
|
+
state.userInput = value;
|
|
402
|
+
} else {
|
|
403
|
+
const val2 = event.target.value;
|
|
404
|
+
state.userInput = val2;
|
|
405
|
+
}
|
|
406
|
+
if (state.type === "time-select") {
|
|
407
|
+
state.picker.state.isFilter = true;
|
|
408
|
+
state.picker.state.filterVal = state.userInput;
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
const formatInputValue = ({ props, state }) => ({ event, prevValue = "" }) => {
|
|
412
|
+
const val = event.target.value;
|
|
413
|
+
const inputData = event.data;
|
|
414
|
+
const format = state.type === "time-select" ? "HH:mm" : props.format || DATEPICKER.DateFormats[state.type];
|
|
415
|
+
if (inputData && inputData.charCodeAt() >= 48 && inputData.charCodeAt() <= 57) {
|
|
416
|
+
return formatText({ event, format, text: prevValue, needSelectionStart: true });
|
|
417
|
+
} else {
|
|
418
|
+
return val;
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
const getSelectionStart = ({ value, format, regx, event }) => {
|
|
422
|
+
const formatMatchArr = format.match(regx);
|
|
423
|
+
let selectionStart = getSelectionStartIndex(event);
|
|
424
|
+
let I = 0;
|
|
425
|
+
if (value !== "") {
|
|
426
|
+
const match = value.match(/[0-9]/g);
|
|
427
|
+
I = match === null ? 0 : match.length;
|
|
428
|
+
for (let i = 0; i < formatMatchArr.length; i++) {
|
|
429
|
+
I -= Math.max(formatMatchArr[i].length, 2);
|
|
430
|
+
}
|
|
431
|
+
I = I >= 0 ? 1 : 0;
|
|
432
|
+
I === 1 && selectionStart >= value.length && (selectionStart = value.length - 1);
|
|
433
|
+
}
|
|
434
|
+
return { selectionStart, I };
|
|
435
|
+
};
|
|
436
|
+
const getEffectiveDateString = (formatStr) => {
|
|
437
|
+
const serializationList = [{ "MM": "01" }, { "M": "1" }, { "dd": "01" }, { "d": "1" }];
|
|
438
|
+
let result = formatStr;
|
|
439
|
+
serializationList.forEach((item) => {
|
|
440
|
+
const itemKey = Object.keys(item)[0];
|
|
441
|
+
if (result.includes(itemKey)) {
|
|
442
|
+
result = result.replace(itemKey, item[itemKey]);
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
return result;
|
|
446
|
+
};
|
|
447
|
+
const getNum = (value, format, regx) => {
|
|
448
|
+
let len = value.length;
|
|
449
|
+
let formatStr = "";
|
|
450
|
+
if (format && regx) {
|
|
451
|
+
const formatMatchArr = format.match(regx);
|
|
452
|
+
formatStr = formatMatchArr.join("");
|
|
453
|
+
len = Math.max(len, formatStr.length);
|
|
454
|
+
}
|
|
455
|
+
const num = { str: "", arr: [] };
|
|
456
|
+
for (let i = 0; i < len; i++) {
|
|
457
|
+
let fillStr = "0";
|
|
458
|
+
if (formatStr && len > value.length) {
|
|
459
|
+
const validStr = getEffectiveDateString(formatStr);
|
|
460
|
+
if (/[0-9]/.test(validStr[i])) {
|
|
461
|
+
fillStr = validStr[i];
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
const char = value.charAt(i) ? value.charAt(i) : fillStr;
|
|
465
|
+
if (/[0-9]/.test(char)) {
|
|
466
|
+
num.str += char;
|
|
467
|
+
} else {
|
|
468
|
+
num.arr[i] = 1;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return num;
|
|
472
|
+
};
|
|
473
|
+
const getSelectionStartIndex = (event) => {
|
|
474
|
+
const inputElem = event.target;
|
|
475
|
+
return inputElem.selectionStart - (event.data ? event.data.length : 0);
|
|
476
|
+
};
|
|
477
|
+
const moveStart = (inputElem, moveStartIndex) => {
|
|
478
|
+
if (inputElem.setSelectionRange) {
|
|
479
|
+
inputElem.focus();
|
|
480
|
+
setTimeout(() => {
|
|
481
|
+
inputElem.setSelectionRange(moveStartIndex, moveStartIndex);
|
|
482
|
+
}, 0);
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
const formatText = ({ event, text, format, needSelectionStart = false }) => {
|
|
486
|
+
if (!format)
|
|
487
|
+
return text;
|
|
488
|
+
let cursorOffset = 0;
|
|
489
|
+
let value = "";
|
|
490
|
+
let regx = /yyyy|yyy|yy|y|MM|M|dd|d|HH|hh|H|h|mm|m|ss|s|WW|W|w/g;
|
|
491
|
+
let startIndex = 0;
|
|
492
|
+
let { numStr, selectionStart } = getNumAndSelectionStart({
|
|
493
|
+
value: text,
|
|
494
|
+
format,
|
|
495
|
+
regx,
|
|
496
|
+
event,
|
|
497
|
+
needSelectionStart
|
|
498
|
+
});
|
|
499
|
+
let matchResult = regx.exec(format);
|
|
500
|
+
while (numStr.str !== "" && matchResult !== null) {
|
|
501
|
+
let subStr;
|
|
502
|
+
let newNum;
|
|
503
|
+
let subLen;
|
|
504
|
+
const endIndex = matchResult.index;
|
|
505
|
+
if (startIndex >= 0) {
|
|
506
|
+
value += format.substring(startIndex, endIndex);
|
|
507
|
+
}
|
|
508
|
+
selectionStart >= startIndex + cursorOffset && selectionStart <= endIndex + cursorOffset && (selectionStart = selectionStart + endIndex - startIndex);
|
|
509
|
+
startIndex = regx.lastIndex;
|
|
510
|
+
subLen = startIndex - endIndex;
|
|
511
|
+
subStr = numStr.str.substring(0, subLen);
|
|
512
|
+
const firstMatchChar = matchResult[0].charAt(0);
|
|
513
|
+
const firstChar = parseInt(subStr.charAt(0), 10);
|
|
514
|
+
if (numStr.str.length > 1) {
|
|
515
|
+
const secondChar = numStr.str.charAt(1);
|
|
516
|
+
newNum = 10 * firstChar + parseInt(secondChar, 10);
|
|
517
|
+
} else {
|
|
518
|
+
newNum = firstChar;
|
|
519
|
+
}
|
|
520
|
+
if (numStr.arr[endIndex + 1] || firstMatchChar === "M" && newNum > 12 || firstMatchChar === "d" && newNum > 31 || ["H", "h"].includes(firstMatchChar) && newNum > 23 || "ms".includes(firstMatchChar) && newNum > 59) {
|
|
521
|
+
subStr = matchResult[0].length === 2 ? "0" + firstChar : firstChar;
|
|
522
|
+
selectionStart++;
|
|
523
|
+
} else {
|
|
524
|
+
if (subLen === 1) {
|
|
525
|
+
subStr = String(newNum);
|
|
526
|
+
subLen++;
|
|
527
|
+
cursorOffset++;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
value += subStr;
|
|
531
|
+
numStr.str = numStr.str.substring(subLen);
|
|
532
|
+
matchResult = regx.exec(format);
|
|
533
|
+
}
|
|
534
|
+
const { value: val, selectionStart: cursorPos } = checkFormat({
|
|
535
|
+
value,
|
|
536
|
+
format,
|
|
537
|
+
startIndex,
|
|
538
|
+
selectionStart,
|
|
539
|
+
regx,
|
|
540
|
+
needSelectionStart
|
|
541
|
+
});
|
|
542
|
+
value = val;
|
|
543
|
+
selectionStart = cursorPos;
|
|
544
|
+
needSelectionStart && moveStart(event.target, selectionStart);
|
|
545
|
+
return value;
|
|
546
|
+
};
|
|
547
|
+
const getNumAndSelectionStart = ({ value, format, regx, event, needSelectionStart }) => {
|
|
548
|
+
if (needSelectionStart) {
|
|
549
|
+
let { selectionStart, I } = getSelectionStart({ value, format, regx, event });
|
|
550
|
+
let valueStr;
|
|
551
|
+
if (event.data) {
|
|
552
|
+
valueStr = value.substring(0, selectionStart) + event.data + value.substring(selectionStart + I);
|
|
553
|
+
selectionStart++;
|
|
554
|
+
} else {
|
|
555
|
+
valueStr = value;
|
|
556
|
+
}
|
|
557
|
+
const numStr = getNum(valueStr);
|
|
558
|
+
return { numStr, selectionStart };
|
|
559
|
+
} else {
|
|
560
|
+
const numStr = getNum(value, format, regx);
|
|
561
|
+
return { numStr };
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
const checkFormat = ({ value, format, startIndex, selectionStart, regx, needSelectionStart }) => {
|
|
565
|
+
if (!needSelectionStart && regx.lastIndex === 0 || needSelectionStart && regx.lastIndex === 0 && selectionStart >= startIndex) {
|
|
566
|
+
const subFormat = `(?<=${format.substring(0, startIndex)})(\\s*\\S*\\s*)+`;
|
|
567
|
+
const pattern = new RegExp(subFormat, "g");
|
|
568
|
+
const res = format.match(pattern);
|
|
569
|
+
if (res) {
|
|
570
|
+
value += res[0];
|
|
571
|
+
selectionStart = value.length;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return { value, selectionStart };
|
|
575
|
+
};
|
|
576
|
+
const handleChange = ({ api, state }) => () => {
|
|
577
|
+
if (state.userInput) {
|
|
578
|
+
const value = api.parseString(state.displayValue);
|
|
579
|
+
if (value) {
|
|
580
|
+
state.picker.state.value = value;
|
|
581
|
+
if (api.isValidValue(value)) {
|
|
582
|
+
api.emitInput(value);
|
|
583
|
+
state.userInput = null;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if (state.userInput === "") {
|
|
588
|
+
api.emitInput(null);
|
|
589
|
+
api.emitChange(null);
|
|
590
|
+
state.userInput = null;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const handleStartInput = ({ state, props, api }) => (event) => {
|
|
594
|
+
const value = props.autoFormat ? api.formatInputValue({ event, prevValue: state.displayValue[0] }) : event.target.value;
|
|
595
|
+
if (state.userInput) {
|
|
596
|
+
state.userInput = [value, state.userInput[1]];
|
|
597
|
+
} else {
|
|
598
|
+
state.userInput = [value, null];
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
const handleEndInput = ({ state, props, api }) => (event) => {
|
|
602
|
+
const value = props.autoFormat ? api.formatInputValue({ event, prevValue: state.displayValue[1] }) : event.target.value;
|
|
603
|
+
if (state.userInput) {
|
|
604
|
+
state.userInput = [state.userInput[0], value];
|
|
605
|
+
} else {
|
|
606
|
+
state.userInput = [null, value];
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
const handleStartChange = ({ api, state }) => () => {
|
|
610
|
+
const value = api.parseString(state.userInput && state.userInput[0]);
|
|
611
|
+
if (value) {
|
|
612
|
+
let newValue;
|
|
613
|
+
if (state.displayValue[1]) {
|
|
614
|
+
state.userInput = [api.formatToString(value), state.displayValue[1]];
|
|
615
|
+
newValue = [value, state.picker.state.value && state.picker.state.value[1]];
|
|
616
|
+
state.startStatus = true;
|
|
617
|
+
} else {
|
|
618
|
+
let now = /* @__PURE__ */ new Date();
|
|
619
|
+
if (now.getTime() < value.getTime()) {
|
|
620
|
+
state.userInput = [api.formatToString(value), api.formatToString(value)];
|
|
621
|
+
newValue = [value, value];
|
|
622
|
+
} else {
|
|
623
|
+
state.userInput = [api.formatToString(value), ""];
|
|
624
|
+
newValue = [value, ""];
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if (api.isValidValue(newValue)) {
|
|
628
|
+
state.picker.state.value = newValue;
|
|
629
|
+
state.historyUserInput = [value, state.picker.state.value && state.picker.state.value[1]];
|
|
630
|
+
state.historyUserValue = newValue;
|
|
631
|
+
api.emitInput(newValue);
|
|
632
|
+
state.userInput = null;
|
|
633
|
+
} else {
|
|
634
|
+
if (state.startStatus) {
|
|
635
|
+
state.picker.state.value = state.historyUserValue ? state.historyUserValue : state.historyValue;
|
|
636
|
+
api.emitInput(state.historyUserValue ? state.historyUserValue : state.historyValue);
|
|
637
|
+
state.userInput = state.historyUserInput ? state.historyUserInput : state.historyInput;
|
|
638
|
+
} else {
|
|
639
|
+
state.picker.state.value = newValue;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const handleEndChange = ({ api, state }) => () => {
|
|
645
|
+
const value = api.parseString(state.userInput && state.userInput[1]);
|
|
646
|
+
if (value) {
|
|
647
|
+
let newValue;
|
|
648
|
+
if (state.displayValue[0]) {
|
|
649
|
+
state.userInput = [state.displayValue[0], api.formatToString(value)];
|
|
650
|
+
newValue = [state.picker.state.value && state.picker.state.value[0], value];
|
|
651
|
+
state.endStatus = true;
|
|
652
|
+
} else {
|
|
653
|
+
let now = /* @__PURE__ */ new Date();
|
|
654
|
+
if (now.getTime() < value.getTime()) {
|
|
655
|
+
state.userInput = [api.formatToString(now), api.formatToString(value)];
|
|
656
|
+
newValue = [now, value];
|
|
657
|
+
} else {
|
|
658
|
+
state.userInput = [api.formatToString(value), api.formatToString(value)];
|
|
659
|
+
newValue = [value, value];
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (api.isValidValue(newValue)) {
|
|
663
|
+
state.historyValue = newValue;
|
|
664
|
+
state.historyInput = [state.displayValue[0], api.formatToString(value)];
|
|
665
|
+
state.picker.state.value = newValue;
|
|
666
|
+
api.emitInput(newValue);
|
|
667
|
+
state.userInput = null;
|
|
668
|
+
} else {
|
|
669
|
+
if (state.endStatus) {
|
|
670
|
+
state.picker.state.value = state.historyValue;
|
|
671
|
+
api.emitInput(state.historyValue);
|
|
672
|
+
state.userInput = state.historyInput;
|
|
673
|
+
} else {
|
|
674
|
+
state.picker.state.value = state.historyValue;
|
|
675
|
+
state.userInput = state.historyInput;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
const handleClickIcon = ({ api, props, state }) => (event) => {
|
|
681
|
+
if (props.readonly || state.pickerDisabled) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
if (state.showClose) {
|
|
685
|
+
state.valueOnOpen = props.modelValue;
|
|
686
|
+
event.stopPropagation();
|
|
687
|
+
api.emitInput(null);
|
|
688
|
+
api.emitChange(null);
|
|
689
|
+
state.showClose = false;
|
|
690
|
+
if (state.picker && typeof state.picker.handleClear === "function") {
|
|
691
|
+
state.picker.handleClear();
|
|
692
|
+
}
|
|
693
|
+
} else {
|
|
694
|
+
state.pickerVisible = !state.pickerVisible;
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
const handleClose = ({ api, props, state }) => () => {
|
|
698
|
+
if (!state.pickerVisible) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
state.pickerVisible = false;
|
|
702
|
+
if (state.type === DATEPICKER.Dates) {
|
|
703
|
+
const oldValue = api.parseAsFormatAndType(state.valueOnOpen, state.valueFormat, state.type, props.rangeSeparator) || state.valueOnOpen;
|
|
704
|
+
api.emitInput(oldValue, true);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
const handleFocus = ({ emit, vm, state, api }) => () => {
|
|
708
|
+
const type = state.type;
|
|
709
|
+
if (DATEPICKER.TriggerTypes.includes(type)) {
|
|
710
|
+
if (state.isMobileScreen && state.isDateMobileComponent) {
|
|
711
|
+
api.dateMobileToggle(true);
|
|
712
|
+
} else if (state.isMobileScreen && state.isTimeMobileComponent) {
|
|
713
|
+
api.timeMobileToggle(true);
|
|
714
|
+
} else {
|
|
715
|
+
state.pickerVisible = true;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
emit("focus", vm.$refs.reference);
|
|
719
|
+
};
|
|
720
|
+
const handleKeydown = ({ api, state }) => (event) => {
|
|
721
|
+
const keyCode = event.keyCode;
|
|
722
|
+
if (keyCode === 27) {
|
|
723
|
+
state.pickerVisible = false;
|
|
724
|
+
event.stopPropagation();
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
if (keyCode === 9) {
|
|
728
|
+
if (!state.ranged) {
|
|
729
|
+
api.handleChange();
|
|
730
|
+
state.pickerVisible = state.picker.state.visible = false;
|
|
731
|
+
api.blur();
|
|
732
|
+
event.stopPropagation();
|
|
733
|
+
} else {
|
|
734
|
+
setTimeout(() => {
|
|
735
|
+
if (!state.refInput.includes(document.activeElement)) {
|
|
736
|
+
state.pickerVisible = false;
|
|
737
|
+
api.blur();
|
|
738
|
+
event.stopPropagation();
|
|
739
|
+
}
|
|
740
|
+
}, 0);
|
|
741
|
+
}
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
if (keyCode === 13) {
|
|
745
|
+
if (state.userInput === "" || api.isValidValue(api.parseString(state.displayValue))) {
|
|
746
|
+
if (state.type === "time-select") {
|
|
747
|
+
state.userInput = state.picker.state.items.length ? state.picker.state.items[0].value : "";
|
|
748
|
+
}
|
|
749
|
+
api.handleChange();
|
|
750
|
+
state.pickerVisible = state.picker.state.visible = false;
|
|
751
|
+
api.blur();
|
|
752
|
+
}
|
|
753
|
+
event.stopPropagation();
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (state.userInput) {
|
|
757
|
+
event.stopPropagation();
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
if (state.picker && state.picker.handleKeydown) {
|
|
761
|
+
state.picker.handleKeydown(event);
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
const hidePicker = ({ destroyPopper, state }) => () => {
|
|
765
|
+
if (state.picker) {
|
|
766
|
+
if (state.type === "time-select") {
|
|
767
|
+
state.picker.state.isFilter = false;
|
|
768
|
+
}
|
|
769
|
+
state.picker.resetView && state.picker.resetView();
|
|
770
|
+
state.pickerVisible = state.picker.visible = state.picker.state.visible = false;
|
|
771
|
+
destroyPopper();
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
const showPicker = ({ api, nextTick, updatePopper, state }) => () => {
|
|
775
|
+
if (state.$isServer) {
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
if (!state.picker) {
|
|
779
|
+
api.mountPicker();
|
|
780
|
+
}
|
|
781
|
+
state.pickerVisible = state.picker.state.visible = true;
|
|
782
|
+
state.picker.state.value = state.parsedValue;
|
|
783
|
+
state.picker.resetView && state.picker.resetView();
|
|
784
|
+
nextTick(() => {
|
|
785
|
+
updatePopper(state.picker.$el);
|
|
786
|
+
state.picker.adjustSpinners && state.picker.adjustSpinners();
|
|
787
|
+
});
|
|
788
|
+
};
|
|
789
|
+
const handlePick = ({ state, api }) => (date = "", visible = false) => {
|
|
790
|
+
if (!state.picker)
|
|
791
|
+
return;
|
|
792
|
+
state.userInput = null;
|
|
793
|
+
state.pickerVisible = state.picker.state.visible = visible;
|
|
794
|
+
api.emitInput(date, visible);
|
|
795
|
+
state.date = date;
|
|
796
|
+
state.picker.resetView && state.picker.resetView();
|
|
797
|
+
};
|
|
798
|
+
const handleSelectRange = (state) => (start, end, pos) => {
|
|
799
|
+
if (state.refInput.length === 0) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
const adjust = (value, start2, end2) => {
|
|
803
|
+
if (value) {
|
|
804
|
+
const valueReg = /(\d+):(\d+):(\d+)(\s+.+)?/;
|
|
805
|
+
if (valueReg.test(value)) {
|
|
806
|
+
const matched = valueReg.exec(value);
|
|
807
|
+
const hourLength = matched[1].length;
|
|
808
|
+
const minuteLength = matched[2].length;
|
|
809
|
+
const secondLength = matched[3].length;
|
|
810
|
+
if (start2 === 0) {
|
|
811
|
+
end2 = hourLength;
|
|
812
|
+
} else if (start2 === 3) {
|
|
813
|
+
start2 = hourLength + 1;
|
|
814
|
+
end2 = hourLength + minuteLength + 1;
|
|
815
|
+
} else {
|
|
816
|
+
start2 = hourLength + minuteLength + 2;
|
|
817
|
+
end2 = hourLength + minuteLength + secondLength + 2;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return { start: start2, end: end2 };
|
|
822
|
+
};
|
|
823
|
+
if (!pos || pos === "min") {
|
|
824
|
+
const value = state.refInput[0].value;
|
|
825
|
+
const res = adjust(value, start, end);
|
|
826
|
+
state.refInput[0].setSelectionRange(res.start, res.end);
|
|
827
|
+
state.refInput[0].focus();
|
|
828
|
+
} else if (pos === "max") {
|
|
829
|
+
const value = state.refInput[1].value;
|
|
830
|
+
const res = adjust(value, start, end);
|
|
831
|
+
state.refInput[1].setSelectionRange(res.start, res.end);
|
|
832
|
+
state.refInput[1].focus();
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
const mountPicker = ({ api, props, state, vm, updatePopper }) => () => {
|
|
836
|
+
state.picker = vm.$refs.picker;
|
|
837
|
+
state.picker.state.defaultValue = props.defaultValue;
|
|
838
|
+
state.picker.state.defaultTime = props.defaultTime;
|
|
839
|
+
state.picker.state.popperClass = props.popperClass;
|
|
840
|
+
state.picker.state.popperAppendToBody = props.popperAppendToBody;
|
|
841
|
+
state.picker.state.fnUpdatePopper = updatePopper;
|
|
842
|
+
state.picker.state.currentInstans = state.picker;
|
|
843
|
+
state.picker.state.timezone = state.timezone;
|
|
844
|
+
state.picker.state.timezoneData = state.timezoneData;
|
|
845
|
+
state.picker.state.showTimezone = props.showTimezone || state.timezone.isServiceTimezone;
|
|
846
|
+
state.picker.state.width = state.reference.getBoundingClientRect().width;
|
|
847
|
+
state.picker.state.timefmt = props.timeFormat || "";
|
|
848
|
+
state.picker.state.showTime = state.type === DATEPICKER.DateTime || state.type === DATEPICKER.DateTimeRange;
|
|
849
|
+
state.picker.state.selectionMode = state.selectionMode;
|
|
850
|
+
state.picker.state.defaultTimezone = props.defaultTimezone;
|
|
851
|
+
state.picker.state.unlinkPanels = props.unlinkPanels;
|
|
852
|
+
state.picker.state.emitDbTime = api.emitDbTime;
|
|
853
|
+
state.picker.state.arrowControl = state.arrowControl || props.timeArrowControl || props.arrowControl || false;
|
|
854
|
+
api.updateOptions();
|
|
855
|
+
state.picker.resetView && state.picker.resetView();
|
|
856
|
+
};
|
|
857
|
+
const updateOptions = ({ api, props, state }) => () => {
|
|
858
|
+
if (!state.picker) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
const options = props.pickerOptions;
|
|
862
|
+
if (options && options.selectableRange) {
|
|
863
|
+
let ranges = options.selectableRange;
|
|
864
|
+
const parser = api.typeValueResolveMap().datetimerange.parser;
|
|
865
|
+
const format = DATEPICKER.DateFormats.timerange;
|
|
866
|
+
ranges = Array.isArray(ranges) ? ranges : [ranges];
|
|
867
|
+
state.picker.state.selectableRange = ranges.map((range) => parser(range, format, props.rangeSeparator));
|
|
868
|
+
}
|
|
869
|
+
for (const option in options) {
|
|
870
|
+
if (option in options && option !== DATEPICKER.SelectbaleRange) {
|
|
871
|
+
state.picker.state[option] = options[option];
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
if (props.format) {
|
|
875
|
+
state.picker.state.format = props.format;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
const valueEquals = (left, right) => {
|
|
879
|
+
const dateEquals = (a, b) => {
|
|
880
|
+
const bIsDate = b instanceof Date;
|
|
881
|
+
const aIsDate = a instanceof Date;
|
|
882
|
+
if (aIsDate && bIsDate) {
|
|
883
|
+
return a.getTime() === b.getTime();
|
|
884
|
+
}
|
|
885
|
+
if (!aIsDate && !bIsDate) {
|
|
886
|
+
return a === b;
|
|
887
|
+
}
|
|
888
|
+
return false;
|
|
889
|
+
};
|
|
890
|
+
const aIsArray = Array.isArray(left);
|
|
891
|
+
const bIsArray = Array.isArray(right);
|
|
892
|
+
if (aIsArray && bIsArray) {
|
|
893
|
+
if (left.length !== right.length) {
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
return left.every((item, index) => dateEquals(item, right[index]));
|
|
897
|
+
}
|
|
898
|
+
if (!aIsArray && !bIsArray) {
|
|
899
|
+
return dateEquals(left, right);
|
|
900
|
+
}
|
|
901
|
+
return false;
|
|
902
|
+
};
|
|
903
|
+
const emitChange = ({ api, dispatch, emit, props, state }) => (val) => {
|
|
904
|
+
if (!valueEquals(val, state.valueOnOpen)) {
|
|
905
|
+
emit("change", val);
|
|
906
|
+
state.valueOnOpen = val;
|
|
907
|
+
if (props.validateEvent) {
|
|
908
|
+
dispatch("FormItem", "form.change", val);
|
|
909
|
+
}
|
|
910
|
+
api.emitDbTime(props.value);
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
const emitInput = ({ api, emit, props, state }) => (val, visible = false) => {
|
|
914
|
+
let value = val;
|
|
915
|
+
const { from, to, timezoneOffset } = state.timezone;
|
|
916
|
+
if (props.type === "datetime") {
|
|
917
|
+
value = getDateWithNewTimezone(value, to, from, -timezoneOffset);
|
|
918
|
+
} else if (props.type === "datetimerange" && Array.isArray(value)) {
|
|
919
|
+
value = value.map((val2) => getDateWithNewTimezone(val2, to, from, -timezoneOffset));
|
|
920
|
+
}
|
|
921
|
+
const formatted = api.formatToValue(value) || val;
|
|
922
|
+
if (!valueEquals(props.modelValue, formatted)) {
|
|
923
|
+
emit("update:modelValue", formatted);
|
|
924
|
+
}
|
|
925
|
+
if (!visible && !valueEquals(state.oldValue, formatted)) {
|
|
926
|
+
state.oldValue = formatted;
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
const isValidValue = ({ api, state }) => (value) => {
|
|
930
|
+
if (!state.picker) {
|
|
931
|
+
api.mountPicker();
|
|
932
|
+
}
|
|
933
|
+
if (state.picker.isValidValue) {
|
|
934
|
+
return value && state.picker.isValidValue(value);
|
|
935
|
+
}
|
|
936
|
+
return true;
|
|
937
|
+
};
|
|
938
|
+
const watchIsRange = ({ api, state, TimePanel, TimeRangePanel }) => (value) => {
|
|
939
|
+
state.type = value ? DATEPICKER.TimeRange : DATEPICKER.Time;
|
|
940
|
+
state.panel = value ? TimeRangePanel : TimePanel;
|
|
941
|
+
api.mountPicker();
|
|
942
|
+
};
|
|
943
|
+
const getType = ({ parent, props }) => () => {
|
|
944
|
+
if (parent.componentName === DATEPICKER.DatePicker) {
|
|
945
|
+
return props.type;
|
|
946
|
+
} else if (parent.componentName === DATEPICKER.TimePicker) {
|
|
947
|
+
return props.isRange ? DATEPICKER.TimeRange : DATEPICKER.Time;
|
|
948
|
+
}
|
|
949
|
+
return DATEPICKER.TimeSelect;
|
|
950
|
+
};
|
|
951
|
+
const watchModelValue = ({ api, props, state, dispatch }) => (value, oldValue) => {
|
|
952
|
+
state.historyInput = state.displayValue;
|
|
953
|
+
if (state.picker) {
|
|
954
|
+
state.historyValue = [
|
|
955
|
+
state.picker.state.value && state.picker.state.value[0],
|
|
956
|
+
api.parseString(state.historyInput && state.historyInput[1])
|
|
957
|
+
];
|
|
958
|
+
}
|
|
959
|
+
if (props.changeCompat) {
|
|
960
|
+
api.emitChange(props.modelValue);
|
|
961
|
+
}
|
|
962
|
+
if (!valueEquals(value, oldValue) && !state.pickerVisible && props.validateEvent) {
|
|
963
|
+
dispatch("FormItem", "form.change", value);
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
const computedFormat = ({ props, utils }) => () => {
|
|
967
|
+
let { type, format } = props;
|
|
968
|
+
if (!format && utils.getDateFormat) {
|
|
969
|
+
const config = utils.getDateFormat() || {};
|
|
970
|
+
if (~["date", "dates", "daterange"].indexOf(type)) {
|
|
971
|
+
format = config.DateFormat;
|
|
972
|
+
}
|
|
973
|
+
if (~["datetime", "datetimerange"].indexOf(type)) {
|
|
974
|
+
format = config.DateTimeFormat;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
return format;
|
|
978
|
+
};
|
|
979
|
+
const computedTriggerClass = ({ props, state }) => () => {
|
|
980
|
+
return props.suffixIcon || props.prefixIcon || (state.type.includes(DATEPICKER.Time) ? DATEPICKER.IconTime : DATEPICKER.IconDate);
|
|
981
|
+
};
|
|
982
|
+
const computedHaveTrigger = ({ props }) => () => {
|
|
983
|
+
return typeof props.showTrigger !== "undefined" ? props.showTrigger : DATEPICKER.TriggerTypes.includes(props.type);
|
|
984
|
+
};
|
|
985
|
+
const initPopper = ({ props, hooks, vnode }) => {
|
|
986
|
+
const { reactive, watch, toRefs, onBeforeUnmount, onDeactivated } = hooks;
|
|
987
|
+
const { emit, vm, slots, nextTick } = vnode;
|
|
988
|
+
const placementMap = DATEPICKER.PlacementMap;
|
|
989
|
+
return userPopper({
|
|
990
|
+
reactive,
|
|
991
|
+
watch,
|
|
992
|
+
emit,
|
|
993
|
+
props: __spreadProps(__spreadValues({}, props), {
|
|
994
|
+
popperOptions: Object.assign({ boundariesPadding: 0, gpuAcceleration: false }, props.popperOptions),
|
|
995
|
+
visibleArrow: false,
|
|
996
|
+
offset: 0,
|
|
997
|
+
boundariesPadding: 5,
|
|
998
|
+
arrowOffset: 35,
|
|
999
|
+
placement: placementMap[props.align] || placementMap.left
|
|
1000
|
+
}),
|
|
1001
|
+
toRefs,
|
|
1002
|
+
vm,
|
|
1003
|
+
slots,
|
|
1004
|
+
nextTick,
|
|
1005
|
+
onBeforeUnmount,
|
|
1006
|
+
onDeactivated
|
|
1007
|
+
});
|
|
1008
|
+
};
|
|
1009
|
+
const emitDbTime = ({ emit, state, t }) => (date) => {
|
|
1010
|
+
const { isServiceTimezone, from } = state.timezone;
|
|
1011
|
+
if (isServiceTimezone && !valueEquals(date, state.dbTime)) {
|
|
1012
|
+
let hasDate = false;
|
|
1013
|
+
const dbTime = [].concat(date).map((item) => {
|
|
1014
|
+
if (isDate(item)) {
|
|
1015
|
+
hasDate = true;
|
|
1016
|
+
let currentDate = getDateWithNewTimezone(item, getLocalTimezone(), from);
|
|
1017
|
+
if (state.valueFormat) {
|
|
1018
|
+
currentDate = formatDate(currentDate, state.valueFormat, t);
|
|
1019
|
+
}
|
|
1020
|
+
return currentDate;
|
|
1021
|
+
}
|
|
1022
|
+
return item;
|
|
1023
|
+
});
|
|
1024
|
+
state.dbTime = dbTime.length > 1 ? dbTime : dbTime[0];
|
|
1025
|
+
hasDate && emit("input", state.dbTime);
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
const initGlobalTimezone = ({ api, state, props }) => () => {
|
|
1029
|
+
const { isServiceTimezone } = state.timezone;
|
|
1030
|
+
if (isServiceTimezone) {
|
|
1031
|
+
state.timezoneData = globalTimezone;
|
|
1032
|
+
} else if (props.showTimezone) {
|
|
1033
|
+
state.timezoneData = props.timezoneData ? extend(true, {}, props.timezoneData) : globalTimezone;
|
|
1034
|
+
}
|
|
1035
|
+
api.emitDbTime(props.value);
|
|
1036
|
+
};
|
|
1037
|
+
const handleEnterDisplayOnlyContent = ({ state, t }) => ($event) => {
|
|
1038
|
+
const target = $event.target;
|
|
1039
|
+
if (target && target.scrollWidth > target.offsetWidth) {
|
|
1040
|
+
state.displayOnlyTooltip = state.displayValue.join(` ${t("ui.datepicker.to")} `);
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
const handleEnterPickerlabel = ({ state, props }) => ($event) => {
|
|
1044
|
+
const target = $event.target;
|
|
1045
|
+
if (target && target.scrollWidth > target.offsetWidth) {
|
|
1046
|
+
state.labelTooltip = props.label;
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
const setInputPaddingLeft = ({ props, state, vm, nextTick }) => () => {
|
|
1050
|
+
const ml = 12;
|
|
1051
|
+
const mr = 8;
|
|
1052
|
+
if (props.label && !state.ranged && vm.$refs.label && vm.$refs.reference) {
|
|
1053
|
+
nextTick(() => {
|
|
1054
|
+
vm.$refs.reference.querySelector("input").style.paddingLeft = vm.$refs.label.offsetWidth + ml + mr + "px";
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
export {
|
|
1059
|
+
blur,
|
|
1060
|
+
computedFormat,
|
|
1061
|
+
computedHaveTrigger,
|
|
1062
|
+
computedTriggerClass,
|
|
1063
|
+
dateFormatter,
|
|
1064
|
+
dateParser,
|
|
1065
|
+
displayValue,
|
|
1066
|
+
emitChange,
|
|
1067
|
+
emitDbTime,
|
|
1068
|
+
emitInput,
|
|
1069
|
+
firstInputId,
|
|
1070
|
+
focus,
|
|
1071
|
+
formatAsFormatAndType,
|
|
1072
|
+
formatInputValue,
|
|
1073
|
+
formatText,
|
|
1074
|
+
formatToString,
|
|
1075
|
+
formatToValue,
|
|
1076
|
+
getMode,
|
|
1077
|
+
getPanel,
|
|
1078
|
+
getTimezone,
|
|
1079
|
+
getType,
|
|
1080
|
+
getValueEmpty,
|
|
1081
|
+
getValueFormat,
|
|
1082
|
+
getWeekData,
|
|
1083
|
+
handleChange,
|
|
1084
|
+
handleClickIcon,
|
|
1085
|
+
handleClose,
|
|
1086
|
+
handleEndChange,
|
|
1087
|
+
handleEndInput,
|
|
1088
|
+
handleEnterDisplayOnlyContent,
|
|
1089
|
+
handleEnterPickerlabel,
|
|
1090
|
+
handleFocus,
|
|
1091
|
+
handleInput,
|
|
1092
|
+
handleKeydown,
|
|
1093
|
+
handleMouseEnter,
|
|
1094
|
+
handlePick,
|
|
1095
|
+
handleSelectRange,
|
|
1096
|
+
handleStartChange,
|
|
1097
|
+
handleStartInput,
|
|
1098
|
+
hidePicker,
|
|
1099
|
+
initGlobalTimezone,
|
|
1100
|
+
initPopper,
|
|
1101
|
+
isValidValue,
|
|
1102
|
+
mountPicker,
|
|
1103
|
+
parseAsFormatAndType,
|
|
1104
|
+
parseString,
|
|
1105
|
+
parseValue,
|
|
1106
|
+
parsedValue,
|
|
1107
|
+
rangeFormatter,
|
|
1108
|
+
rangeParser,
|
|
1109
|
+
secondInputId,
|
|
1110
|
+
setInputPaddingLeft,
|
|
1111
|
+
showPicker,
|
|
1112
|
+
typeValueResolveMap,
|
|
1113
|
+
updateOptions,
|
|
1114
|
+
valueEquals,
|
|
1115
|
+
watchIsRange,
|
|
1116
|
+
watchMobileVisible,
|
|
1117
|
+
watchModelValue,
|
|
1118
|
+
watchPickerVisible
|
|
1119
|
+
};
|