@onereach/ui-components 4.3.11-beta.2664.0 → 4.3.11-beta.2667.0
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/bundled/v2/components/OrSelectV3/OrSelect.js +2 -1
- package/dist/bundled/v2/components/OrTextV3/OrText.js +6 -6
- package/dist/bundled/v3/{OrText.vue_vue_type_script_lang-6ce019db.js → OrText.vue_vue_type_script_lang-23ff666f.js} +6 -6
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +2 -1
- package/dist/bundled/v3/components/OrTextV3/OrText.js +2 -2
- package/dist/bundled/v3/components/OrTextV3/index.js +1 -1
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/index.js +1 -1
- package/dist/esm/v2/{OrSelect-9c8f96b2.js → OrSelect-9d6b3363.js} +2 -1
- package/dist/esm/v2/{OrText-44449e7b.js → OrText-6097bca5.js} +6 -6
- package/dist/esm/v2/components/index.js +2 -2
- package/dist/esm/v2/components/or-select-v3/index.js +1 -1
- package/dist/esm/v2/components/or-text-v3/index.js +1 -1
- package/dist/esm/v2/index.js +2 -2
- package/dist/esm/v3/{OrSelect-b1d7651a.js → OrSelect-3dbddc6b.js} +2 -1
- package/dist/esm/v3/{OrText-d54c951d.js → OrText-de6b2fe2.js} +6 -6
- package/dist/esm/v3/components/index.js +2 -2
- package/dist/esm/v3/components/or-select-v3/index.js +1 -1
- package/dist/esm/v3/components/or-text-v3/index.js +1 -1
- package/dist/esm/v3/index.js +2 -2
- package/package.json +1 -1
- package/src/components/or-select-v3/OrSelect.stories3.ts +39 -1
- package/src/components/or-select-v3/OrSelect.vue +1 -0
- package/src/components/or-text-v3/OrText.vue +6 -11
|
@@ -38,19 +38,19 @@ var script = defineComponent({
|
|
|
38
38
|
const mainTextStyles = computed(() => [...MainText]);
|
|
39
39
|
const restTextStyles = computed(() => [...RestText]);
|
|
40
40
|
/**
|
|
41
|
-
* Preserves whitespace at the
|
|
41
|
+
* Preserves whitespace at the last position as <code> </code>
|
|
42
42
|
* @param str A string to escape
|
|
43
43
|
*/
|
|
44
|
-
const
|
|
44
|
+
const escapeLast = str => str && str.slice(0, -1) + '\xa0';
|
|
45
45
|
/**
|
|
46
|
-
* Preserves whitespace at the
|
|
46
|
+
* Preserves whitespace at the first position as <code> </code>
|
|
47
47
|
* @param str A string to escape
|
|
48
48
|
*/
|
|
49
|
-
const
|
|
49
|
+
const escapeFirst = str => str && '\xa0' + str.slice(1);
|
|
50
50
|
// State
|
|
51
51
|
const mainText = computed(() => {
|
|
52
|
-
if (props.sliceIndex
|
|
53
|
-
let mainPart = props.text.slice(0, Math.abs(props.sliceIndex)
|
|
52
|
+
if (props.sliceIndex) {
|
|
53
|
+
let mainPart = props.text.slice(0, -Math.abs(props.sliceIndex));
|
|
54
54
|
if (mainPart[mainPart.length - 1] === ' ') {
|
|
55
55
|
mainPart = escapeLast(mainPart);
|
|
56
56
|
}
|
|
@@ -37,19 +37,19 @@ var script = defineComponent({
|
|
|
37
37
|
const mainTextStyles = computed(() => [...MainText]);
|
|
38
38
|
const restTextStyles = computed(() => [...RestText]);
|
|
39
39
|
/**
|
|
40
|
-
* Preserves whitespace at the
|
|
40
|
+
* Preserves whitespace at the last position as <code> </code>
|
|
41
41
|
* @param str A string to escape
|
|
42
42
|
*/
|
|
43
|
-
const
|
|
43
|
+
const escapeLast = str => str && str.slice(0, -1) + '\xa0';
|
|
44
44
|
/**
|
|
45
|
-
* Preserves whitespace at the
|
|
45
|
+
* Preserves whitespace at the first position as <code> </code>
|
|
46
46
|
* @param str A string to escape
|
|
47
47
|
*/
|
|
48
|
-
const
|
|
48
|
+
const escapeFirst = str => str && '\xa0' + str.slice(1);
|
|
49
49
|
// State
|
|
50
50
|
const mainText = computed(() => {
|
|
51
|
-
if (props.sliceIndex
|
|
52
|
-
let mainPart = props.text.slice(0, Math.abs(props.sliceIndex)
|
|
51
|
+
if (props.sliceIndex) {
|
|
52
|
+
let mainPart = props.text.slice(0, -Math.abs(props.sliceIndex));
|
|
53
53
|
if (mainPart[mainPart.length - 1] === ' ') {
|
|
54
54
|
mainPart = escapeLast(mainPart);
|
|
55
55
|
}
|
|
@@ -143,12 +143,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
143
143
|
return openBlock(), createBlock(_component_OrTag, {
|
|
144
144
|
key: option.value,
|
|
145
145
|
variant: 'reset',
|
|
146
|
+
disabled: _ctx.disabled || _ctx.readonly,
|
|
146
147
|
onReset: $event => _ctx.deselect(option)
|
|
147
148
|
}, {
|
|
148
149
|
default: withCtx(() => [createTextVNode(toDisplayString(option.label), 1 /* TEXT */)]),
|
|
149
150
|
|
|
150
151
|
_: 2 /* DYNAMIC */
|
|
151
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onReset"]);
|
|
152
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["disabled", "onReset"]);
|
|
152
153
|
}), 128 /* KEYED_FRAGMENT */)) : (openBlock(), createElementBlock("span", {
|
|
153
154
|
key: 1,
|
|
154
155
|
class: normalizeClass(_ctx.placeholderStyles)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as script } from '../../OrText.vue_vue_type_script_lang-
|
|
2
|
-
export { s as default } from '../../OrText.vue_vue_type_script_lang-
|
|
1
|
+
import { s as script } from '../../OrText.vue_vue_type_script_lang-23ff666f.js';
|
|
2
|
+
export { s as default } from '../../OrText.vue_vue_type_script_lang-23ff666f.js';
|
|
3
3
|
import { openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString } from 'vue';
|
|
4
4
|
import 'vue-demi';
|
|
5
5
|
import './styles.js';
|
|
@@ -135,7 +135,7 @@ export { s as OrTagV3 } from '../OrTag.vue_vue_type_script_lang-8643b784.js';
|
|
|
135
135
|
export { TagColor, TagVariant } from './OrTagV3/props.js';
|
|
136
136
|
export { default as OrTeleport } from './OrTeleport/OrTeleport.js';
|
|
137
137
|
export { s as OrTeleportV3 } from '../OrTeleport.vue3.vue_vue_type_script_lang-a6ce162e.js';
|
|
138
|
-
export { s as OrTextV3 } from '../OrText.vue_vue_type_script_lang-
|
|
138
|
+
export { s as OrTextV3 } from '../OrText.vue_vue_type_script_lang-23ff666f.js';
|
|
139
139
|
export { s as OrTextarea } from '../OrTextarea.vue_vue_type_script_lang-048cb245.js';
|
|
140
140
|
export { s as OrTextareaV3 } from '../OrTextarea.vue_vue_type_script_lang-f287189f.js';
|
|
141
141
|
export { s as OrTextbox } from '../OrTextbox.vue_vue_type_script_lang-dad835c3.js';
|
package/dist/bundled/v3/index.js
CHANGED
|
@@ -110,7 +110,7 @@ export { s as OrTabsV3 } from './OrTabs.vue_vue_type_script_lang-6d47e560.js';
|
|
|
110
110
|
import './components/OrTag/OrTag.js';
|
|
111
111
|
export { s as OrTag } from './OrTag.vue_vue_type_script_lang-4e98d8a0.js';
|
|
112
112
|
import './components/OrTextV3/OrText.js';
|
|
113
|
-
export { s as OrTextV3 } from './OrText.vue_vue_type_script_lang-
|
|
113
|
+
export { s as OrTextV3 } from './OrText.vue_vue_type_script_lang-23ff666f.js';
|
|
114
114
|
import './components/OrTextarea/OrTextarea.js';
|
|
115
115
|
export { s as OrTextarea } from './OrTextarea.vue_vue_type_script_lang-048cb245.js';
|
|
116
116
|
import './components/OrTextareaV3/OrTextarea.js';
|
|
@@ -53,19 +53,19 @@ var script = defineComponent({
|
|
|
53
53
|
const mainTextStyles = computed(() => [...MainText]);
|
|
54
54
|
const restTextStyles = computed(() => [...RestText]);
|
|
55
55
|
/**
|
|
56
|
-
* Preserves whitespace at the
|
|
56
|
+
* Preserves whitespace at the last position as <code> </code>
|
|
57
57
|
* @param str A string to escape
|
|
58
58
|
*/
|
|
59
|
-
const
|
|
59
|
+
const escapeLast = str => str && str.slice(0, -1) + '\xa0';
|
|
60
60
|
/**
|
|
61
|
-
* Preserves whitespace at the
|
|
61
|
+
* Preserves whitespace at the first position as <code> </code>
|
|
62
62
|
* @param str A string to escape
|
|
63
63
|
*/
|
|
64
|
-
const
|
|
64
|
+
const escapeFirst = str => str && '\xa0' + str.slice(1);
|
|
65
65
|
// State
|
|
66
66
|
const mainText = computed(() => {
|
|
67
|
-
if (props.sliceIndex
|
|
68
|
-
let mainPart = props.text.slice(0, Math.abs(props.sliceIndex)
|
|
67
|
+
if (props.sliceIndex) {
|
|
68
|
+
let mainPart = props.text.slice(0, -Math.abs(props.sliceIndex));
|
|
69
69
|
if (mainPart[mainPart.length - 1] === ' ') {
|
|
70
70
|
mainPart = escapeLast(mainPart);
|
|
71
71
|
}
|
|
@@ -73,7 +73,7 @@ export { _ as OrSearch } from '../OrSearch-330e9af0.js';
|
|
|
73
73
|
export { _ as OrSearchV3 } from '../OrSearch-7ccc1f33.js';
|
|
74
74
|
export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-a1ea5b72.js';
|
|
75
75
|
export { _ as OrSelect } from '../OrSelect-22eea9cc.js';
|
|
76
|
-
export { _ as OrSelectV3 } from '../OrSelect-
|
|
76
|
+
export { _ as OrSelectV3 } from '../OrSelect-9d6b3363.js';
|
|
77
77
|
export { _ as OrSidebar, O as OrSidebarSide } from '../OrSidebar-feacf13a.js';
|
|
78
78
|
export { _ as OrSidebarV3 } from '../OrSidebar-b8387abe.js';
|
|
79
79
|
export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-4bf3bad8.js';
|
|
@@ -98,7 +98,7 @@ export { _ as OrTag } from '../OrTag-8ded4261.js';
|
|
|
98
98
|
export { _ as OrTagV3, a as TagColor, T as TagVariant } from '../OrTag-843ec724.js';
|
|
99
99
|
export { _ as OrTeleport } from '../OrTeleport.vue2-f0c16c71.js';
|
|
100
100
|
export { _ as OrTeleportV3 } from '../OrTeleport.vue2-424c7f33.js';
|
|
101
|
-
export { _ as OrTextV3 } from '../OrText-
|
|
101
|
+
export { _ as OrTextV3 } from '../OrText-6097bca5.js';
|
|
102
102
|
export { _ as OrTextarea } from '../OrTextarea-226ab7a2.js';
|
|
103
103
|
export { _ as OrTextareaV3 } from '../OrTextarea-800f63d4.js';
|
|
104
104
|
export { _ as OrTextbox, T as TextboxTypes } from '../OrTextbox-90badc95.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { _ as OrSelectV3 } from '../../OrSelect-
|
|
1
|
+
export { _ as OrSelectV3 } from '../../OrSelect-9d6b3363.js';
|
|
2
2
|
export { I as SelectSize } from '../../OrInputBox.vue_rollup-plugin-vue_script-fe250f7a.js';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import '../../dropdown-open-e1f90e0a.js';
|
package/dist/esm/v2/index.js
CHANGED
|
@@ -73,7 +73,7 @@ export { _ as OrSearch } from './OrSearch-330e9af0.js';
|
|
|
73
73
|
export { _ as OrSearchV3 } from './OrSearch-7ccc1f33.js';
|
|
74
74
|
export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-a1ea5b72.js';
|
|
75
75
|
export { _ as OrSelect } from './OrSelect-22eea9cc.js';
|
|
76
|
-
export { _ as OrSelectV3 } from './OrSelect-
|
|
76
|
+
export { _ as OrSelectV3 } from './OrSelect-9d6b3363.js';
|
|
77
77
|
export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-feacf13a.js';
|
|
78
78
|
export { _ as OrSidebarV3 } from './OrSidebar-b8387abe.js';
|
|
79
79
|
export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-4bf3bad8.js';
|
|
@@ -98,7 +98,7 @@ export { _ as OrTag } from './OrTag-8ded4261.js';
|
|
|
98
98
|
export { _ as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-843ec724.js';
|
|
99
99
|
export { _ as OrTeleport } from './OrTeleport.vue2-f0c16c71.js';
|
|
100
100
|
export { _ as OrTeleportV3 } from './OrTeleport.vue2-424c7f33.js';
|
|
101
|
-
export { _ as OrTextV3 } from './OrText-
|
|
101
|
+
export { _ as OrTextV3 } from './OrText-6097bca5.js';
|
|
102
102
|
export { _ as OrTextarea } from './OrTextarea-226ab7a2.js';
|
|
103
103
|
export { _ as OrTextareaV3 } from './OrTextarea-800f63d4.js';
|
|
104
104
|
export { _ as OrTextbox, T as TextboxTypes } from './OrTextbox-90badc95.js';
|
|
@@ -359,12 +359,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
359
359
|
return openBlock(), createBlock(_component_OrTag, {
|
|
360
360
|
key: option.value,
|
|
361
361
|
variant: 'reset',
|
|
362
|
+
disabled: _ctx.disabled || _ctx.readonly,
|
|
362
363
|
onReset: $event => _ctx.deselect(option)
|
|
363
364
|
}, {
|
|
364
365
|
default: withCtx(() => [createTextVNode(toDisplayString(option.label), 1 /* TEXT */)]),
|
|
365
366
|
|
|
366
367
|
_: 2 /* DYNAMIC */
|
|
367
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onReset"]);
|
|
368
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["disabled", "onReset"]);
|
|
368
369
|
}), 128 /* KEYED_FRAGMENT */)) : (openBlock(), createElementBlock("span", {
|
|
369
370
|
key: 1,
|
|
370
371
|
class: normalizeClass(_ctx.placeholderStyles)
|
|
@@ -53,19 +53,19 @@ var script = defineComponent({
|
|
|
53
53
|
const mainTextStyles = computed(() => [...MainText]);
|
|
54
54
|
const restTextStyles = computed(() => [...RestText]);
|
|
55
55
|
/**
|
|
56
|
-
* Preserves whitespace at the
|
|
56
|
+
* Preserves whitespace at the last position as <code> </code>
|
|
57
57
|
* @param str A string to escape
|
|
58
58
|
*/
|
|
59
|
-
const
|
|
59
|
+
const escapeLast = str => str && str.slice(0, -1) + '\xa0';
|
|
60
60
|
/**
|
|
61
|
-
* Preserves whitespace at the
|
|
61
|
+
* Preserves whitespace at the first position as <code> </code>
|
|
62
62
|
* @param str A string to escape
|
|
63
63
|
*/
|
|
64
|
-
const
|
|
64
|
+
const escapeFirst = str => str && '\xa0' + str.slice(1);
|
|
65
65
|
// State
|
|
66
66
|
const mainText = computed(() => {
|
|
67
|
-
if (props.sliceIndex
|
|
68
|
-
let mainPart = props.text.slice(0, Math.abs(props.sliceIndex)
|
|
67
|
+
if (props.sliceIndex) {
|
|
68
|
+
let mainPart = props.text.slice(0, -Math.abs(props.sliceIndex));
|
|
69
69
|
if (mainPart[mainPart.length - 1] === ' ') {
|
|
70
70
|
mainPart = escapeLast(mainPart);
|
|
71
71
|
}
|
|
@@ -71,7 +71,7 @@ export { s as OrSearch } from '../OrSearch-f4ad73db.js';
|
|
|
71
71
|
export { s as OrSearchV3 } from '../OrSearch-e15c7fd2.js';
|
|
72
72
|
export { s as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-359fbf3a.js';
|
|
73
73
|
export { s as OrSelect } from '../OrSelect-6ff34196.js';
|
|
74
|
-
export { s as OrSelectV3 } from '../OrSelect-
|
|
74
|
+
export { s as OrSelectV3 } from '../OrSelect-3dbddc6b.js';
|
|
75
75
|
export { s as OrSidebar, O as OrSidebarSide } from '../OrSidebar-375c85a3.js';
|
|
76
76
|
export { s as OrSidebarV3 } from '../OrSidebar-bfd19c4c.js';
|
|
77
77
|
export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-63914891.js';
|
|
@@ -96,7 +96,7 @@ export { s as OrTag } from '../OrTag-2d9eacf8.js';
|
|
|
96
96
|
export { s as OrTagV3, a as TagColor, T as TagVariant } from '../OrTag-6116c6e3.js';
|
|
97
97
|
export { s as OrTeleport } from '../OrTeleport.vue3-9bce0c02.js';
|
|
98
98
|
export { s as OrTeleportV3 } from '../OrTeleport.vue3-8099178c.js';
|
|
99
|
-
export { s as OrTextV3 } from '../OrText-
|
|
99
|
+
export { s as OrTextV3 } from '../OrText-de6b2fe2.js';
|
|
100
100
|
export { s as OrTextarea } from '../OrTextarea-f6722edc.js';
|
|
101
101
|
export { s as OrTextareaV3 } from '../OrTextarea-fa1454e3.js';
|
|
102
102
|
export { s as OrTextbox, T as TextboxTypes } from '../OrTextbox-6e585202.js';
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -71,7 +71,7 @@ export { s as OrSearch } from './OrSearch-f4ad73db.js';
|
|
|
71
71
|
export { s as OrSearchV3 } from './OrSearch-e15c7fd2.js';
|
|
72
72
|
export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-359fbf3a.js';
|
|
73
73
|
export { s as OrSelect } from './OrSelect-6ff34196.js';
|
|
74
|
-
export { s as OrSelectV3 } from './OrSelect-
|
|
74
|
+
export { s as OrSelectV3 } from './OrSelect-3dbddc6b.js';
|
|
75
75
|
export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-375c85a3.js';
|
|
76
76
|
export { s as OrSidebarV3 } from './OrSidebar-bfd19c4c.js';
|
|
77
77
|
export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-63914891.js';
|
|
@@ -96,7 +96,7 @@ export { s as OrTag } from './OrTag-2d9eacf8.js';
|
|
|
96
96
|
export { s as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-6116c6e3.js';
|
|
97
97
|
export { s as OrTeleport } from './OrTeleport.vue3-9bce0c02.js';
|
|
98
98
|
export { s as OrTeleportV3 } from './OrTeleport.vue3-8099178c.js';
|
|
99
|
-
export { s as OrTextV3 } from './OrText-
|
|
99
|
+
export { s as OrTextV3 } from './OrText-de6b2fe2.js';
|
|
100
100
|
export { s as OrTextarea } from './OrTextarea-f6722edc.js';
|
|
101
101
|
export { s as OrTextareaV3 } from './OrTextarea-fa1454e3.js';
|
|
102
102
|
export { s as OrTextbox, T as TextboxTypes } from './OrTextbox-6e585202.js';
|
package/package.json
CHANGED
|
@@ -168,7 +168,7 @@ const Template: StoryFn<typeof OrSelect> = (args) => ({
|
|
|
168
168
|
|
|
169
169
|
setup() {
|
|
170
170
|
// State
|
|
171
|
-
const model = ref<string | string[]>();
|
|
171
|
+
const model = ref<string | string[]>(args.modelValue);
|
|
172
172
|
const searchOptions = ref<SelectOption[]>(args.options);
|
|
173
173
|
|
|
174
174
|
// Handlers
|
|
@@ -468,3 +468,41 @@ WithLongStrings.args = {
|
|
|
468
468
|
|
|
469
469
|
placeholder: 'Wery Wery Wery WeryWeryWeryWery Wery Wery long placeholder',
|
|
470
470
|
};
|
|
471
|
+
|
|
472
|
+
export const MultipleReadonly = Template.bind({});
|
|
473
|
+
|
|
474
|
+
MultipleReadonly.args = {
|
|
475
|
+
...Default.args,
|
|
476
|
+
readonly: true,
|
|
477
|
+
options: Array.from<string, SelectOption>([
|
|
478
|
+
'Alfa',
|
|
479
|
+
'Bravo',
|
|
480
|
+
'Charlie',
|
|
481
|
+
'Delta',
|
|
482
|
+
'Echo',
|
|
483
|
+
], (item) => ({
|
|
484
|
+
value: item.toLowerCase().replace(/\s/g, ''),
|
|
485
|
+
label: item,
|
|
486
|
+
})),
|
|
487
|
+
multiple: true,
|
|
488
|
+
modelValue: ['alfa', 'bravo'],
|
|
489
|
+
};
|
|
490
|
+
export const MultipleDisabled = Template.bind({});
|
|
491
|
+
|
|
492
|
+
MultipleDisabled.args = {
|
|
493
|
+
...Default.args,
|
|
494
|
+
options: Array.from<string, SelectOption>([
|
|
495
|
+
'Alfa',
|
|
496
|
+
'Bravo',
|
|
497
|
+
'Charlie',
|
|
498
|
+
'Delta',
|
|
499
|
+
'Echo',
|
|
500
|
+
], (item) => ({
|
|
501
|
+
value: item.toLowerCase().replace(/\s/g, ''),
|
|
502
|
+
label: item,
|
|
503
|
+
})),
|
|
504
|
+
disabled: true,
|
|
505
|
+
multiple: true,
|
|
506
|
+
modelValue: ['alfa', 'bravo'],
|
|
507
|
+
paceholder: 'disabled placeholder',
|
|
508
|
+
};
|
|
@@ -70,26 +70,23 @@ export default defineComponent({
|
|
|
70
70
|
]);
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Preserves whitespace at the
|
|
73
|
+
* Preserves whitespace at the last position as <code> </code>
|
|
74
74
|
* @param str A string to escape
|
|
75
75
|
*/
|
|
76
|
-
const
|
|
77
|
-
|
|
76
|
+
const escapeLast = (str: string): string => str && (str.slice(0, -1) + '\xa0');
|
|
78
77
|
/**
|
|
79
|
-
* Preserves whitespace at the
|
|
78
|
+
* Preserves whitespace at the first position as <code> </code>
|
|
80
79
|
* @param str A string to escape
|
|
81
80
|
*/
|
|
82
|
-
const
|
|
81
|
+
const escapeFirst = (str: string): string => str && ('\xa0' + str.slice(1));
|
|
83
82
|
|
|
84
83
|
// State
|
|
85
84
|
const mainText = computed(() => {
|
|
86
|
-
if (props.sliceIndex
|
|
87
|
-
let mainPart = props.text.slice(0, Math.abs(props.sliceIndex)
|
|
88
|
-
|
|
85
|
+
if (props.sliceIndex) {
|
|
86
|
+
let mainPart = props.text.slice(0, -Math.abs(props.sliceIndex));
|
|
89
87
|
if (mainPart[mainPart.length - 1] === ' ') {
|
|
90
88
|
mainPart = escapeLast(mainPart);
|
|
91
89
|
}
|
|
92
|
-
|
|
93
90
|
return mainPart;
|
|
94
91
|
}
|
|
95
92
|
|
|
@@ -98,11 +95,9 @@ export default defineComponent({
|
|
|
98
95
|
|
|
99
96
|
const restText = computed(() => {
|
|
100
97
|
let restPart = props.text.slice(mainText.value.length);
|
|
101
|
-
|
|
102
98
|
if (restPart[0] === ' ') {
|
|
103
99
|
restPart = escapeFirst(restPart);
|
|
104
100
|
}
|
|
105
|
-
|
|
106
101
|
return restPart;
|
|
107
102
|
});
|
|
108
103
|
|