From 91f400d5ac8e1f1f5a4c6ea04d72633f5142db1e Mon Sep 17 00:00:00 2001 From: roma Date: Tue, 3 May 2022 13:28:18 +0300 Subject: [PATCH 1/7] feat: button Add instead of input when nothing is added --- vue-tags-input/vue-tags-input.js | 36 ++++++++++++++++++++++++-- vue-tags-input/vue-tags-input.props.js | 19 ++++++++++++++ vue-tags-input/vue-tags-input.scss | 5 ++++ vue-tags-input/vue-tags-input.vue | 25 +++++++++++++++++- 4 files changed, 82 insertions(+), 3 deletions(-) diff --git a/vue-tags-input/vue-tags-input.js b/vue-tags-input/vue-tags-input.js index be1abe2..3b6bc7e 100644 --- a/vue-tags-input/vue-tags-input.js +++ b/vue-tags-input/vue-tags-input.js @@ -20,6 +20,7 @@ export default { deletionMarkTime: null, selectedItem: null, focused: null, + mouseOverWorkingPlace: false, }; }, computed: { @@ -128,8 +129,9 @@ export default { // Focuses the input of a tag focus(index) { this.$nextTick(() => { - const el = this.$refs.tagCenter[index].querySelector('input.ti-tag-input'); - if (el) el.focus(); + // const el = this.$refs.tagCenter[index].querySelector('input.ti-tag-input'); + // if (el) el.focus(); + this.$refs.newTagInput.focus(); }); }, quote(regex) { @@ -366,8 +368,38 @@ export default { if (this.addOnBlur && this.focused) this.performAddTags(this.newTag); // Hide autocomplete layer + this.close(); + }, + + + open(focus=true) { + if (this.preventAdd) { + this.$emit('prevent-add'); + return; + } + + setTimeout(() => { + this.focused = true; + focus && setTimeout(() => { + this.focus(); + }); + }) + + }, + + + close() { this.focused = false; }, + + + closeIfMouseOut() { + if (this.mouseOverWorkingPlace) { + return; + } + this.close(); + }, + }, watch: { value(newValue){ diff --git a/vue-tags-input/vue-tags-input.props.js b/vue-tags-input/vue-tags-input.props.js index 2d36a83..e405489 100644 --- a/vue-tags-input/vue-tags-input.props.js +++ b/vue-tags-input/vue-tags-input.props.js @@ -341,4 +341,23 @@ export default { default: true, type: Boolean, }, + /** + * @description Show link {{ placeholder }} instead of when input is unfocused + * @type {Boolean} + * @default false + */ + linkInsteadOfUnfocusedInput: { + default: false, + type: Boolean, + }, + + /** + * @description Prevent adding new tags + * @type {Boolean} + * @default false + */ + preventAdd: { + default: false, + type: Boolean, + }, }; diff --git a/vue-tags-input/vue-tags-input.scss b/vue-tags-input/vue-tags-input.scss index 5d60089..984ddc5 100644 --- a/vue-tags-input/vue-tags-input.scss +++ b/vue-tags-input/vue-tags-input.scss @@ -175,3 +175,8 @@ div.vue-tags-input.disabled { background-color: $primary; color: #fff; } + +.ti-new-tab-button { + margin: 2px; + padding: 5px; +} diff --git a/vue-tags-input/vue-tags-input.vue b/vue-tags-input/vue-tags-input.vue index c44362e..4e71936 100644 --- a/vue-tags-input/vue-tags-input.vue +++ b/vue-tags-input/vue-tags-input.vue @@ -7,9 +7,12 @@
    + +
+ + + +
  • + + + + @mouseenter="mouseOverWorkingPlace = true" + @mouseleave="mouseOverWorkingPlace = false" + /> +
  • + + +
      From c1df40f0f6573a2c6023edf10e231ea44c8fdf7f Mon Sep 17 00:00:00 2001 From: roma Date: Tue, 3 May 2022 16:43:13 +0300 Subject: [PATCH 2/7] fix: main point --- .directory | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .directory diff --git a/.directory b/.directory new file mode 100644 index 0000000..95e7e30 --- /dev/null +++ b/.directory @@ -0,0 +1,4 @@ +[Dolphin] +Timestamp=2022,5,3,13,27,8 +Version=4 +ViewMode=2 diff --git a/package.json b/package.json index 140e905..c075ccf 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/JohMun/vue-tags-input.git" }, - "main": "dist/vue-tags-input.js", + "main": "vue-tags-input/vue-tags-input.vue", "scripts": { "dev": "npm run docs", "docs": "cross-env NODE_ENV=development webpack-dev-server --hot --config ./build/docs.config.js", From 088e47d43d82f309ed971b7aa6e8c0ba80c7e3f3 Mon Sep 17 00:00:00 2001 From: Roman Mavliutov Date: Mon, 4 Jul 2022 19:54:28 +0300 Subject: [PATCH 3/7] fix: open event --- vue-tags-input/vue-tags-input.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vue-tags-input/vue-tags-input.js b/vue-tags-input/vue-tags-input.js index 3b6bc7e..80ea8ba 100644 --- a/vue-tags-input/vue-tags-input.js +++ b/vue-tags-input/vue-tags-input.js @@ -379,8 +379,11 @@ export default { } setTimeout(() => { + console.log('open', 1) this.focused = true; + console.log(2) focus && setTimeout(() => { + console.log(3) this.focus(); }); }) From 9772045482fb74c3d2c80378695b38b793945f90 Mon Sep 17 00:00:00 2001 From: Roman Mavliutov Date: Mon, 4 Jul 2022 19:59:06 +0300 Subject: [PATCH 4/7] fix: open on focus --- vue-tags-input/vue-tags-input.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/vue-tags-input/vue-tags-input.js b/vue-tags-input/vue-tags-input.js index 80ea8ba..3b6bc7e 100644 --- a/vue-tags-input/vue-tags-input.js +++ b/vue-tags-input/vue-tags-input.js @@ -379,11 +379,8 @@ export default { } setTimeout(() => { - console.log('open', 1) this.focused = true; - console.log(2) focus && setTimeout(() => { - console.log(3) this.focus(); }); }) From ae5be8d4020c43389ea1d5b479608ab9a86bacd4 Mon Sep 17 00:00:00 2001 From: Roman Mavliutov Date: Mon, 4 Jul 2022 20:00:03 +0300 Subject: [PATCH 5/7] fix: open on focus --- vue-tags-input/vue-tags-input.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue-tags-input/vue-tags-input.vue b/vue-tags-input/vue-tags-input.vue index 4e71936..e60e520 100644 --- a/vue-tags-input/vue-tags-input.vue +++ b/vue-tags-input/vue-tags-input.vue @@ -129,7 +129,7 @@ From 2756ab6f97510c2fd72da05593886da99d1a5a02 Mon Sep 17 00:00:00 2001 From: Roman Mavliutov Date: Mon, 4 Jul 2022 20:02:30 +0300 Subject: [PATCH 6/7] fix: focus on open --- vue-tags-input/vue-tags-input.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vue-tags-input/vue-tags-input.js b/vue-tags-input/vue-tags-input.js index 3b6bc7e..b48eb99 100644 --- a/vue-tags-input/vue-tags-input.js +++ b/vue-tags-input/vue-tags-input.js @@ -377,10 +377,14 @@ export default { this.$emit('prevent-add'); return; } + + console.log(1) setTimeout(() => { this.focused = true; + console.log(2, focus) focus && setTimeout(() => { + console.log(3) this.focus(); }); }) From 1358d6e3f56cace75d68063edd9f71507e898f20 Mon Sep 17 00:00:00 2001 From: roma Date: Sat, 16 Dec 2023 19:42:41 +0300 Subject: [PATCH 7/7] =?UTF-8?q?feat:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BE=20=D0=BB=D0=B8=D1=86?= =?UTF-8?q?=D0=B5=D0=BD=D0=B7=D0=B8=D1=8F=D1=85=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D1=85=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json => package.bak.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename package.json => package.bak.json (100%) diff --git a/package.json b/package.bak.json similarity index 100% rename from package.json rename to package.bak.json