@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.
Files changed (482) hide show
  1. package/README.md +7 -26
  2. package/action-menu/index.js +15 -15
  3. package/action-menu/vue.js +17 -22
  4. package/action-sheet/index.js +53 -68
  5. package/action-sheet/vue.js +28 -54
  6. package/alert/index.js +10 -21
  7. package/alert/vue.js +19 -33
  8. package/amount/index.js +205 -308
  9. package/amount/vue.js +113 -187
  10. package/anchor/index.js +102 -173
  11. package/anchor/vue.js +26 -47
  12. package/area/index.js +93 -153
  13. package/area/vue.js +26 -62
  14. package/autocomplete/index.js +115 -157
  15. package/autocomplete/vue.js +84 -159
  16. package/autonavi-map/index.js +12 -22
  17. package/avatar/index.js +28 -31
  18. package/avatar/vue.js +16 -19
  19. package/badge/index.js +11 -15
  20. package/badge/vue.js +19 -27
  21. package/baidu-map/index.js +12 -22
  22. package/breadcrumb/index.js +8 -7
  23. package/breadcrumb/vue.js +15 -22
  24. package/breadcrumb-item/index.js +14 -26
  25. package/breadcrumb-item/vue.js +20 -28
  26. package/bulletin-board/index.js +19 -22
  27. package/bulletin-board/vue.js +26 -33
  28. package/button/index.js +14 -18
  29. package/button/vue.js +26 -38
  30. package/button-group/index.js +19 -24
  31. package/button-group/vue.js +32 -45
  32. package/calendar/index.js +168 -203
  33. package/calendar/vue.js +89 -100
  34. package/card-template/index.js +29 -37
  35. package/card-template/vue.js +18 -30
  36. package/carousel/index.js +125 -198
  37. package/carousel/vue.js +132 -188
  38. package/carousel-item/index.js +55 -80
  39. package/carousel-item/vue.js +42 -42
  40. package/cascader/index.js +329 -460
  41. package/cascader/vue.js +159 -319
  42. package/cascader-menu/index.js +32 -39
  43. package/cascader-menu/vue.js +21 -30
  44. package/cascader-node/index.js +41 -60
  45. package/cascader-node/vue.js +27 -59
  46. package/cascader-panel/index.js +229 -311
  47. package/cascader-panel/node.js +118 -190
  48. package/cascader-panel/store.js +49 -76
  49. package/cascader-panel/vue.js +125 -197
  50. package/chart-bar/index.js +129 -439
  51. package/chart-boxplot/index.js +78 -219
  52. package/chart-candle/index.js +134 -379
  53. package/chart-core/deps/constants.js +70 -49
  54. package/chart-core/deps/numerify.js +106 -147
  55. package/chart-core/deps/utils.js +118 -121
  56. package/chart-core/index.js +302 -469
  57. package/chart-core/modules/animation.js +7 -5
  58. package/chart-core/modules/extend.js +18 -19
  59. package/chart-core/modules/mark.js +7 -3
  60. package/chart-core/vue.js +81 -120
  61. package/chart-funnel/index.js +47 -126
  62. package/chart-gauge/index.js +54 -128
  63. package/chart-graph/index.js +22 -35
  64. package/chart-heatmap/index.js +116 -362
  65. package/chart-line/index.js +98 -289
  66. package/chart-liquidfill/index.js +35 -100
  67. package/chart-map/index.js +64 -217
  68. package/chart-pie/index.js +93 -274
  69. package/chart-radar/index.js +59 -135
  70. package/chart-sankey/index.js +51 -137
  71. package/chart-scatter/index.js +118 -313
  72. package/chart-sunburst/index.js +25 -33
  73. package/chart-tree/index.js +43 -85
  74. package/chart-waterfall/index.js +77 -210
  75. package/chart-wordcloud/index.js +36 -85
  76. package/checkbox/index.js +82 -133
  77. package/checkbox/vue.js +62 -132
  78. package/checkbox-button/index.js +60 -96
  79. package/checkbox-button/vue.js +53 -135
  80. package/checkbox-group/index.js +6 -11
  81. package/checkbox-group/vue.js +22 -27
  82. package/chunk-PKUHTIDK.js +37 -0
  83. package/col/index.js +89 -119
  84. package/col/vue.js +21 -31
  85. package/collapse/index.js +31 -40
  86. package/collapse/vue.js +24 -32
  87. package/collapse-item/index.js +22 -36
  88. package/collapse-item/vue.js +22 -42
  89. package/common/array.js +51 -56
  90. package/common/bigInt.js +187 -243
  91. package/common/browser.js +35 -31
  92. package/common/dataset/index.js +74 -110
  93. package/common/date.js +199 -201
  94. package/common/decimal.js +94 -142
  95. package/common/deps/ResizeObserver.js +188 -208
  96. package/common/deps/after-leave.js +12 -10
  97. package/common/deps/clickoutside.js +32 -36
  98. package/common/deps/date-util.js +139 -166
  99. package/common/deps/date.js +206 -241
  100. package/common/deps/debounce.js +8 -4
  101. package/common/deps/dom.js +75 -68
  102. package/common/deps/eSpaceCtrl.js +170 -153
  103. package/common/deps/fullscreen/apis.js +51 -65
  104. package/common/deps/fullscreen/screenfull.js +61 -45
  105. package/common/deps/letter-only.js +12 -8
  106. package/common/deps/memorize.js +100 -125
  107. package/common/deps/modal-queue.js +6 -2
  108. package/common/deps/number-only.js +13 -9
  109. package/common/deps/popper.js +280 -372
  110. package/common/deps/popup-manager.js +71 -75
  111. package/common/deps/repeat-click.js +14 -10
  112. package/common/deps/requestAnimationFrame.js +13 -13
  113. package/common/deps/resize-event.js +15 -10
  114. package/common/deps/scroll-into-view.js +13 -13
  115. package/common/deps/scrollbar-width.js +22 -18
  116. package/common/deps/throttle.js +15 -11
  117. package/common/deps/touch.js +24 -22
  118. package/common/deps/tree-model/node.js +374 -524
  119. package/common/deps/tree-model/tree-store.js +251 -352
  120. package/common/deps/tree-model/util.js +10 -4
  121. package/common/deps/upload-ajax.js +28 -24
  122. package/common/deps/vue-emitter.js +15 -11
  123. package/common/deps/vue-popper.js +181 -214
  124. package/common/deps/vue-popup.js +118 -168
  125. package/common/event.js +10 -9
  126. package/common/index.js +180 -194
  127. package/common/object.js +92 -91
  128. package/common/runtime.js +78 -51
  129. package/common/string.js +194 -266
  130. package/common/type.js +49 -51
  131. package/common/validate/index.js +8 -4
  132. package/common/validate/messages.js +64 -67
  133. package/common/validate/rules/enum.js +10 -6
  134. package/common/validate/rules/index.js +18 -14
  135. package/common/validate/rules/pattern.js +9 -5
  136. package/common/validate/rules/range.js +26 -39
  137. package/common/validate/rules/required.js +8 -10
  138. package/common/validate/rules/type.js +67 -79
  139. package/common/validate/rules/whitespace.js +8 -4
  140. package/common/validate/schema.js +159 -199
  141. package/common/validate/util.js +95 -82
  142. package/common/validate/validations/array.js +14 -17
  143. package/common/validate/validations/date.js +16 -20
  144. package/common/validate/validations/enum.js +14 -16
  145. package/common/validate/validations/float.js +13 -15
  146. package/common/validate/validations/index.js +28 -24
  147. package/common/validate/validations/integer.js +13 -15
  148. package/common/validate/validations/method.js +13 -15
  149. package/common/validate/validations/number.js +15 -17
  150. package/common/validate/validations/pattern.js +14 -16
  151. package/common/validate/validations/required.js +10 -14
  152. package/common/validate/validations/string.js +19 -15
  153. package/common/validate/validations/type.js +17 -13
  154. package/common/xss.js +202 -184
  155. package/company/index.js +34 -49
  156. package/company/vue.js +23 -29
  157. package/container/index.js +72 -98
  158. package/container/vue.js +36 -61
  159. package/country/index.js +33 -47
  160. package/country/vue.js +24 -29
  161. package/credit-card/index.js +72 -86
  162. package/credit-card/vue.js +49 -104
  163. package/credit-card-form/index.js +97 -129
  164. package/credit-card-form/vue.js +102 -133
  165. package/crop/index.js +175 -294
  166. package/crop/vue.js +132 -144
  167. package/currency/index.js +49 -67
  168. package/currency/vue.js +25 -34
  169. package/date-panel/index.js +384 -524
  170. package/date-panel/vue.js +178 -289
  171. package/date-picker/index.js +198 -260
  172. package/date-picker/vue.js +97 -155
  173. package/date-range/index.js +324 -435
  174. package/date-range/vue.js +154 -273
  175. package/date-table/index.js +279 -391
  176. package/date-table/vue.js +63 -139
  177. package/dept/index.js +196 -291
  178. package/dept/vue.js +74 -144
  179. package/detail-page/index.js +72 -131
  180. package/detail-page/vue.js +53 -128
  181. package/dialog-box/index.js +178 -248
  182. package/dialog-box/vue.js +111 -201
  183. package/drop-roles/index.js +44 -65
  184. package/drop-roles/vue.js +23 -31
  185. package/drop-times/index.js +21 -22
  186. package/drop-times/vue.js +19 -23
  187. package/dropdown/index.js +182 -253
  188. package/dropdown/vue.js +55 -101
  189. package/dropdown-item/index.js +113 -167
  190. package/dropdown-item/vue.js +73 -121
  191. package/dropdown-menu/index.js +85 -111
  192. package/dropdown-menu/vue.js +23 -36
  193. package/espace/index.js +86 -106
  194. package/espace/vue.js +26 -48
  195. package/exception/index.js +9 -12
  196. package/exception/vue.js +15 -22
  197. package/fall-menu/index.js +81 -110
  198. package/fall-menu/vue.js +32 -78
  199. package/file-upload/index.js +1081 -1713
  200. package/file-upload/vue.js +175 -417
  201. package/floatbar/index.js +8 -5
  202. package/floatbar/vue.js +13 -16
  203. package/form/index.js +124 -165
  204. package/form/vue.js +54 -66
  205. package/form-item/index.js +255 -328
  206. package/form-item/vue.js +97 -198
  207. package/fullscreen/index.js +95 -127
  208. package/fullscreen/vue.js +36 -72
  209. package/grid/core/index.js +7 -3
  210. package/grid/core/interceptor.js +28 -20
  211. package/grid/core/storeMap.js +11 -7
  212. package/grid/plugins/export.js +72 -95
  213. package/grid/plugins/exportExcel.js +244 -561
  214. package/grid/plugins/header.js +22 -21
  215. package/grid/plugins/resize.js +45 -62
  216. package/grid/static/array/arrayEach.js +7 -3
  217. package/grid/static/array/arrayIndexOf.js +7 -3
  218. package/grid/static/array/eachTree.js +17 -21
  219. package/grid/static/array/every.js +6 -2
  220. package/grid/static/array/filterTree.js +17 -12
  221. package/grid/static/array/find.js +7 -3
  222. package/grid/static/array/findTree.js +19 -30
  223. package/grid/static/array/helperCreateIterateHandle.js +31 -39
  224. package/grid/static/array/helperCreateTreeFunc.js +18 -16
  225. package/grid/static/array/includes.js +6 -4
  226. package/grid/static/array/lastArrayEach.js +7 -3
  227. package/grid/static/array/map.js +11 -10
  228. package/grid/static/array/mapTree.js +19 -23
  229. package/grid/static/array/slice.js +7 -3
  230. package/grid/static/array/sortBy.js +32 -34
  231. package/grid/static/array/sum.js +14 -13
  232. package/grid/static/array/toArray.js +6 -6
  233. package/grid/static/array/toTreeArray.js +13 -15
  234. package/grid/static/base/clear.js +18 -14
  235. package/grid/static/base/clone.js +11 -17
  236. package/grid/static/base/destructuring.js +14 -10
  237. package/grid/static/base/each.js +8 -4
  238. package/grid/static/base/eqNull.js +7 -5
  239. package/grid/static/base/findIndexOf.js +8 -4
  240. package/grid/static/base/get.js +21 -17
  241. package/grid/static/base/has.js +21 -20
  242. package/grid/static/base/hasOwnProp.js +5 -3
  243. package/grid/static/base/helperCreateGetObjects.js +13 -9
  244. package/grid/static/base/helperCreateInInObjectString.js +8 -4
  245. package/grid/static/base/helperCreateInTypeof.js +8 -5
  246. package/grid/static/base/helperCreateIndexOf.js +19 -18
  247. package/grid/static/base/helperCreateiterateIndexOf.js +20 -19
  248. package/grid/static/base/helperDefaultCompare.js +5 -1
  249. package/grid/static/base/helperDeleteProperty.js +7 -3
  250. package/grid/static/base/helperEqualCompare.js +27 -29
  251. package/grid/static/base/helperGetHGSKeys.js +5 -3
  252. package/grid/static/base/indexOf.js +7 -3
  253. package/grid/static/base/isArray.js +7 -3
  254. package/grid/static/base/isBoolean.js +5 -3
  255. package/grid/static/base/isDate.js +7 -3
  256. package/grid/static/base/isEmpty.js +7 -3
  257. package/grid/static/base/isEqual.js +10 -10
  258. package/grid/static/base/isFunction.js +5 -3
  259. package/grid/static/base/isNaN.js +6 -4
  260. package/grid/static/base/isNull.js +5 -3
  261. package/grid/static/base/isNumber.js +5 -3
  262. package/grid/static/base/isObject.js +5 -4
  263. package/grid/static/base/isPlainObject.js +6 -2
  264. package/grid/static/base/isRegExp.js +7 -3
  265. package/grid/static/base/isSet.js +6 -4
  266. package/grid/static/base/isString.js +5 -3
  267. package/grid/static/base/isUndefined.js +5 -3
  268. package/grid/static/base/keys.js +7 -3
  269. package/grid/static/base/lastEach.js +8 -4
  270. package/grid/static/base/remove.js +20 -20
  271. package/grid/static/base/set.js +22 -18
  272. package/grid/static/base/toJSONString.js +5 -3
  273. package/grid/static/base/toStringJSON.js +10 -5
  274. package/grid/static/base/uniqueId.js +6 -4
  275. package/grid/static/browse/browse.js +25 -22
  276. package/grid/static/function/property.js +6 -6
  277. package/grid/static/function/throttle.js +18 -14
  278. package/grid/static/index.js +111 -55
  279. package/grid/static/number/helperCreateToNumber.js +12 -10
  280. package/grid/static/number/toNumber.js +7 -3
  281. package/grid/static/object/assign.js +20 -20
  282. package/grid/static/object/extend.js +7 -3
  283. package/grid/static/object/lastObjectEach.js +9 -5
  284. package/grid/static/object/objectEach.js +8 -4
  285. package/grid/static/object/objectMap.js +11 -7
  286. package/grid/static/object/values.js +15 -7
  287. package/grid/static/static/staticDocument.js +7 -4
  288. package/grid/static/static/staticHGKeyRE.js +6 -2
  289. package/grid/static/static/staticParseInt.js +6 -2
  290. package/grid/static/static/staticStrUndefined.js +6 -2
  291. package/grid/static/static/staticWindow.js +7 -4
  292. package/grid/static/string/template.js +10 -8
  293. package/grid/static/string/toString.js +12 -8
  294. package/grid/utils/column.js +11 -14
  295. package/grid/utils/common.js +84 -102
  296. package/grid/utils/dom.js +104 -117
  297. package/grid/utils/event.js +23 -28
  298. package/grid/utils/index.js +8 -5
  299. package/hrapprover/index.js +80 -105
  300. package/hrapprover/vue.js +45 -90
  301. package/image/index.js +107 -175
  302. package/image/vue.js +56 -126
  303. package/image-viewer/index.js +328 -416
  304. package/image-viewer/vue.js +131 -206
  305. package/index-bar/index.js +42 -51
  306. package/index-bar/vue.js +53 -74
  307. package/index-bar-anchor/vue.js +14 -18
  308. package/input/index.js +232 -302
  309. package/input/vue.js +181 -284
  310. package/ip-address/index.js +168 -335
  311. package/ip-address/vue.js +95 -160
  312. package/layout/vue.js +7 -4
  313. package/link/index.js +9 -10
  314. package/link/vue.js +15 -23
  315. package/link-menu/index.js +86 -128
  316. package/link-menu/vue.js +55 -118
  317. package/list/index.js +12 -12
  318. package/list/vue.js +15 -15
  319. package/loading/index.js +22 -21
  320. package/loading/vue.js +15 -18
  321. package/locales/index.js +72 -104
  322. package/locales/vue.js +23 -41
  323. package/logon-user/index.js +14 -19
  324. package/logon-user/vue.js +17 -20
  325. package/logout/index.js +58 -96
  326. package/logout/vue.js +15 -19
  327. package/milestone/index.js +53 -76
  328. package/milestone/vue.js +28 -26
  329. package/mini-picker/index.js +155 -219
  330. package/mini-picker/vue.js +98 -118
  331. package/modal/index.js +386 -735
  332. package/modal/vue.js +81 -117
  333. package/month-range/index.js +108 -143
  334. package/month-range/vue.js +57 -85
  335. package/month-table/index.js +157 -202
  336. package/month-table/vue.js +42 -64
  337. package/multi-select/index.js +150 -214
  338. package/multi-select/vue.js +58 -102
  339. package/nav-menu/index.js +276 -410
  340. package/nav-menu/vue.js +110 -174
  341. package/notify/index.js +59 -81
  342. package/notify/vue.js +42 -57
  343. package/numeric/index.js +231 -363
  344. package/numeric/vue.js +78 -202
  345. package/option/index.js +44 -72
  346. package/option/vue.js +66 -179
  347. package/option-group/index.js +12 -17
  348. package/option-group/vue.js +25 -30
  349. package/package.json +32 -84
  350. package/pager-item/index.js +91 -103
  351. package/pager-item/vue.js +36 -48
  352. package/panel/index.js +22 -28
  353. package/panel/vue.js +17 -23
  354. package/picker/index.js +689 -963
  355. package/picker/timezone.js +1174 -974
  356. package/picker/vue.js +187 -389
  357. package/picker-column/index.js +182 -232
  358. package/picker-column/vue.js +71 -130
  359. package/pop-upload/index.js +162 -321
  360. package/pop-upload/vue.js +143 -273
  361. package/popeditor/index.js +528 -807
  362. package/popeditor/vue.js +165 -334
  363. package/popover/index.js +160 -219
  364. package/popover/vue.js +76 -162
  365. package/popup/index.js +90 -128
  366. package/popup/vue.js +39 -112
  367. package/progress/index.js +108 -171
  368. package/progress/vue.js +65 -115
  369. package/pull-refresh/index.js +118 -132
  370. package/pull-refresh/vue.js +38 -66
  371. package/radio/index.js +41 -77
  372. package/radio/vue.js +35 -92
  373. package/radio-button/index.js +35 -54
  374. package/radio-button/vue.js +28 -61
  375. package/radio-group/index.js +46 -48
  376. package/radio-group/vue.js +26 -30
  377. package/rate/index.js +158 -197
  378. package/rate/vue.js +90 -138
  379. package/roles/index.js +48 -77
  380. package/roles/vue.js +20 -32
  381. package/row/index.js +15 -16
  382. package/row/vue.js +20 -19
  383. package/scroll-text/index.js +17 -22
  384. package/scroll-text/vue.js +18 -27
  385. package/scrollbar/index.js +87 -115
  386. package/scrollbar/vue-bar.js +23 -46
  387. package/scrollbar/vue.js +25 -33
  388. package/search/index.js +67 -95
  389. package/search/vue.js +80 -100
  390. package/select/index.js +1094 -1584
  391. package/select/vue.js +342 -672
  392. package/select-dropdown/index.js +18 -23
  393. package/select-dropdown/vue.js +56 -112
  394. package/slide-bar/index.js +58 -85
  395. package/slide-bar/vue.js +21 -47
  396. package/slider/index.js +276 -373
  397. package/slider/vue.js +94 -144
  398. package/split/index.js +74 -123
  399. package/split/vue.js +63 -116
  400. package/steps/vue.js +8 -3
  401. package/switch/index.js +35 -43
  402. package/switch/vue.js +32 -58
  403. package/tab-bar/index.js +48 -46
  404. package/tab-bar/vue.js +14 -12
  405. package/tab-dropdown/index.js +11 -10
  406. package/tab-dropdown/vue.js +14 -11
  407. package/tab-item/index.js +20 -35
  408. package/tab-item/vue.js +22 -42
  409. package/tab-nav/index.js +194 -227
  410. package/tab-nav/vue.js +62 -83
  411. package/tabbar/index.js +23 -30
  412. package/tabbar/vue.js +22 -45
  413. package/tabbar-item/index.js +39 -51
  414. package/tabbar-item/vue.js +23 -48
  415. package/table/index.js +69 -103
  416. package/table/vue.js +37 -61
  417. package/tabs/index.js +125 -174
  418. package/tabs/vue.js +98 -143
  419. package/tag/index.js +13 -18
  420. package/tag/vue.js +11 -16
  421. package/tall-storage/index.js +87 -106
  422. package/tall-storage/vue-storage-box.js +14 -20
  423. package/tall-storage/vue.js +27 -35
  424. package/text-popup/index.js +48 -70
  425. package/text-popup/vue.js +27 -60
  426. package/time/index.js +71 -113
  427. package/time/vue.js +65 -108
  428. package/time-line/index.js +30 -56
  429. package/time-line/vue.js +23 -46
  430. package/time-panel/index.js +112 -175
  431. package/time-panel/scrollIntoView.js +12 -10
  432. package/time-panel/vue.js +64 -94
  433. package/time-range/index.js +123 -184
  434. package/time-range/vue.js +63 -115
  435. package/time-spinner/index.js +139 -179
  436. package/time-spinner/vue.js +72 -110
  437. package/toggle-menu/index.js +68 -98
  438. package/toggle-menu/vue.js +64 -54
  439. package/tooltip/index.js +127 -168
  440. package/tooltip/vue.js +81 -134
  441. package/top-box/index.js +46 -79
  442. package/top-box/vue.js +34 -62
  443. package/transfer/index.js +184 -263
  444. package/transfer/vue.js +65 -134
  445. package/transfer-panel/index.js +240 -329
  446. package/transfer-panel/vue.js +127 -232
  447. package/tree/index.js +422 -591
  448. package/tree/vue.js +163 -249
  449. package/tree-menu/index.js +97 -122
  450. package/tree-menu/vue.js +57 -39
  451. package/tree-node/index.js +180 -248
  452. package/tree-node/vue.js +107 -202
  453. package/upload/index.js +201 -276
  454. package/upload/vue.js +51 -82
  455. package/upload-dragger/index.js +38 -49
  456. package/upload-dragger/vue.js +16 -24
  457. package/upload-list/index.js +41 -50
  458. package/upload-list/vue.js +21 -27
  459. package/user/index.js +356 -510
  460. package/user/vue.js +50 -97
  461. package/user-account/index.js +16 -21
  462. package/user-account/vue.js +20 -23
  463. package/user-contact/index.js +11 -10
  464. package/user-contact/vue.js +15 -15
  465. package/user-head/index.js +69 -84
  466. package/user-head/vue.js +24 -45
  467. package/user-link/index.js +31 -41
  468. package/user-link/vue.js +23 -46
  469. package/wheel/index.js +136 -161
  470. package/wheel/vue.js +64 -95
  471. package/wizard/index.js +83 -102
  472. package/wizard/vue.js +19 -34
  473. package/year-table/index.js +31 -37
  474. package/year-table/vue.js +17 -21
  475. package/rich-text/clipboard.js +0 -77
  476. package/rich-text/index.js +0 -176
  477. package/rich-text/module/file-upload.js +0 -118
  478. package/rich-text/module/image-drop.js +0 -54
  479. package/rich-text/module/image-upload.js +0 -84
  480. package/rich-text/options.js +0 -187
  481. package/rich-text/table-module.js +0 -557
  482. package/rich-text/vue.js +0 -149
package/select/index.js CHANGED
@@ -1,284 +1,211 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- import { find } from '@opentiny/vue-renderless/common/array';
7
- import { getObj, isEqual } from '@opentiny/vue-renderless/common/object';
8
- import { isKorean } from '@opentiny/vue-renderless/common/string';
9
- import scrollIntoView from '@opentiny/vue-renderless/common/deps/scroll-into-view';
10
- import PopupManager from '@opentiny/vue-renderless/common/deps/popup-manager';
11
- import debounce from '@opentiny/vue-renderless/common/deps/debounce';
12
- import { getDataset } from '@opentiny/vue-renderless/common/dataset';
13
- import Memorize from '@opentiny/vue-renderless/common/deps/memorize';
14
- import { isEmptyObject } from '@opentiny/vue-renderless/common/type';
15
- import { addResizeListener, removeResizeListener } from '@opentiny/vue-renderless/common/deps/resize-event';
16
- import { extend } from '@opentiny/vue-renderless/common/object';
17
- export var handleComposition = function handleComposition(_ref) {
18
- var api = _ref.api,
19
- nextTick = _ref.nextTick,
20
- state = _ref.state;
21
- return function (event) {
22
- var text = event.target.value;
23
- if (event.type === 'compositionend') {
24
- state.isOnComposition = false;
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
- export var defaultOnQueryChange = function defaultOnQueryChange(_ref4) {
111
- var props = _ref4.props,
112
- state = _ref4.state,
113
- constants = _ref4.constants,
114
- api = _ref4.api;
115
- return function (value) {
116
- if (props.remote && typeof props.remoteMethod === 'function') {
117
- state.hoverIndex = -1;
118
- props.remoteMethod(value);
119
- } else if (typeof props.filterMethod === 'function') {
120
- props.filterMethod(value);
121
- state.selectEmitter.emit(constants.COMPONENT_NAME.OptionGroup, constants.EVENT_NAME.queryChange);
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
- state.filteredOptionsCount = state.optionsCount;
124
- state.selectEmitter.emit(constants.EVENT_NAME.queryChange, value);
41
+ overflow = refs.tags.scrollHeight > refs.tags.getBoundingClientRect().height;
125
42
  }
126
- if (props.defaultFirstOption && (props.filterable || props.remote) && state.filteredOptionsCount) {
127
- api.checkDefaultFirstOption();
128
- }
129
- };
43
+ state.showTip = show && overflow && !!state.tips && !state.visible;
44
+ }
130
45
  };
131
- export var handleQueryChange = function handleQueryChange(_ref5) {
132
- var api = _ref5.api,
133
- constants = _ref5.constants,
134
- nextTick = _ref5.nextTick,
135
- props = _ref5.props,
136
- vm = _ref5.vm,
137
- state = _ref5.state;
138
- return function (value) {
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
- nextTick(function () {
159
- if (state.visible) {
160
- state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
161
- state.showWarper = true;
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
- if (props.multiple && props.filterable) {
166
- nextTick(function () {
167
- if (refs.input) {
168
- var length = refs.input.value.length * 15 + 20;
169
- state.inputLength = state.collapseTags ? Math.min(50, length) : length;
170
- api.managePlaceholder();
171
- api.resetInputHeight();
172
- }
173
- });
174
- }
175
- if (props.renderType === constants.TYPE.Tree) {
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
- export var scrollToOption = function scrollToOption(_ref6) {
182
- var refs = _ref6.refs,
183
- constants = _ref6.constants;
184
- return function (option) {
185
- var target = Array.isArray(option) && option[0] ? option[0].el : option.el;
186
- if (refs.popper && target) {
187
- var menu = refs.popper.$el.querySelector(constants.CLASS.SelectDropdownWrap);
188
- scrollIntoView(menu, target);
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
- refs.scrollbar && refs.scrollbar.handleScroll();
191
- };
192
- };
193
- export var handleMenuEnter = function handleMenuEnter(_ref7) {
194
- var api = _ref7.api,
195
- nextTick = _ref7.nextTick,
196
- state = _ref7.state;
197
- return function () {
198
- nextTick(function () {
199
- return api.scrollToOption(state.selected);
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
- export var emitChange = function emitChange(_ref8) {
204
- var emit = _ref8.emit,
205
- props = _ref8.props,
206
- state = _ref8.state,
207
- constants = _ref8.constants;
208
- return function (value) {
209
- var seekItem = function seekItem(val, arr, items, flag) {
210
- if (constants.TYPE.Tree === flag) {
211
- var recurNode = function recurNode(node) {
212
- val === node[props.valueField] && items.push(node);
213
- val !== node[props.valueField] && Array.isArray(node.children) && node.children.forEach(recurNode);
214
- };
215
- arr.forEach(recurNode);
216
- } else if (constants.TYPE.Grid === flag) {
217
- for (var i = 0; i < arr.length; i++) {
218
- if (val === arr[i][props.valueField]) {
219
- items.push(arr[i]);
220
- break;
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
- export var getOption = function getOption(_ref9) {
249
- var props = _ref9.props,
250
- state = _ref9.state;
251
- return function (value) {
252
- var option;
253
- var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
254
- var isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
255
- var isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]';
256
- for (var i = state.cachedOptions.length - 1; i >= 0; i--) {
257
- var cachedOption = state.cachedOptions[i];
258
- var _isEqual = isObject ? getObj(cachedOption.value, props.valueKey) === getObj(value, props.valueKey) : cachedOption.value === value;
259
- if (_isEqual) {
260
- option = cachedOption;
261
- break;
262
- }
263
- }
264
- if (option) {
265
- return option;
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
- var label = !isObject && !isNull && !isUndefined ? value : '';
268
- var newOption = {
269
- value: value,
270
- currentLabel: label
271
- };
272
- if (props.multiple) {
273
- newOption.hitState = false;
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
- return newOption;
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
- var getOptionOfSetSelected = function getOptionOfSetSelected(_ref10) {
279
- var api = _ref10.api,
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
- var getResultOfSetSelected = function getResultOfSetSelected(_ref11) {
294
- var props = _ref11.props,
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(function (value) {
223
+ props.modelValue.forEach((value) => {
301
224
  if (isGrid || isTree) {
302
- var option = api.getPluginOption(value, isTree);
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
- export var setSelected = function setSelected(_ref12) {
312
- var api = _ref12.api,
313
- constants = _ref12.constants,
314
- nextTick = _ref12.nextTick,
315
- props = _ref12.props,
316
- refs = _ref12.refs,
317
- state = _ref12.state;
318
- return function () {
319
- var isTree = props.renderType === constants.TYPE.Tree;
320
- var isGrid = props.renderType === constants.TYPE.Grid;
321
- if (!props.multiple) {
322
- if (isGrid || isTree) {
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
- return;
357
- }
358
- var result = getResultOfSetSelected({
359
- props: props,
360
- isGrid: isGrid,
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
- return values;
406
- };
407
- var value;
408
- if (state.selectCls === 'check') {
409
- value = getEnabledValues(state.options);
410
- } else if (state.selectCls === 'halfselect') {
411
- var unchecked = state.options.filter(function (item) {
412
- return !item.disabled && item.state.selectCls === 'check';
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
- api.setSoftFocus();
419
- emit('update:modelValue', value);
420
- emit('change', value);
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
- export var resetFilter = function resetFilter(_ref15) {
424
- var state = _ref15.state,
425
- api = _ref15.api;
426
- return function () {
427
- state.query = '';
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
- export var handleFocus = function handleFocus(_ref16) {
433
- var emit = _ref16.emit,
434
- props = _ref16.props,
435
- state = _ref16.state,
436
- api = _ref16.api;
437
- return function (event) {
438
- if (!state.softFocus) {
439
- if (props.automaticDropdown || props.filterable) {
440
- state.visible = true;
441
- state.softFocus = true;
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
- state.softFocus = false;
348
+ emit("blur", event);
446
349
  }
447
- if (props.remote && state.filterOrSearch && state.firstAutoSeach) {
448
- state.firstAutoSeach = false;
449
- api.resetFilter();
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
- export var focus = function focus(_ref17) {
454
- var refs = _ref17.refs,
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
- export var blur = function blur(_ref18) {
464
- var refs = _ref18.refs,
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
- export var handleBlur = function handleBlur(_ref19) {
473
- var constants = _ref19.constants,
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
- export var handleClearClick = function handleClearClick(api) {
491
- return function (event) {
492
- api.deleteSelected(event);
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
- export var doDestroy = function doDestroy(refs) {
496
- return function () {
497
- refs.popper && refs.popper.doDestroy();
498
- };
393
+ const managePlaceholder = ({ refs, state }) => () => {
394
+ if (state.currentPlaceholder !== "") {
395
+ state.currentPlaceholder = refs.input.value ? "" : state.cachedPlaceHolder;
396
+ }
499
397
  };
500
- export var handleClose = function handleClose(state) {
501
- return function () {
502
- state.visible = false;
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
- export var toggleLastOptionHitState = function toggleLastOptionHitState(_ref20) {
506
- var state = _ref20.state;
507
- return function (hit) {
508
- if (!Array.isArray(state.selected)) {
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
- var option = state.selected[state.selected.length - 1];
512
- if (!option) {
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
- var hitTarget = option.state || option;
516
- if (hit === true || hit === false) {
517
- hitTarget.hitState = hit;
518
- return hit;
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
- hitTarget.hitState = !hitTarget.hitState;
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
- export var managePlaceholder = function managePlaceholder(_ref22) {
549
- var refs = _ref22.refs,
550
- state = _ref22.state;
551
- return function () {
552
- if (state.currentPlaceholder !== '') {
553
- state.currentPlaceholder = refs.input.value ? '' : state.cachedPlaceHolder;
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
- export var resetInputState = function resetInputState(_ref23) {
558
- var api = _ref23.api,
559
- refs = _ref23.refs,
560
- state = _ref23.state;
561
- return function (event) {
562
- if (event.keyCode !== 8) {
563
- api.toggleLastOptionHitState(false);
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
- state.inputLength = refs.input.value.length * 15 + 20;
566
- api.resetInputHeight();
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
- nextTick(function () {
580
- if (!refs.reference) {
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
- state.isSilentBlur = byClick;
664
- api.setSoftFocus();
665
- if (state.visible) {
666
- return;
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
- nextTick(function () {
669
- api.scrollToOption(option);
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
- export var setSoftFocus = function setSoftFocus(_ref27) {
674
- var refs = _ref27.refs,
675
- state = _ref27.state;
676
- return function () {
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
- export var getValueIndex = function getValueIndex(props) {
683
- return function () {
684
- var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
685
- var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
686
- var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
687
- if (!isObject) {
688
- return arr.indexOf(value);
689
- } else {
690
- var valueKey = props.valueKey;
691
- var index = -1;
692
- arr.some(function (item, i) {
693
- if (getObj(item, valueKey) === getObj(value, valueKey)) {
694
- index = i;
695
- return true;
696
- }
697
- return false;
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
- export var toggleMenu = function toggleMenu(_ref28) {
704
- var refs = _ref28.refs,
705
- state = _ref28.state,
706
- props = _ref28.props;
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
- if (state.softFocus && refs.reference) {
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
- export var selectOption = function selectOption(_ref29) {
722
- var api = _ref29.api,
723
- state = _ref29.state,
724
- props = _ref29.props;
725
- return function () {
726
- if (!state.visible || props.hideDrop) {
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
- export var deleteSelected = function deleteSelected(_ref30) {
736
- var api = _ref30.api,
737
- constants = _ref30.constants,
738
- emit = _ref30.emit,
739
- props = _ref30.props,
740
- vm = _ref30.vm,
741
- state = _ref30.state;
742
- return function (event) {
743
- event.stopPropagation();
744
- var value = props.multiple ? [] : '';
745
- var refs = vm.$refs;
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
- state.selected = {};
748
- state.selectedLabel = '';
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
- state.selectedLabel = '';
753
- refs.selectGrid.clearRadioRow();
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
- state.showTip = false;
756
- emit('update:modelValue', value);
579
+ emit("update:modelValue", isTree ? treeValue : value);
757
580
  api.emitChange(value);
758
- state.visible = false;
759
- emit('clear');
760
- };
581
+ emit(constants.EVENT_NAME.removeTag, tag[props.valueField]);
582
+ }
583
+ event.stopPropagation();
761
584
  };
762
- export var deleteTag = function deleteTag(_ref31) {
763
- var api = _ref31.api,
764
- constants = _ref31.constants,
765
- emit = _ref31.emit,
766
- props = _ref31.props,
767
- state = _ref31.state,
768
- vm = _ref31.vm;
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
- if (index > -1 && !state.selectDisabled) {
789
- var value = props.modelValue.slice();
790
- value.splice(index, 1);
791
- if (props.renderType === constants.TYPE.Tree) {
792
- props.treeOp.checkStrictly && treeValue.push.apply(treeValue, _toConsumableArray(value));
793
- refs.selectTree.setCheckedKeys(treeValue);
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
- export var onOptionDestroy = function onOptionDestroy(state) {
832
- return function (index) {
833
- if (index > -1) {
834
- state.optionsCount--;
835
- state.filteredOptionsCount--;
836
- state.options.splice(index, 1);
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
- export var resetInputWidth = function resetInputWidth(_ref33) {
841
- var refs = _ref33.refs,
842
- state = _ref33.state;
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
- export var handleResize = function handleResize(_ref34) {
849
- var api = _ref34.api,
850
- props = _ref34.props;
851
- return function () {
852
- api.resetInputWidth();
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
- export var checkDefaultFirstOption = function checkDefaultFirstOption(state) {
859
- return function () {
860
- state.hoverIndex = -1;
861
- var hasCreated = false;
862
- for (var i = state.options.length - 1; i >= 0; i--) {
863
- if (state.options[i].created) {
864
- hasCreated = true;
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
- if (hasCreated) {
870
- return;
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
- export var getValueKey = function getValueKey(props) {
889
- return function (item) {
890
- if (Object.prototype.toString.call(item.value).toLowerCase() !== '[object object]') {
891
- return item.value;
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
- export var navigateOptions = function navigateOptions(_ref35) {
897
- var api = _ref35.api,
898
- nextTick = _ref35.nextTick,
899
- state = _ref35.state;
900
- return function (direction) {
901
- var len = state.options.length;
902
- if (!state.visible) {
903
- state.visible = true;
904
- return;
905
- }
906
- if (len === 0 || state.filteredOptionsCount === 0) {
907
- return;
908
- }
909
- if (!state.optionsAllDisabled) {
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
- var option = state.options[state.hoverIndex];
922
- if (option.disabled === true || option.groupDisabled === true || !option.visible) {
923
- api.navigateOptions(direction);
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
- export var emptyText = function emptyText(_ref36) {
932
- var I18N = _ref36.I18N,
933
- props = _ref36.props,
934
- state = _ref36.state,
935
- t = _ref36.t;
936
- return function () {
937
- if (props.loading) {
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
- return null;
959
- };
960
- };
961
- var optmzApis = {
962
- exist: function exist(val, multiple) {
963
- return multiple ? Array.isArray(val) && val.length : val;
964
- },
965
- getValueIndex: function getValueIndex(props) {
966
- var options = props.options,
967
- valueField = props.valueField,
968
- modelValue = props.modelValue,
969
- multiple = props.multiple;
970
- var contain = function contain(val, arr) {
971
- return Array.isArray(arr) && ~arr.indexOf(val);
972
- };
973
- var equal = function equal(val, opt) {
974
- return multiple ? contain(opt[valueField], [val]) : opt[valueField] === val;
975
- };
976
- var start = 0;
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
- var lastVal = multiple ? modelValue[modelValue.length - 1] : modelValue;
979
- for (var i = 0; i < options.length; i++) {
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: function getStartIndex(_ref37) {
989
- var props = _ref37.props,
990
- state = _ref37.state;
991
- var options = props.options;
992
- var optimizeOpts = state.optimizeOpts,
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: function getViewStyle(_ref38) {
999
- var props = _ref38.props,
1000
- state = _ref38.state;
1001
- var options = props.options;
1002
- var optimizeOpts = state.optimizeOpts;
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: function getStoreDatas(_ref39) {
1007
- var props = _ref39.props,
1008
- state = _ref39.state;
1009
- var options = props.options,
1010
- valueField = props.valueField,
1011
- modelValue = props.modelValue,
1012
- multiple = props.multiple;
1013
- var datas = state.datas,
1014
- optimizeOpts = state.optimizeOpts,
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: function queryWrap(refs) {
1039
- return refs.scrollbar.$el.querySelector('.tiny-scrollbar__wrap.virtual');
1040
- },
1041
- queryItems: function queryItems(refs) {
1042
- return refs.scrollbar.$el.querySelectorAll('.tiny-select-dropdown__item.virtual');
1043
- },
1044
- createMacro: function createMacro(cb) {
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: function setValueIndex(_ref41) {
1057
- var props = _ref41.props,
1058
- state = _ref41.state;
1059
- return state.optimizeStore.valueIndex = optmzApis.getValueIndex(props);
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
- addScrollListener: function addScrollListener(_ref42) {
1062
- var api = _ref42.api,
1063
- refs = _ref42.refs,
1064
- state = _ref42.state;
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
- removeScrollListener: function removeScrollListener(_ref43) {
1070
- var api = _ref43.api,
1071
- refs = _ref43.refs,
1072
- state = _ref43.state;
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: function natural(val) {
1086
- return val < 0 ? 0 : val;
1087
- },
1088
- updateItems: function updateItems(_ref45) {
1089
- var refs = _ref45.refs,
1090
- state = _ref45.state,
1091
- itemFn = _ref45.itemFn;
1092
- var optimizeOpts = state.optimizeOpts;
1093
- var optionHeight = optimizeOpts.optionHeight;
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: function process(_ref46) {
1102
- var props = _ref46.props,
1103
- start = _ref46.start,
1104
- state = _ref46.state;
1105
- var optimizeStore = state.optimizeStore;
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
- export var watchValue = function watchValue(_ref47) {
1121
- var api = _ref47.api,
1122
- constants = _ref47.constants,
1123
- dispatch = _ref47.dispatch,
1124
- props = _ref47.props,
1125
- refs = _ref47.refs,
1126
- state = _ref47.state;
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.completed && !isEqual(value, oldValue)) {
1145
- dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formChange, value);
808
+ if (state.filterOrSearch && !props.reserveKeyword) {
809
+ props.renderType !== constants.TYPE.Grid && (state.query = "");
810
+ api.handleQueryChange(state.query);
1146
811
  }
1147
- state.optimizeStore.flag && optmzApis.setValueIndex({
1148
- props: props,
1149
- state: state
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
- export var calcOverFlow = function calcOverFlow(_ref48) {
1154
- var refs = _ref48.refs,
1155
- props = _ref48.props,
1156
- state = _ref48.state;
1157
- return function (height) {
1158
- if (!props.multiple || !props.showOverflowTooltip) {
1159
- return;
1160
- }
1161
- state.overflow = false;
1162
- var tagDom = refs.tags;
1163
- var tags = tagDom.querySelectorAll('.tiny-tag');
1164
- if (tags.length) {
1165
- tagDom.scrollTo && tagDom.scrollTo({
1166
- top: 0
1167
- });
1168
- var _tags$0$getBoundingCl = tags[0].getBoundingClientRect(),
1169
- x = _tags$0$getBoundingCl.x,
1170
- width = _tags$0$getBoundingCl.width;
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
- refs.select.style.height = refs.select.style.height || height;
1184
- refs.reference.$el.style.position = 'absolute';
1185
- var inputWidth = refs.select.getBoundingClientRect().width;
1186
- var position = state.visible ? 'absolute' : '';
1187
- state.selectFiexd = {
1188
- height: height,
1189
- position: position,
1190
- width: inputWidth + 'px',
1191
- zIndex: PopupManager.nextZIndex()
1192
- };
1193
- state.inputWidth = inputWidth;
1194
- };
1195
- };
1196
- var postOperOfToVisible = function postOperOfToVisible(_ref49) {
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
- export var toVisible = function toVisible(_ref50) {
1222
- var constants = _ref50.constants,
1223
- state = _ref50.state,
1224
- props = _ref50.props,
1225
- vm = _ref50.vm,
1226
- api = _ref50.api,
1227
- nextTick = _ref50.nextTick;
1228
- return function () {
1229
- var _refs$input2;
1230
- var refs = vm.$refs;
1231
- state.selectEmitter.emit(constants.EVENT_NAME.destroyPopper);
1232
- props.remote && props.dropOnlySearch && (state.showWarper = false);
1233
- (_refs$input2 = refs.input) === null || _refs$input2 === void 0 ? void 0 : _refs$input2.blur();
1234
- state.query = '';
1235
- state.selectedLabel = '';
1236
- state.inputLength = 20;
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.clearSelection();
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
- nextTick(function () {
1331
- state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
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
- api.resetInputHeight();
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
- state.selected.length > 0 && state.selected.forEach(function (item) {
1409
- checkedKey.push(item[props.valueField]);
1410
- });
1411
- return checkedKey;
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
- export var radioChange = function radioChange(_ref58) {
1416
- var emit = _ref58.emit,
1417
- props = _ref58.props,
1418
- state = _ref58.state;
1419
- return function (_ref59) {
1420
- var row = _ref59.row;
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
- export var nodeCheckClick = function nodeCheckClick(_ref61) {
1462
- var emit = _ref61.emit,
1463
- props = _ref61.props;
1464
- return function (data, _ref62) {
1465
- var checkedKeys = _ref62.checkedKeys,
1466
- checkedNodes = _ref62.checkedNodes;
1467
- checkedNodes.forEach(function (node) {
1468
- node.currentLabel = node[props.textField];
1469
- node.value = node[props.valueField];
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
- emit('update:modelValue', checkedKeys);
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
- export var debouncRquest = function debouncRquest(_ref65) {
1494
- var api = _ref65.api,
1495
- state = _ref65.state,
1496
- props = _ref65.props;
1497
- return debounce(props.delay, function () {
1498
- if (state.filterOrSearch && state.query !== state.selectedLabel) {
1499
- state.query = state.selectedLabel;
1500
- api.handleQueryChange(state.query);
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
- export var getChildValue = function getChildValue() {
1505
- return function (data, key) {
1506
- var ids = [];
1507
- var getChild = function getChild(nodes) {
1508
- nodes.forEach(function (node) {
1509
- ids.push(node.data[key]);
1510
- if (node.childNodes.length > 0) {
1511
- getChild(node.childNodes);
1512
- }
1513
- });
1514
- };
1515
- getChild(data);
1516
- return ids;
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
- export var watchPropsOption = function watchPropsOption(_ref66) {
1520
- var constants = _ref66.constants,
1521
- parent = _ref66.parent,
1522
- props = _ref66.props,
1523
- state = _ref66.state;
1524
- return function () {
1525
- var renderType = props.renderType;
1526
- var _props$treeOp = props.treeOp,
1527
- key = _props$treeOp.key,
1528
- parentKey = _props$treeOp.parentKey;
1529
- var dataset = {
1530
- dataset: props.options || props.dataset,
1531
- service: parent.$service,
1532
- tree: {
1533
- key: key,
1534
- parentKey: parentKey
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
- export var buildSelectConfig = function buildSelectConfig(_ref67) {
1554
- var props = _ref67.props,
1555
- state = _ref67.state;
1556
- return function () {
1557
- var checkRowKeys = state.gridCheckedData;
1558
- var selectConfig = props.selectConfig;
1559
- return _objectSpread(_objectSpread({}, selectConfig), {}, {
1560
- checkRowKeys: checkRowKeys
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
- export var buildRadioConfig = function buildRadioConfig(_ref68) {
1565
- var props = _ref68.props,
1566
- state = _ref68.state;
1567
- return function () {
1568
- var checkRowKey = state.currentKey;
1569
- var highlight = true;
1570
- var radioConfig = props.radioConfig;
1571
- return _objectSpread(_objectSpread({}, radioConfig), {
1572
- checkRowKey: checkRowKey,
1573
- highlight: highlight
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
- export var onMouseenterNative = function onMouseenterNative(_ref69) {
1578
- var state = _ref69.state;
1579
- return function () {
1580
- state.inputHovering = true;
1581
- if (state.searchSingleCopy && state.selectedLabel) {
1582
- state.softFocus = true;
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
- export var onMouseleaveNative = function onMouseleaveNative(_ref70) {
1587
- var state = _ref70.state;
1588
- return function () {
1589
- state.inputHovering = false;
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
- export var onCopying = function onCopying(_ref71) {
1596
- var state = _ref71.state,
1597
- refs = _ref71.refs;
1598
- return function () {
1599
- return state.searchSingleCopy && state.selectedLabel && refs.reference && refs.reference.hasSelection && refs.reference.hasSelection();
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
- export var watchHoverIndex = function watchHoverIndex(_ref72) {
1603
- var state = _ref72.state;
1604
- return function (value) {
1605
- if (typeof value === 'number' && value > -1) {
1606
- state.hoverOption = state.options[value] || {};
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
- export var mounted = function mounted(_ref73) {
1616
- var api = _ref73.api,
1617
- parent = _ref73.parent,
1618
- state = _ref73.state,
1619
- props = _ref73.props,
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
- export var unMount = function unMount(_ref74) {
1656
- var api = _ref74.api,
1657
- parent = _ref74.parent,
1658
- refs = _ref74.refs,
1659
- state = _ref74.state;
1660
- return function () {
1661
- if (parent.$el && api.handleResize) {
1662
- removeResizeListener(parent.$el, api.handleResize);
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
- removeResizeListener(refs.tags, api.resetInputHeight);
1147
+ addResizeListener(refs.tags, api.resetInputHeight);
1666
1148
  }
1667
- state.popperElm = null;
1668
- state.optimizeStore.flag && optmzApis.removeScrollListener({
1669
- api: api,
1670
- refs: refs,
1671
- state: state
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
- export var computeOptimizeOpts = function computeOptimizeOpts(_ref75) {
1676
- var props = _ref75.props,
1677
- state = _ref75.state;
1678
- return function () {
1679
- var optimization = props.optimization;
1680
- var baseOpts = {
1681
- gt: 20,
1682
- rSize: 10,
1683
- optionHeight: 30,
1684
- limit: 20
1685
- };
1686
- var optOpts;
1687
- if (optimization) {
1688
- if (typeof optimization === 'boolean') {
1689
- optOpts = extend(true, {}, baseOpts);
1690
- } else {
1691
- optOpts = extend(true, {}, baseOpts, optimization);
1692
- }
1693
- optOpts.virtualScroll = optOpts.gt > 0 && optOpts.gt <= state.datas.length;
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
- export var watchOptimizeOpts = function watchOptimizeOpts(_ref76) {
1699
- var api = _ref76.api,
1700
- props = _ref76.props,
1701
- refs = _ref76.refs,
1702
- state = _ref76.state;
1703
- return function () {
1704
- var optimizeOpts = state.optimizeOpts,
1705
- optimizeStore = state.optimizeStore;
1706
- if (optimizeOpts) {
1707
- var virtualScroll = optimizeOpts.virtualScroll,
1708
- optionHeight = optimizeOpts.optionHeight;
1709
- optimizeStore.flag = virtualScroll;
1710
- if (virtualScroll) {
1711
- optimizeStore.viewStyle = optmzApis.getViewStyle({
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
- export var getScrollListener = function getScrollListener(_ref77) {
1740
- var props = _ref77.props,
1741
- refs = _ref77.refs,
1742
- state = _ref77.state;
1743
- var listener = function listener() {
1744
- var options = props.options;
1745
- var optimizeOpts = state.optimizeOpts;
1746
- var optionHeight = optimizeOpts.optionHeight;
1747
- var viewHeight = optionHeight * options.length;
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
- props: props,
1756
- start: start,
1757
- state: 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
- var optimization = props.optimization;
1772
- var delay = optmzApis.natural((optimization && _typeof(optimization) === 'object' ? optimization.delay : null) || 10);
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
- export var computeCollapseTags = function computeCollapseTags(props) {
1776
- return function () {
1777
- return props.collapseTags;
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
- };