@web-utils/component 2.0.9 → 2.0.11

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 (172) hide show
  1. package/dist/chunks/3d28cc08.js +57 -0
  2. package/dist/chunks/{41a066be.js → 44b78389.js} +8 -8
  3. package/dist/chunks/5d33812d.js +147 -0
  4. package/dist/chunks/{61ad06b2.js → 822300f3.js} +3 -3
  5. package/dist/chunks/9d848bf6.js +99 -0
  6. package/dist/chunks/a0bb327b.js +96 -0
  7. package/dist/chunks/a8891d2c.js +30 -0
  8. package/dist/chunks/c69d5628.js +248 -0
  9. package/dist/chunks/de9fe802.js +24 -0
  10. package/dist/chunks/{5a78e0db.js → e1939731.js} +6 -5
  11. package/dist/components/address-input/index.js +56 -43
  12. package/dist/components/address-input/style.css +15 -1
  13. package/dist/components/aside-menu/index.js +36 -30
  14. package/dist/components/aside-menu/style.css +9 -1
  15. package/dist/components/awesome-button/index.js +35 -32
  16. package/dist/components/base.css +66 -1
  17. package/dist/components/capsule-tab/index.js +33 -27
  18. package/dist/components/capsule-tab/style.css +32 -1
  19. package/dist/components/chunk-file-uploader/index.js +88 -54
  20. package/dist/components/chunk-file-uploader/style.css +4 -1
  21. package/dist/components/chunk-file-uploader-button/index.js +31 -25
  22. package/dist/components/chunk-file-uploader-button/style.css +17 -1
  23. package/dist/components/chunk-file-uploader-drop/index.js +42 -28
  24. package/dist/components/chunk-file-uploader-drop/style.css +12 -1
  25. package/dist/components/chunk-file-uploader-file/index.js +212 -134
  26. package/dist/components/chunk-file-uploader-file/style.css +125 -1
  27. package/dist/components/chunk-file-uploader-files/index.js +34 -28
  28. package/dist/components/chunk-file-uploader-files/style.css +9 -1
  29. package/dist/components/chunk-file-uploader-list/index.js +35 -29
  30. package/dist/components/chunk-file-uploader-list/style.css +9 -1
  31. package/dist/components/chunk-file-uploader-un-support/index.js +38 -30
  32. package/dist/components/chunk-file-uploader-un-support/style.css +6 -1
  33. package/dist/components/code-mirror-editor/index.js +181 -153
  34. package/dist/components/code-mirror-editor/style.css +17 -1
  35. package/dist/components/color-picker/index.js +68 -49
  36. package/dist/components/confirm-button/index.js +21 -19
  37. package/dist/components/confirmable/index.js +19 -18
  38. package/dist/components/context-menu/index.js +130 -108
  39. package/dist/components/context-menu/style.css +88 -1
  40. package/dist/components/custom-scrollbar/index.js +67 -49
  41. package/dist/components/data-table-picker/index.js +81 -62
  42. package/dist/components/dynamic-table/index.js +113 -89
  43. package/dist/components/dynamic-table/style.css +30 -1
  44. package/dist/components/e-charts/index.js +201 -120
  45. package/dist/components/e-charts/style.css +10 -1
  46. package/dist/components/editable-progress/index.js +93 -60
  47. package/dist/components/editable-progress/style.css +37 -1
  48. package/dist/components/editable-tree/index.js +638 -423
  49. package/dist/components/editable-tree/style.css +82 -1
  50. package/dist/components/egd-collapse/index.js +46 -33
  51. package/dist/components/egd-collapse-item/index.js +76 -60
  52. package/dist/components/element-dialog/index.js +147 -95
  53. package/dist/components/element-dialog/style.css +102 -1
  54. package/dist/components/empty-view/index.js +34 -28
  55. package/dist/components/empty-view/style.css +17 -1
  56. package/dist/components/error-view/index.js +32 -26
  57. package/dist/components/error-view/style.css +17 -1
  58. package/dist/components/flex-column/index.js +40 -25
  59. package/dist/components/flex-item/index.js +57 -29
  60. package/dist/components/flex-row/index.js +40 -25
  61. package/dist/components/flex-scroller/index.js +32 -26
  62. package/dist/components/flex-scroller/style.css +20 -1
  63. package/dist/components/form-button/index.js +38 -34
  64. package/dist/components/form-cascader/index.js +81 -71
  65. package/dist/components/form-checkbox-group/index.js +113 -88
  66. package/dist/components/form-checkbox-group/style.css +51 -1
  67. package/dist/components/form-date-picker/index.js +132 -70
  68. package/dist/components/form-holder/index.js +39 -32
  69. package/dist/components/form-input/index.js +62 -56
  70. package/dist/components/form-input-email/index.js +60 -48
  71. package/dist/components/form-input-id-card/index.js +59 -53
  72. package/dist/components/form-input-number/index.js +68 -61
  73. package/dist/components/form-input-number/style.css +12 -1
  74. package/dist/components/form-input-phone-number/index.js +55 -49
  75. package/dist/components/form-input-time/index.js +59 -53
  76. package/dist/components/form-item/index.js +123 -80
  77. package/dist/components/form-item/style.css +11 -1
  78. package/dist/components/form-item-config-provider/index.js +26 -25
  79. package/dist/components/form-item-group/index.js +111 -85
  80. package/dist/components/form-item-group/style.css +30 -1
  81. package/dist/components/form-radio-group/index.js +104 -85
  82. package/dist/components/form-radio-group/style.css +53 -1
  83. package/dist/components/form-select/index.js +91 -76
  84. package/dist/components/form-switch/index.js +57 -51
  85. package/dist/components/form-textarea/index.js +57 -51
  86. package/dist/components/form-view/index.js +232 -165
  87. package/dist/components/form-view/style.css +158 -1
  88. package/dist/components/guide-steps/index.js +58 -44
  89. package/dist/components/guide-steps/style.css +34 -1
  90. package/dist/components/icon-card/index.js +35 -29
  91. package/dist/components/icon-card/style.css +56 -1
  92. package/dist/components/iframe-window/index.js +35 -29
  93. package/dist/components/iframe-window/style.css +20 -1
  94. package/dist/components/image-viewer/index.js +66 -48
  95. package/dist/components/image-viewer/style.css +21 -1
  96. package/dist/components/input-number/index.js +193 -127
  97. package/dist/components/input-number/style.css +15 -1
  98. package/dist/components/input-number-range/index.js +57 -45
  99. package/dist/components/input-number-range/style.css +12 -1
  100. package/dist/components/j-s-x-component/index.js +4 -4
  101. package/dist/components/keep-view-alive/index.js +120 -73
  102. package/dist/components/loading-view/index.js +32 -26
  103. package/dist/components/loading-view/style.css +17 -1
  104. package/dist/components/nav-bar/index.js +37 -27
  105. package/dist/components/nav-bar/style.css +17 -1
  106. package/dist/components/not-implement/index.js +31 -23
  107. package/dist/components/not-implement/style.css +15 -1
  108. package/dist/components/page/index.js +28 -22
  109. package/dist/components/page/style.css +12 -1
  110. package/dist/components/page-header/index.js +36 -30
  111. package/dist/components/page-header/style.css +14 -1
  112. package/dist/components/page-index/index.js +83 -62
  113. package/dist/components/page-index/style.css +23 -1
  114. package/dist/components/page-index-top/index.js +68 -53
  115. package/dist/components/page-skeleton/index.js +37 -31
  116. package/dist/components/page-skeleton/style.css +23 -1
  117. package/dist/components/page-skeleton-new/index.js +48 -42
  118. package/dist/components/page-skeleton-new/style.css +42 -1
  119. package/dist/components/pageable-table/index.js +253 -186
  120. package/dist/components/pageable-table/style.css +72 -1
  121. package/dist/components/pageable-view/index.js +199 -129
  122. package/dist/components/pageable-view/style.css +69 -1
  123. package/dist/components/photo-swipe/index.js +151 -110
  124. package/dist/components/photo-swipe/style.css +20 -1
  125. package/dist/components/resize-observer/index.js +68 -34
  126. package/dist/components/resize-observer/style.css +31 -1
  127. package/dist/components/search-popover/index.js +211 -153
  128. package/dist/components/search-popover/style.css +93 -1
  129. package/dist/components/sign-panel/index.js +142 -92
  130. package/dist/components/sign-panel/style.css +97 -1
  131. package/dist/components/split-pane/index.js +162 -101
  132. package/dist/components/split-pane/style.css +100 -1
  133. package/dist/components/stateful/index.js +34 -31
  134. package/dist/components/stateful/style.css +33 -1
  135. package/dist/components/static-pageable-table/index.js +44 -37
  136. package/dist/components/static-pageable-table/style.css +9 -1
  137. package/dist/components/swiper/index.js +150 -85
  138. package/dist/components/swiper/style.css +43 -1
  139. package/dist/components/tab/index.js +72 -54
  140. package/dist/components/tab/style.css +122 -1
  141. package/dist/components/tab-item/index.js +35 -30
  142. package/dist/components/table-column/index.js +32 -30
  143. package/dist/components/table-view/index.js +227 -156
  144. package/dist/components/table-view/style.css +95 -1
  145. package/dist/components/tag-render/index.js +58 -44
  146. package/dist/components/tag-render/style.css +33 -1
  147. package/dist/components/tinymce-editor/index.js +95 -79
  148. package/dist/components/tinymce-editor/style.css +43 -1
  149. package/dist/components/tinymce-wrapper/index.js +121 -92
  150. package/dist/components/tinymce-wrapper/style.css +36 -1
  151. package/dist/components/toolbar/index.js +84 -63
  152. package/dist/components/toolbar/style.css +39 -1
  153. package/dist/components/toolbar-button/index.js +48 -41
  154. package/dist/components/toolbar-button/style.css +21 -1
  155. package/dist/components/trigger/index.js +36 -29
  156. package/dist/components/vue-tags-input/index.js +308 -188
  157. package/dist/components/vue-tags-input/style.css +682 -1
  158. package/dist/components/watermark/index.js +37 -25
  159. package/dist/components/watermark/style.css +11 -1
  160. package/dist/components/x-dialog/index.js +93 -67
  161. package/dist/components/x-dialog/style.css +15 -1
  162. package/dist/index.css +1105 -193
  163. package/dist/index.es.js +7242 -4789
  164. package/package.json +2 -1
  165. package/web-types.json +1 -1
  166. package/dist/chunks/3a79781b.js +0 -75
  167. package/dist/chunks/5d4282fb.js +0 -30
  168. package/dist/chunks/76680a03.js +0 -24
  169. package/dist/chunks/8c0142e0.js +0 -81
  170. package/dist/chunks/97652d86.js +0 -26
  171. package/dist/chunks/b4acd3a6.js +0 -126
  172. package/dist/chunks/f71045fc.js +0 -184
@@ -1,162 +1,186 @@
1
- import { n as l } from "../../chunks/5d4282fb.js";
2
- var h = function() {
3
- var e = this, s = e.$createElement, a = e._self._c || s;
4
- return a("div", {
1
+ import { n as normalizeComponent } from "../../chunks/3d28cc08.js";
2
+ var render = function() {
3
+ var _vm = this;
4
+ var _h = _vm.$createElement;
5
+ var _c = _vm._self._c || _h;
6
+ return _c("div", {
5
7
  staticClass: "tags-input-root"
6
- }, [a("div", {
7
- class: `${e.wrapperClass} tags-input`
8
- }, [e._l(e.tags, function(t, i) {
9
- return a("span", {
10
- key: i,
8
+ }, [_c("div", {
9
+ class: `${_vm.wrapperClass} tags-input`
10
+ }, [_vm._l(_vm.tags, function(tag, index) {
11
+ return _c("span", {
12
+ key: index,
11
13
  staticClass: "el-tag el-tag--medium el-tag--light"
12
- }, [a("span", {
14
+ }, [_c("span", {
13
15
  domProps: {
14
- innerHTML: e._s(t.value)
16
+ "innerHTML": _vm._s(tag.value)
15
17
  }
16
- }), a("i", {
18
+ }), _c("i", {
17
19
  staticClass: "tags-input-remove ov",
18
20
  attrs: {
19
- href: "#"
21
+ "href": "#"
20
22
  },
21
23
  on: {
22
- click: function(n) {
23
- return n.preventDefault(), e.removeTag(i);
24
+ "click": function($event) {
25
+ $event.preventDefault();
26
+ return _vm.removeTag(index);
24
27
  }
25
28
  }
26
29
  })]);
27
- }), a("input", {
30
+ }), _c("input", {
28
31
  directives: [{
29
32
  name: "model",
30
33
  rawName: "v-model",
31
- value: e.input,
34
+ value: _vm.input,
32
35
  expression: "input"
33
36
  }],
34
37
  ref: "taginput",
35
38
  staticStyle: {
36
- height: "28px",
39
+ "height": "28px",
37
40
  "margin-top": "5px",
38
41
  "line-height": "28px"
39
42
  },
40
43
  attrs: {
41
- type: "text",
42
- placeholder: e.placeholder
44
+ "type": "text",
45
+ "placeholder": _vm.placeholder
43
46
  },
44
47
  domProps: {
45
- value: e.input
48
+ "value": _vm.input
46
49
  },
47
50
  on: {
48
- keydown: [function(t) {
49
- return !t.type.indexOf("key") && e._k(t.keyCode, "enter", 13, t.key, "Enter") ? null : (t.preventDefault(), e.tagFromInput(!1));
50
- }, function(t) {
51
- return !t.type.indexOf("key") && t.keyCode !== 8 ? null : e.removeLastTag.apply(null, arguments);
52
- }, function(t) {
53
- return !t.type.indexOf("key") && e._k(t.keyCode, "down", 40, t.key, ["Down", "ArrowDown"]) ? null : e.nextSearchResult.apply(null, arguments);
54
- }, function(t) {
55
- return !t.type.indexOf("key") && e._k(t.keyCode, "up", 38, t.key, ["Up", "ArrowUp"]) ? null : e.prevSearchResult.apply(null, arguments);
56
- }, e.onKeyDown],
57
- keyup: [e.onKeyUp, function(t) {
58
- return !t.type.indexOf("key") && e._k(t.keyCode, "esc", 27, t.key, ["Esc", "Escape"]) ? null : e.clearSearchResults.apply(null, arguments);
51
+ "keydown": [function($event) {
52
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter"))
53
+ return null;
54
+ $event.preventDefault();
55
+ return _vm.tagFromInput(false);
56
+ }, function($event) {
57
+ if (!$event.type.indexOf("key") && $event.keyCode !== 8)
58
+ return null;
59
+ return _vm.removeLastTag.apply(null, arguments);
60
+ }, function($event) {
61
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "down", 40, $event.key, ["Down", "ArrowDown"]))
62
+ return null;
63
+ return _vm.nextSearchResult.apply(null, arguments);
64
+ }, function($event) {
65
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"]))
66
+ return null;
67
+ return _vm.prevSearchResult.apply(null, arguments);
68
+ }, _vm.onKeyDown],
69
+ "keyup": [_vm.onKeyUp, function($event) {
70
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "esc", 27, $event.key, ["Esc", "Escape"]))
71
+ return null;
72
+ return _vm.clearSearchResults.apply(null, arguments);
59
73
  }],
60
- focus: e.onFocus,
61
- blur: e.onBlur,
62
- value: e.tags,
63
- input: function(t) {
64
- t.target.composing || (e.input = t.target.value);
74
+ "focus": _vm.onFocus,
75
+ "blur": _vm.onBlur,
76
+ "value": _vm.tags,
77
+ "input": function($event) {
78
+ if ($event.target.composing)
79
+ return;
80
+ _vm.input = $event.target.value;
65
81
  }
66
82
  }
67
- }), e.elementId ? a("input", {
83
+ }), _vm.elementId ? _c("input", {
68
84
  directives: [{
69
85
  name: "model",
70
86
  rawName: "v-model",
71
- value: e.hiddenInput,
87
+ value: _vm.hiddenInput,
72
88
  expression: "hiddenInput"
73
89
  }],
74
90
  attrs: {
75
- id: e.elementId,
76
- type: "hidden",
77
- name: e.elementId
91
+ "id": _vm.elementId,
92
+ "type": "hidden",
93
+ "name": _vm.elementId
78
94
  },
79
95
  domProps: {
80
- value: e.hiddenInput
96
+ "value": _vm.hiddenInput
81
97
  },
82
98
  on: {
83
- input: function(t) {
84
- t.target.composing || (e.hiddenInput = t.target.value);
99
+ "input": function($event) {
100
+ if ($event.target.composing)
101
+ return;
102
+ _vm.hiddenInput = $event.target.value;
85
103
  }
86
104
  }
87
- }) : e._e()], 2), a("div", {
105
+ }) : _vm._e()], 2), _c("div", {
88
106
  directives: [{
89
107
  name: "show",
90
108
  rawName: "v-show",
91
- value: e.searchResults.length,
109
+ value: _vm.searchResults.length,
92
110
  expression: "searchResults.length"
93
111
  }]
94
- }, [e.typeaheadStyle === "badges" ? a("p", {
95
- class: `typeahead-${e.typeaheadStyle}`
96
- }, [e.typeaheadHideDiscard ? e._e() : a("span", {
112
+ }, [_vm.typeaheadStyle === "badges" ? _c("p", {
113
+ class: `typeahead-${_vm.typeaheadStyle}`
114
+ }, [!_vm.typeaheadHideDiscard ? _c("span", {
97
115
  staticClass: "tags-input-badge typeahead-hide-btn tags-input-typeahead-item-default",
98
116
  domProps: {
99
- textContent: e._s(e.discardSearchText)
117
+ "textContent": _vm._s(_vm.discardSearchText)
100
118
  },
101
119
  on: {
102
- click: function(t) {
103
- return t.preventDefault(), e.clearSearchResults.apply(null, arguments);
120
+ "click": function($event) {
121
+ $event.preventDefault();
122
+ return _vm.clearSearchResults.apply(null, arguments);
104
123
  }
105
124
  }
106
- }), e._l(e.searchResults, function(t, i) {
107
- return a("span", {
108
- key: i,
125
+ }) : _vm._e(), _vm._l(_vm.searchResults, function(tag, index) {
126
+ return _c("span", {
127
+ key: index,
109
128
  staticClass: "tags-input-badge",
110
129
  class: {
111
- "tags-input-typeahead-item-default": i != e.searchSelection,
112
- "tags-input-typeahead-item-highlighted-default": i == e.searchSelection
130
+ "tags-input-typeahead-item-default": index != _vm.searchSelection,
131
+ "tags-input-typeahead-item-highlighted-default": index == _vm.searchSelection
113
132
  },
114
133
  domProps: {
115
- innerHTML: e._s(t.value)
134
+ "innerHTML": _vm._s(tag.value)
116
135
  },
117
136
  on: {
118
- mouseover: function(n) {
119
- e.searchSelection = i;
137
+ "mouseover": function($event) {
138
+ _vm.searchSelection = index;
120
139
  },
121
- mousedown: function(n) {
122
- return n.preventDefault(), e.tagFromSearchOnClick(t);
140
+ "mousedown": function($event) {
141
+ $event.preventDefault();
142
+ return _vm.tagFromSearchOnClick(tag);
123
143
  }
124
144
  }
125
145
  });
126
- })], 2) : e.typeaheadStyle === "dropdown" ? a("ul", {
127
- class: `typeahead-${e.typeaheadStyle}`
128
- }, [e.typeaheadHideDiscard ? e._e() : a("li", {
146
+ })], 2) : _vm.typeaheadStyle === "dropdown" ? _c("ul", {
147
+ class: `typeahead-${_vm.typeaheadStyle}`
148
+ }, [!_vm.typeaheadHideDiscard ? _c("li", {
129
149
  staticClass: "tags-input-typeahead-item-default typeahead-hide-btn",
130
150
  domProps: {
131
- textContent: e._s(e.discardSearchText)
151
+ "textContent": _vm._s(_vm.discardSearchText)
132
152
  },
133
153
  on: {
134
- mousedown: function(t) {
135
- return t.preventDefault(), e.clearSearchResults.apply(null, arguments);
154
+ "mousedown": function($event) {
155
+ $event.preventDefault();
156
+ return _vm.clearSearchResults.apply(null, arguments);
136
157
  }
137
158
  }
138
- }), e._l(e.searchResults, function(t, i) {
139
- return a("li", {
140
- key: i,
159
+ }) : _vm._e(), _vm._l(_vm.searchResults, function(tag, index) {
160
+ return _c("li", {
161
+ key: index,
141
162
  class: {
142
- "tags-input-typeahead-item-default": i != e.searchSelection,
143
- "tags-input-typeahead-item-highlighted-default": i == e.searchSelection
163
+ "tags-input-typeahead-item-default": index != _vm.searchSelection,
164
+ "tags-input-typeahead-item-highlighted-default": index == _vm.searchSelection
144
165
  },
145
166
  domProps: {
146
- innerHTML: e._s(t.value)
167
+ "innerHTML": _vm._s(tag.value)
147
168
  },
148
169
  on: {
149
- mouseover: function(n) {
150
- e.searchSelection = i;
170
+ "mouseover": function($event) {
171
+ _vm.searchSelection = index;
151
172
  },
152
- mousedown: function(n) {
153
- return n.preventDefault(), e.tagFromSearchOnClick(t);
173
+ "mousedown": function($event) {
174
+ $event.preventDefault();
175
+ return _vm.tagFromSearchOnClick(tag);
154
176
  }
155
177
  }
156
178
  });
157
- })], 2) : e._e()])]);
158
- }, u = [];
159
- const o = {
179
+ })], 2) : _vm._e()])]);
180
+ };
181
+ var staticRenderFns = [];
182
+ const VueTagsInput_vue_vue_type_style_index_0_lang = "";
183
+ const __vue2_script = {
160
184
  name: "VueTagsInput",
161
185
  props: {
162
186
  elementId: {
@@ -164,15 +188,19 @@ const o = {
164
188
  },
165
189
  existingTags: {
166
190
  type: Array,
167
- default: () => []
191
+ default: () => {
192
+ return [];
193
+ }
168
194
  },
169
195
  value: {
170
196
  type: Array,
171
- default: () => []
197
+ default: () => {
198
+ return [];
199
+ }
172
200
  },
173
201
  typeahead: {
174
202
  type: Boolean,
175
- default: !1
203
+ default: false
176
204
  },
177
205
  typeaheadStyle: {
178
206
  type: String,
@@ -188,11 +216,11 @@ const o = {
188
216
  },
189
217
  typeaheadAlwaysShow: {
190
218
  type: Boolean,
191
- default: !1
219
+ default: false
192
220
  },
193
221
  typeaheadHideDiscard: {
194
222
  type: Boolean,
195
- default: !1
223
+ default: false
196
224
  },
197
225
  placeholder: {
198
226
  type: String,
@@ -208,31 +236,31 @@ const o = {
208
236
  },
209
237
  onlyExistingTags: {
210
238
  type: Boolean,
211
- default: !1
239
+ default: false
212
240
  },
213
241
  deleteOnBackspace: {
214
242
  type: Boolean,
215
- default: !0
243
+ default: true
216
244
  },
217
245
  allowDuplicates: {
218
246
  type: Boolean,
219
- default: !1
247
+ default: false
220
248
  },
221
249
  validate: {
222
250
  type: Function,
223
- default: () => !0
251
+ default: () => true
224
252
  },
225
253
  addTagsOnComma: {
226
254
  type: Boolean,
227
- default: !1
255
+ default: false
228
256
  },
229
257
  addTagsOnSpace: {
230
258
  type: Boolean,
231
- default: !1
259
+ default: false
232
260
  },
233
261
  addTagsOnBlur: {
234
262
  type: Boolean,
235
- default: !1
263
+ default: false
236
264
  },
237
265
  wrapperClass: {
238
266
  type: String,
@@ -240,19 +268,19 @@ const o = {
240
268
  },
241
269
  sortSearchResults: {
242
270
  type: Boolean,
243
- default: !0
271
+ default: true
244
272
  },
245
273
  caseSensitiveTags: {
246
274
  type: Boolean,
247
- default: !1
275
+ default: false
248
276
  },
249
277
  beforeAddingTag: {
250
278
  type: Function,
251
- default: () => !0
279
+ default: () => true
252
280
  },
253
281
  beforeRemovingTag: {
254
282
  type: Function,
255
- default: () => !0
283
+ default: () => true
256
284
  }
257
285
  },
258
286
  data() {
@@ -266,107 +294,180 @@ const o = {
266
294
  };
267
295
  },
268
296
  watch: {
269
- input(e, s) {
270
- this.$emit("input-changed", e), this.searchTag(!1), e.length && e !== s && (this.addTagsOnSpace && e.endsWith(" ") && (this.input = e.trim(), this.tagFromInput(!0)), this.addTagsOnComma && (e = e.trim(), e.endsWith(",") && (this.input = e.substring(0, e.length - 1), this.tagFromInput(!0))), this.$emit("change", e));
297
+ input(newVal, oldVal) {
298
+ this.$emit("input-changed", newVal);
299
+ this.searchTag(false);
300
+ if (newVal.length && newVal !== oldVal) {
301
+ if (this.addTagsOnSpace) {
302
+ if (newVal.endsWith(" ")) {
303
+ this.input = newVal.trim();
304
+ this.tagFromInput(true);
305
+ }
306
+ }
307
+ if (this.addTagsOnComma) {
308
+ newVal = newVal.trim();
309
+ if (newVal.endsWith(",")) {
310
+ this.input = newVal.substring(0, newVal.length - 1);
311
+ this.tagFromInput(true);
312
+ }
313
+ }
314
+ this.$emit("change", newVal);
315
+ }
271
316
  },
272
317
  tags() {
273
- this.hiddenInput = JSON.stringify(this.tags), this.$emit("input", this.tags);
318
+ this.hiddenInput = JSON.stringify(this.tags);
319
+ this.$emit("input", this.tags);
274
320
  },
275
321
  value() {
276
322
  this.tagsFromValue();
277
323
  },
278
- typeaheadAlwaysShow(e) {
279
- e ? this.searchTag(!1) : this.clearSearchResults();
324
+ typeaheadAlwaysShow(newValue) {
325
+ if (newValue) {
326
+ this.searchTag(false);
327
+ } else {
328
+ this.clearSearchResults();
329
+ }
280
330
  }
281
331
  },
282
332
  created() {
283
- this.tagsFromValue(), this.typeaheadAlwaysShow && this.searchTag(!1), this.$emit("initialized");
333
+ this.tagsFromValue();
334
+ if (this.typeaheadAlwaysShow) {
335
+ this.searchTag(false);
336
+ }
337
+ this.$emit("initialized");
284
338
  },
285
339
  methods: {
286
- escapeRegExp(e) {
287
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
288
- },
289
- tagFromInput(e = !1) {
290
- if (this.searchResults.length && this.searchSelection >= 0 && !e)
291
- this.tagFromSearch(this.searchResults[this.searchSelection]), this.input = "";
292
- else {
293
- const s = this.input.trim();
294
- if (!this.onlyExistingTags && s.length && this.validate(s)) {
340
+ escapeRegExp(string) {
341
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
342
+ },
343
+ tagFromInput(ignoreSearchResults = false) {
344
+ if (this.searchResults.length && this.searchSelection >= 0 && !ignoreSearchResults) {
345
+ this.tagFromSearch(this.searchResults[this.searchSelection]);
346
+ this.input = "";
347
+ } else {
348
+ const text = this.input.trim();
349
+ if (!this.onlyExistingTags && text.length && this.validate(text)) {
295
350
  this.input = "";
296
- let a = {
351
+ let newTag = {
297
352
  key: "",
298
- value: s
353
+ value: text
299
354
  };
300
- const t = this.escapeRegExp(this.caseSensitiveTags ? a.value : a.value.toLowerCase());
301
- for (const i of this.existingTags) {
302
- const n = this.caseSensitiveTags ? i.value : i.value.toLowerCase();
303
- if (t === n) {
304
- a = Object.assign({}, i);
355
+ const searchQuery = this.escapeRegExp(this.caseSensitiveTags ? newTag.value : newTag.value.toLowerCase());
356
+ for (const tag of this.existingTags) {
357
+ const compareable = this.caseSensitiveTags ? tag.value : tag.value.toLowerCase();
358
+ if (searchQuery === compareable) {
359
+ newTag = Object.assign({}, tag);
305
360
  break;
306
361
  }
307
362
  }
308
- this.addTag(a);
363
+ this.addTag(newTag);
309
364
  }
310
365
  }
311
366
  },
312
- tagFromSearchOnClick(e) {
313
- this.tagFromSearch(e), this.$refs.taginput.blur();
367
+ tagFromSearchOnClick(tag) {
368
+ this.tagFromSearch(tag);
369
+ this.$refs.taginput.blur();
314
370
  },
315
- tagFromSearch(e) {
316
- this.clearSearchResults(), this.addTag(e), this.$nextTick(() => {
317
- this.input = "", this.oldInput = "";
371
+ tagFromSearch(tag) {
372
+ this.clearSearchResults();
373
+ this.addTag(tag);
374
+ this.$nextTick(() => {
375
+ this.input = "";
376
+ this.oldInput = "";
318
377
  });
319
378
  },
320
- addTag(e) {
321
- if (!this.beforeAddingTag(e))
322
- return !1;
323
- if (this.limit > 0 && this.tags.length >= this.limit)
324
- return this.$emit("limit-reached"), !1;
325
- this.tagSelected(e) || (this.tags.push(e), this.$nextTick(() => {
326
- this.$emit("tag-added", e), this.$emit("tags-updated");
327
- }));
379
+ addTag(tag) {
380
+ if (!this.beforeAddingTag(tag)) {
381
+ return false;
382
+ }
383
+ if (this.limit > 0 && this.tags.length >= this.limit) {
384
+ this.$emit("limit-reached");
385
+ return false;
386
+ }
387
+ if (!this.tagSelected(tag)) {
388
+ this.tags.push(tag);
389
+ this.$nextTick(() => {
390
+ this.$emit("tag-added", tag);
391
+ this.$emit("tags-updated");
392
+ });
393
+ }
328
394
  },
329
395
  removeLastTag() {
330
- !this.input.length && this.deleteOnBackspace && this.tags.length && this.removeTag(this.tags.length - 1);
331
- },
332
- removeTag(e) {
333
- const s = this.tags[e];
334
- if (!this.beforeRemovingTag(s))
335
- return !1;
336
- this.tags.splice(e, 1), this.$nextTick(() => {
337
- this.$emit("tag-removed", s), this.$emit("tags-updated"), this.typeaheadAlwaysShow && this.searchTag();
396
+ if (!this.input.length && this.deleteOnBackspace && this.tags.length) {
397
+ this.removeTag(this.tags.length - 1);
398
+ }
399
+ },
400
+ removeTag(index) {
401
+ const tag = this.tags[index];
402
+ if (!this.beforeRemovingTag(tag)) {
403
+ return false;
404
+ }
405
+ this.tags.splice(index, 1);
406
+ this.$nextTick(() => {
407
+ this.$emit("tag-removed", tag);
408
+ this.$emit("tags-updated");
409
+ if (this.typeaheadAlwaysShow) {
410
+ this.searchTag();
411
+ }
338
412
  });
339
413
  },
340
414
  searchTag() {
341
- if (this.typeahead !== !0)
342
- return !1;
415
+ if (this.typeahead !== true) {
416
+ return false;
417
+ }
343
418
  if (this.oldInput !== this.input || !this.searchResults.length && this.typeaheadActivationThreshold === 0 || this.typeaheadAlwaysShow) {
344
- this.searchResults = [], this.searchSelection = 0;
345
- const e = this.input.trim();
346
- if (e.length && e.length >= this.typeaheadActivationThreshold || this.typeaheadActivationThreshold === 0 || this.typeaheadAlwaysShow) {
347
- const s = this.escapeRegExp(this.caseSensitiveTags ? e : e.toLowerCase());
348
- for (const a of this.existingTags)
349
- (this.caseSensitiveTags ? a.value : a.value.toLowerCase()).search(s) > -1 && !this.tagSelected(a) && this.searchResults.push(a);
350
- this.sortSearchResults && this.searchResults.sort((a, t) => a.value < t.value ? -1 : a.value > t.value ? 1 : 0), this.typeaheadMaxResults > 0 && (this.searchResults = this.searchResults.slice(0, this.typeaheadMaxResults));
419
+ this.searchResults = [];
420
+ this.searchSelection = 0;
421
+ const input = this.input.trim();
422
+ if (input.length && input.length >= this.typeaheadActivationThreshold || this.typeaheadActivationThreshold === 0 || this.typeaheadAlwaysShow) {
423
+ const searchQuery = this.escapeRegExp(this.caseSensitiveTags ? input : input.toLowerCase());
424
+ for (const tag of this.existingTags) {
425
+ const compareable = this.caseSensitiveTags ? tag.value : tag.value.toLowerCase();
426
+ if (compareable.search(searchQuery) > -1 && !this.tagSelected(tag)) {
427
+ this.searchResults.push(tag);
428
+ }
429
+ }
430
+ if (this.sortSearchResults) {
431
+ this.searchResults.sort((a, b) => {
432
+ if (a.value < b.value)
433
+ return -1;
434
+ if (a.value > b.value)
435
+ return 1;
436
+ return 0;
437
+ });
438
+ }
439
+ if (this.typeaheadMaxResults > 0) {
440
+ this.searchResults = this.searchResults.slice(0, this.typeaheadMaxResults);
441
+ }
351
442
  }
352
443
  this.oldInput = this.input;
353
444
  }
354
445
  },
355
446
  hideTypeahead() {
356
- this.input.length || this.$nextTick(() => {
357
- this.clearSearchResults();
358
- });
447
+ if (!this.input.length) {
448
+ this.$nextTick(() => {
449
+ this.clearSearchResults();
450
+ });
451
+ }
359
452
  },
360
453
  nextSearchResult() {
361
- this.searchSelection + 1 <= this.searchResults.length - 1 && this.searchSelection++;
454
+ if (this.searchSelection + 1 <= this.searchResults.length - 1) {
455
+ this.searchSelection++;
456
+ }
362
457
  },
363
458
  prevSearchResult() {
364
- this.searchSelection > 0 && this.searchSelection--;
459
+ if (this.searchSelection > 0) {
460
+ this.searchSelection--;
461
+ }
365
462
  },
366
463
  clearSearchResults() {
367
- this.searchResults = [], this.searchSelection = 0, this.typeaheadAlwaysShow && this.$nextTick(() => {
368
- this.searchTag();
369
- });
464
+ this.searchResults = [];
465
+ this.searchSelection = 0;
466
+ if (this.typeaheadAlwaysShow) {
467
+ this.$nextTick(() => {
468
+ this.searchTag();
469
+ });
470
+ }
370
471
  },
371
472
  clearTags() {
372
473
  this.tags.splice(0, this.tags.length);
@@ -377,28 +478,36 @@ const o = {
377
478
  console.error("Voerro Tags Input: the v-model value must be an array!");
378
479
  return;
379
480
  }
380
- const e = this.value;
381
- if (this.tags === e)
481
+ const tags = this.value;
482
+ if (this.tags === tags) {
382
483
  return;
484
+ }
383
485
  this.clearTags();
384
- for (const s of e)
385
- this.addTag(s);
486
+ for (const tag of tags) {
487
+ this.addTag(tag);
488
+ }
386
489
  } else {
387
- if (this.tags.length === 0)
490
+ if (this.tags.length === 0) {
388
491
  return;
492
+ }
389
493
  this.clearTags();
390
494
  }
391
495
  },
392
- tagSelected(e) {
393
- if (this.allowDuplicates || !e)
394
- return !1;
395
- const s = this.escapeRegExp(this.caseSensitiveTags ? e.value : e.value.toLowerCase());
396
- for (const a of this.tags) {
397
- const t = this.caseSensitiveTags ? a.value : a.value.toLowerCase();
398
- if (a.key === e.key && t.search(s) > -1)
399
- return !0;
496
+ tagSelected(tag) {
497
+ if (this.allowDuplicates) {
498
+ return false;
499
+ }
500
+ if (!tag) {
501
+ return false;
502
+ }
503
+ const searchQuery = this.escapeRegExp(this.caseSensitiveTags ? tag.value : tag.value.toLowerCase());
504
+ for (const selectedTag of this.tags) {
505
+ const compareable = this.caseSensitiveTags ? selectedTag.value : selectedTag.value.toLowerCase();
506
+ if (selectedTag.key === tag.key && compareable.search(searchQuery) > -1) {
507
+ return true;
508
+ }
400
509
  }
401
- return !1;
510
+ return false;
402
511
  },
403
512
  clearInput() {
404
513
  this.input = "";
@@ -410,30 +519,41 @@ const o = {
410
519
  this.$emit("keydown", e);
411
520
  },
412
521
  onFocus(e) {
413
- this.$emit("focus", e), this.searchTag();
522
+ this.$emit("focus", e);
523
+ this.searchTag();
414
524
  },
415
525
  onBlur(e) {
416
- this.$emit("blur", e), this.addTagsOnBlur && this.tagFromInput(!0), this.typeaheadAlwaysShow ? this.searchTag() : this.hideTypeahead();
526
+ this.$emit("blur", e);
527
+ if (this.addTagsOnBlur) {
528
+ this.tagFromInput(true);
529
+ }
530
+ if (!this.typeaheadAlwaysShow) {
531
+ this.hideTypeahead();
532
+ } else {
533
+ this.searchTag();
534
+ }
417
535
  }
418
536
  }
419
- }, r = {};
420
- var c = /* @__PURE__ */ l(
421
- o,
422
- h,
423
- u,
424
- !1,
425
- p,
537
+ };
538
+ const __cssModules = {};
539
+ var __component__ = /* @__PURE__ */ normalizeComponent(
540
+ __vue2_script,
541
+ render,
542
+ staticRenderFns,
543
+ false,
544
+ __vue2_injectStyles,
426
545
  null,
427
546
  null,
428
547
  null
429
548
  );
430
- function p(e) {
431
- for (let s in r)
432
- this[s] = r[s];
549
+ function __vue2_injectStyles(context) {
550
+ for (let o in __cssModules) {
551
+ this[o] = __cssModules[o];
552
+ }
433
553
  }
434
- const g = /* @__PURE__ */ function() {
435
- return c.exports;
554
+ const VueTagsInput = /* @__PURE__ */ function() {
555
+ return __component__.exports;
436
556
  }();
437
557
  export {
438
- g as default
558
+ VueTagsInput as default
439
559
  };