@sdata/web-vue 3.27.0 → 3.28.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/sd.css +4 -0
- package/dist/sd.min.css +1 -1
- package/es/_utils/grapheme.d.ts +5 -0
- package/es/_utils/grapheme.js +93 -0
- package/es/basic-crud-table/basic-crud-table.vue_vue_type_script_setup_true_lang.js +33 -23
- package/es/basic-crud-table/index.d.ts +1 -1
- package/es/basic-crud-table/types.d.ts +9 -1
- package/es/components.d.ts +1 -0
- package/es/index.css +4 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +4 -1
- package/es/index.scss +1 -0
- package/es/input/input.js +5 -6
- package/es/input-mask/index.d.ts +120 -0
- package/es/input-mask/index.js +12 -0
- package/es/input-mask/input-mask.js +5 -0
- package/es/input-mask/input-mask.vue.d.ts +49 -0
- package/es/input-mask/input-mask.vue_vue_type_script_setup_true_lang.js +346 -0
- package/es/input-mask/mask-engine.d.ts +18 -0
- package/es/input-mask/mask-engine.js +176 -0
- package/es/input-mask/presets.d.ts +2 -0
- package/es/input-mask/presets.js +220 -0
- package/es/input-mask/style/css.js +1 -0
- package/es/input-mask/style/index.css +20 -0
- package/es/input-mask/style/index.d.ts +2 -0
- package/es/input-mask/style/index.js +1 -0
- package/es/input-mask/style/index.scss +10 -0
- package/es/input-mask/style/token.scss +5 -0
- package/es/input-mask/types.d.ts +49 -0
- package/es/sd-vue.js +2 -0
- package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +5 -6
- package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +8 -10
- package/es/toolbar/types.d.ts +3 -0
- package/json/vetur-attributes.json +6 -0
- package/json/vetur-tags.json +5 -0
- package/json/web-types.json +23 -1
- package/package.json +1 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
//#region components/input-mask/presets.ts
|
|
2
|
+
var testPattern = (pattern, value) => {
|
|
3
|
+
pattern.lastIndex = 0;
|
|
4
|
+
return pattern.test(value);
|
|
5
|
+
};
|
|
6
|
+
var filterCharacters = (pattern) => (value) => Array.from(value).filter((character) => testPattern(pattern, character)).join("");
|
|
7
|
+
var acceptsIpv4 = (value) => {
|
|
8
|
+
if (!/^\d*(?:\.\d*){0,3}$/.test(value)) return false;
|
|
9
|
+
return value.split(".").every((part) => part.length <= 3 && (!part || Number(part) <= 255));
|
|
10
|
+
};
|
|
11
|
+
var acceptsIpv6 = (value) => {
|
|
12
|
+
var _value$match, _value$match2;
|
|
13
|
+
if (!/^[0-9A-Fa-f:]*$/.test(value)) return false;
|
|
14
|
+
if (value.includes(":::")) return false;
|
|
15
|
+
if (((_value$match = value.match(/::/g)) !== null && _value$match !== void 0 ? _value$match : []).length > 1) return false;
|
|
16
|
+
if (((_value$match2 = value.match(/:/g)) !== null && _value$match2 !== void 0 ? _value$match2 : []).length > 7) return false;
|
|
17
|
+
return value.split(":").every((part) => part.length <= 4);
|
|
18
|
+
};
|
|
19
|
+
var formatDateTimeDigits = (digits, dateTimeSeparator) => {
|
|
20
|
+
const value = digits.slice(0, 14);
|
|
21
|
+
let result = value.slice(0, 4);
|
|
22
|
+
if (value.length >= 4) result += "-";
|
|
23
|
+
result += value.slice(4, 6);
|
|
24
|
+
if (value.length >= 6) result += "-";
|
|
25
|
+
result += value.slice(6, 8);
|
|
26
|
+
if (value.length >= 8) result += dateTimeSeparator;
|
|
27
|
+
result += value.slice(8, 10);
|
|
28
|
+
if (value.length >= 10) result += ":";
|
|
29
|
+
result += value.slice(10, 12);
|
|
30
|
+
if (value.length >= 12) result += ":";
|
|
31
|
+
result += value.slice(12, 14);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
var normalizeDateTime = (dateTimeSeparator) => (value) => {
|
|
35
|
+
const normalized = filterCharacters(/[0-9TtZz:+\-. ]/)(value);
|
|
36
|
+
const suffix = normalized.slice(19);
|
|
37
|
+
if (normalized.includes(".") || /[Zz+]/.test(normalized) || suffix.includes("-")) return normalized;
|
|
38
|
+
return formatDateTimeDigits(normalized.replace(/\D/g, ""), dateTimeSeparator);
|
|
39
|
+
};
|
|
40
|
+
var normalizeIban = (value) => filterCharacters(/[A-Za-z0-9]/)(value).toUpperCase().slice(0, 34).replace(/(.{4})(?=.)/g, "$1 ");
|
|
41
|
+
var looseUriCharacters = /[^\s]/u;
|
|
42
|
+
var inputMaskPresets = {
|
|
43
|
+
"date": {
|
|
44
|
+
placeholder: "YYYY-MM-DD",
|
|
45
|
+
inputMode: "numeric",
|
|
46
|
+
mask: "9999-99-99"
|
|
47
|
+
},
|
|
48
|
+
"time": {
|
|
49
|
+
placeholder: "HH:MM:SS",
|
|
50
|
+
inputMode: "numeric",
|
|
51
|
+
mask: "99:99:99"
|
|
52
|
+
},
|
|
53
|
+
"datetime": {
|
|
54
|
+
placeholder: "2026-08-06 10:30:00",
|
|
55
|
+
inputMode: "text",
|
|
56
|
+
normalize: normalizeDateTime(" "),
|
|
57
|
+
accepts: (value) => /^\d{0,4}(?:-\d{0,2}(?:-\d{0,2}(?:[Tt ]\d{0,2}(?::\d{0,2}(?::\d{0,2}(?:\.\d{0,6})?(?:[Zz]|[+-]\d{0,2}(?::\d{0,2})?)?)?)?)?)?)?$/.test(value)
|
|
58
|
+
},
|
|
59
|
+
"rfc3339": {
|
|
60
|
+
placeholder: "2026-08-06T10:30:00+08:00",
|
|
61
|
+
inputMode: "text",
|
|
62
|
+
normalize: normalizeDateTime("T"),
|
|
63
|
+
accepts: (value) => /^\d{0,4}(?:-\d{0,2}(?:-\d{0,2}(?:[Tt]\d{0,2}(?::\d{0,2}(?::\d{0,2}(?:\.\d{0,6})?(?:[Zz]|[+-]\d{0,2}(?::\d{0,2})?)?)?)?)?)?)?$/.test(value)
|
|
64
|
+
},
|
|
65
|
+
"ip": {
|
|
66
|
+
placeholder: "192.168.1.1 或 2001:db8::1",
|
|
67
|
+
inputMode: "text",
|
|
68
|
+
normalize: filterCharacters(/[0-9A-Fa-f:.]/),
|
|
69
|
+
accepts: (value) => acceptsIpv4(value) || acceptsIpv6(value)
|
|
70
|
+
},
|
|
71
|
+
"ipv4": {
|
|
72
|
+
placeholder: "192.168.1.1",
|
|
73
|
+
inputMode: "decimal",
|
|
74
|
+
normalize: filterCharacters(/[0-9.]/),
|
|
75
|
+
accepts: acceptsIpv4
|
|
76
|
+
},
|
|
77
|
+
"ipv6": {
|
|
78
|
+
placeholder: "2001:db8::1",
|
|
79
|
+
inputMode: "text",
|
|
80
|
+
normalize: filterCharacters(/[0-9A-Fa-f:]/),
|
|
81
|
+
accepts: acceptsIpv6
|
|
82
|
+
},
|
|
83
|
+
"ip-range": {
|
|
84
|
+
placeholder: "192.168.1.0/24",
|
|
85
|
+
inputMode: "text",
|
|
86
|
+
normalize: filterCharacters(/[0-9A-Fa-f:./]/),
|
|
87
|
+
accepts: (value) => {
|
|
88
|
+
const slash = value.lastIndexOf("/");
|
|
89
|
+
if (slash === -1) return acceptsIpv4(value) || acceptsIpv6(value);
|
|
90
|
+
const ip = value.slice(0, slash);
|
|
91
|
+
const prefix = value.slice(slash + 1);
|
|
92
|
+
if (!(acceptsIpv4(ip) || acceptsIpv6(ip))) return false;
|
|
93
|
+
if (prefix === "") return true;
|
|
94
|
+
if (!/^\d{0,3}$/.test(prefix)) return false;
|
|
95
|
+
const prefixNum = Number(prefix);
|
|
96
|
+
if (prefixNum > 128) return false;
|
|
97
|
+
if (ip.includes(".") && !ip.includes(":") && prefixNum > 32) return false;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"url": {
|
|
102
|
+
placeholder: "https://example.com/path",
|
|
103
|
+
inputMode: "url",
|
|
104
|
+
normalize: filterCharacters(/[A-Za-z0-9:/?#@!$&'()*+,;=._~%\u005B\u005D-]/),
|
|
105
|
+
accepts: (value) => /^(?:[A-Za-z][A-Za-z\d+.-]*:\/{0,2})?[A-Za-z0-9:/?#@!$&'()*+,;=._~%\u005B\u005D-]*$/.test(value)
|
|
106
|
+
},
|
|
107
|
+
"email": {
|
|
108
|
+
placeholder: "name@example.com",
|
|
109
|
+
inputMode: "email",
|
|
110
|
+
normalize: filterCharacters(looseUriCharacters),
|
|
111
|
+
accepts: (value) => /^[^\s@]*(?:@[^\s@]*)?$/u.test(value)
|
|
112
|
+
},
|
|
113
|
+
"fqdn": {
|
|
114
|
+
placeholder: "example.com",
|
|
115
|
+
inputMode: "url",
|
|
116
|
+
normalize: filterCharacters(/* @__PURE__ */ new RegExp("[\\p{Letter}\\p{Number}._*-]", "u")),
|
|
117
|
+
accepts: (value) => !value.includes("..")
|
|
118
|
+
},
|
|
119
|
+
"semver": {
|
|
120
|
+
placeholder: "1.2.3-beta.1+build.7",
|
|
121
|
+
inputMode: "text",
|
|
122
|
+
normalize: filterCharacters(/[0-9A-Za-z.+-]/),
|
|
123
|
+
accepts: (value) => /^(?:0|[1-9]\d*)?(?:\.(?:0|[1-9]\d*)?)?(?:\.(?:0|[1-9]\d*)?)?(?:-[0-9A-Za-z-]*(?:\.[0-9A-Za-z-]*)*)?(?:\+[0-9A-Za-z-]*(?:\.[0-9A-Za-z-]*)*)?$/.test(value)
|
|
124
|
+
},
|
|
125
|
+
"uuid": {
|
|
126
|
+
placeholder: "550e8400-e29b-41d4-a716-446655440000",
|
|
127
|
+
inputMode: "text",
|
|
128
|
+
mask: "hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh",
|
|
129
|
+
formatChars: { h: /[0-9A-Fa-f]/ }
|
|
130
|
+
},
|
|
131
|
+
"mac-address": {
|
|
132
|
+
placeholder: "01:23:45:67:89:ab",
|
|
133
|
+
inputMode: "text",
|
|
134
|
+
mask: "hh:hh:hh:hh:hh:hh",
|
|
135
|
+
formatChars: { h: /[0-9A-Fa-f]/ }
|
|
136
|
+
},
|
|
137
|
+
"lat-long": {
|
|
138
|
+
placeholder: "31.2304, 121.4737",
|
|
139
|
+
inputMode: "text",
|
|
140
|
+
normalize: filterCharacters(/[-0-9+., ]/),
|
|
141
|
+
accepts: (value) => /^[-+]?\d*(?:\.\d*)?(?:, ?[-+]?\d*(?:\.\d*)?)?$/.test(value)
|
|
142
|
+
},
|
|
143
|
+
"hex-color": {
|
|
144
|
+
placeholder: "#1677ff",
|
|
145
|
+
inputMode: "text",
|
|
146
|
+
normalize: filterCharacters(/[0-9A-Fa-f#]/),
|
|
147
|
+
accepts: (value) => /^#?[0-9A-Fa-f]{0,8}$/.test(value)
|
|
148
|
+
},
|
|
149
|
+
"rgb-color": {
|
|
150
|
+
placeholder: "rgb(22, 119, 255)",
|
|
151
|
+
inputMode: "text",
|
|
152
|
+
normalize: filterCharacters(/[0-9a-zA-Z().,% ]/),
|
|
153
|
+
accepts: (value) => /^r(?:g(?:b(?:a)?)?)?\(?(?:\d{0,3}(?:, ?\d{0,3}(?:, ?\d{0,3}(?:, ?(?:\d{0,3}(?:\.\d{0,3})?%?)?)?)?)?)?\)?$/i.test(value)
|
|
154
|
+
},
|
|
155
|
+
"hsl": {
|
|
156
|
+
placeholder: "hsl(210, 100%, 50%)",
|
|
157
|
+
inputMode: "text",
|
|
158
|
+
normalize: filterCharacters(/[0-9a-zA-Z().,% ]/),
|
|
159
|
+
accepts: (value) => /^h(?:s(?:l(?:a)?)?)?\(?(?:\d{0,3}(?:, ?\d{0,3}%?(?:, ?\d{0,3}%?(?:, ?(?:\d{0,3}(?:\.\d{0,3})?%?)?)?)?)?)?\)?$/i.test(value)
|
|
160
|
+
},
|
|
161
|
+
"imei": {
|
|
162
|
+
placeholder: "12-345678-901234-5",
|
|
163
|
+
inputMode: "numeric",
|
|
164
|
+
mask: "99-999999-999999-9"
|
|
165
|
+
},
|
|
166
|
+
"issn": {
|
|
167
|
+
placeholder: "1234-567X",
|
|
168
|
+
inputMode: "text",
|
|
169
|
+
mask: "9999-999x",
|
|
170
|
+
formatChars: { x: /[0-9Xx]/ }
|
|
171
|
+
},
|
|
172
|
+
"isrc": {
|
|
173
|
+
placeholder: "US-AAA-26-12345",
|
|
174
|
+
inputMode: "text",
|
|
175
|
+
mask: "aa-aaa-99-99999"
|
|
176
|
+
},
|
|
177
|
+
"iso6346": {
|
|
178
|
+
placeholder: "MSCU 123456 7",
|
|
179
|
+
inputMode: "text",
|
|
180
|
+
mask: "aaaa 999999 9"
|
|
181
|
+
},
|
|
182
|
+
"jwt": {
|
|
183
|
+
placeholder: "header.payload.signature",
|
|
184
|
+
inputMode: "text",
|
|
185
|
+
normalize: filterCharacters(/[0-9A-Za-z._-]/),
|
|
186
|
+
accepts: (value) => /^[0-9A-Za-z_-]*(?:\.[0-9A-Za-z_-]*){0,2}$/.test(value)
|
|
187
|
+
},
|
|
188
|
+
"mime-type": {
|
|
189
|
+
placeholder: "application/json",
|
|
190
|
+
inputMode: "text",
|
|
191
|
+
normalize: filterCharacters(/[0-9A-Za-z!#$&^_.+/-]/),
|
|
192
|
+
accepts: (value) => /^[^/\s]*(?:\/[^/\s]*)?$/.test(value)
|
|
193
|
+
},
|
|
194
|
+
"mailto-uri": {
|
|
195
|
+
placeholder: "mailto:name@example.com",
|
|
196
|
+
inputMode: "email",
|
|
197
|
+
normalize: filterCharacters(looseUriCharacters),
|
|
198
|
+
accepts: (value) => /^(?:mailto:?)?[^\s]*$/i.test(value)
|
|
199
|
+
},
|
|
200
|
+
"data-uri": {
|
|
201
|
+
placeholder: "data:text/plain;base64,...",
|
|
202
|
+
inputMode: "text",
|
|
203
|
+
normalize: filterCharacters(looseUriCharacters),
|
|
204
|
+
accepts: (value) => /^(?:data:?)?[^\s]*$/i.test(value)
|
|
205
|
+
},
|
|
206
|
+
"magnet-uri": {
|
|
207
|
+
placeholder: "magnet:?xt=urn:btih:...",
|
|
208
|
+
inputMode: "text",
|
|
209
|
+
normalize: filterCharacters(looseUriCharacters),
|
|
210
|
+
accepts: (value) => /^(?:magnet:?)?[^\s]*$/i.test(value)
|
|
211
|
+
},
|
|
212
|
+
"iban": {
|
|
213
|
+
placeholder: "GB82 WEST 1234 5698 7654 32",
|
|
214
|
+
inputMode: "text",
|
|
215
|
+
normalize: normalizeIban,
|
|
216
|
+
accepts: (value) => /^[A-Z0-9 ]{0,42}$/.test(value)
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
//#endregion
|
|
220
|
+
export { inputMaskPresets };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/******** borderSize *******/
|
|
2
|
+
/******** borderStyle *******/
|
|
3
|
+
/******** radius *******/
|
|
4
|
+
/******** shadow distance *******/
|
|
5
|
+
/******** size *******/
|
|
6
|
+
/******** spacing *******/
|
|
7
|
+
/******** shadow *******/
|
|
8
|
+
/******** opacity *******/
|
|
9
|
+
/******** fontSize *******/
|
|
10
|
+
/******** fontWeight ********/
|
|
11
|
+
/******** Primary *******/
|
|
12
|
+
/******** success *******/
|
|
13
|
+
/******** warning *******/
|
|
14
|
+
/******** danger *******/
|
|
15
|
+
/******** link *******/
|
|
16
|
+
/******** radius *******/
|
|
17
|
+
/********* icon hover *********/
|
|
18
|
+
.sd-input-mask .sd-input {
|
|
19
|
+
font-variant-numeric: tabular-nums;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.scss";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@use '@style/theme/index.scss' as theme;
|
|
2
|
+
@use '@components/input-mask/style/token.scss' as *;
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
|
|
5
|
+
$input-mask-prefix-cls: string.unquote('#{theme.$prefix}-input-mask');
|
|
6
|
+
$input-prefix-cls: string.unquote('#{theme.$prefix}-input');
|
|
7
|
+
|
|
8
|
+
.#{$input-mask-prefix-cls} .#{$input-prefix-cls} {
|
|
9
|
+
font-variant-numeric: $input-mask-font-variant-numeric;
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type InputMaskSize = 'mini' | 'small' | 'medium' | 'large';
|
|
2
|
+
export type InputMaskToken = string | RegExp;
|
|
3
|
+
export type InputMaskPattern = string | readonly InputMaskToken[];
|
|
4
|
+
export interface InputMaskSelection {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
}
|
|
8
|
+
export interface InputMaskState {
|
|
9
|
+
value: string;
|
|
10
|
+
selection: InputMaskSelection | null;
|
|
11
|
+
}
|
|
12
|
+
export type InputMaskBeforeChange = (nextState: InputMaskState, previousState: InputMaskState) => InputMaskState;
|
|
13
|
+
export interface InputMaskPresetDefinition {
|
|
14
|
+
placeholder: string;
|
|
15
|
+
inputMode?: 'decimal' | 'email' | 'numeric' | 'search' | 'tel' | 'text' | 'url';
|
|
16
|
+
mask?: InputMaskPattern;
|
|
17
|
+
formatChars?: Readonly<Record<string, RegExp>>;
|
|
18
|
+
normalize?: (value: string) => string;
|
|
19
|
+
accepts?: (value: string) => boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface InputMaskProps {
|
|
22
|
+
modelValue?: string;
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
mask?: InputMaskPattern;
|
|
25
|
+
preset?: InputMaskPresetName;
|
|
26
|
+
maskChar?: string | null;
|
|
27
|
+
formatChars?: Readonly<Record<string, RegExp>>;
|
|
28
|
+
alwaysShowMask?: boolean;
|
|
29
|
+
beforeMaskedValueChange?: InputMaskBeforeChange;
|
|
30
|
+
size?: InputMaskSize;
|
|
31
|
+
allowClear?: boolean;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
readonly?: boolean | string;
|
|
34
|
+
error?: boolean;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
fitWidth?: boolean;
|
|
37
|
+
maxWFull?: boolean;
|
|
38
|
+
showWordLimit?: boolean;
|
|
39
|
+
maxLength?: number | {
|
|
40
|
+
length: number;
|
|
41
|
+
errorOnly?: boolean;
|
|
42
|
+
};
|
|
43
|
+
wordLength?: (value: string) => number;
|
|
44
|
+
wordSlice?: (value: string, maxLength: number) => string;
|
|
45
|
+
inputAttrs?: Record<string, unknown>;
|
|
46
|
+
prepend?: string;
|
|
47
|
+
append?: string;
|
|
48
|
+
}
|
|
49
|
+
export type InputMaskPresetName = 'data-uri' | 'date' | 'datetime' | 'email' | 'fqdn' | 'hex-color' | 'hsl' | 'iban' | 'imei' | 'ip' | 'ip-range' | 'ipv4' | 'ipv6' | 'isrc' | 'iso6346' | 'issn' | 'jwt' | 'lat-long' | 'mac-address' | 'magnet-uri' | 'mailto-uri' | 'mime-type' | 'rgb-color' | 'rfc3339' | 'semver' | 'time' | 'url' | 'uuid';
|
package/es/sd-vue.js
CHANGED
|
@@ -105,6 +105,7 @@ import preview_group_default from "./image/preview-group.js";
|
|
|
105
105
|
import Image from "./image/index.js";
|
|
106
106
|
import FilePreviewer from "./file-previewer/index.js";
|
|
107
107
|
import Icon from "./icon-component/index.js";
|
|
108
|
+
import InputMask from "./input-mask/index.js";
|
|
108
109
|
import KvList from "./kv-list/index.js";
|
|
109
110
|
import content_default from "./layout/content.js";
|
|
110
111
|
import footer_default from "./layout/footer.js";
|
|
@@ -194,6 +195,7 @@ var components = {
|
|
|
194
195
|
JsonForm,
|
|
195
196
|
KvList,
|
|
196
197
|
Input,
|
|
198
|
+
InputMask,
|
|
197
199
|
InputNumber,
|
|
198
200
|
InputTag,
|
|
199
201
|
Mention,
|
|
@@ -12,6 +12,7 @@ import { useCursor } from "../_hooks/use-cursor.js";
|
|
|
12
12
|
import { useFitWidth } from "../_hooks/use-fit-width.js";
|
|
13
13
|
import { isReadonlyModificationKey, useReadonlyTip, useReadonlyTipText } from "../_hooks/use-readonly-tip.js";
|
|
14
14
|
import { INPUT_EVENTS } from "../_utils/constant.js";
|
|
15
|
+
import { countGraphemes, sliceGraphemes } from "../_utils/grapheme.js";
|
|
15
16
|
import { omit } from "../_utils/omit.js";
|
|
16
17
|
import pick from "../_utils/pick.js";
|
|
17
18
|
import Tooltip from "../tooltip/index.js";
|
|
@@ -191,9 +192,8 @@ var textarea_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
|
|
|
191
192
|
return props.maxLength;
|
|
192
193
|
});
|
|
193
194
|
const getValueLength = (value) => {
|
|
194
|
-
var _value$length;
|
|
195
195
|
if (isFunction(props.wordLength)) return props.wordLength(value);
|
|
196
|
-
return (
|
|
196
|
+
return countGraphemes(value);
|
|
197
197
|
};
|
|
198
198
|
const valueLength = computed(() => getValueLength(computedValue.value));
|
|
199
199
|
const mergedError = computed(() => _mergedError.value || Boolean(computedMaxLength.value && maxLengthErrorOnly.value && valueLength.value > computedMaxLength.value));
|
|
@@ -214,10 +214,9 @@ var textarea_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
|
|
|
214
214
|
});
|
|
215
215
|
};
|
|
216
216
|
const updateValue = (value, inner = true) => {
|
|
217
|
-
if (computedMaxLength.value && !maxLengthErrorOnly.value && getValueLength(value) > computedMaxLength.value)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
217
|
+
if (computedMaxLength.value && !maxLengthErrorOnly.value && getValueLength(value) > computedMaxLength.value) if (isFunction(props.wordSlice)) value = props.wordSlice(value, computedMaxLength.value);
|
|
218
|
+
else if (isFunction(props.wordLength)) value = value.slice(0, computedMaxLength.value);
|
|
219
|
+
else value = sliceGraphemes(value, computedMaxLength.value);
|
|
221
220
|
_value.value = value;
|
|
222
221
|
if (inner) emit("update:modelValue", value);
|
|
223
222
|
keepControl();
|
|
@@ -27,6 +27,8 @@ var toolbar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
27
27
|
type: Boolean,
|
|
28
28
|
default: true
|
|
29
29
|
},
|
|
30
|
+
searchBtn: {},
|
|
31
|
+
resetBtn: {},
|
|
30
32
|
showActions: {
|
|
31
33
|
type: Boolean,
|
|
32
34
|
default: true
|
|
@@ -175,21 +177,17 @@ var toolbar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
175
177
|
_: 3
|
|
176
178
|
}, 8, ["class"])) : createCommentVNode("", true), _ctx.$slots.extra ? renderSlot(_ctx.$slots, "extra", {}, void 0, void 0, 1) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
177
179
|
renderSlot(_ctx.$slots, "action-prepend"),
|
|
178
|
-
__props.showSearch ? (openBlock(), createBlock(unref(Button), {
|
|
180
|
+
__props.showSearch ? (openBlock(), createBlock(unref(Button), mergeProps({
|
|
179
181
|
key: 0,
|
|
180
|
-
type: "primary"
|
|
181
|
-
|
|
182
|
-
}, {
|
|
182
|
+
type: "primary"
|
|
183
|
+
}, __props.searchBtn, { onClick: handleSearch }), {
|
|
183
184
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.searchText), 1)]),
|
|
184
185
|
_: 1
|
|
185
|
-
})) : createCommentVNode("", true),
|
|
186
|
-
__props.showReset ? (openBlock(), createBlock(unref(Button), {
|
|
187
|
-
key: 1,
|
|
188
|
-
onClick: _cache[1] || (_cache[1] = ($event) => reset())
|
|
189
|
-
}, {
|
|
186
|
+
}, 16)) : createCommentVNode("", true),
|
|
187
|
+
__props.showReset ? (openBlock(), createBlock(unref(Button), mergeProps({ key: 1 }, __props.resetBtn, { onClick: _cache[1] || (_cache[1] = ($event) => reset()) }), {
|
|
190
188
|
default: withCtx(() => [createTextVNode(toDisplayString(__props.resetText), 1)]),
|
|
191
189
|
_: 1
|
|
192
|
-
})) : createCommentVNode("", true),
|
|
190
|
+
}, 16)) : createCommentVNode("", true),
|
|
193
191
|
renderSlot(_ctx.$slots, "action-append")
|
|
194
192
|
], 64))], 2)) : createCommentVNode("", true)]),
|
|
195
193
|
_: 3
|
package/es/toolbar/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ButtonProps } from '../button';
|
|
1
2
|
import type { JsonFormSchema } from '../json-form';
|
|
2
3
|
import type { SpinProps } from '../spin';
|
|
3
4
|
export type ToolbarModelValue = Record<string, unknown>;
|
|
@@ -7,6 +8,8 @@ export interface ToolbarProps {
|
|
|
7
8
|
spinProps?: SpinProps;
|
|
8
9
|
showSearch?: boolean;
|
|
9
10
|
showReset?: boolean;
|
|
11
|
+
searchBtn?: ButtonProps;
|
|
12
|
+
resetBtn?: ButtonProps;
|
|
10
13
|
showActions?: boolean;
|
|
11
14
|
searchText?: string;
|
|
12
15
|
resetText?: string;
|
|
@@ -4184,6 +4184,12 @@
|
|
|
4184
4184
|
"description": "Whether to show the reset button",
|
|
4185
4185
|
"type": "boolean"
|
|
4186
4186
|
},
|
|
4187
|
+
"sd-toolbar/search-btn": {
|
|
4188
|
+
"description": "Props of the search button"
|
|
4189
|
+
},
|
|
4190
|
+
"sd-toolbar/reset-btn": {
|
|
4191
|
+
"description": "Props of the reset button"
|
|
4192
|
+
},
|
|
4187
4193
|
"sd-toolbar/show-actions": {
|
|
4188
4194
|
"description": "Whether to show the right-side action area",
|
|
4189
4195
|
"type": "boolean"
|
package/json/vetur-tags.json
CHANGED
|
@@ -698,6 +698,9 @@
|
|
|
698
698
|
"zoom-rate"
|
|
699
699
|
]
|
|
700
700
|
},
|
|
701
|
+
"sd-input-mask": {
|
|
702
|
+
"attributes": []
|
|
703
|
+
},
|
|
701
704
|
"sd-input-number": {
|
|
702
705
|
"attributes": [
|
|
703
706
|
"change",
|
|
@@ -1728,6 +1731,8 @@
|
|
|
1728
1731
|
"spin-props",
|
|
1729
1732
|
"show-search",
|
|
1730
1733
|
"show-reset",
|
|
1734
|
+
"search-btn",
|
|
1735
|
+
"reset-btn",
|
|
1731
1736
|
"show-actions",
|
|
1732
1737
|
"search-text",
|
|
1733
1738
|
"reset-text",
|
package/json/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "@sdata/web-vue",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.27.0",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"types-syntax": "typescript",
|
|
@@ -4126,6 +4126,12 @@
|
|
|
4126
4126
|
],
|
|
4127
4127
|
"slots": []
|
|
4128
4128
|
},
|
|
4129
|
+
{
|
|
4130
|
+
"name": "sd-input-mask",
|
|
4131
|
+
"attributes": [],
|
|
4132
|
+
"events": [],
|
|
4133
|
+
"slots": []
|
|
4134
|
+
},
|
|
4129
4135
|
{
|
|
4130
4136
|
"name": "sd-input-number",
|
|
4131
4137
|
"attributes": [
|
|
@@ -10225,6 +10231,22 @@
|
|
|
10225
10231
|
"kind": "expression"
|
|
10226
10232
|
}
|
|
10227
10233
|
},
|
|
10234
|
+
{
|
|
10235
|
+
"name": "search-btn",
|
|
10236
|
+
"description": "Props of the search button",
|
|
10237
|
+
"value": {
|
|
10238
|
+
"type": "ButtonProps",
|
|
10239
|
+
"kind": "expression"
|
|
10240
|
+
}
|
|
10241
|
+
},
|
|
10242
|
+
{
|
|
10243
|
+
"name": "reset-btn",
|
|
10244
|
+
"description": "Props of the reset button",
|
|
10245
|
+
"value": {
|
|
10246
|
+
"type": "ButtonProps",
|
|
10247
|
+
"kind": "expression"
|
|
10248
|
+
}
|
|
10249
|
+
},
|
|
10228
10250
|
{
|
|
10229
10251
|
"name": "show-actions",
|
|
10230
10252
|
"description": "Whether to show the right-side action area",
|