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
|
@@ -48729,8 +48729,8 @@ var TogglePodiumBadge_component = normalizeComponent(
|
|
|
48729
48729
|
)
|
|
48730
48730
|
|
|
48731
48731
|
/* harmony default export */ var TogglePodiumBadge = (TogglePodiumBadge_component.exports);
|
|
48732
|
-
// 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=
|
|
48733
|
-
var
|
|
48732
|
+
// 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&
|
|
48733
|
+
var ToggleBreadCrumbvue_type_template_id_521e5ac4_render = function render() {
|
|
48734
48734
|
var _vm = this,
|
|
48735
48735
|
_c = _vm._self._c;
|
|
48736
48736
|
return _vm.breadcrumb_computed ? _c('div', {
|
|
@@ -48745,13 +48745,9 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_render = function render() {
|
|
|
48745
48745
|
attrs: {
|
|
48746
48746
|
"contenteditable": "true"
|
|
48747
48747
|
},
|
|
48748
|
-
domProps: {
|
|
48749
|
-
"textContent": _vm._s(_vm.initialContent)
|
|
48750
|
-
},
|
|
48751
48748
|
on: {
|
|
48752
|
-
"input":
|
|
48753
|
-
|
|
48754
|
-
},
|
|
48749
|
+
"input": _vm.handleInput,
|
|
48750
|
+
"keypress": _vm.handleKeypress,
|
|
48755
48751
|
"keydown": function ($event) {
|
|
48756
48752
|
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) return null;
|
|
48757
48753
|
$event.preventDefault();
|
|
@@ -48762,7 +48758,7 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_render = function render() {
|
|
|
48762
48758
|
return _vm.handlePaste.apply(null, arguments);
|
|
48763
48759
|
}
|
|
48764
48760
|
}
|
|
48765
|
-
})] : [crumb.link && !_vm.isNuxt ? _c('router-link', {
|
|
48761
|
+
}, [_vm._v(_vm._s(crumb.name))])] : [crumb.link && !_vm.isNuxt ? _c('router-link', {
|
|
48766
48762
|
staticClass: "back-product",
|
|
48767
48763
|
attrs: {
|
|
48768
48764
|
"to": {
|
|
@@ -48783,13 +48779,12 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_render = function render() {
|
|
|
48783
48779
|
}, [_vm._v(_vm._s(crumb.name))]) : _vm._e()]], 2);
|
|
48784
48780
|
}), 0) : _vm._e();
|
|
48785
48781
|
};
|
|
48786
|
-
var
|
|
48782
|
+
var ToggleBreadCrumbvue_type_template_id_521e5ac4_staticRenderFns = [];
|
|
48787
48783
|
|
|
48788
|
-
// CONCATENATED MODULE: ./src/components/breadcrumb/ToggleBreadCrumb.vue?vue&type=template&id=
|
|
48784
|
+
// CONCATENATED MODULE: ./src/components/breadcrumb/ToggleBreadCrumb.vue?vue&type=template&id=521e5ac4&
|
|
48789
48785
|
|
|
48790
48786
|
// 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&
|
|
48791
48787
|
/* harmony default export */ var ToggleBreadCrumbvue_type_script_lang_js_ = ({
|
|
48792
|
-
mixins: [],
|
|
48793
48788
|
props: {
|
|
48794
48789
|
isNuxt: {
|
|
48795
48790
|
type: Boolean,
|
|
@@ -48812,9 +48807,7 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_staticRenderFns = [];
|
|
|
48812
48807
|
},
|
|
48813
48808
|
data() {
|
|
48814
48809
|
return {
|
|
48815
|
-
|
|
48816
|
-
initialContent: '',
|
|
48817
|
-
lastSelection: null
|
|
48810
|
+
lastValidContent: ''
|
|
48818
48811
|
};
|
|
48819
48812
|
},
|
|
48820
48813
|
computed: {
|
|
@@ -48823,82 +48816,82 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_staticRenderFns = [];
|
|
|
48823
48816
|
}
|
|
48824
48817
|
},
|
|
48825
48818
|
mounted() {
|
|
48826
|
-
|
|
48827
|
-
const lastCrumb = this.breadcrumb_computed[this.breadcrumb_computed.length - 1];
|
|
48828
|
-
this.content = lastCrumb.name;
|
|
48829
|
-
this.initialContent = lastCrumb.name;
|
|
48830
|
-
}
|
|
48819
|
+
this.updateContent();
|
|
48831
48820
|
},
|
|
48832
48821
|
methods: {
|
|
48833
|
-
|
|
48834
|
-
|
|
48835
|
-
|
|
48836
|
-
|
|
48837
|
-
|
|
48838
|
-
this.
|
|
48839
|
-
|
|
48840
|
-
end: range.endOffset
|
|
48841
|
-
};
|
|
48822
|
+
updateContent() {
|
|
48823
|
+
var _this$breadcrumb_comp;
|
|
48824
|
+
if (this.$refs.editableSpan && (_this$breadcrumb_comp = this.breadcrumb_computed) !== null && _this$breadcrumb_comp !== void 0 && _this$breadcrumb_comp.length) {
|
|
48825
|
+
const lastCrumb = this.breadcrumb_computed[this.breadcrumb_computed.length - 1];
|
|
48826
|
+
if (this.$refs.editableSpan.textContent !== lastCrumb.name) {
|
|
48827
|
+
this.$refs.editableSpan.textContent = lastCrumb.name;
|
|
48828
|
+
this.lastValidContent = lastCrumb.name;
|
|
48842
48829
|
}
|
|
48843
48830
|
}
|
|
48844
48831
|
},
|
|
48845
|
-
|
|
48846
|
-
if (
|
|
48847
|
-
const
|
|
48848
|
-
|
|
48849
|
-
|
|
48832
|
+
handleKeypress(event) {
|
|
48833
|
+
if (event.key.length !== 1) return;
|
|
48834
|
+
const currentLength = this.$refs.editableSpan.textContent.length;
|
|
48835
|
+
const selection = window.getSelection();
|
|
48836
|
+
const selectedLength = selection.toString().length;
|
|
48837
|
+
if (currentLength - selectedLength >= this.maxChars) {
|
|
48838
|
+
event.preventDefault();
|
|
48839
|
+
return false;
|
|
48850
48840
|
}
|
|
48851
|
-
|
|
48852
|
-
|
|
48853
|
-
|
|
48854
|
-
|
|
48841
|
+
},
|
|
48842
|
+
handleInput(event) {
|
|
48843
|
+
const newText = event.target.textContent;
|
|
48844
|
+
if (newText.length <= this.maxChars) {
|
|
48845
|
+
this.lastValidContent = newText;
|
|
48846
|
+
this.$emit('update:lastCrumb', newText);
|
|
48847
|
+
} else {
|
|
48848
|
+
// Get cursor position before restoring text
|
|
48849
|
+
const selection = window.getSelection();
|
|
48850
|
+
const cursorPosition = selection.getRangeAt(0).startOffset;
|
|
48851
|
+
|
|
48852
|
+
// Restore previous content
|
|
48853
|
+
event.target.textContent = this.lastValidContent;
|
|
48855
48854
|
|
|
48856
|
-
//
|
|
48857
|
-
const
|
|
48858
|
-
const
|
|
48859
|
-
|
|
48860
|
-
|
|
48861
|
-
|
|
48862
|
-
|
|
48863
|
-
|
|
48864
|
-
|
|
48855
|
+
// Restore cursor position
|
|
48856
|
+
const range = document.createRange();
|
|
48857
|
+
const textNode = event.target.firstChild;
|
|
48858
|
+
if (textNode) {
|
|
48859
|
+
range.setStart(textNode, Math.min(cursorPosition, this.lastValidContent.length));
|
|
48860
|
+
range.collapse(true);
|
|
48861
|
+
selection.removeAllRanges();
|
|
48862
|
+
selection.addRange(range);
|
|
48863
|
+
}
|
|
48865
48864
|
}
|
|
48866
48865
|
},
|
|
48867
48866
|
handlePaste(event) {
|
|
48867
|
+
event.preventDefault();
|
|
48868
48868
|
const text = (event.clipboardData || window.clipboardData).getData('text');
|
|
48869
48869
|
const cleanText = text.replace(/[\r\n\s]+/g, ' ').trim();
|
|
48870
|
-
this.saveSelection();
|
|
48871
48870
|
const selection = window.getSelection();
|
|
48871
|
+
const range = selection.getRangeAt(0);
|
|
48872
|
+
const currentLength = this.$refs.editableSpan.textContent.length;
|
|
48872
48873
|
const selectionLength = selection.toString().length;
|
|
48873
|
-
const
|
|
48874
|
-
if (
|
|
48875
|
-
const
|
|
48874
|
+
const availableSpace = this.maxChars - (currentLength - selectionLength);
|
|
48875
|
+
if (availableSpace > 0) {
|
|
48876
|
+
const truncatedText = cleanText.slice(0, availableSpace);
|
|
48876
48877
|
range.deleteContents();
|
|
48877
|
-
range.insertNode(document.createTextNode(
|
|
48878
|
+
range.insertNode(document.createTextNode(truncatedText));
|
|
48878
48879
|
range.collapse(false);
|
|
48879
|
-
|
|
48880
|
-
|
|
48881
|
-
this.content = event.target.innerText;
|
|
48882
|
-
this.$emit('update:lastCrumb', this.content);
|
|
48880
|
+
this.lastValidContent = this.$refs.editableSpan.textContent;
|
|
48881
|
+
this.$emit('update:lastCrumb', this.lastValidContent);
|
|
48883
48882
|
}
|
|
48884
48883
|
},
|
|
48885
48884
|
handleEnterKey(event) {
|
|
48886
48885
|
event.preventDefault();
|
|
48887
48886
|
event.target.blur();
|
|
48888
|
-
}
|
|
48889
|
-
|
|
48890
|
-
|
|
48891
|
-
|
|
48892
|
-
|
|
48893
|
-
|
|
48894
|
-
|
|
48895
|
-
|
|
48896
|
-
this.content = newText;
|
|
48897
|
-
this.$emit('update:lastCrumb', this.content);
|
|
48898
|
-
this.$nextTick(() => {
|
|
48899
|
-
this.restoreSelection();
|
|
48900
|
-
});
|
|
48901
|
-
}
|
|
48887
|
+
}
|
|
48888
|
+
},
|
|
48889
|
+
watch: {
|
|
48890
|
+
'breadcrumb_computed': {
|
|
48891
|
+
handler() {
|
|
48892
|
+
this.$nextTick(this.updateContent);
|
|
48893
|
+
},
|
|
48894
|
+
deep: true
|
|
48902
48895
|
}
|
|
48903
48896
|
}
|
|
48904
48897
|
});
|
|
@@ -48914,8 +48907,8 @@ var ToggleBreadCrumbvue_type_template_id_93f64828_staticRenderFns = [];
|
|
|
48914
48907
|
|
|
48915
48908
|
var ToggleBreadCrumb_component = normalizeComponent(
|
|
48916
48909
|
breadcrumb_ToggleBreadCrumbvue_type_script_lang_js_,
|
|
48917
|
-
|
|
48918
|
-
|
|
48910
|
+
ToggleBreadCrumbvue_type_template_id_521e5ac4_render,
|
|
48911
|
+
ToggleBreadCrumbvue_type_template_id_521e5ac4_staticRenderFns,
|
|
48919
48912
|
false,
|
|
48920
48913
|
null,
|
|
48921
48914
|
null,
|