persagy-vant 0.0.48 → 0.0.50

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.
@@ -198,10 +198,11 @@ var stdin_default = defineComponent({
198
198
  if (modelValue && getStringLength(modelValue) === +maxlength) {
199
199
  return modelValue;
200
200
  }
201
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
201
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
202
202
  if (state.focused && selectionEnd) {
203
203
  const valueArr = [...value];
204
204
  const exceededLength = valueArr.length - +maxlength;
205
+ selectionEnd = getStringLength(value.slice(0, selectionEnd));
205
206
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
206
207
  return valueArr.join("");
207
208
  }
@@ -212,7 +213,7 @@ var stdin_default = defineComponent({
212
213
  const updateValue = (value, trigger = "onChange") => {
213
214
  const originalValue = value;
214
215
  value = limitValueLength(value);
215
- const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
216
+ const limitDiffLen = originalValue.length - value.length;
216
217
  if (props.type === "number" || props.type === "digit") {
217
218
  const isNumber = props.type === "number";
218
219
  value = formatNumber(value, isNumber, isNumber);
@@ -232,7 +233,7 @@ var stdin_default = defineComponent({
232
233
  selectionEnd
233
234
  } = inputRef.value;
234
235
  const bcoVal = cutString(originalValue, selectionEnd);
235
- formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
236
+ formatterDiffLen = formatter(bcoVal).length - bcoVal.length;
236
237
  }
237
238
  }
238
239
  if (inputRef.value && inputRef.value.value !== value) {
@@ -243,7 +244,7 @@ var stdin_default = defineComponent({
243
244
  } = inputRef.value;
244
245
  inputRef.value.value = value;
245
246
  if (isDef(selectionStart) && isDef(selectionEnd)) {
246
- const valueLen = getStringLength(value);
247
+ const valueLen = value.length;
247
248
  if (limitDiffLen) {
248
249
  selectionStart -= limitDiffLen;
249
250
  selectionEnd -= limitDiffLen;
@@ -411,9 +412,16 @@ var stdin_default = defineComponent({
411
412
  "class": bem("unit")
412
413
  }, [props.unit]);
413
414
  };
415
+ const getWordLimitValue = () => {
416
+ const value = getModelValue();
417
+ if (props.type !== "textarea") {
418
+ return value;
419
+ }
420
+ return value.split(/\r\n|\r|\n/).map((paragraph) => paragraph.trim()).join("\n").trim();
421
+ };
414
422
  const renderWordLimit = () => {
415
423
  if (props.showWordLimit && props.maxlength) {
416
- const count = getStringLength(getModelValue());
424
+ const count = getStringLength(getWordLimitValue());
417
425
  return _createVNode("div", {
418
426
  "class": bem("word-limit")
419
427
  }, [_createVNode("span", {
package/es/index.d.ts CHANGED
@@ -117,4 +117,4 @@ declare namespace _default {
117
117
  }
118
118
  export default _default;
119
119
  export function install(app: any): void;
120
- export const version: "0.0.48";
120
+ export const version: "0.0.50";
package/es/index.mjs CHANGED
@@ -110,7 +110,7 @@ import { Uploader } from "./uploader/index.mjs";
110
110
  import { VideoPreview } from "./video-preview/index.mjs";
111
111
  import { WorkOrderCard } from "./work-order-card/index.mjs";
112
112
  import { WorkOrderFilter } from "./work-order-filter/index.mjs";
113
- const version = "0.0.48";
113
+ const version = "0.0.50";
114
114
  function install(app) {
115
115
  const components = [
116
116
  ActionBar,
@@ -221,10 +221,11 @@ var stdin_default = (0, import_vue.defineComponent)({
221
221
  if (modelValue && (0, import_utils2.getStringLength)(modelValue) === +maxlength) {
222
222
  return modelValue;
223
223
  }
224
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
224
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
225
225
  if (state.focused && selectionEnd) {
226
226
  const valueArr = [...value];
227
227
  const exceededLength = valueArr.length - +maxlength;
228
+ selectionEnd = (0, import_utils2.getStringLength)(value.slice(0, selectionEnd));
228
229
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
229
230
  return valueArr.join("");
230
231
  }
@@ -235,7 +236,7 @@ var stdin_default = (0, import_vue.defineComponent)({
235
236
  const updateValue = (value, trigger = "onChange") => {
236
237
  const originalValue = value;
237
238
  value = limitValueLength(value);
238
- const limitDiffLen = (0, import_utils2.getStringLength)(originalValue) - (0, import_utils2.getStringLength)(value);
239
+ const limitDiffLen = originalValue.length - value.length;
239
240
  if (props.type === "number" || props.type === "digit") {
240
241
  const isNumber = props.type === "number";
241
242
  value = (0, import_utils.formatNumber)(value, isNumber, isNumber);
@@ -255,7 +256,7 @@ var stdin_default = (0, import_vue.defineComponent)({
255
256
  selectionEnd
256
257
  } = inputRef.value;
257
258
  const bcoVal = (0, import_utils2.cutString)(originalValue, selectionEnd);
258
- formatterDiffLen = (0, import_utils2.getStringLength)(formatter(bcoVal)) - (0, import_utils2.getStringLength)(bcoVal);
259
+ formatterDiffLen = formatter(bcoVal).length - bcoVal.length;
259
260
  }
260
261
  }
261
262
  if (inputRef.value && inputRef.value.value !== value) {
@@ -266,7 +267,7 @@ var stdin_default = (0, import_vue.defineComponent)({
266
267
  } = inputRef.value;
267
268
  inputRef.value.value = value;
268
269
  if ((0, import_utils.isDef)(selectionStart) && (0, import_utils.isDef)(selectionEnd)) {
269
- const valueLen = (0, import_utils2.getStringLength)(value);
270
+ const valueLen = value.length;
270
271
  if (limitDiffLen) {
271
272
  selectionStart -= limitDiffLen;
272
273
  selectionEnd -= limitDiffLen;
@@ -434,9 +435,16 @@ var stdin_default = (0, import_vue.defineComponent)({
434
435
  "class": bem("unit")
435
436
  }, [props.unit]);
436
437
  };
438
+ const getWordLimitValue = () => {
439
+ const value = getModelValue();
440
+ if (props.type !== "textarea") {
441
+ return value;
442
+ }
443
+ return value.split(/\r\n|\r|\n/).map((paragraph) => paragraph.trim()).join("\n").trim();
444
+ };
437
445
  const renderWordLimit = () => {
438
446
  if (props.showWordLimit && props.maxlength) {
439
- const count = (0, import_utils2.getStringLength)(getModelValue());
447
+ const count = (0, import_utils2.getStringLength)(getWordLimitValue());
440
448
  return (0, import_vue.createVNode)("div", {
441
449
  "class": bem("word-limit")
442
450
  }, [(0, import_vue.createVNode)("span", {
package/lib/index.d.ts CHANGED
@@ -117,4 +117,4 @@ declare namespace _default {
117
117
  }
118
118
  export default _default;
119
119
  export function install(app: any): void;
120
- export const version: "0.0.48";
120
+ export const version: "0.0.50";
package/lib/index.js CHANGED
@@ -248,7 +248,7 @@ __reExport(stdin_exports, require("./uploader"), module.exports);
248
248
  __reExport(stdin_exports, require("./video-preview"), module.exports);
249
249
  __reExport(stdin_exports, require("./work-order-card"), module.exports);
250
250
  __reExport(stdin_exports, require("./work-order-filter"), module.exports);
251
- const version = "0.0.48";
251
+ const version = "0.0.50";
252
252
  function install(app) {
253
253
  const components = [
254
254
  import_action_bar.ActionBar,
package/lib/vant.cjs.js CHANGED
@@ -4197,10 +4197,11 @@ var stdin_default$1K = vue.defineComponent({
4197
4197
  if (modelValue && getStringLength(modelValue) === +maxlength) {
4198
4198
  return modelValue;
4199
4199
  }
4200
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4200
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4201
4201
  if (state.focused && selectionEnd) {
4202
4202
  const valueArr = [...value];
4203
4203
  const exceededLength = valueArr.length - +maxlength;
4204
+ selectionEnd = getStringLength(value.slice(0, selectionEnd));
4204
4205
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
4205
4206
  return valueArr.join("");
4206
4207
  }
@@ -4211,7 +4212,7 @@ var stdin_default$1K = vue.defineComponent({
4211
4212
  const updateValue = (value, trigger = "onChange") => {
4212
4213
  const originalValue = value;
4213
4214
  value = limitValueLength(value);
4214
- const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
4215
+ const limitDiffLen = originalValue.length - value.length;
4215
4216
  if (props2.type === "number" || props2.type === "digit") {
4216
4217
  const isNumber = props2.type === "number";
4217
4218
  value = formatNumber(value, isNumber, isNumber);
@@ -4231,7 +4232,7 @@ var stdin_default$1K = vue.defineComponent({
4231
4232
  selectionEnd
4232
4233
  } = inputRef.value;
4233
4234
  const bcoVal = cutString(originalValue, selectionEnd);
4234
- formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
4235
+ formatterDiffLen = formatter(bcoVal).length - bcoVal.length;
4235
4236
  }
4236
4237
  }
4237
4238
  if (inputRef.value && inputRef.value.value !== value) {
@@ -4242,7 +4243,7 @@ var stdin_default$1K = vue.defineComponent({
4242
4243
  } = inputRef.value;
4243
4244
  inputRef.value.value = value;
4244
4245
  if (isDef(selectionStart) && isDef(selectionEnd)) {
4245
- const valueLen = getStringLength(value);
4246
+ const valueLen = value.length;
4246
4247
  if (limitDiffLen) {
4247
4248
  selectionStart -= limitDiffLen;
4248
4249
  selectionEnd -= limitDiffLen;
@@ -4410,9 +4411,16 @@ var stdin_default$1K = vue.defineComponent({
4410
4411
  "class": bem$1x("unit")
4411
4412
  }, [props2.unit]);
4412
4413
  };
4414
+ const getWordLimitValue = () => {
4415
+ const value = getModelValue();
4416
+ if (props2.type !== "textarea") {
4417
+ return value;
4418
+ }
4419
+ return value.split(/\r\n|\r|\n/).map((paragraph) => paragraph.trim()).join("\n").trim();
4420
+ };
4413
4421
  const renderWordLimit = () => {
4414
4422
  if (props2.showWordLimit && props2.maxlength) {
4415
- const count = getStringLength(getModelValue());
4423
+ const count = getStringLength(getWordLimitValue());
4416
4424
  return vue.createVNode("div", {
4417
4425
  "class": bem$1x("word-limit")
4418
4426
  }, [vue.createVNode("span", {
@@ -21842,7 +21850,7 @@ const Lazyload = {
21842
21850
  });
21843
21851
  }
21844
21852
  };
21845
- const version = "0.0.48";
21853
+ const version = "0.0.50";
21846
21854
  function install(app) {
21847
21855
  const components = [
21848
21856
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -4195,10 +4195,11 @@ var stdin_default$1K = defineComponent({
4195
4195
  if (modelValue && getStringLength(modelValue) === +maxlength) {
4196
4196
  return modelValue;
4197
4197
  }
4198
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4198
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4199
4199
  if (state.focused && selectionEnd) {
4200
4200
  const valueArr = [...value];
4201
4201
  const exceededLength = valueArr.length - +maxlength;
4202
+ selectionEnd = getStringLength(value.slice(0, selectionEnd));
4202
4203
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
4203
4204
  return valueArr.join("");
4204
4205
  }
@@ -4209,7 +4210,7 @@ var stdin_default$1K = defineComponent({
4209
4210
  const updateValue = (value, trigger = "onChange") => {
4210
4211
  const originalValue = value;
4211
4212
  value = limitValueLength(value);
4212
- const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
4213
+ const limitDiffLen = originalValue.length - value.length;
4213
4214
  if (props2.type === "number" || props2.type === "digit") {
4214
4215
  const isNumber = props2.type === "number";
4215
4216
  value = formatNumber(value, isNumber, isNumber);
@@ -4229,7 +4230,7 @@ var stdin_default$1K = defineComponent({
4229
4230
  selectionEnd
4230
4231
  } = inputRef.value;
4231
4232
  const bcoVal = cutString(originalValue, selectionEnd);
4232
- formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
4233
+ formatterDiffLen = formatter(bcoVal).length - bcoVal.length;
4233
4234
  }
4234
4235
  }
4235
4236
  if (inputRef.value && inputRef.value.value !== value) {
@@ -4240,7 +4241,7 @@ var stdin_default$1K = defineComponent({
4240
4241
  } = inputRef.value;
4241
4242
  inputRef.value.value = value;
4242
4243
  if (isDef(selectionStart) && isDef(selectionEnd)) {
4243
- const valueLen = getStringLength(value);
4244
+ const valueLen = value.length;
4244
4245
  if (limitDiffLen) {
4245
4246
  selectionStart -= limitDiffLen;
4246
4247
  selectionEnd -= limitDiffLen;
@@ -4408,9 +4409,16 @@ var stdin_default$1K = defineComponent({
4408
4409
  "class": bem$1x("unit")
4409
4410
  }, [props2.unit]);
4410
4411
  };
4412
+ const getWordLimitValue = () => {
4413
+ const value = getModelValue();
4414
+ if (props2.type !== "textarea") {
4415
+ return value;
4416
+ }
4417
+ return value.split(/\r\n|\r|\n/).map((paragraph) => paragraph.trim()).join("\n").trim();
4418
+ };
4411
4419
  const renderWordLimit = () => {
4412
4420
  if (props2.showWordLimit && props2.maxlength) {
4413
- const count = getStringLength(getModelValue());
4421
+ const count = getStringLength(getWordLimitValue());
4414
4422
  return createVNode("div", {
4415
4423
  "class": bem$1x("word-limit")
4416
4424
  }, [createVNode("span", {
@@ -21840,7 +21848,7 @@ const Lazyload = {
21840
21848
  });
21841
21849
  }
21842
21850
  };
21843
- const version = "0.0.48";
21851
+ const version = "0.0.50";
21844
21852
  function install(app) {
21845
21853
  const components = [
21846
21854
  ActionBar,
package/lib/vant.js CHANGED
@@ -5435,10 +5435,11 @@
5435
5435
  if (modelValue && getStringLength(modelValue) === +maxlength) {
5436
5436
  return modelValue;
5437
5437
  }
5438
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
5438
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
5439
5439
  if (state.focused && selectionEnd) {
5440
5440
  const valueArr = [...value];
5441
5441
  const exceededLength = valueArr.length - +maxlength;
5442
+ selectionEnd = getStringLength(value.slice(0, selectionEnd));
5442
5443
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
5443
5444
  return valueArr.join("");
5444
5445
  }
@@ -5449,7 +5450,7 @@
5449
5450
  const updateValue = (value, trigger2 = "onChange") => {
5450
5451
  const originalValue = value;
5451
5452
  value = limitValueLength(value);
5452
- const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
5453
+ const limitDiffLen = originalValue.length - value.length;
5453
5454
  if (props2.type === "number" || props2.type === "digit") {
5454
5455
  const isNumber2 = props2.type === "number";
5455
5456
  value = formatNumber(value, isNumber2, isNumber2);
@@ -5469,7 +5470,7 @@
5469
5470
  selectionEnd
5470
5471
  } = inputRef.value;
5471
5472
  const bcoVal = cutString(originalValue, selectionEnd);
5472
- formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
5473
+ formatterDiffLen = formatter(bcoVal).length - bcoVal.length;
5473
5474
  }
5474
5475
  }
5475
5476
  if (inputRef.value && inputRef.value.value !== value) {
@@ -5480,7 +5481,7 @@
5480
5481
  } = inputRef.value;
5481
5482
  inputRef.value.value = value;
5482
5483
  if (isDef(selectionStart) && isDef(selectionEnd)) {
5483
- const valueLen = getStringLength(value);
5484
+ const valueLen = value.length;
5484
5485
  if (limitDiffLen) {
5485
5486
  selectionStart -= limitDiffLen;
5486
5487
  selectionEnd -= limitDiffLen;
@@ -5648,9 +5649,16 @@
5648
5649
  "class": bem$1x("unit")
5649
5650
  }, [props2.unit]);
5650
5651
  };
5652
+ const getWordLimitValue = () => {
5653
+ const value = getModelValue();
5654
+ if (props2.type !== "textarea") {
5655
+ return value;
5656
+ }
5657
+ return value.split(/\r\n|\r|\n/).map((paragraph) => paragraph.trim()).join("\n").trim();
5658
+ };
5651
5659
  const renderWordLimit = () => {
5652
5660
  if (props2.showWordLimit && props2.maxlength) {
5653
- const count = getStringLength(getModelValue());
5661
+ const count = getStringLength(getWordLimitValue());
5654
5662
  return vue.createVNode("div", {
5655
5663
  "class": bem$1x("word-limit")
5656
5664
  }, [vue.createVNode("span", {
@@ -25429,7 +25437,7 @@
25429
25437
  });
25430
25438
  }
25431
25439
  };
25432
- const version = "0.0.48";
25440
+ const version = "0.0.50";
25433
25441
  function install(app) {
25434
25442
  const components = [
25435
25443
  ActionBar,