toggle-components-library 1.37.0-beta.5 → 1.37.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/toggle-components-library.common.js +65 -72
- package/dist/toggle-components-library.common.js.map +1 -1
- package/dist/toggle-components-library.umd.js +65 -72
- package/dist/toggle-components-library.umd.js.map +1 -1
- package/dist/toggle-components-library.umd.min.js +1 -1
- package/dist/toggle-components-library.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/breadcrumb/ToggleBreadCrumb.vue +63 -69
|
@@ -48720,8 +48720,8 @@ var TogglePodiumBadge_component = normalizeComponent(
|
|
|
48720
48720
|
)
|
|
48721
48721
|
|
|
48722
48722
|
/* harmony default export */ var TogglePodiumBadge = (TogglePodiumBadge_component.exports);
|
|
48723
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"a48609c2-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/breadcrumb/ToggleBreadCrumb.vue?vue&type=template&id=
|
|
48724
|
-
var
|
|
48723
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"a48609c2-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/breadcrumb/ToggleBreadCrumb.vue?vue&type=template&id=521e5ac4&
|
|
48724
|
+
var ToggleBreadCrumbvue_type_template_id_521e5ac4_render = function render() {
|
|
48725
48725
|
var _vm = this,
|
|
48726
48726
|
_c = _vm._self._c;
|
|
48727
48727
|
return _vm.breadcrumb_computed ? _c('div', {
|
|
@@ -48736,13 +48736,9 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_render = function render() {
|
|
|
48736
48736
|
attrs: {
|
|
48737
48737
|
"contenteditable": "true"
|
|
48738
48738
|
},
|
|
48739
|
-
domProps: {
|
|
48740
|
-
"textContent": _vm._s(_vm.initialContent)
|
|
48741
|
-
},
|
|
48742
48739
|
on: {
|
|
48743
|
-
"input":
|
|
48744
|
-
|
|
48745
|
-
},
|
|
48740
|
+
"input": _vm.handleInput,
|
|
48741
|
+
"keypress": _vm.handleKeypress,
|
|
48746
48742
|
"keydown": function ($event) {
|
|
48747
48743
|
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) return null;
|
|
48748
48744
|
$event.preventDefault();
|
|
@@ -48753,7 +48749,7 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_render = function render() {
|
|
|
48753
48749
|
return _vm.handlePaste.apply(null, arguments);
|
|
48754
48750
|
}
|
|
48755
48751
|
}
|
|
48756
|
-
})] : [crumb.link && !_vm.isNuxt ? _c('router-link', {
|
|
48752
|
+
}, [_vm._v(_vm._s(crumb.name))])] : [crumb.link && !_vm.isNuxt ? _c('router-link', {
|
|
48757
48753
|
staticClass: "back-product",
|
|
48758
48754
|
attrs: {
|
|
48759
48755
|
"to": {
|
|
@@ -48774,13 +48770,12 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_render = function render() {
|
|
|
48774
48770
|
}, [_vm._v(_vm._s(crumb.name))]) : _vm._e()]], 2);
|
|
48775
48771
|
}), 0) : _vm._e();
|
|
48776
48772
|
};
|
|
48777
|
-
var
|
|
48773
|
+
var ToggleBreadCrumbvue_type_template_id_521e5ac4_staticRenderFns = [];
|
|
48778
48774
|
|
|
48779
|
-
// CONCATENATED MODULE: ./src/components/breadcrumb/ToggleBreadCrumb.vue?vue&type=template&id=
|
|
48775
|
+
// CONCATENATED MODULE: ./src/components/breadcrumb/ToggleBreadCrumb.vue?vue&type=template&id=521e5ac4&
|
|
48780
48776
|
|
|
48781
48777
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/breadcrumb/ToggleBreadCrumb.vue?vue&type=script&lang=js&
|
|
48782
48778
|
/* harmony default export */ var ToggleBreadCrumbvue_type_script_lang_js_ = ({
|
|
48783
|
-
mixins: [],
|
|
48784
48779
|
props: {
|
|
48785
48780
|
isNuxt: {
|
|
48786
48781
|
type: Boolean,
|
|
@@ -48803,9 +48798,7 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_staticRenderFns = [];
|
|
|
48803
48798
|
},
|
|
48804
48799
|
data() {
|
|
48805
48800
|
return {
|
|
48806
|
-
|
|
48807
|
-
initialContent: '',
|
|
48808
|
-
lastSelection: null
|
|
48801
|
+
lastValidContent: ''
|
|
48809
48802
|
};
|
|
48810
48803
|
},
|
|
48811
48804
|
computed: {
|
|
@@ -48814,82 +48807,82 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_staticRenderFns = [];
|
|
|
48814
48807
|
}
|
|
48815
48808
|
},
|
|
48816
48809
|
mounted() {
|
|
48817
|
-
|
|
48818
|
-
const lastCrumb = this.breadcrumb_computed[this.breadcrumb_computed.length - 1];
|
|
48819
|
-
this.content = lastCrumb.name;
|
|
48820
|
-
this.initialContent = lastCrumb.name;
|
|
48821
|
-
}
|
|
48810
|
+
this.updateContent();
|
|
48822
48811
|
},
|
|
48823
48812
|
methods: {
|
|
48824
|
-
|
|
48825
|
-
|
|
48826
|
-
|
|
48827
|
-
|
|
48828
|
-
|
|
48829
|
-
this.
|
|
48830
|
-
|
|
48831
|
-
end: range.endOffset
|
|
48832
|
-
};
|
|
48813
|
+
updateContent() {
|
|
48814
|
+
var _this$breadcrumb_comp;
|
|
48815
|
+
if (this.$refs.editableSpan && (_this$breadcrumb_comp = this.breadcrumb_computed) !== null && _this$breadcrumb_comp !== void 0 && _this$breadcrumb_comp.length) {
|
|
48816
|
+
const lastCrumb = this.breadcrumb_computed[this.breadcrumb_computed.length - 1];
|
|
48817
|
+
if (this.$refs.editableSpan.textContent !== lastCrumb.name) {
|
|
48818
|
+
this.$refs.editableSpan.textContent = lastCrumb.name;
|
|
48819
|
+
this.lastValidContent = lastCrumb.name;
|
|
48833
48820
|
}
|
|
48834
48821
|
}
|
|
48835
48822
|
},
|
|
48836
|
-
|
|
48837
|
-
if (
|
|
48838
|
-
const
|
|
48839
|
-
|
|
48840
|
-
|
|
48823
|
+
handleKeypress(event) {
|
|
48824
|
+
if (event.key.length !== 1) return;
|
|
48825
|
+
const currentLength = this.$refs.editableSpan.textContent.length;
|
|
48826
|
+
const selection = window.getSelection();
|
|
48827
|
+
const selectedLength = selection.toString().length;
|
|
48828
|
+
if (currentLength - selectedLength >= this.maxChars) {
|
|
48829
|
+
event.preventDefault();
|
|
48830
|
+
return false;
|
|
48841
48831
|
}
|
|
48842
|
-
|
|
48843
|
-
|
|
48844
|
-
|
|
48845
|
-
|
|
48832
|
+
},
|
|
48833
|
+
handleInput(event) {
|
|
48834
|
+
const newText = event.target.textContent;
|
|
48835
|
+
if (newText.length <= this.maxChars) {
|
|
48836
|
+
this.lastValidContent = newText;
|
|
48837
|
+
this.$emit('update:lastCrumb', newText);
|
|
48838
|
+
} else {
|
|
48839
|
+
// Get cursor position before restoring text
|
|
48840
|
+
const selection = window.getSelection();
|
|
48841
|
+
const cursorPosition = selection.getRangeAt(0).startOffset;
|
|
48842
|
+
|
|
48843
|
+
// Restore previous content
|
|
48844
|
+
event.target.textContent = this.lastValidContent;
|
|
48846
48845
|
|
|
48847
|
-
//
|
|
48848
|
-
const
|
|
48849
|
-
const
|
|
48850
|
-
|
|
48851
|
-
|
|
48852
|
-
|
|
48853
|
-
|
|
48854
|
-
|
|
48855
|
-
|
|
48846
|
+
// Restore cursor position
|
|
48847
|
+
const range = document.createRange();
|
|
48848
|
+
const textNode = event.target.firstChild;
|
|
48849
|
+
if (textNode) {
|
|
48850
|
+
range.setStart(textNode, Math.min(cursorPosition, this.lastValidContent.length));
|
|
48851
|
+
range.collapse(true);
|
|
48852
|
+
selection.removeAllRanges();
|
|
48853
|
+
selection.addRange(range);
|
|
48854
|
+
}
|
|
48856
48855
|
}
|
|
48857
48856
|
},
|
|
48858
48857
|
handlePaste(event) {
|
|
48858
|
+
event.preventDefault();
|
|
48859
48859
|
const text = (event.clipboardData || window.clipboardData).getData('text');
|
|
48860
48860
|
const cleanText = text.replace(/[\r\n\s]+/g, ' ').trim();
|
|
48861
|
-
this.saveSelection();
|
|
48862
48861
|
const selection = window.getSelection();
|
|
48862
|
+
const range = selection.getRangeAt(0);
|
|
48863
|
+
const currentLength = this.$refs.editableSpan.textContent.length;
|
|
48863
48864
|
const selectionLength = selection.toString().length;
|
|
48864
|
-
const
|
|
48865
|
-
if (
|
|
48866
|
-
const
|
|
48865
|
+
const availableSpace = this.maxChars - (currentLength - selectionLength);
|
|
48866
|
+
if (availableSpace > 0) {
|
|
48867
|
+
const truncatedText = cleanText.slice(0, availableSpace);
|
|
48867
48868
|
range.deleteContents();
|
|
48868
|
-
range.insertNode(document.createTextNode(
|
|
48869
|
+
range.insertNode(document.createTextNode(truncatedText));
|
|
48869
48870
|
range.collapse(false);
|
|
48870
|
-
|
|
48871
|
-
|
|
48872
|
-
this.content = event.target.innerText;
|
|
48873
|
-
this.$emit('update:lastCrumb', this.content);
|
|
48871
|
+
this.lastValidContent = this.$refs.editableSpan.textContent;
|
|
48872
|
+
this.$emit('update:lastCrumb', this.lastValidContent);
|
|
48874
48873
|
}
|
|
48875
48874
|
},
|
|
48876
48875
|
handleEnterKey(event) {
|
|
48877
48876
|
event.preventDefault();
|
|
48878
48877
|
event.target.blur();
|
|
48879
|
-
}
|
|
48880
|
-
|
|
48881
|
-
|
|
48882
|
-
|
|
48883
|
-
|
|
48884
|
-
|
|
48885
|
-
|
|
48886
|
-
|
|
48887
|
-
this.content = newText;
|
|
48888
|
-
this.$emit('update:lastCrumb', this.content);
|
|
48889
|
-
this.$nextTick(() => {
|
|
48890
|
-
this.restoreSelection();
|
|
48891
|
-
});
|
|
48892
|
-
}
|
|
48878
|
+
}
|
|
48879
|
+
},
|
|
48880
|
+
watch: {
|
|
48881
|
+
'breadcrumb_computed': {
|
|
48882
|
+
handler() {
|
|
48883
|
+
this.$nextTick(this.updateContent);
|
|
48884
|
+
},
|
|
48885
|
+
deep: true
|
|
48893
48886
|
}
|
|
48894
48887
|
}
|
|
48895
48888
|
});
|
|
@@ -48905,8 +48898,8 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_staticRenderFns = [];
|
|
|
48905
48898
|
|
|
48906
48899
|
var ToggleBreadCrumb_component = normalizeComponent(
|
|
48907
48900
|
breadcrumb_ToggleBreadCrumbvue_type_script_lang_js_,
|
|
48908
|
-
|
|
48909
|
-
|
|
48901
|
+
ToggleBreadCrumbvue_type_template_id_521e5ac4_render,
|
|
48902
|
+
ToggleBreadCrumbvue_type_template_id_521e5ac4_staticRenderFns,
|
|
48910
48903
|
false,
|
|
48911
48904
|
null,
|
|
48912
48905
|
null,
|