eco-vue-js 0.11.35 → 0.11.37
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/components/Auth/utils/utils.js +1 -1
- package/dist/components/Input/WInput.vue.d.ts.map +1 -1
- package/dist/components/Input/WInput.vue.js +12 -19
- package/dist/components/Input/components/ContentEditable.vue.d.ts +2 -2
- package/dist/components/Input/components/ContentEditable.vue2.js +2 -2
- package/dist/utils/ApiClient.js +1 -1
- package/package.json +1 -1
@@ -17,7 +17,7 @@ function deleteCookie(name) {
|
|
17
17
|
}
|
18
18
|
const EXP_FACTOR = 1e3;
|
19
19
|
function checkExpirationDate() {
|
20
|
-
const exp = Number.parseFloat(getCookie(EXPIRATION_DATE_KEY));
|
20
|
+
const exp = Number.parseFloat(localStorage.getItem(EXPIRATION_DATE_KEY) ?? getCookie(EXPIRATION_DATE_KEY));
|
21
21
|
if (!exp || !Number.isFinite(exp)) return null;
|
22
22
|
return exp > Date.now() / EXP_FACTOR;
|
23
23
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInput.vue"],"names":[],"mappings":"AA4PA;
|
1
|
+
{"version":3,"file":"WInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInput.vue"],"names":[],"mappings":"AA4PA;AAqkBA,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,C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;CAAG,GAAG,EAAE,CAAC"}
|
@@ -87,14 +87,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
87
87
|
if ("setCaret" in inputRef.value) inputRef.value.setCaret(start, end);
|
88
88
|
else inputRef.value.setSelectionRange(start, end ?? start);
|
89
89
|
};
|
90
|
-
const addToHistory = (value) => {
|
90
|
+
const addToHistory = (value, noDebounce) => {
|
91
91
|
if (history.value.length === 0) {
|
92
92
|
history.value.push({ value: props.modelValue, caret: getCaret() });
|
93
93
|
historyPosition.value = 0;
|
94
94
|
}
|
95
|
-
|
95
|
+
if (noDebounce) nextTick(() => addToHistoryFn(value));
|
96
|
+
else addToHistoryDebounced(value);
|
96
97
|
};
|
97
|
-
const
|
98
|
+
const addToHistoryFn = (value) => {
|
98
99
|
const entry = { value, caret: getCaret() };
|
99
100
|
if (historyPosition.value < history.value.length - 1) history.value = history.value.slice(0, historyPosition.value + 1);
|
100
101
|
history.value.push(entry);
|
@@ -103,7 +104,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
103
104
|
history.value.shift();
|
104
105
|
historyPosition.value--;
|
105
106
|
}
|
106
|
-
}
|
107
|
+
};
|
108
|
+
const addToHistoryDebounced = debounce(addToHistoryFn, 500);
|
107
109
|
const undo = () => {
|
108
110
|
if (props.loading || isDisabled.value || isReadonly.value || props.unclickable || props.textSecure) return;
|
109
111
|
if (historyPosition.value <= 0) {
|
@@ -140,12 +142,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
140
142
|
if (event.shiftKey) redo();
|
141
143
|
else undo();
|
142
144
|
};
|
143
|
-
const updateModelValue = (value) => {
|
145
|
+
const updateModelValue = (value, noDebounce = false) => {
|
144
146
|
if (props.loading || isDisabled.value || isReadonly.value || props.unclickable) return;
|
145
147
|
let newValue;
|
146
148
|
if (props.type === "number") newValue = typeof value === "string" && value.length ? Number.parseFloat(value) : void 0;
|
147
149
|
else newValue = value;
|
148
|
-
if (!props.textSecure) addToHistory(newValue);
|
150
|
+
if (!props.textSecure) addToHistory(newValue, noDebounce);
|
149
151
|
emit("update:model-value", newValue);
|
150
152
|
};
|
151
153
|
const handleBackspace = (event) => {
|
@@ -183,8 +185,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
183
185
|
};
|
184
186
|
const clearValue = () => {
|
185
187
|
if (isDisabled.value || isReadonly.value || props.unclickable) return;
|
186
|
-
if (typeof props.modelValue === "string") updateModelValue("");
|
187
|
-
else updateModelValue(void 0);
|
188
|
+
if (typeof props.modelValue === "string") updateModelValue("", true);
|
189
|
+
else updateModelValue(void 0, true);
|
188
190
|
inputRef.value?.focus();
|
189
191
|
emit("click:clear");
|
190
192
|
};
|
@@ -205,7 +207,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
205
207
|
const caret = getCaret();
|
206
208
|
const value = props.modelValue?.toString() ?? "";
|
207
209
|
const newValue = value.slice(0, caret.start) + text + value.slice(caret.end);
|
208
|
-
updateModelValue(newValue);
|
210
|
+
updateModelValue(newValue, true);
|
209
211
|
await nextTick();
|
210
212
|
setCaret(Math.min(caret.start + text.length, props.modelValue?.toString().length ?? 0));
|
211
213
|
};
|
@@ -217,7 +219,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
217
219
|
if (!value) {
|
218
220
|
Notify.warn({ title: "Nothing to paste" });
|
219
221
|
} else if (!props.maxLength || props.maxLength <= value.length) {
|
220
|
-
updateModelValue(value);
|
222
|
+
updateModelValue(value, true);
|
221
223
|
Notify.success({ title: "Pasted" });
|
222
224
|
nextTick().then(() => emit("paste"));
|
223
225
|
} else Notify.error({
|
@@ -255,17 +257,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
255
257
|
if (value === false || value === void 0) return;
|
256
258
|
nextTick(autofocusDebounced);
|
257
259
|
});
|
258
|
-
const handle = watch(() => props.modelValue, (value) => {
|
259
|
-
if (history.value.length === 0) {
|
260
|
-
if (value) {
|
261
|
-
addToHistory(value);
|
262
|
-
handle.stop();
|
263
|
-
}
|
264
|
-
} else handle.stop();
|
265
|
-
});
|
266
260
|
onMounted(() => {
|
267
261
|
if (props.autofocus !== false && props.autofocus !== void 0) autofocusDebounced();
|
268
|
-
if (props.modelValue) addToHistory(props.modelValue);
|
269
262
|
});
|
270
263
|
onBeforeUnmount(() => {
|
271
264
|
if (timeout) {
|
@@ -20,12 +20,12 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
20
20
|
blur: (value: FocusEvent) => any;
|
21
21
|
focus: (value: FocusEvent) => any;
|
22
22
|
keydown: (value: KeyboardEvent) => any;
|
23
|
-
"update:model-value": (value: string) => any;
|
23
|
+
"update:model-value": (value: string, noDebounce?: boolean | undefined) => any;
|
24
24
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
25
25
|
onBlur?: ((value: FocusEvent) => any) | undefined;
|
26
26
|
onFocus?: ((value: FocusEvent) => any) | undefined;
|
27
27
|
onKeydown?: ((value: KeyboardEvent) => any) | undefined;
|
28
|
-
"onUpdate:model-value"?: ((value: string) => any) | undefined;
|
28
|
+
"onUpdate:model-value"?: ((value: string, noDebounce?: boolean | undefined) => any) | undefined;
|
29
29
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
30
30
|
element: HTMLDivElement;
|
31
31
|
}, HTMLDivElement>;
|
@@ -115,7 +115,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
115
115
|
const currentText = getCurrentText();
|
116
116
|
const next = (currentText ?? "").slice(0, start) + " ".repeat(trail) + text + ((currentText ?? "").slice(end) || " ");
|
117
117
|
const caretAfter = start + text.length + trail;
|
118
|
-
emit("update:model-value", props.maxLength && next.length > props.maxLength ? next.substring(0, props.maxLength) : next);
|
118
|
+
emit("update:model-value", props.maxLength && next.length > props.maxLength ? next.substring(0, props.maxLength) : next, true);
|
119
119
|
nextTick(() => setCaret(props.maxLength ? Math.min(caretAfter, props.maxLength) : caretAfter));
|
120
120
|
};
|
121
121
|
const getCaret = () => getCaretOffset(elementRef.value);
|
@@ -211,7 +211,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
211
211
|
break;
|
212
212
|
}
|
213
213
|
isSetCaretNext = true;
|
214
|
-
emit("update:model-value", newText);
|
214
|
+
emit("update:model-value", newText, true);
|
215
215
|
requestAnimationFrame(() => setCaret(newCursorStart, newCursorEnd));
|
216
216
|
};
|
217
217
|
const focus = () => {
|
package/dist/utils/ApiClient.js
CHANGED
@@ -16,7 +16,7 @@ const HEADERS_FORMDATA = {
|
|
16
16
|
class ApiClientInstance {
|
17
17
|
constructor(config) {
|
18
18
|
this.config = config;
|
19
|
-
if (typeof window !== "undefined")
|
19
|
+
if (typeof window !== "undefined") setInterval(this.checkAuth, 500);
|
20
20
|
this.useAuth = () => {
|
21
21
|
return this.auth;
|
22
22
|
};
|