eco-vue-js 0.11.34 → 0.11.35

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.
@@ -1 +1 @@
1
- {"version":3,"file":"WInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInput.vue"],"names":[],"mappings":"AA2PA;AA2iBA,OAAO,KAAK,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;AAatD,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAA;yBAE9B,IAAI,SAAS,SAAS,GAAG,MAAM,EAC/C,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAqyBO,mBAAmB,CAAC,oCAAkE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB;qBA3mB7B,IAAI;oBAOL,IAAI;+BAkCS,aAAa;0BA1KlB,MAAM,QAAQ,MAAM,KAAG,IAAI;wBAN/B,WAAW;;;oBAyBf,IAAI;oBAgBJ,IAAI;MAysBgD,GAAG,IAAI;WACpE,GAAG;;uBAhEgB,GAAG;0BACA,GAAG;wBACJ,GAAG;;;YAGH,GAAG;;;YAFH,GAAG;;;YAGH,GAAG;;mCAzgBF,aAAa;YAugBb,GAAG;uBAGL,GAAG;;;;YACF,GAAG;uBACJ,GAAG;uBACH,GAAG;wBACF,GAAG;;;YAxtB1B,oBAAoB,SAAS,4CAAa,SAAS,GAAG,IAAI;YAC1D,gBAAgB,SAAS,aAAa,GAAG,IAAI;YAC7C,aAAa,SAAS,aAAa,GAAG,IAAI;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value) inputRef.value.setCaret(start, end);
88
- else inputRef.value.setSelectionRange(start, end ?? null);
88
+ else inputRef.value.setSelectionRange(start, end ?? start);
89
89
  };
90
- const addToHistory = debounce((value) => {
90
+ const addToHistory = (value) => {
91
+ if (history.value.length === 0) {
92
+ history.value.push({ value: props.modelValue, caret: getCaret() });
93
+ historyPosition.value = 0;
94
+ }
95
+ addToHistoryDebounced(value);
96
+ };
97
+ const addToHistoryDebounced = debounce((value) => {
91
98
  const entry = { value, caret: getCaret() };
92
99
  if (historyPosition.value < history.value.length - 1) history.value = history.value.slice(0, historyPosition.value + 1);
93
100
  history.value.push(entry);
@@ -187,7 +194,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
187
194
  else inputRef.value?.focus();
188
195
  };
189
196
  const blur = () => inputRef.value?.blur();
197
+ const onPaste = async (e) => {
198
+ if (props.loading || isDisabled.value || isReadonly.value || props.unclickable) return;
199
+ navigator.clipboard.readText();
200
+ const text = (e.clipboardData?.getData("text/plain") || await navigator.clipboard.readText()).replace(/\r\n?/g, "\n");
201
+ if (!text) {
202
+ fieldWrapperRef.value?.showMessage("Nothing to paste");
203
+ return;
204
+ }
205
+ const caret = getCaret();
206
+ const value = props.modelValue?.toString() ?? "";
207
+ const newValue = value.slice(0, caret.start) + text + value.slice(caret.end);
208
+ updateModelValue(newValue);
209
+ await nextTick();
210
+ setCaret(Math.min(caret.start + text.length, props.modelValue?.toString().length ?? 0));
211
+ };
190
212
  const paste = async () => {
213
+ if (props.loading || isDisabled.value || isReadonly.value || props.unclickable) return;
191
214
  try {
192
215
  await checkPermissionPaste();
193
216
  await navigator.clipboard.readText().then((value) => {
@@ -429,7 +452,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
429
452
  onClick: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("click", $event)),
430
453
  onMousedown: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.$emit("mousedown", $event), ["stop"])),
431
454
  onSelect: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.$emit("select:input", $event), ["stop"])),
432
- "onUpdate:modelValue": updateModelValue
455
+ "onUpdate:modelValue": updateModelValue,
456
+ onPaste: withModifiers(onPaste, ["prevent"])
433
457
  }, null, 40, ["id", "class", "value", "placeholder", "type", "name", "disabled", "readonly", "autocomplete", "size", "step", "min", "max", "spellcheck", "max-length", "text-parts", "onFocus", "onBlur"])),
434
458
  renderSlot(_ctx.$slots, "after")
435
459
  ])
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEditable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/ContentEditable.vue"],"names":[],"mappings":"AAiBA;AA0UA,OAAO,KAAK,EAAC,QAAQ,EAAG,aAAa,EAAC,MAAM,UAAU,CAAA;AAStD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAA;IACjC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B,CAAC;;;;2BAqK4B,aAAa,KAAG,IAAI;2BATpB,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;;;AAsNvD,wBAUG"}
1
+ {"version":3,"file":"ContentEditable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/ContentEditable.vue"],"names":[],"mappings":"AAiBA;AAwUA,OAAO,KAAK,EAAC,QAAQ,EAAG,aAAa,EAAC,MAAM,UAAU,CAAA;AAStD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAA;IACjC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B,CAAC;;;;2BAmK4B,aAAa,KAAG,IAAI;2BATpB,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;;;AAsNvD,wBAUG"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, useTemplateRef, ref, watch, onMounted, createElementBlock, openBlock, nextTick } from 'vue';
1
+ import { defineComponent, useTemplateRef, ref, watch, onMounted, createElementBlock, openBlock, withModifiers, nextTick } from 'vue';
2
2
  import { WrapSelectionType } from '../../../utils/utils.js';
3
3
  import { preserveIndentation } from '../models/toolbarActions.js';
4
4
  import { getCaretOffset, setCaretOffset } from '../models/utils.js';
@@ -104,7 +104,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
104
104
  }
105
105
  };
106
106
  const onPaste = async (e) => {
107
- e.preventDefault();
108
107
  navigator.clipboard.readText();
109
108
  const text = (e.clipboardData?.getData("text/plain") || await navigator.clipboard.readText()).replace(/\r\n?/g, "\n");
110
109
  insertPlain(text);
@@ -246,7 +245,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
246
245
  class: "relative whitespace-pre",
247
246
  onInput,
248
247
  onBeforeinput: _cache[0] || (_cache[0] = ($event) => insertParagraph($event)),
249
- onPaste,
248
+ onPaste: withModifiers(onPaste, ["prevent"]),
250
249
  onKeydown: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("keydown", $event)),
251
250
  onFocus: _cache[2] || (_cache[2] = ($event) => {
252
251
  _ctx.$emit("focus", $event);
@@ -16,7 +16,7 @@ const HEADERS_FORMDATA = {
16
16
  class ApiClientInstance {
17
17
  constructor(config) {
18
18
  this.config = config;
19
- window.addEventListener("storage", this.checkAuth);
19
+ if (typeof window !== "undefined") window.addEventListener("storage", this.checkAuth);
20
20
  this.useAuth = () => {
21
21
  return this.auth;
22
22
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.11.34",
7
+ "version": "0.11.35",
8
8
  "dependencies": {
9
9
  "@stylistic/eslint-plugin": "5.2.3",
10
10
  "@tanstack/eslint-plugin-query": "5.83.1",