@opentiny/vue-renderless 3.6.0 → 3.6.1-alpha.2
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/README.md +7 -26
- package/action-menu/index.js +15 -15
- package/action-menu/vue.js +17 -22
- package/action-sheet/index.js +53 -68
- package/action-sheet/vue.js +28 -54
- package/alert/index.js +10 -21
- package/alert/vue.js +19 -33
- package/amount/index.js +205 -308
- package/amount/vue.js +113 -187
- package/anchor/index.js +102 -173
- package/anchor/vue.js +26 -47
- package/area/index.js +93 -153
- package/area/vue.js +26 -62
- package/autocomplete/index.js +115 -157
- package/autocomplete/vue.js +84 -159
- package/autonavi-map/index.js +12 -22
- package/avatar/index.js +28 -31
- package/avatar/vue.js +16 -19
- package/badge/index.js +11 -15
- package/badge/vue.js +19 -27
- package/baidu-map/index.js +12 -22
- package/breadcrumb/index.js +8 -7
- package/breadcrumb/vue.js +15 -22
- package/breadcrumb-item/index.js +14 -26
- package/breadcrumb-item/vue.js +20 -28
- package/bulletin-board/index.js +19 -22
- package/bulletin-board/vue.js +26 -33
- package/button/index.js +14 -18
- package/button/vue.js +26 -38
- package/button-group/index.js +19 -24
- package/button-group/vue.js +32 -45
- package/calendar/index.js +168 -203
- package/calendar/vue.js +89 -100
- package/card-template/index.js +29 -37
- package/card-template/vue.js +18 -30
- package/carousel/index.js +125 -198
- package/carousel/vue.js +132 -188
- package/carousel-item/index.js +55 -80
- package/carousel-item/vue.js +42 -42
- package/cascader/index.js +329 -460
- package/cascader/vue.js +159 -319
- package/cascader-menu/index.js +32 -39
- package/cascader-menu/vue.js +21 -30
- package/cascader-node/index.js +41 -60
- package/cascader-node/vue.js +27 -59
- package/cascader-panel/index.js +229 -311
- package/cascader-panel/node.js +118 -190
- package/cascader-panel/store.js +49 -76
- package/cascader-panel/vue.js +125 -197
- package/chart-bar/index.js +129 -439
- package/chart-boxplot/index.js +78 -219
- package/chart-candle/index.js +134 -379
- package/chart-core/deps/constants.js +70 -49
- package/chart-core/deps/numerify.js +106 -147
- package/chart-core/deps/utils.js +118 -121
- package/chart-core/index.js +302 -469
- package/chart-core/modules/animation.js +7 -5
- package/chart-core/modules/extend.js +18 -19
- package/chart-core/modules/mark.js +7 -3
- package/chart-core/vue.js +81 -120
- package/chart-funnel/index.js +47 -126
- package/chart-gauge/index.js +54 -128
- package/chart-graph/index.js +22 -35
- package/chart-heatmap/index.js +116 -362
- package/chart-line/index.js +98 -289
- package/chart-liquidfill/index.js +35 -100
- package/chart-map/index.js +64 -217
- package/chart-pie/index.js +93 -274
- package/chart-radar/index.js +59 -135
- package/chart-sankey/index.js +51 -137
- package/chart-scatter/index.js +118 -313
- package/chart-sunburst/index.js +25 -33
- package/chart-tree/index.js +43 -85
- package/chart-waterfall/index.js +77 -210
- package/chart-wordcloud/index.js +36 -85
- package/checkbox/index.js +82 -133
- package/checkbox/vue.js +62 -132
- package/checkbox-button/index.js +60 -96
- package/checkbox-button/vue.js +53 -135
- package/checkbox-group/index.js +6 -11
- package/checkbox-group/vue.js +22 -27
- package/chunk-PKUHTIDK.js +37 -0
- package/col/index.js +89 -119
- package/col/vue.js +21 -31
- package/collapse/index.js +31 -40
- package/collapse/vue.js +24 -32
- package/collapse-item/index.js +22 -36
- package/collapse-item/vue.js +22 -42
- package/common/array.js +51 -56
- package/common/bigInt.js +187 -243
- package/common/browser.js +35 -31
- package/common/dataset/index.js +74 -110
- package/common/date.js +199 -201
- package/common/decimal.js +94 -142
- package/common/deps/ResizeObserver.js +188 -208
- package/common/deps/after-leave.js +12 -10
- package/common/deps/clickoutside.js +32 -36
- package/common/deps/date-util.js +139 -166
- package/common/deps/date.js +206 -241
- package/common/deps/debounce.js +8 -4
- package/common/deps/dom.js +75 -68
- package/common/deps/eSpaceCtrl.js +170 -153
- package/common/deps/fullscreen/apis.js +51 -65
- package/common/deps/fullscreen/screenfull.js +61 -45
- package/common/deps/letter-only.js +12 -8
- package/common/deps/memorize.js +100 -125
- package/common/deps/modal-queue.js +6 -2
- package/common/deps/number-only.js +13 -9
- package/common/deps/popper.js +280 -372
- package/common/deps/popup-manager.js +71 -75
- package/common/deps/repeat-click.js +14 -10
- package/common/deps/requestAnimationFrame.js +13 -13
- package/common/deps/resize-event.js +15 -10
- package/common/deps/scroll-into-view.js +13 -13
- package/common/deps/scrollbar-width.js +22 -18
- package/common/deps/throttle.js +15 -11
- package/common/deps/touch.js +24 -22
- package/common/deps/tree-model/node.js +374 -524
- package/common/deps/tree-model/tree-store.js +251 -352
- package/common/deps/tree-model/util.js +10 -4
- package/common/deps/upload-ajax.js +28 -24
- package/common/deps/vue-emitter.js +15 -11
- package/common/deps/vue-popper.js +181 -214
- package/common/deps/vue-popup.js +118 -168
- package/common/event.js +10 -9
- package/common/index.js +180 -194
- package/common/object.js +92 -91
- package/common/runtime.js +78 -51
- package/common/string.js +194 -266
- package/common/type.js +49 -51
- package/common/validate/index.js +8 -4
- package/common/validate/messages.js +64 -67
- package/common/validate/rules/enum.js +10 -6
- package/common/validate/rules/index.js +18 -14
- package/common/validate/rules/pattern.js +9 -5
- package/common/validate/rules/range.js +26 -39
- package/common/validate/rules/required.js +8 -10
- package/common/validate/rules/type.js +67 -79
- package/common/validate/rules/whitespace.js +8 -4
- package/common/validate/schema.js +159 -199
- package/common/validate/util.js +95 -82
- package/common/validate/validations/array.js +14 -17
- package/common/validate/validations/date.js +16 -20
- package/common/validate/validations/enum.js +14 -16
- package/common/validate/validations/float.js +13 -15
- package/common/validate/validations/index.js +28 -24
- package/common/validate/validations/integer.js +13 -15
- package/common/validate/validations/method.js +13 -15
- package/common/validate/validations/number.js +15 -17
- package/common/validate/validations/pattern.js +14 -16
- package/common/validate/validations/required.js +10 -14
- package/common/validate/validations/string.js +19 -15
- package/common/validate/validations/type.js +17 -13
- package/common/xss.js +202 -184
- package/company/index.js +34 -49
- package/company/vue.js +23 -29
- package/container/index.js +72 -98
- package/container/vue.js +36 -61
- package/country/index.js +33 -47
- package/country/vue.js +24 -29
- package/credit-card/index.js +72 -86
- package/credit-card/vue.js +49 -104
- package/credit-card-form/index.js +97 -129
- package/credit-card-form/vue.js +102 -133
- package/crop/index.js +175 -294
- package/crop/vue.js +132 -144
- package/currency/index.js +49 -67
- package/currency/vue.js +25 -34
- package/date-panel/index.js +384 -524
- package/date-panel/vue.js +178 -289
- package/date-picker/index.js +198 -260
- package/date-picker/vue.js +97 -155
- package/date-range/index.js +324 -435
- package/date-range/vue.js +154 -273
- package/date-table/index.js +279 -391
- package/date-table/vue.js +63 -139
- package/dept/index.js +196 -291
- package/dept/vue.js +74 -144
- package/detail-page/index.js +72 -131
- package/detail-page/vue.js +53 -128
- package/dialog-box/index.js +178 -248
- package/dialog-box/vue.js +111 -201
- package/drop-roles/index.js +44 -65
- package/drop-roles/vue.js +23 -31
- package/drop-times/index.js +21 -22
- package/drop-times/vue.js +19 -23
- package/dropdown/index.js +182 -253
- package/dropdown/vue.js +55 -101
- package/dropdown-item/index.js +113 -167
- package/dropdown-item/vue.js +73 -121
- package/dropdown-menu/index.js +85 -111
- package/dropdown-menu/vue.js +23 -36
- package/espace/index.js +86 -106
- package/espace/vue.js +26 -48
- package/exception/index.js +9 -12
- package/exception/vue.js +15 -22
- package/fall-menu/index.js +81 -110
- package/fall-menu/vue.js +32 -78
- package/file-upload/index.js +1081 -1713
- package/file-upload/vue.js +175 -417
- package/floatbar/index.js +8 -5
- package/floatbar/vue.js +13 -16
- package/form/index.js +124 -165
- package/form/vue.js +54 -66
- package/form-item/index.js +255 -328
- package/form-item/vue.js +97 -198
- package/fullscreen/index.js +95 -127
- package/fullscreen/vue.js +36 -72
- package/grid/core/index.js +7 -3
- package/grid/core/interceptor.js +28 -20
- package/grid/core/storeMap.js +11 -7
- package/grid/plugins/export.js +72 -95
- package/grid/plugins/exportExcel.js +244 -561
- package/grid/plugins/header.js +22 -21
- package/grid/plugins/resize.js +45 -62
- package/grid/static/array/arrayEach.js +7 -3
- package/grid/static/array/arrayIndexOf.js +7 -3
- package/grid/static/array/eachTree.js +17 -21
- package/grid/static/array/every.js +6 -2
- package/grid/static/array/filterTree.js +17 -12
- package/grid/static/array/find.js +7 -3
- package/grid/static/array/findTree.js +19 -30
- package/grid/static/array/helperCreateIterateHandle.js +31 -39
- package/grid/static/array/helperCreateTreeFunc.js +18 -16
- package/grid/static/array/includes.js +6 -4
- package/grid/static/array/lastArrayEach.js +7 -3
- package/grid/static/array/map.js +11 -10
- package/grid/static/array/mapTree.js +19 -23
- package/grid/static/array/slice.js +7 -3
- package/grid/static/array/sortBy.js +32 -34
- package/grid/static/array/sum.js +14 -13
- package/grid/static/array/toArray.js +6 -6
- package/grid/static/array/toTreeArray.js +13 -15
- package/grid/static/base/clear.js +18 -14
- package/grid/static/base/clone.js +11 -17
- package/grid/static/base/destructuring.js +14 -10
- package/grid/static/base/each.js +8 -4
- package/grid/static/base/eqNull.js +7 -5
- package/grid/static/base/findIndexOf.js +8 -4
- package/grid/static/base/get.js +21 -17
- package/grid/static/base/has.js +21 -20
- package/grid/static/base/hasOwnProp.js +5 -3
- package/grid/static/base/helperCreateGetObjects.js +13 -9
- package/grid/static/base/helperCreateInInObjectString.js +8 -4
- package/grid/static/base/helperCreateInTypeof.js +8 -5
- package/grid/static/base/helperCreateIndexOf.js +19 -18
- package/grid/static/base/helperCreateiterateIndexOf.js +20 -19
- package/grid/static/base/helperDefaultCompare.js +5 -1
- package/grid/static/base/helperDeleteProperty.js +7 -3
- package/grid/static/base/helperEqualCompare.js +27 -29
- package/grid/static/base/helperGetHGSKeys.js +5 -3
- package/grid/static/base/indexOf.js +7 -3
- package/grid/static/base/isArray.js +7 -3
- package/grid/static/base/isBoolean.js +5 -3
- package/grid/static/base/isDate.js +7 -3
- package/grid/static/base/isEmpty.js +7 -3
- package/grid/static/base/isEqual.js +10 -10
- package/grid/static/base/isFunction.js +5 -3
- package/grid/static/base/isNaN.js +6 -4
- package/grid/static/base/isNull.js +5 -3
- package/grid/static/base/isNumber.js +5 -3
- package/grid/static/base/isObject.js +5 -4
- package/grid/static/base/isPlainObject.js +6 -2
- package/grid/static/base/isRegExp.js +7 -3
- package/grid/static/base/isSet.js +6 -4
- package/grid/static/base/isString.js +5 -3
- package/grid/static/base/isUndefined.js +5 -3
- package/grid/static/base/keys.js +7 -3
- package/grid/static/base/lastEach.js +8 -4
- package/grid/static/base/remove.js +20 -20
- package/grid/static/base/set.js +22 -18
- package/grid/static/base/toJSONString.js +5 -3
- package/grid/static/base/toStringJSON.js +10 -5
- package/grid/static/base/uniqueId.js +6 -4
- package/grid/static/browse/browse.js +25 -22
- package/grid/static/function/property.js +6 -6
- package/grid/static/function/throttle.js +18 -14
- package/grid/static/index.js +111 -55
- package/grid/static/number/helperCreateToNumber.js +12 -10
- package/grid/static/number/toNumber.js +7 -3
- package/grid/static/object/assign.js +20 -20
- package/grid/static/object/extend.js +7 -3
- package/grid/static/object/lastObjectEach.js +9 -5
- package/grid/static/object/objectEach.js +8 -4
- package/grid/static/object/objectMap.js +11 -7
- package/grid/static/object/values.js +15 -7
- package/grid/static/static/staticDocument.js +7 -4
- package/grid/static/static/staticHGKeyRE.js +6 -2
- package/grid/static/static/staticParseInt.js +6 -2
- package/grid/static/static/staticStrUndefined.js +6 -2
- package/grid/static/static/staticWindow.js +7 -4
- package/grid/static/string/template.js +10 -8
- package/grid/static/string/toString.js +12 -8
- package/grid/utils/column.js +11 -14
- package/grid/utils/common.js +84 -102
- package/grid/utils/dom.js +104 -117
- package/grid/utils/event.js +23 -28
- package/grid/utils/index.js +8 -5
- package/hrapprover/index.js +80 -105
- package/hrapprover/vue.js +45 -90
- package/image/index.js +107 -175
- package/image/vue.js +56 -126
- package/image-viewer/index.js +328 -416
- package/image-viewer/vue.js +131 -206
- package/index-bar/index.js +42 -51
- package/index-bar/vue.js +53 -74
- package/index-bar-anchor/vue.js +14 -18
- package/input/index.js +232 -302
- package/input/vue.js +181 -284
- package/ip-address/index.js +168 -335
- package/ip-address/vue.js +95 -160
- package/layout/vue.js +7 -4
- package/link/index.js +9 -10
- package/link/vue.js +15 -23
- package/link-menu/index.js +86 -128
- package/link-menu/vue.js +55 -118
- package/list/index.js +12 -12
- package/list/vue.js +15 -15
- package/loading/index.js +22 -21
- package/loading/vue.js +15 -18
- package/locales/index.js +72 -104
- package/locales/vue.js +23 -41
- package/logon-user/index.js +14 -19
- package/logon-user/vue.js +17 -20
- package/logout/index.js +58 -96
- package/logout/vue.js +15 -19
- package/milestone/index.js +53 -76
- package/milestone/vue.js +28 -26
- package/mini-picker/index.js +155 -219
- package/mini-picker/vue.js +98 -118
- package/modal/index.js +386 -735
- package/modal/vue.js +81 -117
- package/month-range/index.js +108 -143
- package/month-range/vue.js +57 -85
- package/month-table/index.js +157 -202
- package/month-table/vue.js +42 -64
- package/multi-select/index.js +150 -214
- package/multi-select/vue.js +58 -102
- package/nav-menu/index.js +276 -410
- package/nav-menu/vue.js +110 -174
- package/notify/index.js +59 -81
- package/notify/vue.js +42 -57
- package/numeric/index.js +231 -363
- package/numeric/vue.js +78 -202
- package/option/index.js +44 -72
- package/option/vue.js +66 -179
- package/option-group/index.js +12 -17
- package/option-group/vue.js +25 -30
- package/package.json +32 -84
- package/pager-item/index.js +91 -103
- package/pager-item/vue.js +36 -48
- package/panel/index.js +22 -28
- package/panel/vue.js +17 -23
- package/picker/index.js +689 -963
- package/picker/timezone.js +1174 -974
- package/picker/vue.js +187 -389
- package/picker-column/index.js +182 -232
- package/picker-column/vue.js +71 -130
- package/pop-upload/index.js +162 -321
- package/pop-upload/vue.js +143 -273
- package/popeditor/index.js +528 -807
- package/popeditor/vue.js +165 -334
- package/popover/index.js +160 -219
- package/popover/vue.js +76 -162
- package/popup/index.js +90 -128
- package/popup/vue.js +39 -112
- package/progress/index.js +108 -171
- package/progress/vue.js +65 -115
- package/pull-refresh/index.js +118 -132
- package/pull-refresh/vue.js +38 -66
- package/radio/index.js +41 -77
- package/radio/vue.js +35 -92
- package/radio-button/index.js +35 -54
- package/radio-button/vue.js +28 -61
- package/radio-group/index.js +46 -48
- package/radio-group/vue.js +26 -30
- package/rate/index.js +158 -197
- package/rate/vue.js +90 -138
- package/roles/index.js +48 -77
- package/roles/vue.js +20 -32
- package/row/index.js +15 -16
- package/row/vue.js +20 -19
- package/scroll-text/index.js +17 -22
- package/scroll-text/vue.js +18 -27
- package/scrollbar/index.js +87 -115
- package/scrollbar/vue-bar.js +23 -46
- package/scrollbar/vue.js +25 -33
- package/search/index.js +67 -95
- package/search/vue.js +80 -100
- package/select/index.js +1094 -1584
- package/select/vue.js +342 -672
- package/select-dropdown/index.js +18 -23
- package/select-dropdown/vue.js +56 -112
- package/slide-bar/index.js +58 -85
- package/slide-bar/vue.js +21 -47
- package/slider/index.js +276 -373
- package/slider/vue.js +94 -144
- package/split/index.js +74 -123
- package/split/vue.js +63 -116
- package/steps/vue.js +8 -3
- package/switch/index.js +35 -43
- package/switch/vue.js +32 -58
- package/tab-bar/index.js +48 -46
- package/tab-bar/vue.js +14 -12
- package/tab-dropdown/index.js +11 -10
- package/tab-dropdown/vue.js +14 -11
- package/tab-item/index.js +20 -35
- package/tab-item/vue.js +22 -42
- package/tab-nav/index.js +194 -227
- package/tab-nav/vue.js +62 -83
- package/tabbar/index.js +23 -30
- package/tabbar/vue.js +22 -45
- package/tabbar-item/index.js +39 -51
- package/tabbar-item/vue.js +23 -48
- package/table/index.js +69 -103
- package/table/vue.js +37 -61
- package/tabs/index.js +125 -174
- package/tabs/vue.js +98 -143
- package/tag/index.js +13 -18
- package/tag/vue.js +11 -16
- package/tall-storage/index.js +87 -106
- package/tall-storage/vue-storage-box.js +14 -20
- package/tall-storage/vue.js +27 -35
- package/text-popup/index.js +48 -70
- package/text-popup/vue.js +27 -60
- package/time/index.js +71 -113
- package/time/vue.js +65 -108
- package/time-line/index.js +30 -56
- package/time-line/vue.js +23 -46
- package/time-panel/index.js +112 -175
- package/time-panel/scrollIntoView.js +12 -10
- package/time-panel/vue.js +64 -94
- package/time-range/index.js +123 -184
- package/time-range/vue.js +63 -115
- package/time-spinner/index.js +139 -179
- package/time-spinner/vue.js +72 -110
- package/toggle-menu/index.js +68 -98
- package/toggle-menu/vue.js +64 -54
- package/tooltip/index.js +127 -168
- package/tooltip/vue.js +81 -134
- package/top-box/index.js +46 -79
- package/top-box/vue.js +34 -62
- package/transfer/index.js +184 -263
- package/transfer/vue.js +65 -134
- package/transfer-panel/index.js +240 -329
- package/transfer-panel/vue.js +127 -232
- package/tree/index.js +422 -591
- package/tree/vue.js +163 -249
- package/tree-menu/index.js +97 -122
- package/tree-menu/vue.js +57 -39
- package/tree-node/index.js +180 -248
- package/tree-node/vue.js +107 -202
- package/upload/index.js +201 -276
- package/upload/vue.js +51 -82
- package/upload-dragger/index.js +38 -49
- package/upload-dragger/vue.js +16 -24
- package/upload-list/index.js +41 -50
- package/upload-list/vue.js +21 -27
- package/user/index.js +356 -510
- package/user/vue.js +50 -97
- package/user-account/index.js +16 -21
- package/user-account/vue.js +20 -23
- package/user-contact/index.js +11 -10
- package/user-contact/vue.js +15 -15
- package/user-head/index.js +69 -84
- package/user-head/vue.js +24 -45
- package/user-link/index.js +31 -41
- package/user-link/vue.js +23 -46
- package/wheel/index.js +136 -161
- package/wheel/vue.js +64 -95
- package/wizard/index.js +83 -102
- package/wizard/vue.js +19 -34
- package/year-table/index.js +31 -37
- package/year-table/vue.js +17 -21
- package/rich-text/clipboard.js +0 -77
- package/rich-text/index.js +0 -176
- package/rich-text/module/file-upload.js +0 -118
- package/rich-text/module/image-drop.js +0 -54
- package/rich-text/module/image-upload.js +0 -84
- package/rich-text/options.js +0 -187
- package/rich-text/table-module.js +0 -557
- package/rich-text/vue.js +0 -149
package/select/index.js
CHANGED
|
@@ -1,284 +1,211 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
nextTick(function () {
|
|
26
|
-
return api.handleQueryChange(text);
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
var lastCharacter = text[text.length - 1] || '';
|
|
30
|
-
state.isOnComposition = !isKorean(lastCharacter);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export var showTip = function showTip(_ref2) {
|
|
35
|
-
var props = _ref2.props,
|
|
36
|
-
state = _ref2.state,
|
|
37
|
-
refs = _ref2.refs;
|
|
38
|
-
return function (show) {
|
|
39
|
-
if (!props.showOverflowTooltip) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
var overflow;
|
|
43
|
-
if (!show) {
|
|
44
|
-
clearTimeout(state.tipTimer);
|
|
45
|
-
state.tipTimer = setTimeout(function () {
|
|
46
|
-
state.showTip = state.tipHover;
|
|
47
|
-
}, refs.popover.closeDelay);
|
|
48
|
-
} else {
|
|
49
|
-
if (!props.multiple) {
|
|
50
|
-
var reference = refs.reference.$el;
|
|
51
|
-
overflow = reference.querySelector('input').scrollWidth > reference.scrollWidth;
|
|
52
|
-
} else {
|
|
53
|
-
overflow = refs.tags.scrollHeight > refs.tags.getBoundingClientRect().height;
|
|
54
|
-
}
|
|
55
|
-
state.showTip = show && overflow && !!state.tips && !state.visible;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
export var gridOnQueryChange = function gridOnQueryChange(_ref3) {
|
|
60
|
-
var props = _ref3.props,
|
|
61
|
-
refs = _ref3.refs,
|
|
62
|
-
constants = _ref3.constants,
|
|
63
|
-
state = _ref3.state;
|
|
64
|
-
return function (value) {
|
|
65
|
-
var multiple = props.multiple,
|
|
66
|
-
valueField = props.valueField,
|
|
67
|
-
filterMethod = props.filterMethod,
|
|
68
|
-
filterable = props.filterable,
|
|
69
|
-
remote = props.remote,
|
|
70
|
-
remoteMethod = props.remoteMethod;
|
|
71
|
-
if (filterable && typeof filterMethod === 'function') {
|
|
72
|
-
var table = refs.selectGrid.$refs.tinyTable;
|
|
73
|
-
var fullData = table.afterFullData;
|
|
74
|
-
refs.selectGrid.scrollTo(null, 0);
|
|
75
|
-
table.afterFullData = filterMethod(value, fullData) || [];
|
|
76
|
-
refs.selectGrid.handleTableData(!value).then(function () {
|
|
77
|
-
return state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
78
|
-
});
|
|
79
|
-
state.previousQuery = value;
|
|
80
|
-
} else if (remote && typeof remoteMethod === 'function') {
|
|
81
|
-
state.previousQuery = value;
|
|
82
|
-
remoteMethod(value).then(function (data) {
|
|
83
|
-
if (multiple) {
|
|
84
|
-
var selectedIds = state.selected.map(function (sel) {
|
|
85
|
-
return sel[valueField];
|
|
86
|
-
});
|
|
87
|
-
refs.selectGrid.clearSelection();
|
|
88
|
-
refs.selectGrid.setSelection(data.filter(function (row) {
|
|
89
|
-
return ~selectedIds.indexOf(row[valueField]);
|
|
90
|
-
}), true);
|
|
91
|
-
state.remoteData = data.filter(function (row) {
|
|
92
|
-
return !~selectedIds.indexOf(row[valueField]);
|
|
93
|
-
}).concat(state.selected);
|
|
94
|
-
} else {
|
|
95
|
-
refs.selectGrid.clearRadioRow();
|
|
96
|
-
refs.selectGrid.setRadioRow(find(data, function (item) {
|
|
97
|
-
return props.modelValue == item[props.valueField];
|
|
98
|
-
}));
|
|
99
|
-
state.remoteData = data;
|
|
100
|
-
}
|
|
101
|
-
refs.selectGrid.$refs.tinyTable.lastScrollTop = 0;
|
|
102
|
-
refs.selectGrid.loadData(data);
|
|
103
|
-
refs.selectGrid.handleTableData(!value).then(function () {
|
|
104
|
-
return state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-PKUHTIDK.js";
|
|
5
|
+
import { find } from "@opentiny/vue-renderless/common/array";
|
|
6
|
+
import { getObj, isEqual } from "@opentiny/vue-renderless/common/object";
|
|
7
|
+
import { isKorean } from "@opentiny/vue-renderless/common/string";
|
|
8
|
+
import scrollIntoView from "@opentiny/vue-renderless/common/deps/scroll-into-view";
|
|
9
|
+
import PopupManager from "@opentiny/vue-renderless/common/deps/popup-manager";
|
|
10
|
+
import debounce from "@opentiny/vue-renderless/common/deps/debounce";
|
|
11
|
+
import { getDataset } from "@opentiny/vue-renderless/common/dataset";
|
|
12
|
+
import Memorize from "@opentiny/vue-renderless/common/deps/memorize";
|
|
13
|
+
import { isEmptyObject } from "@opentiny/vue-renderless/common/type";
|
|
14
|
+
import { addResizeListener, removeResizeListener } from "@opentiny/vue-renderless/common/deps/resize-event";
|
|
15
|
+
import { extend } from "@opentiny/vue-renderless/common/object";
|
|
16
|
+
const handleComposition = ({ api, nextTick, state }) => (event) => {
|
|
17
|
+
const text = event.target.value;
|
|
18
|
+
if (event.type === "compositionend") {
|
|
19
|
+
state.isOnComposition = false;
|
|
20
|
+
nextTick(() => api.handleQueryChange(text));
|
|
21
|
+
} else {
|
|
22
|
+
const lastCharacter = text[text.length - 1] || "";
|
|
23
|
+
state.isOnComposition = !isKorean(lastCharacter);
|
|
24
|
+
}
|
|
109
25
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
26
|
+
const showTip = ({ props, state, refs }) => (show) => {
|
|
27
|
+
if (!props.showOverflowTooltip) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let overflow;
|
|
31
|
+
if (!show) {
|
|
32
|
+
clearTimeout(state.tipTimer);
|
|
33
|
+
state.tipTimer = setTimeout(() => {
|
|
34
|
+
state.showTip = state.tipHover;
|
|
35
|
+
}, refs.popover.closeDelay);
|
|
36
|
+
} else {
|
|
37
|
+
if (!props.multiple) {
|
|
38
|
+
const reference = refs.reference.$el;
|
|
39
|
+
overflow = reference.querySelector("input").scrollWidth > reference.scrollWidth;
|
|
122
40
|
} else {
|
|
123
|
-
|
|
124
|
-
state.selectEmitter.emit(constants.EVENT_NAME.queryChange, value);
|
|
41
|
+
overflow = refs.tags.scrollHeight > refs.tags.getBoundingClientRect().height;
|
|
125
42
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
};
|
|
43
|
+
state.showTip = show && overflow && !!state.tips && !state.visible;
|
|
44
|
+
}
|
|
130
45
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
var refs = vm.$refs;
|
|
140
|
-
if (state.previousQuery === value || state.isOnComposition) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (state.previousQuery === null && (typeof props.filterMethod === 'function' || typeof props.remoteMethod === 'function')) {
|
|
144
|
-
state.previousQuery = value;
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (props.renderType === constants.TYPE.Grid) {
|
|
148
|
-
api.gridOnQueryChange(value);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
if (props.renderType === constants.TYPE.Tree) {
|
|
152
|
-
state.previousQuery = value;
|
|
153
|
-
if (state.filterOrSearch && typeof props.filterMethod === 'function') {
|
|
154
|
-
refs.selectTree && refs.selectTree.filter(value);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
46
|
+
const gridOnQueryChange = ({ props, refs, constants, state }) => (value) => {
|
|
47
|
+
const { multiple, valueField, filterMethod, filterable, remote, remoteMethod } = props;
|
|
48
|
+
if (filterable && typeof filterMethod === "function") {
|
|
49
|
+
const table = refs.selectGrid.$refs.tinyTable;
|
|
50
|
+
const fullData = table.afterFullData;
|
|
51
|
+
refs.selectGrid.scrollTo(null, 0);
|
|
52
|
+
table.afterFullData = filterMethod(value, fullData) || [];
|
|
53
|
+
refs.selectGrid.handleTableData(!value).then(() => state.selectEmitter.emit(constants.EVENT_NAME.updatePopper));
|
|
157
54
|
state.previousQuery = value;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
55
|
+
} else if (remote && typeof remoteMethod === "function") {
|
|
56
|
+
state.previousQuery = value;
|
|
57
|
+
remoteMethod(value).then((data) => {
|
|
58
|
+
if (multiple) {
|
|
59
|
+
const selectedIds = state.selected.map((sel) => sel[valueField]);
|
|
60
|
+
refs.selectGrid.clearSelection();
|
|
61
|
+
refs.selectGrid.setSelection(
|
|
62
|
+
data.filter((row) => ~selectedIds.indexOf(row[valueField])),
|
|
63
|
+
true
|
|
64
|
+
);
|
|
65
|
+
state.remoteData = data.filter((row) => !~selectedIds.indexOf(row[valueField])).concat(state.selected);
|
|
66
|
+
} else {
|
|
67
|
+
refs.selectGrid.clearRadioRow();
|
|
68
|
+
refs.selectGrid.setRadioRow(find(data, (item) => props.modelValue == item[props.valueField]));
|
|
69
|
+
state.remoteData = data;
|
|
162
70
|
}
|
|
71
|
+
refs.selectGrid.$refs.tinyTable.lastScrollTop = 0;
|
|
72
|
+
refs.selectGrid.loadData(data);
|
|
73
|
+
refs.selectGrid.handleTableData(!value).then(() => state.selectEmitter.emit(constants.EVENT_NAME.updatePopper));
|
|
163
74
|
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const defaultOnQueryChange = ({ props, state, constants, api }) => (value) => {
|
|
78
|
+
if (props.remote && typeof props.remoteMethod === "function") {
|
|
164
79
|
state.hoverIndex = -1;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
api.defaultOnQueryChange(value);
|
|
179
|
-
};
|
|
80
|
+
props.remoteMethod(value);
|
|
81
|
+
} else if (typeof props.filterMethod === "function") {
|
|
82
|
+
props.filterMethod(value);
|
|
83
|
+
state.selectEmitter.emit(constants.COMPONENT_NAME.OptionGroup, constants.EVENT_NAME.queryChange);
|
|
84
|
+
} else {
|
|
85
|
+
state.filteredOptionsCount = state.optionsCount;
|
|
86
|
+
state.selectEmitter.emit(constants.EVENT_NAME.queryChange, value);
|
|
87
|
+
}
|
|
88
|
+
if (props.defaultFirstOption && (props.filterable || props.remote) && state.filteredOptionsCount) {
|
|
89
|
+
api.checkDefaultFirstOption();
|
|
90
|
+
}
|
|
180
91
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
92
|
+
const handleQueryChange = ({ api, constants, nextTick, props, vm, state }) => (value) => {
|
|
93
|
+
const refs = vm.$refs;
|
|
94
|
+
if (state.previousQuery === value || state.isOnComposition) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (state.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
|
|
98
|
+
state.previousQuery = value;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (props.renderType === constants.TYPE.Grid) {
|
|
102
|
+
api.gridOnQueryChange(value);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (props.renderType === constants.TYPE.Tree) {
|
|
106
|
+
state.previousQuery = value;
|
|
107
|
+
if (state.filterOrSearch && typeof props.filterMethod === "function") {
|
|
108
|
+
refs.selectTree && refs.selectTree.filter(value);
|
|
189
109
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
110
|
+
}
|
|
111
|
+
state.previousQuery = value;
|
|
112
|
+
nextTick(() => {
|
|
113
|
+
if (state.visible) {
|
|
114
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
115
|
+
state.showWarper = true;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
state.hoverIndex = -1;
|
|
119
|
+
if (props.multiple && props.filterable) {
|
|
120
|
+
nextTick(() => {
|
|
121
|
+
if (refs.input) {
|
|
122
|
+
const length = refs.input.value.length * 15 + 20;
|
|
123
|
+
state.inputLength = state.collapseTags ? Math.min(50, length) : length;
|
|
124
|
+
api.managePlaceholder();
|
|
125
|
+
api.resetInputHeight();
|
|
126
|
+
}
|
|
200
127
|
});
|
|
201
|
-
}
|
|
128
|
+
}
|
|
129
|
+
if (props.renderType === constants.TYPE.Tree) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
api.defaultOnQueryChange(value);
|
|
202
133
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
134
|
+
const scrollToOption = ({ refs, constants }) => (option) => {
|
|
135
|
+
const target = Array.isArray(option) && option[0] ? option[0].el : option.el;
|
|
136
|
+
if (refs.popper && target) {
|
|
137
|
+
const menu = refs.popper.$el.querySelector(constants.CLASS.SelectDropdownWrap);
|
|
138
|
+
scrollIntoView(menu, target);
|
|
139
|
+
}
|
|
140
|
+
refs.scrollbar && refs.scrollbar.handleScroll();
|
|
141
|
+
};
|
|
142
|
+
const handleMenuEnter = ({ api, nextTick, state }) => () => {
|
|
143
|
+
nextTick(() => api.scrollToOption(state.selected));
|
|
144
|
+
};
|
|
145
|
+
const emitChange = ({ emit, props, state, constants }) => (value) => {
|
|
146
|
+
const seekItem = (val, arr, items, flag) => {
|
|
147
|
+
if (constants.TYPE.Tree === flag) {
|
|
148
|
+
const recurNode = (node) => {
|
|
149
|
+
val === node[props.valueField] && items.push(node);
|
|
150
|
+
val !== node[props.valueField] && Array.isArray(node.children) && node.children.forEach(recurNode);
|
|
151
|
+
};
|
|
152
|
+
arr.forEach(recurNode);
|
|
153
|
+
} else if (constants.TYPE.Grid === flag) {
|
|
154
|
+
for (let i = 0; i < arr.length; i++) {
|
|
155
|
+
if (val === arr[i][props.valueField]) {
|
|
156
|
+
items.push(arr[i]);
|
|
157
|
+
break;
|
|
222
158
|
}
|
|
223
159
|
}
|
|
224
|
-
};
|
|
225
|
-
if (!isEqual(props.modelValue, value)) {
|
|
226
|
-
if (props.renderType === constants.TYPE.Grid && props.multiple) {
|
|
227
|
-
value = value || [];
|
|
228
|
-
var gridData = state.gridData || [];
|
|
229
|
-
var items = [];
|
|
230
|
-
value.forEach(function (valueItem) {
|
|
231
|
-
seekItem(valueItem, gridData, items, constants.TYPE.Grid);
|
|
232
|
-
});
|
|
233
|
-
emit('change', value, items);
|
|
234
|
-
} else if (props.renderType === constants.TYPE.Tree && props.multiple) {
|
|
235
|
-
value = value || [];
|
|
236
|
-
var treeData = state.treeData || [];
|
|
237
|
-
var _items = [];
|
|
238
|
-
value.forEach(function (valueItem) {
|
|
239
|
-
seekItem(valueItem, treeData, _items, constants.TYPE.Tree);
|
|
240
|
-
});
|
|
241
|
-
emit('change', value, _items);
|
|
242
|
-
} else {
|
|
243
|
-
emit('change', value);
|
|
244
|
-
}
|
|
245
160
|
}
|
|
246
161
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
162
|
+
if (!isEqual(props.modelValue, value)) {
|
|
163
|
+
if (props.renderType === constants.TYPE.Grid && props.multiple) {
|
|
164
|
+
value = value || [];
|
|
165
|
+
const gridData = state.gridData || [];
|
|
166
|
+
const items = [];
|
|
167
|
+
value.forEach((valueItem) => {
|
|
168
|
+
seekItem(valueItem, gridData, items, constants.TYPE.Grid);
|
|
169
|
+
});
|
|
170
|
+
emit("change", value, items);
|
|
171
|
+
} else if (props.renderType === constants.TYPE.Tree && props.multiple) {
|
|
172
|
+
value = value || [];
|
|
173
|
+
const treeData = state.treeData || [];
|
|
174
|
+
const items = [];
|
|
175
|
+
value.forEach((valueItem) => {
|
|
176
|
+
seekItem(valueItem, treeData, items, constants.TYPE.Tree);
|
|
177
|
+
});
|
|
178
|
+
emit("change", value, items);
|
|
179
|
+
} else {
|
|
180
|
+
emit("change", value);
|
|
266
181
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
const getOption = ({ props, state }) => (value) => {
|
|
185
|
+
let option;
|
|
186
|
+
const isObject = Object.prototype.toString.call(value).toLowerCase() === "[object object]";
|
|
187
|
+
const isNull = Object.prototype.toString.call(value).toLowerCase() === "[object null]";
|
|
188
|
+
const isUndefined = Object.prototype.toString.call(value).toLowerCase() === "[object undefined]";
|
|
189
|
+
for (let i = state.cachedOptions.length - 1; i >= 0; i--) {
|
|
190
|
+
const cachedOption = state.cachedOptions[i];
|
|
191
|
+
const isEqual2 = isObject ? getObj(cachedOption.value, props.valueKey) === getObj(value, props.valueKey) : cachedOption.value === value;
|
|
192
|
+
if (isEqual2) {
|
|
193
|
+
option = cachedOption;
|
|
194
|
+
break;
|
|
274
195
|
}
|
|
275
|
-
|
|
276
|
-
|
|
196
|
+
}
|
|
197
|
+
if (option) {
|
|
198
|
+
return option;
|
|
199
|
+
}
|
|
200
|
+
const label = !isObject && !isNull && !isUndefined ? value : "";
|
|
201
|
+
let newOption = { value, currentLabel: label };
|
|
202
|
+
if (props.multiple) {
|
|
203
|
+
newOption.hitState = false;
|
|
204
|
+
}
|
|
205
|
+
return newOption;
|
|
277
206
|
};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
props = _ref10.props;
|
|
281
|
-
var option = api.getOption(props.modelValue) || {};
|
|
207
|
+
const getOptionOfSetSelected = ({ api, props }) => {
|
|
208
|
+
const option = api.getOption(props.modelValue) || {};
|
|
282
209
|
if (!option.state) {
|
|
283
210
|
option.state = {};
|
|
284
211
|
}
|
|
@@ -290,16 +217,12 @@ var getOptionOfSetSelected = function getOptionOfSetSelected(_ref10) {
|
|
|
290
217
|
}
|
|
291
218
|
return option;
|
|
292
219
|
};
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
isGrid = _ref11.isGrid,
|
|
296
|
-
isTree = _ref11.isTree,
|
|
297
|
-
api = _ref11.api;
|
|
298
|
-
var result = [];
|
|
220
|
+
const getResultOfSetSelected = ({ props, isGrid, isTree, api }) => {
|
|
221
|
+
let result = [];
|
|
299
222
|
if (Array.isArray(props.modelValue)) {
|
|
300
|
-
props.modelValue.forEach(
|
|
223
|
+
props.modelValue.forEach((value) => {
|
|
301
224
|
if (isGrid || isTree) {
|
|
302
|
-
|
|
225
|
+
const option = api.getPluginOption(value, isTree);
|
|
303
226
|
result = result.concat(option);
|
|
304
227
|
} else {
|
|
305
228
|
result.push(api.getOption(value));
|
|
@@ -308,675 +231,484 @@ var getResultOfSetSelected = function getResultOfSetSelected(_ref11) {
|
|
|
308
231
|
}
|
|
309
232
|
return result;
|
|
310
233
|
};
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (!props.modelValue) {
|
|
324
|
-
state.selectedLabel = '';
|
|
325
|
-
state.selected = {};
|
|
326
|
-
state.currentKey = '';
|
|
327
|
-
refs.selectGrid && refs.selectGrid.clearRadioRow();
|
|
328
|
-
refs.selectTree && refs.selectTree.setCurrentKey && refs.selectTree.setCurrentKey(null);
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
var isRemote = state.filterOrSearch && props.remote && typeof props.remoteMethod === 'function';
|
|
332
|
-
var nestdata = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
333
|
-
var data = find(nestdata, function (item) {
|
|
334
|
-
return props.modelValue == item[props.valueField];
|
|
335
|
-
});
|
|
336
|
-
if (isEmptyObject(data)) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
var obj = _objectSpread({}, data);
|
|
340
|
-
var label = data[props.textField];
|
|
341
|
-
obj.currentLabel = label;
|
|
342
|
-
state.selectedLabel = label;
|
|
343
|
-
state.selected = obj;
|
|
344
|
-
state.currentKey = data[props.valueField];
|
|
345
|
-
} else {
|
|
346
|
-
var option = getOptionOfSetSelected({
|
|
347
|
-
api: api,
|
|
348
|
-
props: props
|
|
349
|
-
});
|
|
350
|
-
nextTick(function () {
|
|
351
|
-
state.selected = option;
|
|
352
|
-
state.selectedLabel = option.state.currentLabel || option.currentLabel;
|
|
353
|
-
props.filterable && (state.query = state.selectedLabel);
|
|
354
|
-
});
|
|
234
|
+
const setSelected = ({ api, constants, nextTick, props, refs, state }) => () => {
|
|
235
|
+
const isTree = props.renderType === constants.TYPE.Tree;
|
|
236
|
+
const isGrid = props.renderType === constants.TYPE.Grid;
|
|
237
|
+
if (!props.multiple) {
|
|
238
|
+
if (isGrid || isTree) {
|
|
239
|
+
if (!props.modelValue) {
|
|
240
|
+
state.selectedLabel = "";
|
|
241
|
+
state.selected = {};
|
|
242
|
+
state.currentKey = "";
|
|
243
|
+
refs.selectGrid && refs.selectGrid.clearRadioRow();
|
|
244
|
+
refs.selectTree && refs.selectTree.setCurrentKey && refs.selectTree.setCurrentKey(null);
|
|
245
|
+
return;
|
|
355
246
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
isTree: isTree,
|
|
362
|
-
api: api
|
|
363
|
-
});
|
|
364
|
-
state.selectCls = result.length ? result.length === state.options.length ? 'checked-sur' : 'halfselect' : 'check';
|
|
365
|
-
state.selected = result;
|
|
366
|
-
refs.selectTree && refs.selectTree.setCheckedNodes && refs.selectTree.setCheckedNodes(state.selected);
|
|
367
|
-
state.tips = state.selected.map(function (item) {
|
|
368
|
-
return item.state ? item.state.currentLabel : item.currentLabel;
|
|
369
|
-
}).join(',');
|
|
370
|
-
nextTick(api.resetInputHeight);
|
|
371
|
-
};
|
|
372
|
-
};
|
|
373
|
-
export var getPluginOption = function getPluginOption(_ref13) {
|
|
374
|
-
var api = _ref13.api,
|
|
375
|
-
props = _ref13.props,
|
|
376
|
-
state = _ref13.state;
|
|
377
|
-
return function (value, isTree) {
|
|
378
|
-
var isRemote = state.filterOrSearch && props.remote && typeof props.remoteMethod === 'function';
|
|
379
|
-
var textField = props.textField,
|
|
380
|
-
valueField = props.valueField;
|
|
381
|
-
var sourceData = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
382
|
-
var selNode = find(sourceData, function (item) {
|
|
383
|
-
return item[valueField] == value;
|
|
384
|
-
});
|
|
385
|
-
var items = [];
|
|
386
|
-
if (selNode) {
|
|
387
|
-
selNode.currentLabel = selNode[textField];
|
|
388
|
-
items.push(selNode);
|
|
389
|
-
}
|
|
390
|
-
return items;
|
|
391
|
-
};
|
|
392
|
-
};
|
|
393
|
-
export var toggleCheckAll = function toggleCheckAll(_ref14) {
|
|
394
|
-
var api = _ref14.api,
|
|
395
|
-
emit = _ref14.emit,
|
|
396
|
-
state = _ref14.state;
|
|
397
|
-
return function () {
|
|
398
|
-
var getEnabledValues = function getEnabledValues(options) {
|
|
399
|
-
var values = [];
|
|
400
|
-
for (var i = 0; i < options.length; i++) {
|
|
401
|
-
if (!options[i].state.disabled && !options[i].state.groupDisabled) {
|
|
402
|
-
values.push(options[i].value);
|
|
403
|
-
}
|
|
247
|
+
const isRemote = state.filterOrSearch && props.remote && typeof props.remoteMethod === "function";
|
|
248
|
+
const nestdata = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
249
|
+
const data = find(nestdata, (item) => props.modelValue == item[props.valueField]);
|
|
250
|
+
if (isEmptyObject(data)) {
|
|
251
|
+
return;
|
|
404
252
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
253
|
+
const obj = __spreadValues({}, data);
|
|
254
|
+
const label = data[props.textField];
|
|
255
|
+
obj.currentLabel = label;
|
|
256
|
+
state.selectedLabel = label;
|
|
257
|
+
state.selected = obj;
|
|
258
|
+
state.currentKey = data[props.valueField];
|
|
259
|
+
} else {
|
|
260
|
+
const option = getOptionOfSetSelected({ api, props });
|
|
261
|
+
nextTick(() => {
|
|
262
|
+
state.selected = option;
|
|
263
|
+
state.selectedLabel = option.state.currentLabel || option.currentLabel;
|
|
264
|
+
props.filterable && (state.query = state.selectedLabel);
|
|
413
265
|
});
|
|
414
|
-
unchecked.length ? value = getEnabledValues(state.options) : value = [];
|
|
415
|
-
} else if (state.selectCls === 'checked-sur') {
|
|
416
|
-
value = [];
|
|
417
266
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const result = getResultOfSetSelected({ props, isGrid, isTree, api });
|
|
270
|
+
state.selectCls = result.length ? result.length === state.options.length ? "checked-sur" : "halfselect" : "check";
|
|
271
|
+
state.selected = result;
|
|
272
|
+
refs.selectTree && refs.selectTree.setCheckedNodes && refs.selectTree.setCheckedNodes(state.selected);
|
|
273
|
+
state.tips = state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join(",");
|
|
274
|
+
nextTick(api.resetInputHeight);
|
|
275
|
+
};
|
|
276
|
+
const getPluginOption = ({ api, props, state }) => (value, isTree) => {
|
|
277
|
+
const isRemote = state.filterOrSearch && props.remote && typeof props.remoteMethod === "function";
|
|
278
|
+
const { textField, valueField } = props;
|
|
279
|
+
const sourceData = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
280
|
+
const selNode = find(sourceData, (item) => item[valueField] == value);
|
|
281
|
+
const items = [];
|
|
282
|
+
if (selNode) {
|
|
283
|
+
selNode.currentLabel = selNode[textField];
|
|
284
|
+
items.push(selNode);
|
|
285
|
+
}
|
|
286
|
+
return items;
|
|
287
|
+
};
|
|
288
|
+
const toggleCheckAll = ({ api, emit, state }) => () => {
|
|
289
|
+
const getEnabledValues = (options) => {
|
|
290
|
+
let values = [];
|
|
291
|
+
for (let i = 0; i < options.length; i++) {
|
|
292
|
+
if (!options[i].state.disabled && !options[i].state.groupDisabled) {
|
|
293
|
+
values.push(options[i].value);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return values;
|
|
421
297
|
};
|
|
298
|
+
let value;
|
|
299
|
+
if (state.selectCls === "check") {
|
|
300
|
+
value = getEnabledValues(state.options);
|
|
301
|
+
} else if (state.selectCls === "halfselect") {
|
|
302
|
+
const unchecked = state.options.filter((item) => !item.disabled && item.state.selectCls === "check");
|
|
303
|
+
unchecked.length ? value = getEnabledValues(state.options) : value = [];
|
|
304
|
+
} else if (state.selectCls === "checked-sur") {
|
|
305
|
+
value = [];
|
|
306
|
+
}
|
|
307
|
+
api.setSoftFocus();
|
|
308
|
+
emit("update:modelValue", value);
|
|
309
|
+
emit("change", value);
|
|
310
|
+
};
|
|
311
|
+
const resetFilter = ({ state, api }) => () => {
|
|
312
|
+
state.query = "";
|
|
313
|
+
state.previousQuery = void 0;
|
|
314
|
+
api.handleQueryChange(state.query);
|
|
315
|
+
};
|
|
316
|
+
const handleFocus = ({ emit, props, state, api }) => (event) => {
|
|
317
|
+
if (!state.softFocus) {
|
|
318
|
+
if (props.automaticDropdown || props.filterable) {
|
|
319
|
+
state.visible = true;
|
|
320
|
+
state.softFocus = true;
|
|
321
|
+
}
|
|
322
|
+
emit("focus", event);
|
|
323
|
+
} else {
|
|
324
|
+
state.softFocus = false;
|
|
325
|
+
}
|
|
326
|
+
if (props.remote && state.filterOrSearch && state.firstAutoSeach) {
|
|
327
|
+
state.firstAutoSeach = false;
|
|
328
|
+
api.resetFilter();
|
|
329
|
+
}
|
|
422
330
|
};
|
|
423
|
-
|
|
424
|
-
var
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
state.previousQuery = undefined;
|
|
429
|
-
api.handleQueryChange(state.query);
|
|
430
|
-
};
|
|
331
|
+
const focus = ({ refs, state }) => () => {
|
|
332
|
+
var _a;
|
|
333
|
+
if (!state.softFocus) {
|
|
334
|
+
(_a = refs.reference) == null ? void 0 : _a.focus();
|
|
335
|
+
}
|
|
431
336
|
};
|
|
432
|
-
|
|
433
|
-
var
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
emit('focus', event);
|
|
337
|
+
const blur = ({ refs, state }) => () => {
|
|
338
|
+
var _a;
|
|
339
|
+
state.visible = false;
|
|
340
|
+
(_a = refs.reference) == null ? void 0 : _a.blur();
|
|
341
|
+
};
|
|
342
|
+
const handleBlur = ({ constants, dispatch, emit, state }) => (event) => {
|
|
343
|
+
setTimeout(() => {
|
|
344
|
+
var _a;
|
|
345
|
+
if (state.isSilentBlur) {
|
|
346
|
+
state.isSilentBlur = false;
|
|
444
347
|
} else {
|
|
445
|
-
|
|
348
|
+
emit("blur", event);
|
|
446
349
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
};
|
|
350
|
+
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formBlur, (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.value);
|
|
351
|
+
}, 100);
|
|
352
|
+
state.softFocus = false;
|
|
452
353
|
};
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
state = _ref17.state;
|
|
456
|
-
return function () {
|
|
457
|
-
if (!state.softFocus) {
|
|
458
|
-
var _refs$reference;
|
|
459
|
-
(_refs$reference = refs.reference) === null || _refs$reference === void 0 ? void 0 : _refs$reference.focus();
|
|
460
|
-
}
|
|
461
|
-
};
|
|
354
|
+
const handleClearClick = (api) => (event) => {
|
|
355
|
+
api.deleteSelected(event);
|
|
462
356
|
};
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
state = _ref18.state;
|
|
466
|
-
return function () {
|
|
467
|
-
var _refs$reference2;
|
|
468
|
-
state.visible = false;
|
|
469
|
-
(_refs$reference2 = refs.reference) === null || _refs$reference2 === void 0 ? void 0 : _refs$reference2.blur();
|
|
470
|
-
};
|
|
357
|
+
const doDestroy = (refs) => () => {
|
|
358
|
+
refs.popper && refs.popper.doDestroy();
|
|
471
359
|
};
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
dispatch = _ref19.dispatch,
|
|
475
|
-
emit = _ref19.emit,
|
|
476
|
-
state = _ref19.state;
|
|
477
|
-
return function (event) {
|
|
478
|
-
setTimeout(function () {
|
|
479
|
-
var _event$target;
|
|
480
|
-
if (state.isSilentBlur) {
|
|
481
|
-
state.isSilentBlur = false;
|
|
482
|
-
} else {
|
|
483
|
-
emit('blur', event);
|
|
484
|
-
}
|
|
485
|
-
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formBlur, event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
|
|
486
|
-
}, 100);
|
|
487
|
-
state.softFocus = false;
|
|
488
|
-
};
|
|
360
|
+
const handleClose = (state) => () => {
|
|
361
|
+
state.visible = false;
|
|
489
362
|
};
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
363
|
+
const toggleLastOptionHitState = ({ state }) => (hit) => {
|
|
364
|
+
if (!Array.isArray(state.selected)) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const option = state.selected[state.selected.length - 1];
|
|
368
|
+
if (!option) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const hitTarget = option.state || option;
|
|
372
|
+
if (hit === true || hit === false) {
|
|
373
|
+
hitTarget.hitState = hit;
|
|
374
|
+
return hit;
|
|
375
|
+
}
|
|
376
|
+
hitTarget.hitState = !hitTarget.hitState;
|
|
377
|
+
return hitTarget.hitState;
|
|
378
|
+
};
|
|
379
|
+
const deletePrevTag = ({ api, constants, emit, props, state, vm }) => (event) => {
|
|
380
|
+
const refs = vm.$refs;
|
|
381
|
+
if (event.target.value.length <= 0 && !api.toggleLastOptionHitState()) {
|
|
382
|
+
const value = props.modelValue.slice();
|
|
383
|
+
value.pop();
|
|
384
|
+
emit("update:modelValue", value);
|
|
385
|
+
api.emitChange(value);
|
|
386
|
+
if (props.renderType === constants.TYPE.Grid) {
|
|
387
|
+
const rows = state.selected.slice().filter((item) => value.includes(item[props.valueField]));
|
|
388
|
+
refs.selectGrid.clearSelection();
|
|
389
|
+
refs.selectGrid.setSelection(rows, true);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
494
392
|
};
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
}
|
|
393
|
+
const managePlaceholder = ({ refs, state }) => () => {
|
|
394
|
+
if (state.currentPlaceholder !== "") {
|
|
395
|
+
state.currentPlaceholder = refs.input.value ? "" : state.cachedPlaceHolder;
|
|
396
|
+
}
|
|
499
397
|
};
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}
|
|
398
|
+
const resetInputState = ({ api, refs, state }) => (event) => {
|
|
399
|
+
if (event.keyCode !== 8) {
|
|
400
|
+
api.toggleLastOptionHitState(false);
|
|
401
|
+
}
|
|
402
|
+
state.inputLength = refs.input.value.length * 15 + 20;
|
|
403
|
+
api.resetInputHeight();
|
|
504
404
|
};
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
405
|
+
const resetInputHeight = ({ constants, nextTick, props, refs, state }) => () => {
|
|
406
|
+
if (state.collapseTags && (!props.filterable || !props.searchable)) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
nextTick(() => {
|
|
410
|
+
if (!refs.reference) {
|
|
509
411
|
return;
|
|
510
412
|
}
|
|
511
|
-
|
|
512
|
-
|
|
413
|
+
let inputChildNodes = refs.reference.$el.childNodes;
|
|
414
|
+
let input = [].filter.call(inputChildNodes, (item) => item.tagName === "INPUT")[0];
|
|
415
|
+
const tags = refs.tags;
|
|
416
|
+
if (!input) {
|
|
513
417
|
return;
|
|
514
418
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
419
|
+
const sizeInMap = state.initialInputHeight || 30;
|
|
420
|
+
const noSelected = state.selected.length === 0;
|
|
421
|
+
input.style.height = noSelected ? sizeInMap + "px" : Math.max(tags ? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap) + "px";
|
|
422
|
+
if (state.visible && state.emptyText !== false) {
|
|
423
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper, true);
|
|
519
424
|
}
|
|
520
|
-
|
|
521
|
-
return hitTarget.hitState;
|
|
522
|
-
};
|
|
523
|
-
};
|
|
524
|
-
export var deletePrevTag = function deletePrevTag(_ref21) {
|
|
525
|
-
var api = _ref21.api,
|
|
526
|
-
constants = _ref21.constants,
|
|
527
|
-
emit = _ref21.emit,
|
|
528
|
-
props = _ref21.props,
|
|
529
|
-
state = _ref21.state,
|
|
530
|
-
vm = _ref21.vm;
|
|
531
|
-
return function (event) {
|
|
532
|
-
var refs = vm.$refs;
|
|
533
|
-
if (event.target.value.length <= 0 && !api.toggleLastOptionHitState()) {
|
|
534
|
-
var value = props.modelValue.slice();
|
|
535
|
-
value.pop();
|
|
536
|
-
emit('update:modelValue', value);
|
|
537
|
-
api.emitChange(value);
|
|
538
|
-
if (props.renderType === constants.TYPE.Grid) {
|
|
539
|
-
var rows = state.selected.slice().filter(function (item) {
|
|
540
|
-
return value.indexOf(item[props.valueField]) > -1;
|
|
541
|
-
});
|
|
542
|
-
refs.selectGrid.clearSelection();
|
|
543
|
-
refs.selectGrid.setSelection(rows, true);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
};
|
|
425
|
+
});
|
|
547
426
|
};
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
state =
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
427
|
+
const resetHoverIndex = ({ props, state }) => () => {
|
|
428
|
+
if (!props.showOverflowTooltip) {
|
|
429
|
+
state.hoverIndex = -1;
|
|
430
|
+
} else if (!props.multiple) {
|
|
431
|
+
state.hoverIndex = state.options.indexOf(state.selected);
|
|
432
|
+
} else {
|
|
433
|
+
if (state.selected.length > 0) {
|
|
434
|
+
state.hoverIndex = Math.min.apply(
|
|
435
|
+
null,
|
|
436
|
+
state.selected.map((item) => state.options.indexOf(item))
|
|
437
|
+
);
|
|
438
|
+
} else {
|
|
439
|
+
state.hoverIndex = -1;
|
|
554
440
|
}
|
|
555
|
-
}
|
|
441
|
+
}
|
|
556
442
|
};
|
|
557
|
-
|
|
558
|
-
var
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
443
|
+
const handleOptionSelect = ({ api, emit, nextTick, props, refs, state }) => (option, byClick) => {
|
|
444
|
+
var _a, _b;
|
|
445
|
+
state.memorize && state.memorize.updateByKey(option[state.memorize._dataKey] || option.value);
|
|
446
|
+
if (props.multiple) {
|
|
447
|
+
const value = (props.modelValue || []).slice();
|
|
448
|
+
const optionIndex = api.getValueIndex(value, option.value);
|
|
449
|
+
if (optionIndex > -1) {
|
|
450
|
+
value.splice(optionIndex, 1);
|
|
451
|
+
} else if (state.multipleLimit <= 0 || value.length < state.multipleLimit) {
|
|
452
|
+
value.push(option.value);
|
|
453
|
+
}
|
|
454
|
+
emit("update:modelValue", value);
|
|
455
|
+
api.emitChange(value);
|
|
456
|
+
if (option.created) {
|
|
457
|
+
state.query = "";
|
|
458
|
+
api.handleQueryChange("");
|
|
459
|
+
state.inputLength = 20;
|
|
564
460
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
};
|
|
568
|
-
};
|
|
569
|
-
export var resetInputHeight = function resetInputHeight(_ref24) {
|
|
570
|
-
var constants = _ref24.constants,
|
|
571
|
-
nextTick = _ref24.nextTick,
|
|
572
|
-
props = _ref24.props,
|
|
573
|
-
refs = _ref24.refs,
|
|
574
|
-
state = _ref24.state;
|
|
575
|
-
return function () {
|
|
576
|
-
if (state.collapseTags && (!props.filterable || !props.searchable)) {
|
|
577
|
-
return;
|
|
461
|
+
if (props.filterable) {
|
|
462
|
+
(_a = refs.input) == null ? void 0 : _a.focus();
|
|
578
463
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
var inputChildNodes = refs.reference.$el.childNodes;
|
|
584
|
-
var input = [].filter.call(inputChildNodes, function (item) {
|
|
585
|
-
return item.tagName === 'INPUT';
|
|
586
|
-
})[0];
|
|
587
|
-
var tags = refs.tags;
|
|
588
|
-
if (!input) {
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
var sizeInMap = state.initialInputHeight || 30;
|
|
592
|
-
var noSelected = state.selected.length === 0;
|
|
593
|
-
input.style.height = noSelected ? sizeInMap + 'px' : Math.max(tags ? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap) + 'px';
|
|
594
|
-
if (state.visible && state.emptyText !== false) {
|
|
595
|
-
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper, true);
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
};
|
|
599
|
-
};
|
|
600
|
-
export var resetHoverIndex = function resetHoverIndex(_ref25) {
|
|
601
|
-
var props = _ref25.props,
|
|
602
|
-
state = _ref25.state;
|
|
603
|
-
return function () {
|
|
604
|
-
if (!props.showOverflowTooltip) {
|
|
605
|
-
state.hoverIndex = -1;
|
|
606
|
-
} else if (!props.multiple) {
|
|
607
|
-
state.hoverIndex = state.options.indexOf(state.selected);
|
|
608
|
-
} else {
|
|
609
|
-
if (state.selected.length > 0) {
|
|
610
|
-
state.hoverIndex = Math.min.apply(null, state.selected.map(function (item) {
|
|
611
|
-
return state.options.indexOf(item);
|
|
612
|
-
}));
|
|
613
|
-
} else {
|
|
614
|
-
state.hoverIndex = -1;
|
|
615
|
-
}
|
|
464
|
+
if (props.searchable) {
|
|
465
|
+
(_b = refs.reference) == null ? void 0 : _b.focus();
|
|
616
466
|
}
|
|
617
|
-
|
|
618
|
-
};
|
|
619
|
-
export var handleOptionSelect = function handleOptionSelect(_ref26) {
|
|
620
|
-
var api = _ref26.api,
|
|
621
|
-
emit = _ref26.emit,
|
|
622
|
-
nextTick = _ref26.nextTick,
|
|
623
|
-
props = _ref26.props,
|
|
624
|
-
refs = _ref26.refs,
|
|
625
|
-
state = _ref26.state;
|
|
626
|
-
return function (option, byClick) {
|
|
627
|
-
state.memorize && state.memorize.updateByKey(option[state.memorize._dataKey] || option.value);
|
|
628
|
-
if (props.multiple) {
|
|
629
|
-
var value = (props.modelValue || []).slice();
|
|
630
|
-
var optionIndex = api.getValueIndex(value, option.value);
|
|
631
|
-
if (optionIndex > -1) {
|
|
632
|
-
value.splice(optionIndex, 1);
|
|
633
|
-
} else if (state.multipleLimit <= 0 || value.length < state.multipleLimit) {
|
|
634
|
-
value.push(option.value);
|
|
635
|
-
}
|
|
636
|
-
emit('update:modelValue', value);
|
|
637
|
-
api.emitChange(value);
|
|
638
|
-
if (option.created) {
|
|
639
|
-
state.query = '';
|
|
640
|
-
api.handleQueryChange('');
|
|
641
|
-
state.inputLength = 20;
|
|
642
|
-
}
|
|
643
|
-
if (props.filterable) {
|
|
644
|
-
var _refs$input;
|
|
645
|
-
(_refs$input = refs.input) === null || _refs$input === void 0 ? void 0 : _refs$input.focus();
|
|
646
|
-
}
|
|
647
|
-
if (props.searchable) {
|
|
648
|
-
var _refs$reference3;
|
|
649
|
-
(_refs$reference3 = refs.reference) === null || _refs$reference3 === void 0 ? void 0 : _refs$reference3.focus();
|
|
650
|
-
}
|
|
651
|
-
if (props.autoClose) {
|
|
652
|
-
state.visible = false;
|
|
653
|
-
}
|
|
654
|
-
} else {
|
|
655
|
-
emit('update:modelValue', option.value);
|
|
656
|
-
api.emitChange(option.value);
|
|
657
|
-
if (option.created) {
|
|
658
|
-
state.createdSelected = true;
|
|
659
|
-
state.createdLabel = option.value;
|
|
660
|
-
}
|
|
467
|
+
if (props.autoClose) {
|
|
661
468
|
state.visible = false;
|
|
662
469
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
470
|
+
} else {
|
|
471
|
+
emit("update:modelValue", option.value);
|
|
472
|
+
api.emitChange(option.value);
|
|
473
|
+
if (option.created) {
|
|
474
|
+
state.createdSelected = true;
|
|
475
|
+
state.createdLabel = option.value;
|
|
667
476
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
477
|
+
state.visible = false;
|
|
478
|
+
}
|
|
479
|
+
state.isSilentBlur = byClick;
|
|
480
|
+
api.setSoftFocus();
|
|
481
|
+
if (state.visible) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
nextTick(() => {
|
|
485
|
+
api.scrollToOption(option);
|
|
486
|
+
});
|
|
672
487
|
};
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
state.softFocus = true;
|
|
678
|
-
var input = refs.input || refs.reference;
|
|
679
|
-
input === null || input === void 0 ? void 0 : input.focus();
|
|
680
|
-
};
|
|
488
|
+
const setSoftFocus = ({ refs, state }) => () => {
|
|
489
|
+
state.softFocus = true;
|
|
490
|
+
const input = refs.input || refs.reference;
|
|
491
|
+
input == null ? void 0 : input.focus();
|
|
681
492
|
};
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
});
|
|
699
|
-
return index;
|
|
700
|
-
}
|
|
701
|
-
};
|
|
493
|
+
const getValueIndex = (props) => (arr = [], value = null) => {
|
|
494
|
+
const isObject = Object.prototype.toString.call(value).toLowerCase() === "[object object]";
|
|
495
|
+
if (!isObject) {
|
|
496
|
+
return arr.indexOf(value);
|
|
497
|
+
} else {
|
|
498
|
+
const valueKey = props.valueKey;
|
|
499
|
+
let index = -1;
|
|
500
|
+
arr.some((item, i) => {
|
|
501
|
+
if (getObj(item, valueKey) === getObj(value, valueKey)) {
|
|
502
|
+
index = i;
|
|
503
|
+
return true;
|
|
504
|
+
}
|
|
505
|
+
return false;
|
|
506
|
+
});
|
|
507
|
+
return index;
|
|
508
|
+
}
|
|
702
509
|
};
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
state =
|
|
706
|
-
|
|
707
|
-
return function () {
|
|
708
|
-
if (!state.selectDisabled) {
|
|
510
|
+
const toggleMenu = ({ refs, state, props }) => () => {
|
|
511
|
+
if (!state.selectDisabled) {
|
|
512
|
+
!props.ignoreEnter && (state.visible = !state.visible);
|
|
513
|
+
if (state.softFocus && refs.reference) {
|
|
709
514
|
!props.ignoreEnter && (state.visible = !state.visible);
|
|
710
|
-
|
|
711
|
-
!props.ignoreEnter && (state.visible = !state.visible);
|
|
712
|
-
state.softFocus = false;
|
|
713
|
-
}
|
|
714
|
-
if (state.visible) {
|
|
715
|
-
var dom = refs.input || refs.reference;
|
|
716
|
-
dom === null || dom === void 0 ? void 0 : dom.focus();
|
|
717
|
-
}
|
|
515
|
+
state.softFocus = false;
|
|
718
516
|
}
|
|
719
|
-
|
|
517
|
+
if (state.visible) {
|
|
518
|
+
const dom = refs.input || refs.reference;
|
|
519
|
+
dom == null ? void 0 : dom.focus();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
720
522
|
};
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
api.toggleMenu();
|
|
728
|
-
} else {
|
|
729
|
-
if (state.options[state.hoverIndex]) {
|
|
730
|
-
api.handleOptionSelect(state.options[state.hoverIndex]);
|
|
731
|
-
}
|
|
523
|
+
const selectOption = ({ api, state, props }) => () => {
|
|
524
|
+
if (!state.visible || props.hideDrop) {
|
|
525
|
+
api.toggleMenu();
|
|
526
|
+
} else {
|
|
527
|
+
if (state.options[state.hoverIndex]) {
|
|
528
|
+
api.handleOptionSelect(state.options[state.hoverIndex]);
|
|
732
529
|
}
|
|
733
|
-
}
|
|
530
|
+
}
|
|
734
531
|
};
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
state =
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
532
|
+
const deleteSelected = ({ api, constants, emit, props, vm, state }) => (event) => {
|
|
533
|
+
event.stopPropagation();
|
|
534
|
+
const value = props.multiple ? [] : "";
|
|
535
|
+
const refs = vm.$refs;
|
|
536
|
+
if (props.renderType === constants.TYPE.Tree) {
|
|
537
|
+
state.selected = {};
|
|
538
|
+
state.selectedLabel = "";
|
|
539
|
+
refs.selectTree.setCurrentKey(null);
|
|
540
|
+
} else if (props.renderType === constants.TYPE.Grid) {
|
|
541
|
+
state.selected = {};
|
|
542
|
+
state.selectedLabel = "";
|
|
543
|
+
refs.selectGrid.clearRadioRow();
|
|
544
|
+
}
|
|
545
|
+
state.showTip = false;
|
|
546
|
+
emit("update:modelValue", value);
|
|
547
|
+
api.emitChange(value);
|
|
548
|
+
state.visible = false;
|
|
549
|
+
emit("clear");
|
|
550
|
+
};
|
|
551
|
+
const deleteTag = ({ api, constants, emit, props, state, vm }) => (event, tag) => {
|
|
552
|
+
const refs = vm.$refs;
|
|
553
|
+
const isTree = props.renderType === constants.TYPE.Tree;
|
|
554
|
+
const index = state.selected.indexOf(tag);
|
|
555
|
+
const treeValue = [];
|
|
556
|
+
const treeIds = [tag[props.valueField]];
|
|
557
|
+
if (isTree && !props.treeOp.checkStrictly) {
|
|
558
|
+
let node = refs.selectTree.getNode(tag[props.valueField]);
|
|
559
|
+
if (!node.isLeaf) {
|
|
560
|
+
treeIds.push(...api.getChildValue(node.childNodes, props.valueField));
|
|
561
|
+
}
|
|
562
|
+
while (node.parent && !Array.isArray(node.parent.data)) {
|
|
563
|
+
treeIds.push(node.parent.data[props.valueField]);
|
|
564
|
+
node = node.parent;
|
|
565
|
+
}
|
|
566
|
+
state.selected.slice().map((node2) => !treeIds.includes(node2[props.valueField]) && treeValue.push(node2[props.valueField]));
|
|
567
|
+
}
|
|
568
|
+
if (index > -1 && !state.selectDisabled) {
|
|
569
|
+
const value = props.modelValue.slice();
|
|
570
|
+
value.splice(index, 1);
|
|
746
571
|
if (props.renderType === constants.TYPE.Tree) {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
refs.selectTree.setCurrentKey(null);
|
|
572
|
+
props.treeOp.checkStrictly && treeValue.push(...value);
|
|
573
|
+
refs.selectTree.setCheckedKeys(treeValue);
|
|
750
574
|
} else if (props.renderType === constants.TYPE.Grid) {
|
|
751
|
-
state.selected
|
|
752
|
-
|
|
753
|
-
refs.selectGrid.
|
|
575
|
+
const rows = state.selected.slice().filter((item) => value.includes(item[props.valueField]));
|
|
576
|
+
refs.selectGrid.clearSelection();
|
|
577
|
+
refs.selectGrid.setSelection(rows, true);
|
|
754
578
|
}
|
|
755
|
-
|
|
756
|
-
emit('update:modelValue', value);
|
|
579
|
+
emit("update:modelValue", isTree ? treeValue : value);
|
|
757
580
|
api.emitChange(value);
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
581
|
+
emit(constants.EVENT_NAME.removeTag, tag[props.valueField]);
|
|
582
|
+
}
|
|
583
|
+
event.stopPropagation();
|
|
761
584
|
};
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return function (event, tag) {
|
|
770
|
-
var refs = vm.$refs;
|
|
771
|
-
var isTree = props.renderType === constants.TYPE.Tree;
|
|
772
|
-
var index = state.selected.indexOf(tag);
|
|
773
|
-
var treeValue = [];
|
|
774
|
-
var treeIds = [tag[props.valueField]];
|
|
775
|
-
if (isTree && !props.treeOp.checkStrictly) {
|
|
776
|
-
var node = refs.selectTree.getNode(tag[props.valueField]);
|
|
777
|
-
if (!node.isLeaf) {
|
|
778
|
-
treeIds.push.apply(treeIds, _toConsumableArray(api.getChildValue(node.childNodes, props.valueField)));
|
|
779
|
-
}
|
|
780
|
-
while (node.parent && !Array.isArray(node.parent.data)) {
|
|
781
|
-
treeIds.push(node.parent.data[props.valueField]);
|
|
782
|
-
node = node.parent;
|
|
783
|
-
}
|
|
784
|
-
state.selected.slice().map(function (node) {
|
|
785
|
-
return treeIds.indexOf(node[props.valueField]) === -1 && treeValue.push(node[props.valueField]);
|
|
585
|
+
const onInputChange = ({ api, props, state, constants, nextTick }) => () => {
|
|
586
|
+
if (!props.delay) {
|
|
587
|
+
if (props.filterable && state.query !== state.selectedLabel) {
|
|
588
|
+
state.query = state.selectedLabel;
|
|
589
|
+
api.handleQueryChange(state.query);
|
|
590
|
+
nextTick(() => {
|
|
591
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
786
592
|
});
|
|
787
593
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
} else if (props.renderType === constants.TYPE.Grid) {
|
|
795
|
-
var rows = state.selected.slice().filter(function (item) {
|
|
796
|
-
return value.indexOf(item[props.valueField]) > -1;
|
|
797
|
-
});
|
|
798
|
-
refs.selectGrid.clearSelection();
|
|
799
|
-
refs.selectGrid.setSelection(rows, true);
|
|
800
|
-
}
|
|
801
|
-
emit('update:modelValue', isTree ? treeValue : value);
|
|
802
|
-
api.emitChange(value);
|
|
803
|
-
emit(constants.EVENT_NAME.removeTag, tag[props.valueField]);
|
|
804
|
-
}
|
|
805
|
-
event.stopPropagation();
|
|
806
|
-
};
|
|
807
|
-
};
|
|
808
|
-
export var onInputChange = function onInputChange(_ref32) {
|
|
809
|
-
var api = _ref32.api,
|
|
810
|
-
props = _ref32.props,
|
|
811
|
-
state = _ref32.state,
|
|
812
|
-
constants = _ref32.constants,
|
|
813
|
-
nextTick = _ref32.nextTick;
|
|
814
|
-
return function () {
|
|
815
|
-
if (!props.delay) {
|
|
816
|
-
if (props.filterable && state.query !== state.selectedLabel) {
|
|
817
|
-
state.query = state.selectedLabel;
|
|
818
|
-
api.handleQueryChange(state.query);
|
|
819
|
-
nextTick(function () {
|
|
820
|
-
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
} else {
|
|
824
|
-
api.debouncRquest();
|
|
825
|
-
}
|
|
826
|
-
nextTick(function () {
|
|
827
|
-
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
828
|
-
});
|
|
829
|
-
};
|
|
594
|
+
} else {
|
|
595
|
+
api.debouncRquest();
|
|
596
|
+
}
|
|
597
|
+
nextTick(() => {
|
|
598
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
599
|
+
});
|
|
830
600
|
};
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
};
|
|
601
|
+
const onOptionDestroy = (state) => (index) => {
|
|
602
|
+
if (index > -1) {
|
|
603
|
+
state.optionsCount--;
|
|
604
|
+
state.filteredOptionsCount--;
|
|
605
|
+
state.options.splice(index, 1);
|
|
606
|
+
}
|
|
839
607
|
};
|
|
840
|
-
|
|
841
|
-
var
|
|
842
|
-
|
|
843
|
-
return function () {
|
|
844
|
-
var _refs$reference4, _refs$reference4$$el, _refs$reference4$$el$;
|
|
845
|
-
state.inputWidth = ((_refs$reference4 = refs.reference) === null || _refs$reference4 === void 0 ? void 0 : (_refs$reference4$$el = _refs$reference4.$el) === null || _refs$reference4$$el === void 0 ? void 0 : (_refs$reference4$$el$ = _refs$reference4$$el.getBoundingClientRect()) === null || _refs$reference4$$el$ === void 0 ? void 0 : _refs$reference4$$el$.width) || 0;
|
|
846
|
-
};
|
|
608
|
+
const resetInputWidth = ({ refs, state }) => () => {
|
|
609
|
+
var _a, _b, _c;
|
|
610
|
+
state.inputWidth = ((_c = (_b = (_a = refs.reference) == null ? void 0 : _a.$el) == null ? void 0 : _b.getBoundingClientRect()) == null ? void 0 : _c.width) || 0;
|
|
847
611
|
};
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
if (props.multiple) {
|
|
854
|
-
api.resetInputHeight();
|
|
855
|
-
}
|
|
856
|
-
};
|
|
612
|
+
const handleResize = ({ api, props }) => () => {
|
|
613
|
+
api.resetInputWidth();
|
|
614
|
+
if (props.multiple) {
|
|
615
|
+
api.resetInputHeight();
|
|
616
|
+
}
|
|
857
617
|
};
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
618
|
+
const checkDefaultFirstOption = (state) => () => {
|
|
619
|
+
state.hoverIndex = -1;
|
|
620
|
+
let hasCreated = false;
|
|
621
|
+
for (let i = state.options.length - 1; i >= 0; i--) {
|
|
622
|
+
if (state.options[i].created) {
|
|
623
|
+
hasCreated = true;
|
|
624
|
+
state.hoverIndex = i;
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (hasCreated) {
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
for (let i = 0; i !== state.options.length; ++i) {
|
|
632
|
+
const option = state.options[i];
|
|
633
|
+
if (state.query) {
|
|
634
|
+
if (!option.disabled && !option.groupDisabled && option.visible) {
|
|
865
635
|
state.hoverIndex = i;
|
|
866
636
|
break;
|
|
867
637
|
}
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
for (var _i = 0; _i !== state.options.length; ++_i) {
|
|
873
|
-
var option = state.options[_i];
|
|
874
|
-
if (state.query) {
|
|
875
|
-
if (!option.disabled && !option.groupDisabled && option.visible) {
|
|
876
|
-
state.hoverIndex = _i;
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
} else {
|
|
880
|
-
if (option.itemSelected) {
|
|
881
|
-
state.hoverIndex = _i;
|
|
882
|
-
break;
|
|
883
|
-
}
|
|
638
|
+
} else {
|
|
639
|
+
if (option.itemSelected) {
|
|
640
|
+
state.hoverIndex = i;
|
|
641
|
+
break;
|
|
884
642
|
}
|
|
885
643
|
}
|
|
886
|
-
}
|
|
644
|
+
}
|
|
887
645
|
};
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
return getObj(item.value, props.valueKey);
|
|
894
|
-
};
|
|
646
|
+
const getValueKey = (props) => (item) => {
|
|
647
|
+
if (Object.prototype.toString.call(item.value).toLowerCase() !== "[object object]") {
|
|
648
|
+
return item.value;
|
|
649
|
+
}
|
|
650
|
+
return getObj(item.value, props.valueKey);
|
|
895
651
|
};
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
state =
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
if (
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
if (direction === 'next') {
|
|
911
|
-
state.hoverIndex++;
|
|
912
|
-
if (state.hoverIndex === len) {
|
|
913
|
-
state.hoverIndex = 0;
|
|
914
|
-
}
|
|
915
|
-
} else if (direction === 'prev') {
|
|
916
|
-
state.hoverIndex--;
|
|
917
|
-
if (state.hoverIndex < 0) {
|
|
918
|
-
state.hoverIndex = len - 1;
|
|
919
|
-
}
|
|
652
|
+
const navigateOptions = ({ api, nextTick, state }) => (direction) => {
|
|
653
|
+
const len = state.options.length;
|
|
654
|
+
if (!state.visible) {
|
|
655
|
+
state.visible = true;
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
if (len === 0 || state.filteredOptionsCount === 0) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
if (!state.optionsAllDisabled) {
|
|
662
|
+
if (direction === "next") {
|
|
663
|
+
state.hoverIndex++;
|
|
664
|
+
if (state.hoverIndex === len) {
|
|
665
|
+
state.hoverIndex = 0;
|
|
920
666
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
667
|
+
} else if (direction === "prev") {
|
|
668
|
+
state.hoverIndex--;
|
|
669
|
+
if (state.hoverIndex < 0) {
|
|
670
|
+
state.hoverIndex = len - 1;
|
|
924
671
|
}
|
|
925
|
-
nextTick(function () {
|
|
926
|
-
return api.scrollToOption(state.hoverOption);
|
|
927
|
-
});
|
|
928
672
|
}
|
|
929
|
-
|
|
673
|
+
const option = state.options[state.hoverIndex];
|
|
674
|
+
if (option.disabled === true || option.groupDisabled === true || !option.visible) {
|
|
675
|
+
api.navigateOptions(direction);
|
|
676
|
+
}
|
|
677
|
+
nextTick(() => api.scrollToOption(state.hoverOption));
|
|
678
|
+
}
|
|
930
679
|
};
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
props
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
return props.loadingText || t(I18N.loading);
|
|
939
|
-
} else {
|
|
940
|
-
if (props.remote && state.query === '' && props.renderType) {
|
|
941
|
-
if (props.multiple) {
|
|
942
|
-
return state.selected.length > 0 || state.remoteData.length > 0;
|
|
943
|
-
}
|
|
944
|
-
return state.selected[props.valueField] || state.remoteData.length > 0;
|
|
945
|
-
}
|
|
946
|
-
if (props.remote && state.query === '' && state.options.length === 0) {
|
|
947
|
-
return false;
|
|
948
|
-
}
|
|
949
|
-
if (state.filterOrSearch && state.query && state.options.length > 0 && state.filteredOptionsCount === 0) {
|
|
950
|
-
return props.noMatchText || t(I18N.noMatch);
|
|
951
|
-
}
|
|
952
|
-
if (!state.options.some(function (option) {
|
|
953
|
-
return option.visible;
|
|
954
|
-
})) {
|
|
955
|
-
return props.noDataText || t(I18N.noData);
|
|
680
|
+
const emptyText = ({ I18N, props, state, t }) => () => {
|
|
681
|
+
if (props.loading) {
|
|
682
|
+
return props.loadingText || t(I18N.loading);
|
|
683
|
+
} else {
|
|
684
|
+
if (props.remote && state.query === "" && props.renderType) {
|
|
685
|
+
if (props.multiple) {
|
|
686
|
+
return state.selected.length > 0 || state.remoteData.length > 0;
|
|
956
687
|
}
|
|
688
|
+
return state.selected[props.valueField] || state.remoteData.length > 0;
|
|
957
689
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
690
|
+
if (props.remote && state.query === "" && state.options.length === 0) {
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
693
|
+
if (state.filterOrSearch && state.query && state.options.length > 0 && state.filteredOptionsCount === 0) {
|
|
694
|
+
return props.noMatchText || t(I18N.noMatch);
|
|
695
|
+
}
|
|
696
|
+
if (!state.options.some((option) => option.visible)) {
|
|
697
|
+
return props.noDataText || t(I18N.noData);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return null;
|
|
701
|
+
};
|
|
702
|
+
const optmzApis = {
|
|
703
|
+
exist: (val, multiple) => multiple ? Array.isArray(val) && val.length : val,
|
|
704
|
+
getValueIndex: (props) => {
|
|
705
|
+
const { options, valueField, modelValue, multiple } = props;
|
|
706
|
+
const contain = (val, arr) => Array.isArray(arr) && ~arr.indexOf(val);
|
|
707
|
+
const equal = (val, opt) => multiple ? contain(opt[valueField], [val]) : opt[valueField] === val;
|
|
708
|
+
let start = 0;
|
|
977
709
|
if (optmzApis.exist(modelValue, multiple)) {
|
|
978
|
-
|
|
979
|
-
for (
|
|
710
|
+
const lastVal = multiple ? modelValue[modelValue.length - 1] : modelValue;
|
|
711
|
+
for (let i = 0; i < options.length; i++) {
|
|
980
712
|
if (!equal(lastVal, options[i])) {
|
|
981
713
|
continue;
|
|
982
714
|
}
|
|
@@ -985,42 +717,28 @@ var optmzApis = {
|
|
|
985
717
|
}
|
|
986
718
|
return start;
|
|
987
719
|
},
|
|
988
|
-
getStartIndex:
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
optimizeStore = state.optimizeStore;
|
|
994
|
-
var rSize = optimizeOpts.rSize;
|
|
995
|
-
var valueIndex = optimizeStore.valueIndex;
|
|
720
|
+
getStartIndex: ({ props, state }) => {
|
|
721
|
+
const { options } = props;
|
|
722
|
+
const { optimizeOpts, optimizeStore } = state;
|
|
723
|
+
const { rSize } = optimizeOpts;
|
|
724
|
+
const { valueIndex } = optimizeStore;
|
|
996
725
|
return valueIndex + rSize > options.length ? options.length - rSize : valueIndex;
|
|
997
726
|
},
|
|
998
|
-
getViewStyle:
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
var optionHeight = optimizeOpts.optionHeight;
|
|
1004
|
-
return "height:".concat(optionHeight * options.length, "px");
|
|
727
|
+
getViewStyle: ({ props, state }) => {
|
|
728
|
+
const { options } = props;
|
|
729
|
+
const { optimizeOpts } = state;
|
|
730
|
+
const { optionHeight } = optimizeOpts;
|
|
731
|
+
return `height:${optionHeight * options.length}px`;
|
|
1005
732
|
},
|
|
1006
|
-
getStoreDatas:
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
optimizeStore = state.optimizeStore;
|
|
1016
|
-
var startIndex = optimizeStore.startIndex;
|
|
1017
|
-
var rSize = optimizeOpts.rSize;
|
|
1018
|
-
var sliced = datas.slice(startIndex, startIndex + rSize);
|
|
1019
|
-
var hiddenOptions = optimizeStore.hiddenOptions = [];
|
|
1020
|
-
var findPush = function findPush(val) {
|
|
1021
|
-
var opt = options.find(function (option) {
|
|
1022
|
-
return option[valueField] === val;
|
|
1023
|
-
});
|
|
733
|
+
getStoreDatas: ({ props, state }) => {
|
|
734
|
+
const { options, valueField, modelValue, multiple } = props;
|
|
735
|
+
const { datas, optimizeOpts, optimizeStore } = state;
|
|
736
|
+
const { startIndex } = optimizeStore;
|
|
737
|
+
const { rSize } = optimizeOpts;
|
|
738
|
+
const sliced = datas.slice(startIndex, startIndex + rSize);
|
|
739
|
+
const hiddenOptions = optimizeStore.hiddenOptions = [];
|
|
740
|
+
const findPush = (val) => {
|
|
741
|
+
const opt = options.find((option) => option[valueField] === val);
|
|
1024
742
|
if (opt && !~sliced.indexOf(opt)) {
|
|
1025
743
|
sliced.push(opt);
|
|
1026
744
|
hiddenOptions.push(opt);
|
|
@@ -1035,168 +753,107 @@ var optmzApis = {
|
|
|
1035
753
|
}
|
|
1036
754
|
return sliced;
|
|
1037
755
|
},
|
|
1038
|
-
queryWrap:
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
return setTimeout(cb);
|
|
1046
|
-
},
|
|
1047
|
-
setScrollTop: function setScrollTop(_ref40) {
|
|
1048
|
-
var refs = _ref40.refs,
|
|
1049
|
-
state = _ref40.state;
|
|
1050
|
-
var optimizeOpts = state.optimizeOpts,
|
|
1051
|
-
optimizeStore = state.optimizeStore;
|
|
1052
|
-
var optionHeight = optimizeOpts.optionHeight;
|
|
1053
|
-
var wrap = optmzApis.queryWrap(refs);
|
|
756
|
+
queryWrap: (refs) => refs.scrollbar.$el.querySelector(".tiny-scrollbar__wrap.virtual"),
|
|
757
|
+
queryItems: (refs) => refs.scrollbar.$el.querySelectorAll(".tiny-select-dropdown__item.virtual"),
|
|
758
|
+
createMacro: (cb) => setTimeout(cb),
|
|
759
|
+
setScrollTop: ({ refs, state }) => {
|
|
760
|
+
const { optimizeOpts, optimizeStore } = state;
|
|
761
|
+
const { optionHeight } = optimizeOpts;
|
|
762
|
+
const wrap = optmzApis.queryWrap(refs);
|
|
1054
763
|
wrap.scrollTop = optionHeight * optimizeStore.valueIndex;
|
|
1055
764
|
},
|
|
1056
|
-
setValueIndex:
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
765
|
+
setValueIndex: ({ props, state }) => state.optimizeStore.valueIndex = optmzApis.getValueIndex(props),
|
|
766
|
+
addScrollListener: ({ api, refs, state }) => {
|
|
767
|
+
const { optimizeStore } = state;
|
|
768
|
+
const wrap = optmzApis.queryWrap(refs);
|
|
769
|
+
!optimizeStore.bind && wrap.addEventListener("scroll", api.getScrollListener) && (optimizeStore.bind = true);
|
|
1060
770
|
},
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
var optimizeStore = state.optimizeStore;
|
|
1066
|
-
var wrap = optmzApis.queryWrap(refs);
|
|
1067
|
-
!optimizeStore.bind && wrap.addEventListener('scroll', api.getScrollListener) && (optimizeStore.bind = true);
|
|
771
|
+
removeScrollListener: ({ api, refs, state }) => {
|
|
772
|
+
const { optimizeStore } = state;
|
|
773
|
+
const wrap = optmzApis.queryWrap(refs);
|
|
774
|
+
optimizeStore.bind && wrap.removeEventListener("scroll", api.getScrollListener) && (optimizeStore.bind = false);
|
|
1068
775
|
},
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
var optimizeStore = state.optimizeStore;
|
|
1074
|
-
var wrap = optmzApis.queryWrap(refs);
|
|
1075
|
-
optimizeStore.bind && wrap.removeEventListener('scroll', api.getScrollListener) && (optimizeStore.bind = false);
|
|
1076
|
-
},
|
|
1077
|
-
isFirstPage: function isFirstPage(_ref44) {
|
|
1078
|
-
var props = _ref44.props,
|
|
1079
|
-
state = _ref44.state;
|
|
1080
|
-
var optimizeStore = state.optimizeStore;
|
|
1081
|
-
var datas = optimizeStore.datas;
|
|
1082
|
-
var options = props.options;
|
|
776
|
+
isFirstPage: ({ props, state }) => {
|
|
777
|
+
const { optimizeStore } = state;
|
|
778
|
+
const { datas } = optimizeStore;
|
|
779
|
+
const { options } = props;
|
|
1083
780
|
return Array.isArray(datas) && Array.isArray(options) && datas[0] === options[0];
|
|
1084
781
|
},
|
|
1085
|
-
natural:
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
var items = optmzApis.queryItems(refs);
|
|
1095
|
-
for (var i = 0; i < items.length; i++) {
|
|
1096
|
-
var item = items[i];
|
|
1097
|
-
var flag = item.classList.contains('virtual-hidden');
|
|
1098
|
-
item.style.top = flag ? "-".concat(optionHeight, "px") : "".concat(itemFn(i), "px");
|
|
782
|
+
natural: (val) => val < 0 ? 0 : val,
|
|
783
|
+
updateItems: ({ refs, state, itemFn }) => {
|
|
784
|
+
const { optimizeOpts } = state;
|
|
785
|
+
const { optionHeight } = optimizeOpts;
|
|
786
|
+
const items = optmzApis.queryItems(refs);
|
|
787
|
+
for (let i = 0; i < items.length; i++) {
|
|
788
|
+
const item = items[i];
|
|
789
|
+
const flag = item.classList.contains("virtual-hidden");
|
|
790
|
+
item.style.top = flag ? `-${optionHeight}px` : `${itemFn(i)}px`;
|
|
1099
791
|
}
|
|
1100
792
|
},
|
|
1101
|
-
process:
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
optimizeStore.startIndex = typeof start !== 'undefined' ? start : optmzApis.getStartIndex({
|
|
1107
|
-
props: props,
|
|
1108
|
-
state: state
|
|
1109
|
-
});
|
|
1110
|
-
optimizeStore.datas = optmzApis.getStoreDatas({
|
|
1111
|
-
props: props,
|
|
1112
|
-
state: state
|
|
1113
|
-
});
|
|
1114
|
-
optimizeStore.firstPage = optmzApis.isFirstPage({
|
|
1115
|
-
props: props,
|
|
1116
|
-
state: state
|
|
1117
|
-
});
|
|
793
|
+
process: ({ props, start, state }) => {
|
|
794
|
+
const { optimizeStore } = state;
|
|
795
|
+
optimizeStore.startIndex = typeof start !== "undefined" ? start : optmzApis.getStartIndex({ props, state });
|
|
796
|
+
optimizeStore.datas = optmzApis.getStoreDatas({ props, state });
|
|
797
|
+
optimizeStore.firstPage = optmzApis.isFirstPage({ props, state });
|
|
1118
798
|
}
|
|
1119
799
|
};
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
return function (value, oldValue) {
|
|
1128
|
-
if (props.multiple) {
|
|
1129
|
-
api.resetInputHeight();
|
|
1130
|
-
if (value && value.length > 0 || refs.input && state.query !== '') {
|
|
1131
|
-
state.currentPlaceholder = '';
|
|
1132
|
-
} else {
|
|
1133
|
-
state.currentPlaceholder = state.cachedPlaceHolder;
|
|
1134
|
-
}
|
|
1135
|
-
if (state.filterOrSearch && !props.reserveKeyword) {
|
|
1136
|
-
props.renderType !== constants.TYPE.Grid && (state.query = '');
|
|
1137
|
-
api.handleQueryChange(state.query);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
api.setSelected();
|
|
1141
|
-
if (props.filterable && !props.multiple) {
|
|
1142
|
-
state.inputLength = 20;
|
|
800
|
+
const watchValue = ({ api, constants, dispatch, props, refs, state }) => (value, oldValue) => {
|
|
801
|
+
if (props.multiple) {
|
|
802
|
+
api.resetInputHeight();
|
|
803
|
+
if (value && value.length > 0 || refs.input && state.query !== "") {
|
|
804
|
+
state.currentPlaceholder = "";
|
|
805
|
+
} else {
|
|
806
|
+
state.currentPlaceholder = state.cachedPlaceHolder;
|
|
1143
807
|
}
|
|
1144
|
-
if (state.
|
|
1145
|
-
|
|
808
|
+
if (state.filterOrSearch && !props.reserveKeyword) {
|
|
809
|
+
props.renderType !== constants.TYPE.Grid && (state.query = "");
|
|
810
|
+
api.handleQueryChange(state.query);
|
|
1146
811
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
812
|
+
}
|
|
813
|
+
api.setSelected();
|
|
814
|
+
if (props.filterable && !props.multiple) {
|
|
815
|
+
state.inputLength = 20;
|
|
816
|
+
}
|
|
817
|
+
if (state.completed && !isEqual(value, oldValue)) {
|
|
818
|
+
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formChange, value);
|
|
819
|
+
}
|
|
820
|
+
state.optimizeStore.flag && optmzApis.setValueIndex({ props, state });
|
|
1152
821
|
};
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
if (width >= tagDom.getBoundingClientRect().width) {
|
|
1172
|
-
state.overflow = 0;
|
|
1173
|
-
} else {
|
|
1174
|
-
for (var i = 1; i < tags.length; i++) {
|
|
1175
|
-
var tx = tags[i].getBoundingClientRect().x;
|
|
1176
|
-
if (tx == x) {
|
|
1177
|
-
state.overflow = i - 1;
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
822
|
+
const calcOverFlow = ({ refs, props, state }) => (height) => {
|
|
823
|
+
if (!props.multiple || !props.showOverflowTooltip) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
state.overflow = false;
|
|
827
|
+
const tagDom = refs.tags;
|
|
828
|
+
const tags = tagDom.querySelectorAll(".tiny-tag");
|
|
829
|
+
if (tags.length) {
|
|
830
|
+
tagDom.scrollTo && tagDom.scrollTo({ top: 0 });
|
|
831
|
+
let { x, width } = tags[0].getBoundingClientRect();
|
|
832
|
+
if (width >= tagDom.getBoundingClientRect().width) {
|
|
833
|
+
state.overflow = 0;
|
|
834
|
+
} else {
|
|
835
|
+
for (let i = 1; i < tags.length; i++) {
|
|
836
|
+
let tx = tags[i].getBoundingClientRect().x;
|
|
837
|
+
if (tx == x) {
|
|
838
|
+
state.overflow = i - 1;
|
|
839
|
+
break;
|
|
1180
840
|
}
|
|
1181
841
|
}
|
|
1182
842
|
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
var props = _ref49.props,
|
|
1198
|
-
state = _ref49.state,
|
|
1199
|
-
constants = _ref49.constants;
|
|
843
|
+
}
|
|
844
|
+
refs.select.style.height = refs.select.style.height || height;
|
|
845
|
+
refs.reference.$el.style.position = "absolute";
|
|
846
|
+
const inputWidth = refs.select.getBoundingClientRect().width;
|
|
847
|
+
const position = state.visible ? "absolute" : "";
|
|
848
|
+
state.selectFiexd = {
|
|
849
|
+
height,
|
|
850
|
+
position,
|
|
851
|
+
width: inputWidth + "px",
|
|
852
|
+
zIndex: PopupManager.nextZIndex()
|
|
853
|
+
};
|
|
854
|
+
state.inputWidth = inputWidth;
|
|
855
|
+
};
|
|
856
|
+
const postOperOfToVisible = ({ props, state, constants }) => {
|
|
1200
857
|
if (props.multiple) {
|
|
1201
858
|
return;
|
|
1202
859
|
}
|
|
@@ -1218,573 +875,426 @@ var postOperOfToVisible = function postOperOfToVisible(_ref49) {
|
|
|
1218
875
|
}
|
|
1219
876
|
}
|
|
1220
877
|
};
|
|
1221
|
-
|
|
1222
|
-
var
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
state.
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
state.
|
|
1236
|
-
|
|
1237
|
-
if (props.renderType !== constants.TYPE.Tree) {
|
|
1238
|
-
state.previousQuery = props.remoteConfig.clearData && state.previousQuery !== state.query ? undefined : null;
|
|
1239
|
-
}
|
|
1240
|
-
api.resetHoverIndex();
|
|
1241
|
-
nextTick(function () {
|
|
1242
|
-
if (refs.input && refs.input.value === '' && state.selected.length === 0) {
|
|
1243
|
-
state.currentPlaceholder = state.cachedPlaceHolder;
|
|
1244
|
-
}
|
|
1245
|
-
if (refs.selectGrid) {
|
|
1246
|
-
refs.selectGrid.clearScroll();
|
|
1247
|
-
}
|
|
1248
|
-
});
|
|
1249
|
-
postOperOfToVisible({
|
|
1250
|
-
props: props,
|
|
1251
|
-
state: state,
|
|
1252
|
-
constants: constants
|
|
1253
|
-
});
|
|
1254
|
-
};
|
|
1255
|
-
};
|
|
1256
|
-
export var toHide = function toHide(_ref51) {
|
|
1257
|
-
var constants = _ref51.constants,
|
|
1258
|
-
state = _ref51.state,
|
|
1259
|
-
props = _ref51.props,
|
|
1260
|
-
vm = _ref51.vm,
|
|
1261
|
-
api = _ref51.api;
|
|
1262
|
-
return function () {
|
|
1263
|
-
var refs = vm.$refs;
|
|
1264
|
-
state.selectEmitter.emit(constants.COMPONENT_NAME.SelectDropdown, constants.EVENT_NAME.updatePopper);
|
|
1265
|
-
if (state.filterOrSearch) {
|
|
1266
|
-
state.query = props.remote || props.searchable ? '' : props.renderType !== constants.TYPE.Tree ? state.selectedLabel : '';
|
|
1267
|
-
state.previousQuery !== state.query && api.handleQueryChange(state.query);
|
|
1268
|
-
if (props.multiple) {
|
|
1269
|
-
var _refs$input3, _refs$reference5;
|
|
1270
|
-
props.filterable ? (_refs$input3 = refs.input) === null || _refs$input3 === void 0 ? void 0 : _refs$input3.focus() : (_refs$reference5 = refs.reference) === null || _refs$reference5 === void 0 ? void 0 : _refs$reference5.focus();
|
|
1271
|
-
} else {
|
|
1272
|
-
if (!props.remote) {
|
|
1273
|
-
state.selectEmitter.emit(constants.EVENT_NAME.queryChange, '');
|
|
1274
|
-
state.selectEmitter.emit(constants.COMPONENT_NAME.OptionGroup, constants.EVENT_NAME.queryChange);
|
|
1275
|
-
}
|
|
1276
|
-
if (state.selectedLabel) {
|
|
1277
|
-
state.currentPlaceholder = state.selectedLabel;
|
|
1278
|
-
state.selectedLabel = '';
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
878
|
+
const toVisible = ({ constants, state, props, vm, api, nextTick }) => () => {
|
|
879
|
+
var _a;
|
|
880
|
+
const refs = vm.$refs;
|
|
881
|
+
state.selectEmitter.emit(constants.EVENT_NAME.destroyPopper);
|
|
882
|
+
props.remote && props.dropOnlySearch && (state.showWarper = false);
|
|
883
|
+
(_a = refs.input) == null ? void 0 : _a.blur();
|
|
884
|
+
state.query = "";
|
|
885
|
+
state.selectedLabel = "";
|
|
886
|
+
state.inputLength = 20;
|
|
887
|
+
if (props.renderType !== constants.TYPE.Tree) {
|
|
888
|
+
state.previousQuery = props.remoteConfig.clearData && state.previousQuery !== state.query ? void 0 : null;
|
|
889
|
+
}
|
|
890
|
+
api.resetHoverIndex();
|
|
891
|
+
nextTick(() => {
|
|
892
|
+
if (refs.input && refs.input.value === "" && state.selected.length === 0) {
|
|
893
|
+
state.currentPlaceholder = state.cachedPlaceHolder;
|
|
1281
894
|
}
|
|
1282
895
|
if (refs.selectGrid) {
|
|
1283
|
-
refs.selectGrid.
|
|
1284
|
-
refs.selectGrid.setSelection(state.selected, true);
|
|
1285
|
-
if (state.filterOrSearch && typeof props.filterMethod === 'function') {
|
|
1286
|
-
refs.selectGrid.handleTableData(true);
|
|
1287
|
-
} else if (state.filterOrSearch && props.remote && typeof props.remoteMethod === 'function') {
|
|
1288
|
-
refs.selectGrid.handleTableData();
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
};
|
|
1292
|
-
};
|
|
1293
|
-
export var watchVisible = function watchVisible(_ref52) {
|
|
1294
|
-
var api = _ref52.api,
|
|
1295
|
-
constants = _ref52.constants,
|
|
1296
|
-
emit = _ref52.emit,
|
|
1297
|
-
state = _ref52.state,
|
|
1298
|
-
refs = _ref52.refs;
|
|
1299
|
-
return function (value) {
|
|
1300
|
-
if (api.onCopying()) {
|
|
1301
|
-
return;
|
|
1302
|
-
}
|
|
1303
|
-
value ? api.toHide() : api.toVisible();
|
|
1304
|
-
emit(constants.EVENT_NAME.visibleChange, value);
|
|
1305
|
-
setTimeout(function () {
|
|
1306
|
-
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
1307
|
-
});
|
|
1308
|
-
if (value && state.optimizeStore.flag) {
|
|
1309
|
-
optmzApis.createMacro(function () {
|
|
1310
|
-
optmzApis.setScrollTop({
|
|
1311
|
-
refs: refs,
|
|
1312
|
-
state: state
|
|
1313
|
-
});
|
|
1314
|
-
api.getScrollListener();
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1318
|
-
};
|
|
1319
|
-
export var watchOptions = function watchOptions(_ref53) {
|
|
1320
|
-
var api = _ref53.api,
|
|
1321
|
-
constants = _ref53.constants,
|
|
1322
|
-
nextTick = _ref53.nextTick,
|
|
1323
|
-
parent = _ref53.parent,
|
|
1324
|
-
props = _ref53.props,
|
|
1325
|
-
state = _ref53.state;
|
|
1326
|
-
return function () {
|
|
1327
|
-
if (typeof window === 'undefined') {
|
|
1328
|
-
return;
|
|
896
|
+
refs.selectGrid.clearScroll();
|
|
1329
897
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
898
|
+
});
|
|
899
|
+
postOperOfToVisible({ props, state, constants });
|
|
900
|
+
};
|
|
901
|
+
const toHide = ({ constants, state, props, vm, api }) => () => {
|
|
902
|
+
var _a, _b;
|
|
903
|
+
const refs = vm.$refs;
|
|
904
|
+
state.selectEmitter.emit(constants.COMPONENT_NAME.SelectDropdown, constants.EVENT_NAME.updatePopper);
|
|
905
|
+
if (state.filterOrSearch) {
|
|
906
|
+
state.query = props.remote || props.searchable ? "" : props.renderType !== constants.TYPE.Tree ? state.selectedLabel : "";
|
|
907
|
+
state.previousQuery !== state.query && api.handleQueryChange(state.query);
|
|
1333
908
|
if (props.multiple) {
|
|
1334
|
-
|
|
1335
|
-
}
|
|
1336
|
-
nextTick(function () {
|
|
1337
|
-
if (parent.$el.querySelector('input') !== document.activeElement) {
|
|
1338
|
-
api.setSelected();
|
|
1339
|
-
}
|
|
1340
|
-
});
|
|
1341
|
-
if (props.defaultFirstOption && (props.filterabl || props.searchable || props.remote) && state.filteredOptionsCount) {
|
|
1342
|
-
api.checkDefaultFirstOption();
|
|
1343
|
-
}
|
|
1344
|
-
};
|
|
1345
|
-
};
|
|
1346
|
-
export var handleCopyClick = function handleCopyClick(_ref54) {
|
|
1347
|
-
var parent = _ref54.parent,
|
|
1348
|
-
props = _ref54.props,
|
|
1349
|
-
state = _ref54.state;
|
|
1350
|
-
return function () {
|
|
1351
|
-
var input = document.createElement('input');
|
|
1352
|
-
input.style.height = 0;
|
|
1353
|
-
input.style.border = 'none';
|
|
1354
|
-
input.style.position = 'absolute';
|
|
1355
|
-
parent.$el.appendChild(input);
|
|
1356
|
-
input.value = state.selected.map(function (item) {
|
|
1357
|
-
return item.state ? item.state.currentLabel : item.currentLabel;
|
|
1358
|
-
}).join(props.textSplit);
|
|
1359
|
-
input.select();
|
|
1360
|
-
document.execCommand('copy');
|
|
1361
|
-
parent.$el.removeChild(input);
|
|
1362
|
-
};
|
|
1363
|
-
};
|
|
1364
|
-
export var selectChange = function selectChange(_ref55) {
|
|
1365
|
-
var emit = _ref55.emit,
|
|
1366
|
-
props = _ref55.props,
|
|
1367
|
-
state = _ref55.state;
|
|
1368
|
-
return function (_ref56) {
|
|
1369
|
-
var $table = _ref56.$table,
|
|
1370
|
-
selection = _ref56.selection,
|
|
1371
|
-
checked = _ref56.checked,
|
|
1372
|
-
row = _ref56.row;
|
|
1373
|
-
var textField = props.textField,
|
|
1374
|
-
valueField = props.valueField;
|
|
1375
|
-
var remoteItem = function remoteItem(row) {
|
|
1376
|
-
var removeItem = find(state.selected, function (item) {
|
|
1377
|
-
return item[valueField] === row[valueField];
|
|
1378
|
-
});
|
|
1379
|
-
removeItem && state.selected.splice(state.selected.indexOf(removeItem), 1);
|
|
1380
|
-
};
|
|
1381
|
-
if (row) {
|
|
1382
|
-
checked ? state.selected.push(_objectSpread(_objectSpread({}, row), {}, {
|
|
1383
|
-
value: row[valueField],
|
|
1384
|
-
currentLabel: row[textField]
|
|
1385
|
-
})) : remoteItem(row);
|
|
1386
|
-
} else {
|
|
1387
|
-
checked ? state.selected = state.selected.concat(selection.filter(function (row) {
|
|
1388
|
-
return !~props.modelValue.indexOf(row[valueField]);
|
|
1389
|
-
})) : $table.tableData.forEach(function (row) {
|
|
1390
|
-
return remoteItem(row);
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
1393
|
-
var keys = state.selected.map(function (item) {
|
|
1394
|
-
return item[valueField];
|
|
1395
|
-
});
|
|
1396
|
-
emit('update:modelValue', keys);
|
|
1397
|
-
emit('change', keys, state.selected);
|
|
1398
|
-
};
|
|
1399
|
-
};
|
|
1400
|
-
export var getcheckedData = function getcheckedData(_ref57) {
|
|
1401
|
-
var props = _ref57.props,
|
|
1402
|
-
state = _ref57.state;
|
|
1403
|
-
return function () {
|
|
1404
|
-
var checkedKey = [];
|
|
1405
|
-
if (!Array.isArray(state.selected)) {
|
|
1406
|
-
return props.modelValue ? [props.modelValue] : [state.selected[props.valueField]];
|
|
909
|
+
props.filterable ? (_a = refs.input) == null ? void 0 : _a.focus() : (_b = refs.reference) == null ? void 0 : _b.focus();
|
|
1407
910
|
} else {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
911
|
+
if (!props.remote) {
|
|
912
|
+
state.selectEmitter.emit(constants.EVENT_NAME.queryChange, "");
|
|
913
|
+
state.selectEmitter.emit(constants.COMPONENT_NAME.OptionGroup, constants.EVENT_NAME.queryChange);
|
|
914
|
+
}
|
|
915
|
+
if (state.selectedLabel) {
|
|
916
|
+
state.currentPlaceholder = state.selectedLabel;
|
|
917
|
+
state.selectedLabel = "";
|
|
918
|
+
}
|
|
1412
919
|
}
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
props
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
row.value = row[props.valueField];
|
|
1422
|
-
row.currentLabel = row[props.textField];
|
|
1423
|
-
state.selected = row;
|
|
1424
|
-
state.visible = false;
|
|
1425
|
-
state.currentKey = row[props.valueField];
|
|
1426
|
-
emit('update:modelValue', row.value);
|
|
1427
|
-
emit('change', row);
|
|
1428
|
-
};
|
|
1429
|
-
};
|
|
1430
|
-
export var getTreeData = function getTreeData(props) {
|
|
1431
|
-
return function (data) {
|
|
1432
|
-
var nodes = [];
|
|
1433
|
-
var getChild = function getChild(data, pId) {
|
|
1434
|
-
data.forEach(function (node) {
|
|
1435
|
-
node.pId = pId;
|
|
1436
|
-
nodes.push(node);
|
|
1437
|
-
if (node.children && node.children.length > 0) {
|
|
1438
|
-
getChild(node.children, node[props.valueField]);
|
|
1439
|
-
}
|
|
1440
|
-
});
|
|
1441
|
-
};
|
|
1442
|
-
getChild(data, null);
|
|
1443
|
-
return nodes;
|
|
1444
|
-
};
|
|
1445
|
-
};
|
|
1446
|
-
export var treeNodeClick = function treeNodeClick(_ref60) {
|
|
1447
|
-
var emit = _ref60.emit,
|
|
1448
|
-
props = _ref60.props,
|
|
1449
|
-
state = _ref60.state;
|
|
1450
|
-
return function (data) {
|
|
1451
|
-
if (!props.multiple) {
|
|
1452
|
-
data.currentLabel = data[props.textField];
|
|
1453
|
-
data.value = data[props.valueField];
|
|
1454
|
-
state.selected = data;
|
|
1455
|
-
state.visible = false;
|
|
1456
|
-
emit('update:modelValue', data.value);
|
|
1457
|
-
emit('change', data);
|
|
920
|
+
}
|
|
921
|
+
if (refs.selectGrid) {
|
|
922
|
+
refs.selectGrid.clearSelection();
|
|
923
|
+
refs.selectGrid.setSelection(state.selected, true);
|
|
924
|
+
if (state.filterOrSearch && typeof props.filterMethod === "function") {
|
|
925
|
+
refs.selectGrid.handleTableData(true);
|
|
926
|
+
} else if (state.filterOrSearch && props.remote && typeof props.remoteMethod === "function") {
|
|
927
|
+
refs.selectGrid.handleTableData();
|
|
1458
928
|
}
|
|
1459
|
-
}
|
|
929
|
+
}
|
|
1460
930
|
};
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
931
|
+
const watchVisible = ({ api, constants, emit, state, refs }) => (value) => {
|
|
932
|
+
if (api.onCopying()) {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
value ? api.toHide() : api.toVisible();
|
|
936
|
+
emit(constants.EVENT_NAME.visibleChange, value);
|
|
937
|
+
setTimeout(() => {
|
|
938
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
939
|
+
});
|
|
940
|
+
if (value && state.optimizeStore.flag) {
|
|
941
|
+
optmzApis.createMacro(() => {
|
|
942
|
+
optmzApis.setScrollTop({ refs, state });
|
|
943
|
+
api.getScrollListener();
|
|
1470
944
|
});
|
|
1471
|
-
|
|
1472
|
-
emit('change', checkedKeys, checkedNodes);
|
|
1473
|
-
};
|
|
1474
|
-
};
|
|
1475
|
-
export var nodeCollapse = function nodeCollapse(_ref63) {
|
|
1476
|
-
var state = _ref63.state,
|
|
1477
|
-
constants = _ref63.constants;
|
|
1478
|
-
return function () {
|
|
1479
|
-
setTimeout(function () {
|
|
1480
|
-
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
1481
|
-
}, 310);
|
|
1482
|
-
};
|
|
1483
|
-
};
|
|
1484
|
-
export var nodeExpand = function nodeExpand(_ref64) {
|
|
1485
|
-
var state = _ref64.state,
|
|
1486
|
-
constants = _ref64.constants;
|
|
1487
|
-
return function () {
|
|
1488
|
-
setTimeout(function () {
|
|
1489
|
-
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
1490
|
-
}, 310);
|
|
1491
|
-
};
|
|
945
|
+
}
|
|
1492
946
|
};
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
947
|
+
const watchOptions = ({ api, constants, nextTick, parent, props, state }) => () => {
|
|
948
|
+
if (typeof window === "undefined") {
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
nextTick(() => {
|
|
952
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
953
|
+
});
|
|
954
|
+
if (props.multiple) {
|
|
955
|
+
api.resetInputHeight();
|
|
956
|
+
}
|
|
957
|
+
nextTick(() => {
|
|
958
|
+
if (parent.$el.querySelector("input") !== document.activeElement) {
|
|
959
|
+
api.setSelected();
|
|
1501
960
|
}
|
|
1502
961
|
});
|
|
962
|
+
if (props.defaultFirstOption && (props.filterabl || props.searchable || props.remote) && state.filteredOptionsCount) {
|
|
963
|
+
api.checkDefaultFirstOption();
|
|
964
|
+
}
|
|
1503
965
|
};
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
966
|
+
const handleCopyClick = ({ parent, props, state }) => () => {
|
|
967
|
+
const input = document.createElement("input");
|
|
968
|
+
input.style.height = 0;
|
|
969
|
+
input.style.border = "none";
|
|
970
|
+
input.style.position = "absolute";
|
|
971
|
+
parent.$el.appendChild(input);
|
|
972
|
+
input.value = state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join(props.textSplit);
|
|
973
|
+
input.select();
|
|
974
|
+
document.execCommand("copy");
|
|
975
|
+
parent.$el.removeChild(input);
|
|
976
|
+
};
|
|
977
|
+
const selectChange = ({ emit, props, state }) => ({ $table, selection, checked, row }) => {
|
|
978
|
+
const { textField, valueField } = props;
|
|
979
|
+
const remoteItem = (row2) => {
|
|
980
|
+
const removeItem = find(state.selected, (item) => item[valueField] === row2[valueField]);
|
|
981
|
+
removeItem && state.selected.splice(state.selected.indexOf(removeItem), 1);
|
|
982
|
+
};
|
|
983
|
+
if (row) {
|
|
984
|
+
checked ? state.selected.push(__spreadProps(__spreadValues({}, row), { value: row[valueField], currentLabel: row[textField] })) : remoteItem(row);
|
|
985
|
+
} else {
|
|
986
|
+
checked ? state.selected = state.selected.concat(selection.filter((row2) => !~props.modelValue.indexOf(row2[valueField]))) : $table.tableData.forEach((row2) => remoteItem(row2));
|
|
987
|
+
}
|
|
988
|
+
const keys = state.selected.map((item) => item[valueField]);
|
|
989
|
+
emit("update:modelValue", keys);
|
|
990
|
+
emit("change", keys, state.selected);
|
|
991
|
+
};
|
|
992
|
+
const getcheckedData = ({ props, state }) => () => {
|
|
993
|
+
const checkedKey = [];
|
|
994
|
+
if (!Array.isArray(state.selected)) {
|
|
995
|
+
return props.modelValue ? [props.modelValue] : [state.selected[props.valueField]];
|
|
996
|
+
} else {
|
|
997
|
+
state.selected.length > 0 && state.selected.forEach((item) => {
|
|
998
|
+
checkedKey.push(item[props.valueField]);
|
|
999
|
+
});
|
|
1000
|
+
return checkedKey;
|
|
1001
|
+
}
|
|
1518
1002
|
};
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
};
|
|
1537
|
-
getDataset(dataset).then(function (data) {
|
|
1538
|
-
if (renderType === constants.TYPE.Tree) {
|
|
1539
|
-
state.treeData = data;
|
|
1540
|
-
} else if (renderType === constants.TYPE.Grid) {
|
|
1541
|
-
state.gridData = data;
|
|
1542
|
-
} else {
|
|
1543
|
-
if (props.cacheOp && props.cacheOp.key) {
|
|
1544
|
-
state.memorize = new Memorize(props.cacheOp);
|
|
1545
|
-
state.datas = state.memorize.assemble(data.slice());
|
|
1546
|
-
} else {
|
|
1547
|
-
state.datas = data;
|
|
1548
|
-
}
|
|
1003
|
+
const radioChange = ({ emit, props, state }) => ({ row }) => {
|
|
1004
|
+
row.value = row[props.valueField];
|
|
1005
|
+
row.currentLabel = row[props.textField];
|
|
1006
|
+
state.selected = row;
|
|
1007
|
+
state.visible = false;
|
|
1008
|
+
state.currentKey = row[props.valueField];
|
|
1009
|
+
emit("update:modelValue", row.value);
|
|
1010
|
+
emit("change", row);
|
|
1011
|
+
};
|
|
1012
|
+
const getTreeData = (props) => (data) => {
|
|
1013
|
+
const nodes = [];
|
|
1014
|
+
const getChild = (data2, pId) => {
|
|
1015
|
+
data2.forEach((node) => {
|
|
1016
|
+
node.pId = pId;
|
|
1017
|
+
nodes.push(node);
|
|
1018
|
+
if (node.children && node.children.length > 0) {
|
|
1019
|
+
getChild(node.children, node[props.valueField]);
|
|
1549
1020
|
}
|
|
1550
1021
|
});
|
|
1551
1022
|
};
|
|
1023
|
+
getChild(data, null);
|
|
1024
|
+
return nodes;
|
|
1552
1025
|
};
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
};
|
|
1026
|
+
const treeNodeClick = ({ emit, props, state }) => (data) => {
|
|
1027
|
+
if (!props.multiple) {
|
|
1028
|
+
data.currentLabel = data[props.textField];
|
|
1029
|
+
data.value = data[props.valueField];
|
|
1030
|
+
state.selected = data;
|
|
1031
|
+
state.visible = false;
|
|
1032
|
+
emit("update:modelValue", data.value);
|
|
1033
|
+
emit("change", data);
|
|
1034
|
+
}
|
|
1563
1035
|
};
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1036
|
+
const nodeCheckClick = ({ emit, props }) => (data, { checkedKeys, checkedNodes }) => {
|
|
1037
|
+
checkedNodes.forEach((node) => {
|
|
1038
|
+
node.currentLabel = node[props.textField];
|
|
1039
|
+
node.value = node[props.valueField];
|
|
1040
|
+
});
|
|
1041
|
+
emit("update:modelValue", checkedKeys);
|
|
1042
|
+
emit("change", checkedKeys, checkedNodes);
|
|
1043
|
+
};
|
|
1044
|
+
const nodeCollapse = ({ state, constants }) => () => {
|
|
1045
|
+
setTimeout(() => {
|
|
1046
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
1047
|
+
}, 310);
|
|
1048
|
+
};
|
|
1049
|
+
const nodeExpand = ({ state, constants }) => () => {
|
|
1050
|
+
setTimeout(() => {
|
|
1051
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
1052
|
+
}, 310);
|
|
1053
|
+
};
|
|
1054
|
+
const debouncRquest = ({ api, state, props }) => debounce(props.delay, () => {
|
|
1055
|
+
if (state.filterOrSearch && state.query !== state.selectedLabel) {
|
|
1056
|
+
state.query = state.selectedLabel;
|
|
1057
|
+
api.handleQueryChange(state.query);
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
const getChildValue = () => (data, key) => {
|
|
1061
|
+
const ids = [];
|
|
1062
|
+
const getChild = (nodes) => {
|
|
1063
|
+
nodes.forEach((node) => {
|
|
1064
|
+
ids.push(node.data[key]);
|
|
1065
|
+
if (node.childNodes.length > 0) {
|
|
1066
|
+
getChild(node.childNodes);
|
|
1067
|
+
}
|
|
1574
1068
|
});
|
|
1575
1069
|
};
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1070
|
+
getChild(data);
|
|
1071
|
+
return ids;
|
|
1072
|
+
};
|
|
1073
|
+
const watchPropsOption = ({ constants, parent, props, state }) => () => {
|
|
1074
|
+
const renderType = props.renderType;
|
|
1075
|
+
const { key, parentKey } = props.treeOp;
|
|
1076
|
+
const dataset = {
|
|
1077
|
+
dataset: props.options || props.dataset,
|
|
1078
|
+
service: parent.$service,
|
|
1079
|
+
tree: { key, parentKey }
|
|
1080
|
+
};
|
|
1081
|
+
getDataset(dataset).then((data) => {
|
|
1082
|
+
if (renderType === constants.TYPE.Tree) {
|
|
1083
|
+
state.treeData = data;
|
|
1084
|
+
} else if (renderType === constants.TYPE.Grid) {
|
|
1085
|
+
state.gridData = data;
|
|
1086
|
+
} else {
|
|
1087
|
+
if (props.cacheOp && props.cacheOp.key) {
|
|
1088
|
+
state.memorize = new Memorize(props.cacheOp);
|
|
1089
|
+
state.datas = state.memorize.assemble(data.slice());
|
|
1090
|
+
} else {
|
|
1091
|
+
state.datas = data;
|
|
1092
|
+
}
|
|
1583
1093
|
}
|
|
1584
|
-
};
|
|
1094
|
+
});
|
|
1585
1095
|
};
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
if (state.searchSingleCopy && state.selectedLabel) {
|
|
1591
|
-
state.softFocus = false;
|
|
1592
|
-
}
|
|
1593
|
-
};
|
|
1096
|
+
const buildSelectConfig = ({ props, state }) => () => {
|
|
1097
|
+
const checkRowKeys = state.gridCheckedData;
|
|
1098
|
+
const selectConfig = props.selectConfig;
|
|
1099
|
+
return __spreadProps(__spreadValues({}, selectConfig), { checkRowKeys });
|
|
1594
1100
|
};
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
};
|
|
1101
|
+
const buildRadioConfig = ({ props, state }) => () => {
|
|
1102
|
+
const checkRowKey = state.currentKey;
|
|
1103
|
+
const highlight = true;
|
|
1104
|
+
const radioConfig = props.radioConfig;
|
|
1105
|
+
return __spreadValues(__spreadValues({}, radioConfig), { checkRowKey, highlight });
|
|
1601
1106
|
};
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
} else if (value === -9) {
|
|
1608
|
-
state.hoverOption = {};
|
|
1609
|
-
}
|
|
1610
|
-
state.options.forEach(function (option) {
|
|
1611
|
-
option.hover = state.hoverOption === option;
|
|
1612
|
-
});
|
|
1613
|
-
};
|
|
1107
|
+
const onMouseenterNative = ({ state }) => () => {
|
|
1108
|
+
state.inputHovering = true;
|
|
1109
|
+
if (state.searchSingleCopy && state.selectedLabel) {
|
|
1110
|
+
state.softFocus = true;
|
|
1111
|
+
}
|
|
1614
1112
|
};
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
state =
|
|
1619
|
-
|
|
1620
|
-
refs = _ref73.refs;
|
|
1621
|
-
return function () {
|
|
1622
|
-
var parentEl = parent.$el;
|
|
1623
|
-
var inputEl = parentEl.querySelector('input.tiny-input__inner') || parentEl.querySelector('input.tiny-mobile-input__inner');
|
|
1624
|
-
var inputClientRect = inputEl === null || inputEl === void 0 ? void 0 : inputEl.getBoundingClientRect();
|
|
1625
|
-
if (inputEl === document.activeElement) {
|
|
1626
|
-
var _document$activeEleme;
|
|
1627
|
-
(_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.blur();
|
|
1628
|
-
}
|
|
1629
|
-
state.completed = true;
|
|
1630
|
-
var sizeMap = {
|
|
1631
|
-
mini: 28,
|
|
1632
|
-
small: 32,
|
|
1633
|
-
medium: 36
|
|
1634
|
-
};
|
|
1635
|
-
if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
|
|
1636
|
-
state.currentPlaceholder = '';
|
|
1637
|
-
}
|
|
1638
|
-
if (inputClientRect) {
|
|
1639
|
-
state.initialInputHeight = inputClientRect.height || sizeMap[state.selectSize];
|
|
1640
|
-
addResizeListener(parentEl, api.handleResize);
|
|
1641
|
-
if (refs.tags) {
|
|
1642
|
-
addResizeListener(refs.tags, api.resetInputHeight);
|
|
1643
|
-
}
|
|
1644
|
-
if (props.remote && props.multiple) {
|
|
1645
|
-
api.resetInputHeight();
|
|
1646
|
-
}
|
|
1647
|
-
state.inputWidth = inputClientRect.width;
|
|
1648
|
-
}
|
|
1649
|
-
api.setSelected();
|
|
1650
|
-
if (props.dataset) {
|
|
1651
|
-
api.watchPropsOption();
|
|
1652
|
-
}
|
|
1653
|
-
};
|
|
1113
|
+
const onMouseleaveNative = ({ state }) => () => {
|
|
1114
|
+
state.inputHovering = false;
|
|
1115
|
+
if (state.searchSingleCopy && state.selectedLabel) {
|
|
1116
|
+
state.softFocus = false;
|
|
1117
|
+
}
|
|
1654
1118
|
};
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1119
|
+
const onCopying = ({ state, refs }) => () => state.searchSingleCopy && state.selectedLabel && refs.reference && refs.reference.hasSelection && refs.reference.hasSelection();
|
|
1120
|
+
const watchHoverIndex = ({ state }) => (value) => {
|
|
1121
|
+
if (typeof value === "number" && value > -1) {
|
|
1122
|
+
state.hoverOption = state.options[value] || {};
|
|
1123
|
+
} else if (value === -9) {
|
|
1124
|
+
state.hoverOption = {};
|
|
1125
|
+
}
|
|
1126
|
+
state.options.forEach((option) => {
|
|
1127
|
+
option.hover = state.hoverOption === option;
|
|
1128
|
+
});
|
|
1129
|
+
};
|
|
1130
|
+
const mounted = ({ api, parent, state, props, refs }) => () => {
|
|
1131
|
+
var _a;
|
|
1132
|
+
const parentEl = parent.$el;
|
|
1133
|
+
const inputEl = parentEl.querySelector("input.tiny-input__inner") || parentEl.querySelector("input.tiny-mobile-input__inner");
|
|
1134
|
+
const inputClientRect = inputEl == null ? void 0 : inputEl.getBoundingClientRect();
|
|
1135
|
+
if (inputEl === document.activeElement) {
|
|
1136
|
+
(_a = document.activeElement) == null ? void 0 : _a.blur();
|
|
1137
|
+
}
|
|
1138
|
+
state.completed = true;
|
|
1139
|
+
const sizeMap = { mini: 28, small: 32, medium: 36 };
|
|
1140
|
+
if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
|
|
1141
|
+
state.currentPlaceholder = "";
|
|
1142
|
+
}
|
|
1143
|
+
if (inputClientRect) {
|
|
1144
|
+
state.initialInputHeight = inputClientRect.height || sizeMap[state.selectSize];
|
|
1145
|
+
addResizeListener(parentEl, api.handleResize);
|
|
1664
1146
|
if (refs.tags) {
|
|
1665
|
-
|
|
1147
|
+
addResizeListener(refs.tags, api.resetInputHeight);
|
|
1666
1148
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1149
|
+
if (props.remote && props.multiple) {
|
|
1150
|
+
api.resetInputHeight();
|
|
1151
|
+
}
|
|
1152
|
+
state.inputWidth = inputClientRect.width;
|
|
1153
|
+
}
|
|
1154
|
+
api.setSelected();
|
|
1155
|
+
if (props.dataset) {
|
|
1156
|
+
api.watchPropsOption();
|
|
1157
|
+
}
|
|
1674
1158
|
};
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
optOpts
|
|
1694
|
-
return optOpts;
|
|
1159
|
+
const unMount = ({ api, parent, refs, state }) => () => {
|
|
1160
|
+
if (parent.$el && api.handleResize) {
|
|
1161
|
+
removeResizeListener(parent.$el, api.handleResize);
|
|
1162
|
+
}
|
|
1163
|
+
if (refs.tags) {
|
|
1164
|
+
removeResizeListener(refs.tags, api.resetInputHeight);
|
|
1165
|
+
}
|
|
1166
|
+
state.popperElm = null;
|
|
1167
|
+
state.optimizeStore.flag && optmzApis.removeScrollListener({ api, refs, state });
|
|
1168
|
+
};
|
|
1169
|
+
const computeOptimizeOpts = ({ props, state }) => () => {
|
|
1170
|
+
const { optimization } = props;
|
|
1171
|
+
const baseOpts = { gt: 20, rSize: 10, optionHeight: 30, limit: 20 };
|
|
1172
|
+
let optOpts;
|
|
1173
|
+
if (optimization) {
|
|
1174
|
+
if (typeof optimization === "boolean") {
|
|
1175
|
+
optOpts = extend(true, {}, baseOpts);
|
|
1176
|
+
} else {
|
|
1177
|
+
optOpts = extend(true, {}, baseOpts, optimization);
|
|
1695
1178
|
}
|
|
1696
|
-
|
|
1179
|
+
optOpts.virtualScroll = optOpts.gt > 0 && optOpts.gt <= state.datas.length;
|
|
1180
|
+
return optOpts;
|
|
1181
|
+
}
|
|
1697
1182
|
};
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
optimizeStore =
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
props: props,
|
|
1713
|
-
state: state
|
|
1714
|
-
});
|
|
1715
|
-
optimizeStore.valueIndex = optmzApis.getValueIndex(props);
|
|
1716
|
-
optmzApis.process({
|
|
1717
|
-
props: props,
|
|
1718
|
-
state: state
|
|
1719
|
-
});
|
|
1720
|
-
optmzApis.createMacro(function () {
|
|
1721
|
-
var itemFn = function itemFn(i) {
|
|
1722
|
-
return optionHeight * (optimizeStore.startIndex + i);
|
|
1723
|
-
};
|
|
1724
|
-
optmzApis.addScrollListener({
|
|
1725
|
-
api: api,
|
|
1726
|
-
refs: refs,
|
|
1727
|
-
state: state
|
|
1728
|
-
});
|
|
1729
|
-
optmzApis.updateItems({
|
|
1730
|
-
refs: refs,
|
|
1731
|
-
state: state,
|
|
1732
|
-
itemFn: itemFn
|
|
1733
|
-
});
|
|
1734
|
-
});
|
|
1735
|
-
}
|
|
1183
|
+
const watchOptimizeOpts = ({ api, props, refs, state }) => () => {
|
|
1184
|
+
const { optimizeOpts, optimizeStore } = state;
|
|
1185
|
+
if (optimizeOpts) {
|
|
1186
|
+
const { virtualScroll, optionHeight } = optimizeOpts;
|
|
1187
|
+
optimizeStore.flag = virtualScroll;
|
|
1188
|
+
if (virtualScroll) {
|
|
1189
|
+
optimizeStore.viewStyle = optmzApis.getViewStyle({ props, state });
|
|
1190
|
+
optimizeStore.valueIndex = optmzApis.getValueIndex(props);
|
|
1191
|
+
optmzApis.process({ props, state });
|
|
1192
|
+
optmzApis.createMacro(() => {
|
|
1193
|
+
const itemFn = (i) => optionHeight * (optimizeStore.startIndex + i);
|
|
1194
|
+
optmzApis.addScrollListener({ api, refs, state });
|
|
1195
|
+
optmzApis.updateItems({ refs, state, itemFn });
|
|
1196
|
+
});
|
|
1736
1197
|
}
|
|
1737
|
-
}
|
|
1198
|
+
}
|
|
1738
1199
|
};
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
var _optmzApis$queryWrap = optmzApis.queryWrap(refs),
|
|
1749
|
-
clientHeight = _optmzApis$queryWrap.clientHeight,
|
|
1750
|
-
scrollTop = _optmzApis$queryWrap.scrollTop;
|
|
1751
|
-
var maxScrollTop = viewHeight - clientHeight;
|
|
1752
|
-
var start = Math.floor(scrollTop / optionHeight);
|
|
1200
|
+
const getScrollListener = ({ props, refs, state }) => {
|
|
1201
|
+
const listener = () => {
|
|
1202
|
+
const { options } = props;
|
|
1203
|
+
const { optimizeOpts } = state;
|
|
1204
|
+
const { optionHeight } = optimizeOpts;
|
|
1205
|
+
const viewHeight = optionHeight * options.length;
|
|
1206
|
+
const { clientHeight, scrollTop } = optmzApis.queryWrap(refs);
|
|
1207
|
+
const maxScrollTop = viewHeight - clientHeight;
|
|
1208
|
+
const start = Math.floor(scrollTop / optionHeight);
|
|
1753
1209
|
if (scrollTop <= maxScrollTop) {
|
|
1754
|
-
optmzApis.process({
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
state
|
|
1758
|
-
});
|
|
1759
|
-
optmzApis.createMacro(function () {
|
|
1760
|
-
var itemFn = function itemFn(i) {
|
|
1761
|
-
return scrollTop + optionHeight * i - scrollTop % optionHeight;
|
|
1762
|
-
};
|
|
1763
|
-
optmzApis.updateItems({
|
|
1764
|
-
refs: refs,
|
|
1765
|
-
state: state,
|
|
1766
|
-
itemFn: itemFn
|
|
1767
|
-
});
|
|
1210
|
+
optmzApis.process({ props, start, state });
|
|
1211
|
+
optmzApis.createMacro(() => {
|
|
1212
|
+
const itemFn = (i) => scrollTop + optionHeight * i - scrollTop % optionHeight;
|
|
1213
|
+
optmzApis.updateItems({ refs, state, itemFn });
|
|
1768
1214
|
});
|
|
1769
1215
|
}
|
|
1770
1216
|
};
|
|
1771
|
-
|
|
1772
|
-
|
|
1217
|
+
const { optimization } = props;
|
|
1218
|
+
const delay = optmzApis.natural((optimization && typeof optimization === "object" ? optimization.delay : null) || 10);
|
|
1773
1219
|
return debounce(delay, listener);
|
|
1774
1220
|
};
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
};
|
|
1221
|
+
const computeCollapseTags = (props) => () => props.collapseTags;
|
|
1222
|
+
const computeMultipleLimit = ({ props, state }) => () => {
|
|
1223
|
+
const { multipleLimit, multiple } = props;
|
|
1224
|
+
const { optimizeOpts, optimizeStore } = state;
|
|
1225
|
+
return optmzApis.natural(multiple && optimizeStore.flag ? multipleLimit || optimizeOpts.limit : multipleLimit);
|
|
1226
|
+
};
|
|
1227
|
+
export {
|
|
1228
|
+
blur,
|
|
1229
|
+
buildRadioConfig,
|
|
1230
|
+
buildSelectConfig,
|
|
1231
|
+
calcOverFlow,
|
|
1232
|
+
checkDefaultFirstOption,
|
|
1233
|
+
computeCollapseTags,
|
|
1234
|
+
computeMultipleLimit,
|
|
1235
|
+
computeOptimizeOpts,
|
|
1236
|
+
debouncRquest,
|
|
1237
|
+
defaultOnQueryChange,
|
|
1238
|
+
deletePrevTag,
|
|
1239
|
+
deleteSelected,
|
|
1240
|
+
deleteTag,
|
|
1241
|
+
doDestroy,
|
|
1242
|
+
emitChange,
|
|
1243
|
+
emptyText,
|
|
1244
|
+
focus,
|
|
1245
|
+
getChildValue,
|
|
1246
|
+
getOption,
|
|
1247
|
+
getPluginOption,
|
|
1248
|
+
getScrollListener,
|
|
1249
|
+
getTreeData,
|
|
1250
|
+
getValueIndex,
|
|
1251
|
+
getValueKey,
|
|
1252
|
+
getcheckedData,
|
|
1253
|
+
gridOnQueryChange,
|
|
1254
|
+
handleBlur,
|
|
1255
|
+
handleClearClick,
|
|
1256
|
+
handleClose,
|
|
1257
|
+
handleComposition,
|
|
1258
|
+
handleCopyClick,
|
|
1259
|
+
handleFocus,
|
|
1260
|
+
handleMenuEnter,
|
|
1261
|
+
handleOptionSelect,
|
|
1262
|
+
handleQueryChange,
|
|
1263
|
+
handleResize,
|
|
1264
|
+
managePlaceholder,
|
|
1265
|
+
mounted,
|
|
1266
|
+
navigateOptions,
|
|
1267
|
+
nodeCheckClick,
|
|
1268
|
+
nodeCollapse,
|
|
1269
|
+
nodeExpand,
|
|
1270
|
+
onCopying,
|
|
1271
|
+
onInputChange,
|
|
1272
|
+
onMouseenterNative,
|
|
1273
|
+
onMouseleaveNative,
|
|
1274
|
+
onOptionDestroy,
|
|
1275
|
+
radioChange,
|
|
1276
|
+
resetFilter,
|
|
1277
|
+
resetHoverIndex,
|
|
1278
|
+
resetInputHeight,
|
|
1279
|
+
resetInputState,
|
|
1280
|
+
resetInputWidth,
|
|
1281
|
+
scrollToOption,
|
|
1282
|
+
selectChange,
|
|
1283
|
+
selectOption,
|
|
1284
|
+
setSelected,
|
|
1285
|
+
setSoftFocus,
|
|
1286
|
+
showTip,
|
|
1287
|
+
toHide,
|
|
1288
|
+
toVisible,
|
|
1289
|
+
toggleCheckAll,
|
|
1290
|
+
toggleLastOptionHitState,
|
|
1291
|
+
toggleMenu,
|
|
1292
|
+
treeNodeClick,
|
|
1293
|
+
unMount,
|
|
1294
|
+
watchHoverIndex,
|
|
1295
|
+
watchOptimizeOpts,
|
|
1296
|
+
watchOptions,
|
|
1297
|
+
watchPropsOption,
|
|
1298
|
+
watchValue,
|
|
1299
|
+
watchVisible
|
|
1779
1300
|
};
|
|
1780
|
-
export var computeMultipleLimit = function computeMultipleLimit(_ref78) {
|
|
1781
|
-
var props = _ref78.props,
|
|
1782
|
-
state = _ref78.state;
|
|
1783
|
-
return function () {
|
|
1784
|
-
var multipleLimit = props.multipleLimit,
|
|
1785
|
-
multiple = props.multiple;
|
|
1786
|
-
var optimizeOpts = state.optimizeOpts,
|
|
1787
|
-
optimizeStore = state.optimizeStore;
|
|
1788
|
-
return optmzApis.natural(multiple && optimizeStore.flag ? multipleLimit || optimizeOpts.limit : multipleLimit);
|
|
1789
|
-
};
|
|
1790
|
-
};
|