vueless 0.0.290 → 0.0.292
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/package.json
CHANGED
package/service.helper/index.js
CHANGED
|
@@ -6,40 +6,34 @@
|
|
|
6
6
|
@returns {Object}
|
|
7
7
|
*/
|
|
8
8
|
export function cloneDeep(entity, cache = new WeakMap()) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
!new RegExp(referenceTypes.join("|")).test(entityType) ||
|
|
14
|
-
entity instanceof WeakMap ||
|
|
15
|
-
entity instanceof WeakSet
|
|
16
|
-
) {
|
|
9
|
+
// primitives
|
|
10
|
+
if (Object(entity) !== entity) {
|
|
17
11
|
return entity;
|
|
18
12
|
}
|
|
19
13
|
|
|
14
|
+
// cyclic reference
|
|
20
15
|
if (cache.has(entity)) {
|
|
21
16
|
return cache.get(entity);
|
|
22
17
|
}
|
|
23
18
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
cache.set(entity, c);
|
|
19
|
+
const result =
|
|
20
|
+
entity instanceof Set
|
|
21
|
+
? new Set(entity)
|
|
22
|
+
: entity instanceof Map
|
|
23
|
+
? new Map(Array.from(entity, ([key, val]) => [key, cloneDeep(val, cache)]))
|
|
24
|
+
: entity instanceof Date
|
|
25
|
+
? new Date(entity)
|
|
26
|
+
: entity instanceof RegExp
|
|
27
|
+
? new RegExp(entity.source, entity.flags)
|
|
28
|
+
: entity.constructor
|
|
29
|
+
? new entity.constructor()
|
|
30
|
+
: Object.create(null);
|
|
31
|
+
|
|
32
|
+
cache.set(entity, result);
|
|
39
33
|
|
|
40
34
|
return Object.assign(
|
|
41
|
-
|
|
42
|
-
...Object.keys(entity).map((
|
|
35
|
+
result,
|
|
36
|
+
...Object.keys(entity).map((key) => ({ [key]: cloneDeep(entity[key], cache) })),
|
|
43
37
|
);
|
|
44
38
|
}
|
|
45
39
|
|
|
@@ -38,6 +38,9 @@ export default /*tw*/ {
|
|
|
38
38
|
md: "text-sm placeholder:text-sm",
|
|
39
39
|
lg: "text-base placeholder:text-base",
|
|
40
40
|
},
|
|
41
|
+
resizable: {
|
|
42
|
+
false: "resize-none",
|
|
43
|
+
},
|
|
41
44
|
},
|
|
42
45
|
},
|
|
43
46
|
defaults: {
|
|
@@ -46,6 +49,7 @@ export default /*tw*/ {
|
|
|
46
49
|
type: "text",
|
|
47
50
|
inputmode: "text",
|
|
48
51
|
labelAlign: "topInside",
|
|
52
|
+
resizable: false,
|
|
49
53
|
disabled: false,
|
|
50
54
|
readonly: false,
|
|
51
55
|
noAutocomplete: false,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
:placeholder="placeholder"
|
|
30
30
|
:readonly="readonly"
|
|
31
31
|
:disabled="disabled"
|
|
32
|
-
:rows="
|
|
32
|
+
:rows="currentRows"
|
|
33
33
|
:inputmode="inputmode"
|
|
34
34
|
:data-test="dataTest"
|
|
35
35
|
v-bind="textareaAttrs"
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
@mouseleave="onMouseleave"
|
|
40
40
|
@mousedown="onMousedown"
|
|
41
41
|
@click="onClick"
|
|
42
|
+
@keydown.enter="onEnter"
|
|
43
|
+
@keydown.backspace="onBackspace"
|
|
42
44
|
/>
|
|
43
45
|
</label>
|
|
44
46
|
<label v-if="hasSlotContent($slots['right'])" :for="id" v-bind="rightSlotAttrs">
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
</template>
|
|
50
52
|
|
|
51
53
|
<script setup>
|
|
52
|
-
import { computed, onMounted, ref, useSlots } from "vue";
|
|
54
|
+
import { computed, onMounted, ref, watch, useSlots } from "vue";
|
|
53
55
|
|
|
54
56
|
import ULabel from "../ui.form-label";
|
|
55
57
|
import { getRandomId, getDefault } from "../service.ui";
|
|
@@ -112,6 +114,14 @@ const props = defineProps({
|
|
|
112
114
|
default: "",
|
|
113
115
|
},
|
|
114
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Allow resizing of the textarea.
|
|
119
|
+
*/
|
|
120
|
+
resizable: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: getDefault(defaultConfig, UTextarea).resizable,
|
|
123
|
+
},
|
|
124
|
+
|
|
115
125
|
/**
|
|
116
126
|
* Make textarea read only.
|
|
117
127
|
*/
|
|
@@ -157,7 +167,7 @@ const props = defineProps({
|
|
|
157
167
|
* Set number of visible rows.
|
|
158
168
|
*/
|
|
159
169
|
rows: {
|
|
160
|
-
type: String,
|
|
170
|
+
type: [String, Number],
|
|
161
171
|
default: getDefault(defaultConfig, UTextarea).rows,
|
|
162
172
|
},
|
|
163
173
|
|
|
@@ -236,6 +246,33 @@ const labelComponentRef = ref(null);
|
|
|
236
246
|
const leftSlotWrapperRef = ref(null);
|
|
237
247
|
const textareaWrapperRef = ref(null);
|
|
238
248
|
|
|
249
|
+
const currentRows = ref(props.rows);
|
|
250
|
+
|
|
251
|
+
watch(
|
|
252
|
+
() => props.rows,
|
|
253
|
+
(newRows) => {
|
|
254
|
+
currentRows.value = newRows;
|
|
255
|
+
},
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
function onEnter() {
|
|
259
|
+
currentRows.value++;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function onBackspace() {
|
|
263
|
+
const textarea = textareaRef.value;
|
|
264
|
+
|
|
265
|
+
if (!textarea) return;
|
|
266
|
+
|
|
267
|
+
const content = textarea.value;
|
|
268
|
+
const newlineCount = (content.match(/\n/g) || []).length;
|
|
269
|
+
const newRowCount = Math.max(props.rows, newlineCount + 1);
|
|
270
|
+
|
|
271
|
+
if (newRowCount < currentRows.value) {
|
|
272
|
+
currentRows.value = newRowCount;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
239
276
|
const localValue = computed({
|
|
240
277
|
get() {
|
|
241
278
|
return props.modelValue;
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.292",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -8067,6 +8067,15 @@
|
|
|
8067
8067
|
},
|
|
8068
8068
|
"default": "\"\""
|
|
8069
8069
|
},
|
|
8070
|
+
{
|
|
8071
|
+
"name": "resizable",
|
|
8072
|
+
"description": "Allow resizing of the textarea.",
|
|
8073
|
+
"value": {
|
|
8074
|
+
"kind": "expression",
|
|
8075
|
+
"type": "boolean"
|
|
8076
|
+
},
|
|
8077
|
+
"default": "false"
|
|
8078
|
+
},
|
|
8070
8079
|
{
|
|
8071
8080
|
"name": "readonly",
|
|
8072
8081
|
"description": "Make textarea read only.",
|
|
@@ -8117,7 +8126,7 @@
|
|
|
8117
8126
|
"description": "Set number of visible rows.",
|
|
8118
8127
|
"value": {
|
|
8119
8128
|
"kind": "expression",
|
|
8120
|
-
"type": "string"
|
|
8129
|
+
"type": "string|number"
|
|
8121
8130
|
},
|
|
8122
8131
|
"default": "3"
|
|
8123
8132
|
},
|