@matechat/core 1.5.0 → 1.5.1
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/Input/index.css +1 -1
- package/Input/index.js +32 -32
- package/package.json +1 -1
package/Input/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.mc-textarea{width:100%;height:64px;padding:4px 0;color:var(--devui-text, #252b3a);font-size:var(--devui-font-size, 14px);background-color:var(--devui-form-control-bg, #ffffff);vertical-align:middle;outline:none;box-sizing:border-box;resize:none;border:none}.mc-textarea.mc-textarea-simple{height:
|
|
1
|
+
@charset "UTF-8";.mc-textarea{width:100%;height:64px;padding:4px 0;color:var(--devui-text, #252b3a);font-size:var(--devui-font-size, 14px);background-color:var(--devui-form-control-bg, #ffffff);vertical-align:middle;outline:none;box-sizing:border-box;resize:none;border:none}.mc-textarea.mc-textarea-simple{height:32px}.mc-textarea.mc-textarea-disabled{color:var(--devui-disabled-text, #cfd0d3);background-color:var(--devui-disabled-bg, #f5f5f5);cursor:not-allowed}.mc-textarea::placeholder{color:var(--devui-placeholder, #babbc0)}.mc-button[data-v-183bc985]{position:relative;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;height:32px;line-height:1.5;color:var(--devui-light-text, #ffffff);font-size:var(--devui-font-size, 14px);padding:0 12px;border-radius:20px;background-color:var(--devui-primary, #5e7ce0);overflow:hidden;border:none;cursor:pointer;transition:background-color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1)),border-color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1)),color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.mc-button.mc-button-loading svg[data-v-183bc985]{animation:rotating-183bc985 1s linear infinite}.mc-button.mousedown[data-v-183bc985]:not(:disabled){transform:scale(.95)}.mc-button.mc-button-simple[data-v-183bc985]{width:32px;padding:6px;flex-shrink:0;border-radius:100%}.mc-button.mc-button-simple svg[data-v-183bc985]{margin-right:0}.mc-button[data-v-183bc985]:hover{background-color:var(--devui-primary-hover, #7693f5)}.mc-button[data-v-183bc985]:active{background-color:var(--devui-primary-active, #344899)}.mc-button[data-v-183bc985]:disabled{color:var(--devui-light-text, #ffffff);background-color:var(--devui-primary-disabled, #beccfa);cursor:not-allowed}.mc-button .mc-button-content[data-v-183bc985]{display:inline-flex;align-items:center;font-size:var(--devui-font-size, 14px)}.mc-button .mc-button-water-wave[data-v-183bc985]{position:absolute;background-color:var(--devui-base-bg, #ffffff);border-radius:50%;opacity:0;width:20px;height:20px;transform:translate(-50%,-50%);animation:waterWave-183bc985 var(--devui-animation-duration-slow, .3s) var(--devui-animation-linear, cubic-bezier(0, 0, 1, 1))}.mc-button svg[data-v-183bc985]{margin-right:4px}.mc-button svg[data-v-183bc985] path{fill:var(--devui-light-text, #ffffff)}@keyframes rotating-183bc985{0%{transform:rotate(0)}to{transform:rotate(180deg)}}@keyframes waterWave-183bc985{0%{opacity:.2;width:30px;height:30px}to{opacity:0;width:200px;height:200px}}body[ui-theme=infinity-theme]{--mc-text: #aeaeae;--mc-box-shadow: rgba(25, 25, 25, .06)}body[ui-theme=galaxy-theme]{--mc-text: #4e5057;--mc-box-shadow: rgba(206, 209, 219, .06)}.mc-input{display:flex;flex-direction:column;width:100%;padding:12px 0;border:1px solid var(--devui-form-control-line, #d7d8da);border-radius:16px;box-sizing:border-box;background-color:var(--devui-base-bg, #ffffff)}.mc-input.mc-input-simple{border-radius:24px}.mc-input.mc-input-simple .mc-input-content{padding:0 20px}.mc-input.mc-input-borderless{border:none;box-shadow:0 1px 8px 0 var(--mc-box-shadow, rgba(25, 25, 25, .06))}.mc-input.mc-input-disabled{background-color:var(--devui-disabled-bg, #f5f5f5);cursor:not-allowed}.mc-input .mc-input-content{display:flex;align-items:flex-end;padding:0 16px}.mc-input .mc-input-foot{display:flex;justify-content:space-between;align-items:center;height:32px;padding:0 16px}.mc-input .mc-input-foot .mc-input-foot-left{flex:1;height:100%;display:flex;align-items:center}.mc-input .mc-input-foot .mc-input-foot-left .mc-input-foot-count{color:var(--mc-text, #aeaeae);font-size:var(--devui-font-size-sm, 12px)}
|
package/Input/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
import { defineComponent as k, inject as T, computed as M, withDirectives as j, createElementBlock as
|
|
2
|
+
import { defineComponent as k, inject as T, computed as M, withDirectives as j, createElementBlock as p, openBlock as u, normalizeClass as $, unref as n, isRef as z, vModelText as W, nextTick as A, createElementVNode as C, ref as S, reactive as O, createCommentVNode as _, createBlock as K, toDisplayString as x, normalizeStyle as R, watch as U, provide as X, renderSlot as v, createVNode as w } from "vue";
|
|
3
3
|
import { useMcI18n as F } from "@matechat/core/Locale";
|
|
4
4
|
var b = /* @__PURE__ */ ((t) => (t.Simple = "simple", t.Full = "full", t))(b || {}), P = /* @__PURE__ */ ((t) => (t.Bordered = "bordered", t.BorderLess = "borderless", t))(P || {}), E = /* @__PURE__ */ ((t) => (t.Simple = "simple", t.Full = "full", t))(E || {}), y = /* @__PURE__ */ ((t) => (t.Enter = "enter", t.ShiftEnter = "shiftEnter", t))(y || {});
|
|
5
5
|
const Y = {
|
|
@@ -49,31 +49,31 @@ const Y = {
|
|
|
49
49
|
__name: "textarea",
|
|
50
50
|
setup(t) {
|
|
51
51
|
const { t: o } = F(), { inputValue: s, rootProps: e, rootEmits: i } = T(B), a = M(() => {
|
|
52
|
-
let r = "",
|
|
53
|
-
return e.submitShortKey === y.Enter && (r = "Enter",
|
|
52
|
+
let r = "", f = "";
|
|
53
|
+
return e.submitShortKey === y.Enter && (r = "Enter", f = "Shift + Enter"), e.submitShortKey === y.ShiftEnter && (r = "Shift + Enter", f = "Enter"), e.placeholder ?? (r ? o("Input.pleaseEnterPlaceholder", { enterKey: r, shiftEnterKey: f }) : o("Input.pleaseEnter"));
|
|
54
54
|
});
|
|
55
|
-
let
|
|
55
|
+
let c = !1;
|
|
56
56
|
const d = () => {
|
|
57
57
|
A(() => {
|
|
58
58
|
i("change", s.value);
|
|
59
59
|
});
|
|
60
60
|
}, h = () => {
|
|
61
|
-
|
|
61
|
+
c || d();
|
|
62
62
|
}, l = () => {
|
|
63
|
-
|
|
63
|
+
c = !0;
|
|
64
64
|
}, g = () => {
|
|
65
|
-
|
|
66
|
-
},
|
|
65
|
+
c = !1, d();
|
|
66
|
+
}, m = (r) => {
|
|
67
67
|
if (e.submitShortKey === null)
|
|
68
68
|
return;
|
|
69
|
-
(e.submitShortKey === y.Enter ? !r.shiftKey : e.submitShortKey === y.ShiftEnter ? r.shiftKey : !1) && r.key === "Enter" && !
|
|
69
|
+
(e.submitShortKey === y.Enter ? !r.shiftKey : e.submitShortKey === y.ShiftEnter ? r.shiftKey : !1) && r.key === "Enter" && !c && (r.preventDefault(), i("submit", s.value), s.value = "");
|
|
70
70
|
}, L = (r) => {
|
|
71
71
|
i("focus", r);
|
|
72
72
|
}, N = (r) => {
|
|
73
73
|
i("blur", r);
|
|
74
74
|
};
|
|
75
|
-
return (r,
|
|
76
|
-
"onUpdate:modelValue":
|
|
75
|
+
return (r, f) => j((u(), p("textarea", {
|
|
76
|
+
"onUpdate:modelValue": f[0] || (f[0] = (D) => z(s) ? s.value = D : null),
|
|
77
77
|
placeholder: a.value,
|
|
78
78
|
disabled: n(e).disabled,
|
|
79
79
|
maxlength: n(e).maxLength,
|
|
@@ -84,7 +84,7 @@ const Y = {
|
|
|
84
84
|
onInput: h,
|
|
85
85
|
onCompositionstart: l,
|
|
86
86
|
onCompositionend: g,
|
|
87
|
-
onKeydown:
|
|
87
|
+
onKeydown: m,
|
|
88
88
|
onFocus: L,
|
|
89
89
|
onBlur: N
|
|
90
90
|
}, null, 42, G)), [
|
|
@@ -104,7 +104,7 @@ const Y = {
|
|
|
104
104
|
xmlns: "http://www.w3.org/2000/svg"
|
|
105
105
|
};
|
|
106
106
|
function e1(t, o) {
|
|
107
|
-
return u(),
|
|
107
|
+
return u(), p("svg", Q, o[0] || (o[0] = [
|
|
108
108
|
C(
|
|
109
109
|
"g",
|
|
110
110
|
{
|
|
@@ -129,7 +129,7 @@ const t1 = /* @__PURE__ */ I(J, [["render", e1]]), n1 = {}, o1 = {
|
|
|
129
129
|
xmlns: "http://www.w3.org/2000/svg"
|
|
130
130
|
};
|
|
131
131
|
function s1(t, o) {
|
|
132
|
-
return u(),
|
|
132
|
+
return u(), p("svg", o1, o[0] || (o[0] = [
|
|
133
133
|
C(
|
|
134
134
|
"g",
|
|
135
135
|
{
|
|
@@ -151,7 +151,7 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
151
151
|
setup(t) {
|
|
152
152
|
const { t: o } = F(), { inputValue: s, rootProps: e, rootEmits: i } = T(
|
|
153
153
|
B
|
|
154
|
-
), a = S(!1),
|
|
154
|
+
), a = S(!1), c = S(!1), d = O({
|
|
155
155
|
top: "0px",
|
|
156
156
|
left: "0px"
|
|
157
157
|
}), h = M(() => ({
|
|
@@ -159,14 +159,14 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
159
159
|
"mc-button-loading": e.loading,
|
|
160
160
|
mousedown: a.value,
|
|
161
161
|
"mc-button-simple": e.sendBtnVariant === E.Simple
|
|
162
|
-
})), l = (
|
|
163
|
-
d.left =
|
|
164
|
-
|
|
162
|
+
})), l = (m) => {
|
|
163
|
+
d.left = m.offsetX + "px", d.top = m.offsetY + "px", c.value = !0, setTimeout(() => {
|
|
164
|
+
c.value = !1;
|
|
165
165
|
}, 300);
|
|
166
|
-
}, g = (
|
|
167
|
-
l(
|
|
166
|
+
}, g = (m) => {
|
|
167
|
+
l(m), e.loading ? i("cancel") : (i("submit", s.value), s.value = "");
|
|
168
168
|
};
|
|
169
|
-
return (
|
|
169
|
+
return (m, L) => (u(), p("button", {
|
|
170
170
|
disabled: n(e).disabled || !n(e).loading && !n(s),
|
|
171
171
|
class: $(h.value),
|
|
172
172
|
onClick: g,
|
|
@@ -175,7 +175,7 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
175
175
|
}, [
|
|
176
176
|
C("span", i1, [
|
|
177
177
|
n(e).loading ? (u(), K(t1, { key: 0 })) : (u(), K(l1, { key: 1 })),
|
|
178
|
-
n(e).sendBtnVariant === n(E).Full ? (u(),
|
|
178
|
+
n(e).sendBtnVariant === n(E).Full ? (u(), p(
|
|
179
179
|
"span",
|
|
180
180
|
a1,
|
|
181
181
|
x(n(e).loading ? n(o)("Input.pauseAnswer") : n(o)("Input.send")),
|
|
@@ -183,7 +183,7 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
183
183
|
/* TEXT */
|
|
184
184
|
)) : _("v-if", !0)
|
|
185
185
|
]),
|
|
186
|
-
|
|
186
|
+
c.value ? (u(), p(
|
|
187
187
|
"div",
|
|
188
188
|
{
|
|
189
189
|
key: 0,
|
|
@@ -196,10 +196,10 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
196
196
|
)) : _("v-if", !0)
|
|
197
197
|
], 42, r1));
|
|
198
198
|
}
|
|
199
|
-
}), Z = /* @__PURE__ */ I(u1, [["__scopeId", "data-v-
|
|
199
|
+
}), Z = /* @__PURE__ */ I(u1, [["__scopeId", "data-v-183bc985"]]), c1 = { class: "mc-input-content" }, p1 = {
|
|
200
200
|
key: 0,
|
|
201
201
|
class: "mc-input-foot"
|
|
202
|
-
}, d1 = { class: "mc-input-foot-left" },
|
|
202
|
+
}, d1 = { class: "mc-input-foot-left" }, m1 = {
|
|
203
203
|
key: 0,
|
|
204
204
|
class: "mc-input-foot-count"
|
|
205
205
|
}, V = /* @__PURE__ */ k({
|
|
@@ -207,7 +207,7 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
207
207
|
props: Y,
|
|
208
208
|
emits: q,
|
|
209
209
|
setup(t, { expose: o, emit: s }) {
|
|
210
|
-
const e = t, i = s, a = S(""),
|
|
210
|
+
const e = t, i = s, a = S(""), c = M(() => ({
|
|
211
211
|
"mc-input": !0,
|
|
212
212
|
"mc-input-disabled": e.disabled,
|
|
213
213
|
"mc-input-simple": e.displayType === b.Simple,
|
|
@@ -221,14 +221,14 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
221
221
|
a.value = e.value;
|
|
222
222
|
},
|
|
223
223
|
{ immediate: !0 }
|
|
224
|
-
), o({ clearInput: d, getInput: h }), X(B, { inputValue: a, rootProps: e, rootEmits: i }), (l, g) => (u(),
|
|
224
|
+
), o({ clearInput: d, getInput: h }), X(B, { inputValue: a, rootProps: e, rootEmits: i }), (l, g) => (u(), p(
|
|
225
225
|
"div",
|
|
226
226
|
{
|
|
227
|
-
class: $(
|
|
227
|
+
class: $(c.value)
|
|
228
228
|
},
|
|
229
229
|
[
|
|
230
230
|
v(l.$slots, "head"),
|
|
231
|
-
C("div",
|
|
231
|
+
C("div", c1, [
|
|
232
232
|
v(l.$slots, "prefix"),
|
|
233
233
|
w(H),
|
|
234
234
|
v(l.$slots, "suffix"),
|
|
@@ -236,12 +236,12 @@ const l1 = /* @__PURE__ */ I(n1, [["render", s1]]), r1 = ["disabled"], i1 = { cl
|
|
|
236
236
|
w(Z)
|
|
237
237
|
]) : _("v-if", !0)
|
|
238
238
|
]),
|
|
239
|
-
l.displayType === n(b).Full ? (u(),
|
|
239
|
+
l.displayType === n(b).Full ? (u(), p("div", p1, [
|
|
240
240
|
C("div", d1, [
|
|
241
241
|
v(l.$slots, "extra"),
|
|
242
|
-
l.showCount ? (u(),
|
|
242
|
+
l.showCount ? (u(), p(
|
|
243
243
|
"span",
|
|
244
|
-
|
|
244
|
+
m1,
|
|
245
245
|
x(a.value.length) + x(l.maxLength ?? !1 ? `/${l.maxLength}` : ""),
|
|
246
246
|
1
|
|
247
247
|
/* TEXT */
|