@94ai/nf-virtual-select 3.3.45 → 3.3.51

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.
@@ -324,6 +324,7 @@ declare const _default: import("vue").DefineComponent<{
324
324
  value: string | number | unknown[];
325
325
  showTip: boolean;
326
326
  tag: string;
327
+ multiple: boolean;
327
328
  offset: number;
328
329
  start: number;
329
330
  pageMode: boolean;
@@ -352,7 +353,6 @@ declare const _default: import("vue").DefineComponent<{
352
353
  virtualList: boolean;
353
354
  options: unknown[];
354
355
  placeholder: string;
355
- multiple: boolean;
356
356
  width: string;
357
357
  maxWidth: string;
358
358
  height: string;
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  defineComponent,
4
4
  } from 'vue-demi'
5
+ import Sortable from 'sortablejs'
5
6
 
6
7
  export default defineComponent({
7
8
  name: 'nf-virtual-select-container',
@@ -63,6 +64,32 @@ export default defineComponent({
63
64
  </Tag>
64
65
  );
65
66
  },
67
+ mounted() {
68
+ if (this.config.multiple && !this.config['collapse-tags']) {
69
+ this.setSort()
70
+ }
71
+ },
72
+ methods: {
73
+ setSort() {
74
+ const elSelectRef = this.$refs.nfVirtualSelect as any
75
+ const el = elSelectRef?.$el?.querySelectorAll('.el-select__tags > span')[0]
76
+ if (el) {
77
+ Sortable.create(el, {
78
+ ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
79
+ setData: function(dataTransfer) {
80
+ dataTransfer.setData('Text', '')
81
+ // to avoid Firefox bug
82
+ // Detail see : https://github.com/RubaXa/Sortable/issues/1012
83
+ },
84
+ onEnd: evt => {
85
+ const valueChange = this.value as any[]
86
+ const targetRow = valueChange.splice(evt.oldIndex, 1)[0]
87
+ valueChange.splice(evt.newIndex, 0, targetRow)
88
+ }
89
+ })
90
+ }
91
+ }
92
+ }
66
93
  });
67
94
  </script>
68
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-virtual-select",
3
- "version": "3.3.45",
3
+ "version": "3.3.51",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>,DESKTOP-1EDDQ79\\dev026 <liuxiangxiang@94ai.com>",
@@ -14,9 +14,10 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/common-utils": "^3.3.45",
18
- "@94ai/nf-theme-chalk": "^3.3.45",
17
+ "@94ai/common-utils": "^3.3.51",
18
+ "@94ai/nf-theme-chalk": "^3.3.51",
19
19
  "lodash-es": "^4.17.21",
20
+ "sortablejs": "^1.15.2",
20
21
  "vue-demi": "^0.14.5",
21
22
  "vue-virtual-scroll-list": "^2.3.5"
22
23
  },
@@ -33,5 +34,5 @@
33
34
  "types": "lib/index.d.ts",
34
35
  "main": "lib/nf-virtual-select.cjs.js",
35
36
  "module": "lib/nf-virtual-select.esm-bundler.js",
36
- "gitHead": "dff35e1dac073742a91b656449c9d4ed833a6258"
37
+ "gitHead": "d5b493e6b5681b244f3f182b4ffb99f5dd24d63c"
37
38
  }