@dazhicheng/ui 1.6.33 → 1.6.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.
- package/dist/components/tt-form/src/config.js +33 -31
- package/dist/components/tt-form/src/form-render/dependencies.js +46 -39
- package/dist/components/tt-form/src/types.d.ts +2 -0
- package/dist/components/tt-input-textarea/index.d.ts +6 -0
- package/dist/components/tt-input-textarea/index.js +22 -0
- package/dist/components/tt-input-textarea/index.vue.d.ts +1606 -0
- package/dist/components/tt-input-textarea/index.vue.js +383 -0
- package/dist/components/tt-input-textarea/index.vue3.js +5 -0
- package/dist/components/tt-input-textarea/types.d.ts +142 -0
- package/dist/components/tt-modal-form/index.vue.js +13 -12
- package/dist/components/tt-nav-anchor/index.d.ts +3 -3
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.d.ts +1 -1
- package/dist/components/tt-table/index.js +5 -4
- package/dist/components/tt-table/src/TableForm.vue.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +104 -101
- package/dist/packages/utils/src/is.js +37 -32
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { defineComponent as ve, mergeModels as X, useModel as me, ref as v, useAttrs as be, inject as ge, computed as T, toValue as Y, nextTick as N, onMounted as ye, withDirectives as xe, createElementBlock as A, openBlock as E, normalizeClass as L, unref as C, createVNode as ee, createCommentVNode as te, createBlock as we, mergeProps as ae, createSlots as We, renderList as Ce, withCtx as Ve, renderSlot as Be, normalizeProps as Ie, guardReactiveProps as Te, withModifiers as ke, Teleport as Se, withKeys as O, normalizeStyle as Ee } from "vue";
|
|
2
|
+
import "../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
|
|
3
|
+
import { useDesign as Oe } from "../../packages/hooks/src/useDesign.js";
|
|
4
|
+
import "axios";
|
|
5
|
+
import { useZIndex as $e, useFormItem as Re, ElInput as ie } from "element-plus";
|
|
6
|
+
import { isArray as De, isObject as Me, isNumber as Fe, isString as He, isStringNumber as Ne, isClient as _ } from "../../packages/utils/src/is.js";
|
|
7
|
+
import "dayjs";
|
|
8
|
+
import "numeral";
|
|
9
|
+
import "xe-utils";
|
|
10
|
+
import "dayjs/plugin/utc";
|
|
11
|
+
import "dayjs/plugin/timezone";
|
|
12
|
+
import "../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
13
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
14
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
15
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
16
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
17
|
+
import "lodash-es";
|
|
18
|
+
import "vue-router";
|
|
19
|
+
import { useEventListener as P, onClickOutside as Ae } from "@vueuse/core";
|
|
20
|
+
import { FieldContextKey as Le } from "vee-validate";
|
|
21
|
+
import "../tt-icon/index.js";
|
|
22
|
+
import _e from "../../directives/disabled-tip/index.js";
|
|
23
|
+
const Pe = 'a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),summary,[tabindex]:not([tabindex="-1"])', ct = /* @__PURE__ */ ve({
|
|
24
|
+
name: "TtInputTextarea",
|
|
25
|
+
inheritAttrs: !1,
|
|
26
|
+
__name: "index",
|
|
27
|
+
props: /* @__PURE__ */ X({
|
|
28
|
+
minHeight: { default: 28 },
|
|
29
|
+
maxHeight: { default: 100 },
|
|
30
|
+
autofocus: { type: Boolean, default: !1 },
|
|
31
|
+
disabledTip: { default: void 0 },
|
|
32
|
+
border: { type: Boolean, default: !0 },
|
|
33
|
+
disabled: { type: Boolean, default: !1 },
|
|
34
|
+
readonly: { type: Boolean, default: !1 },
|
|
35
|
+
placeholder: { default: "" },
|
|
36
|
+
maxlength: {},
|
|
37
|
+
showWordLimit: { type: Boolean, default: !1 },
|
|
38
|
+
clearable: { type: Boolean, default: !1 },
|
|
39
|
+
teleportTo: { default: "body" },
|
|
40
|
+
expandWidth: { default: void 0 },
|
|
41
|
+
minExpandWidth: { default: 280 },
|
|
42
|
+
expandOnDisabled: { type: Boolean, default: !0 },
|
|
43
|
+
isInValid: { type: Boolean, default: void 0 }
|
|
44
|
+
}, {
|
|
45
|
+
modelValue: {
|
|
46
|
+
default: ""
|
|
47
|
+
},
|
|
48
|
+
modelModifiers: {}
|
|
49
|
+
}),
|
|
50
|
+
emits: /* @__PURE__ */ X(["change", "input", "focus", "blur", "clear"], ["update:modelValue"]),
|
|
51
|
+
setup(K, { expose: le, emit: ne }) {
|
|
52
|
+
const r = K, g = ne, y = me(K, "modelValue"), m = v(null), f = v(null), s = v(null), x = v(null), n = v(!1), $ = v(!1), z = v(2e3), V = be(), { prefixCls: R } = Oe("input-textarea"), { nextZIndex: oe } = $e(), { formItem: p } = Re(), d = ge(Le, null), c = v({
|
|
53
|
+
top: 0,
|
|
54
|
+
left: 0,
|
|
55
|
+
width: 0,
|
|
56
|
+
height: 0
|
|
57
|
+
});
|
|
58
|
+
function k() {
|
|
59
|
+
var t;
|
|
60
|
+
const e = m.value || ((t = f.value) == null ? void 0 : t.$el);
|
|
61
|
+
if (e) {
|
|
62
|
+
const a = e.getBoundingClientRect();
|
|
63
|
+
c.value = {
|
|
64
|
+
top: a.top,
|
|
65
|
+
left: a.left,
|
|
66
|
+
width: a.width,
|
|
67
|
+
height: a.height
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
P(
|
|
72
|
+
window,
|
|
73
|
+
"scroll",
|
|
74
|
+
() => {
|
|
75
|
+
n.value && (k(), (c.value.top + c.value.height < 0 || c.value.top > window.innerHeight) && (n.value = !1));
|
|
76
|
+
},
|
|
77
|
+
{ capture: !0, passive: !0 }
|
|
78
|
+
), P(
|
|
79
|
+
window,
|
|
80
|
+
"resize",
|
|
81
|
+
() => {
|
|
82
|
+
n.value && k();
|
|
83
|
+
},
|
|
84
|
+
{ passive: !0 }
|
|
85
|
+
), P(
|
|
86
|
+
window,
|
|
87
|
+
"keydown",
|
|
88
|
+
(e) => {
|
|
89
|
+
n.value && (e.key === "Escape" || e.key === "Esc") && M(e);
|
|
90
|
+
},
|
|
91
|
+
{ capture: !0 }
|
|
92
|
+
), Ae(
|
|
93
|
+
x,
|
|
94
|
+
(e) => {
|
|
95
|
+
var a, i;
|
|
96
|
+
if (!n.value) return;
|
|
97
|
+
const t = e.target;
|
|
98
|
+
t && ((a = m.value) != null && a.contains(t) || (i = x.value) != null && i.contains(t)) || (n.value = !1);
|
|
99
|
+
},
|
|
100
|
+
{ ignore: [m] }
|
|
101
|
+
);
|
|
102
|
+
const w = T(() => {
|
|
103
|
+
if (V.disabled !== void 0)
|
|
104
|
+
return !!V.disabled;
|
|
105
|
+
if (r.disabled)
|
|
106
|
+
return !0;
|
|
107
|
+
const e = r.disabledTip;
|
|
108
|
+
return De(e) && e.length > 0 ? e.some((t) => !!Y(t == null ? void 0 : t.condition)) : Me(e) ? !!Y(e.condition) : !1;
|
|
109
|
+
}), D = T(() => w.value ? r.expandOnDisabled : !0), U = T(() => {
|
|
110
|
+
var e, t;
|
|
111
|
+
return d ? !!((e = d.errorMessage) != null && e.value) || ((t = d.errors) == null ? void 0 : t.value) && d.errors.value.length > 0 : p != null && p.validateState ? p.validateState === "error" : r.isInValid !== void 0 ? !!r.isInValid : V.isInValid !== void 0 ? !!V.isInValid : !1;
|
|
112
|
+
}), q = T(() => {
|
|
113
|
+
const {
|
|
114
|
+
"data-testid": e,
|
|
115
|
+
class: t,
|
|
116
|
+
style: a,
|
|
117
|
+
onFocus: i,
|
|
118
|
+
onBlur: l,
|
|
119
|
+
onChange: o,
|
|
120
|
+
onInput: u,
|
|
121
|
+
onClear: b,
|
|
122
|
+
form: h,
|
|
123
|
+
isInValid: W,
|
|
124
|
+
...H
|
|
125
|
+
} = V;
|
|
126
|
+
return H;
|
|
127
|
+
}), re = T(() => {
|
|
128
|
+
var Q;
|
|
129
|
+
if (!n.value)
|
|
130
|
+
return { display: "none" };
|
|
131
|
+
const e = c.value.top, t = c.value.left, a = c.value.height > 0 ? c.value.height : r.minHeight, i = r.maxHeight, l = _ ? window.innerHeight : 800, o = _ ? window.innerWidth : 1200, u = e + i > l;
|
|
132
|
+
let b = e;
|
|
133
|
+
u && e + a - i >= 0 ? b = e + a - i : u && (b = Math.max(8, l - i - 8));
|
|
134
|
+
const h = c.value.width > 0 ? c.value.width : ((Q = m.value) == null ? void 0 : Q.offsetWidth) || 200, { numericWidth: W, cssWidth: H } = ue(h, o);
|
|
135
|
+
let I = t;
|
|
136
|
+
return I + W > o - 8 ? I = Math.max(8, o - W - 8) : I = Math.max(8, I), {
|
|
137
|
+
position: "fixed",
|
|
138
|
+
top: `${b}px`,
|
|
139
|
+
left: `${I}px`,
|
|
140
|
+
width: H,
|
|
141
|
+
maxWidth: "calc(100vw - 16px)",
|
|
142
|
+
zIndex: z.value,
|
|
143
|
+
display: "block"
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
function ue(e, t) {
|
|
147
|
+
if (Fe(r.expandWidth))
|
|
148
|
+
return { numericWidth: r.expandWidth, cssWidth: `${r.expandWidth}px` };
|
|
149
|
+
if (He(r.expandWidth) && r.expandWidth.trim().length > 0) {
|
|
150
|
+
const i = r.expandWidth.trim();
|
|
151
|
+
if (i.endsWith("px")) {
|
|
152
|
+
const l = parseFloat(i) || e;
|
|
153
|
+
return { numericWidth: l, cssWidth: `${l}px` };
|
|
154
|
+
}
|
|
155
|
+
if (i.endsWith("%")) {
|
|
156
|
+
const l = parseFloat(i) / 100;
|
|
157
|
+
return { numericWidth: Math.round(t * l), cssWidth: i };
|
|
158
|
+
}
|
|
159
|
+
if (Ne(i)) {
|
|
160
|
+
const l = Number(i);
|
|
161
|
+
return { numericWidth: l, cssWidth: `${l}px` };
|
|
162
|
+
}
|
|
163
|
+
return { numericWidth: e, cssWidth: i };
|
|
164
|
+
}
|
|
165
|
+
const a = Math.max(e, r.minExpandWidth);
|
|
166
|
+
return { numericWidth: a, cssWidth: `${a}px` };
|
|
167
|
+
}
|
|
168
|
+
function j() {
|
|
169
|
+
!n.value && D.value && S();
|
|
170
|
+
}
|
|
171
|
+
async function S(e) {
|
|
172
|
+
var t, a, i, l;
|
|
173
|
+
if (!$.value) {
|
|
174
|
+
if (n.value) {
|
|
175
|
+
const o = _ ? document.activeElement : null, u = x.value;
|
|
176
|
+
if (o && (u != null && u.contains(o)))
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (!D.value) {
|
|
180
|
+
e && g("focus", e);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (k(), n.value = !0, z.value = oe(), await N(), !w.value) {
|
|
184
|
+
const o = ((t = s.value) == null ? void 0 : t.textarea) || ((i = (a = s.value) == null ? void 0 : a.$el) == null ? void 0 : i.querySelector("textarea"));
|
|
185
|
+
o ? o.focus({ preventScroll: !0 }) : (l = s.value) == null || l.focus();
|
|
186
|
+
}
|
|
187
|
+
e && g("focus", e);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function B(e, t) {
|
|
191
|
+
var a;
|
|
192
|
+
if ((a = p == null ? void 0 : p.validate) == null || a.call(p, e).catch(() => {
|
|
193
|
+
}), d) {
|
|
194
|
+
const i = t !== void 0 ? t : y.value;
|
|
195
|
+
d.setValue(i), e === "blur" ? (d.handleBlur(), d.validate().catch(() => {
|
|
196
|
+
})) : e === "change" ? d.handleChange(i) : e === "input" && d.validate().catch(() => {
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function Z(e) {
|
|
201
|
+
g("input", e), B("input", e);
|
|
202
|
+
}
|
|
203
|
+
function se(e) {
|
|
204
|
+
var a, i;
|
|
205
|
+
const t = e.relatedTarget;
|
|
206
|
+
t && ((a = m.value) != null && a.contains(t) || (i = x.value) != null && i.contains(t)) || (n.value = !1, g("blur", e), B("blur"));
|
|
207
|
+
}
|
|
208
|
+
function M(e) {
|
|
209
|
+
var a, i, l, o, u;
|
|
210
|
+
e.stopPropagation(), "preventDefault" in e && e.preventDefault(), $.value = !0, n.value = !1, (a = s.value) == null || a.blur();
|
|
211
|
+
const t = ((i = f.value) == null ? void 0 : i.input) || ((o = (l = f.value) == null ? void 0 : l.$el) == null ? void 0 : o.querySelector("input"));
|
|
212
|
+
t ? t.focus({ preventScroll: !0 }) : (u = f.value) == null || u.focus(), N(() => {
|
|
213
|
+
$.value = !1;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function de(e) {
|
|
217
|
+
if ("disabled" in e && e.disabled || e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" || e.closest("[disabled], .is-disabled") || e.getAttribute("tabindex") === "-1" || e.offsetWidth === 0 && e.offsetHeight === 0 && !e.getClientRects().length)
|
|
218
|
+
return !1;
|
|
219
|
+
const t = window.getComputedStyle(e);
|
|
220
|
+
return t.display !== "none" && t.visibility !== "hidden";
|
|
221
|
+
}
|
|
222
|
+
function G(e) {
|
|
223
|
+
var b;
|
|
224
|
+
e.stopPropagation(), "preventDefault" in e && e.preventDefault();
|
|
225
|
+
const t = m.value, a = x.value, i = !("shiftKey" in e && e.shiftKey);
|
|
226
|
+
if (n.value = !1, B("blur"), !t)
|
|
227
|
+
return;
|
|
228
|
+
const o = Array.from(document.querySelectorAll(Pe)).filter((h) => a != null && a.contains(h) || t.contains(h) ? !1 : de(h)).filter((h) => {
|
|
229
|
+
const W = t.compareDocumentPosition(h);
|
|
230
|
+
return i ? !!(W & Node.DOCUMENT_POSITION_FOLLOWING) : !!(W & Node.DOCUMENT_POSITION_PRECEDING);
|
|
231
|
+
}), u = i ? o[0] : o[o.length - 1];
|
|
232
|
+
u ? N(() => {
|
|
233
|
+
u.focus({ preventScroll: !0 });
|
|
234
|
+
}) : (b = f.value) == null || b.blur();
|
|
235
|
+
}
|
|
236
|
+
function J(e) {
|
|
237
|
+
g("change", e), B("change", e);
|
|
238
|
+
}
|
|
239
|
+
function F() {
|
|
240
|
+
y.value = "", g("clear"), B("change", "");
|
|
241
|
+
}
|
|
242
|
+
function ce() {
|
|
243
|
+
var e, t, a, i;
|
|
244
|
+
if (n.value) {
|
|
245
|
+
const l = ((e = s.value) == null ? void 0 : e.textarea) || ((a = (t = s.value) == null ? void 0 : t.$el) == null ? void 0 : a.querySelector("textarea"));
|
|
246
|
+
l ? l.focus({ preventScroll: !0 }) : (i = s.value) == null || i.focus();
|
|
247
|
+
} else
|
|
248
|
+
S();
|
|
249
|
+
}
|
|
250
|
+
function fe() {
|
|
251
|
+
var e, t;
|
|
252
|
+
n.value ? (e = s.value) == null || e.blur() : (t = f.value) == null || t.blur();
|
|
253
|
+
}
|
|
254
|
+
function pe() {
|
|
255
|
+
var e, t;
|
|
256
|
+
n.value ? (e = s.value) == null || e.select() : (t = f.value) == null || t.select();
|
|
257
|
+
}
|
|
258
|
+
function he() {
|
|
259
|
+
F();
|
|
260
|
+
}
|
|
261
|
+
return ye(() => {
|
|
262
|
+
k(), r.autofocus && S();
|
|
263
|
+
}), le({
|
|
264
|
+
/**
|
|
265
|
+
* 未激活态单行触发输入框实例引用(ElInput)
|
|
266
|
+
*/
|
|
267
|
+
referenceRef: f,
|
|
268
|
+
/**
|
|
269
|
+
* 激活展开态的多行文本框实例引用(ElInput)
|
|
270
|
+
*/
|
|
271
|
+
textareaRef: s,
|
|
272
|
+
/**
|
|
273
|
+
* 使输入框获取焦点并展开多行浮层
|
|
274
|
+
*/
|
|
275
|
+
focus: ce,
|
|
276
|
+
/**
|
|
277
|
+
* 使输入框失去焦点并收起多行浮层
|
|
278
|
+
*/
|
|
279
|
+
blur: fe,
|
|
280
|
+
/**
|
|
281
|
+
* 选中输入框内的所有文本
|
|
282
|
+
*/
|
|
283
|
+
select: pe,
|
|
284
|
+
/**
|
|
285
|
+
* 一键清空输入框绑定的文本内容
|
|
286
|
+
*/
|
|
287
|
+
clear: he
|
|
288
|
+
}), (e, t) => xe((E(), A("div", {
|
|
289
|
+
ref_key: "wrapperRef",
|
|
290
|
+
ref: m,
|
|
291
|
+
class: L([
|
|
292
|
+
C(R),
|
|
293
|
+
{
|
|
294
|
+
"is-not-border": !e.border,
|
|
295
|
+
"is-disabled": w.value,
|
|
296
|
+
"is-error": U.value
|
|
297
|
+
}
|
|
298
|
+
]),
|
|
299
|
+
onClick: j
|
|
300
|
+
}, [
|
|
301
|
+
ee(C(ie), ae({
|
|
302
|
+
ref_key: "referenceRef",
|
|
303
|
+
ref: f,
|
|
304
|
+
modelValue: y.value,
|
|
305
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => y.value = a)
|
|
306
|
+
}, q.value, {
|
|
307
|
+
tabindex: n.value ? -1 : void 0,
|
|
308
|
+
disabled: w.value,
|
|
309
|
+
readonly: e.readonly,
|
|
310
|
+
placeholder: e.placeholder,
|
|
311
|
+
clearable: e.clearable,
|
|
312
|
+
type: "text",
|
|
313
|
+
"input-style": { height: `${e.minHeight}px` },
|
|
314
|
+
onInput: Z,
|
|
315
|
+
onFocus: S,
|
|
316
|
+
onChange: J,
|
|
317
|
+
onClear: F
|
|
318
|
+
}), We({ _: 2 }, [
|
|
319
|
+
Ce(Object.keys(e.$slots), (a) => ({
|
|
320
|
+
name: a,
|
|
321
|
+
fn: Ve((i) => [
|
|
322
|
+
Be(e.$slots, a, Ie(Te(i || {})))
|
|
323
|
+
])
|
|
324
|
+
}))
|
|
325
|
+
]), 1040, ["modelValue", "tabindex", "disabled", "readonly", "placeholder", "clearable", "input-style"]),
|
|
326
|
+
w.value && D.value ? (E(), A("div", {
|
|
327
|
+
key: 0,
|
|
328
|
+
class: L(`${C(R)}__disabled-mask`),
|
|
329
|
+
onClick: ke(j, ["stop"])
|
|
330
|
+
}, null, 2)) : te("", !0),
|
|
331
|
+
(E(), we(Se, { to: e.teleportTo }, [
|
|
332
|
+
n.value ? (E(), A("div", {
|
|
333
|
+
key: 0,
|
|
334
|
+
ref_key: "floatingRef",
|
|
335
|
+
ref: x,
|
|
336
|
+
class: L([
|
|
337
|
+
`${C(R)}__floating`,
|
|
338
|
+
{
|
|
339
|
+
"is-error": U.value
|
|
340
|
+
}
|
|
341
|
+
]),
|
|
342
|
+
style: Ee(re.value),
|
|
343
|
+
onKeydown: [
|
|
344
|
+
O(M, ["esc"]),
|
|
345
|
+
O(G, ["tab"])
|
|
346
|
+
]
|
|
347
|
+
}, [
|
|
348
|
+
ee(C(ie), ae({
|
|
349
|
+
ref_key: "textareaRef",
|
|
350
|
+
ref: s,
|
|
351
|
+
modelValue: y.value,
|
|
352
|
+
"onUpdate:modelValue": t[1] || (t[1] = (a) => y.value = a)
|
|
353
|
+
}, q.value, {
|
|
354
|
+
disabled: w.value,
|
|
355
|
+
readonly: e.readonly,
|
|
356
|
+
placeholder: e.placeholder,
|
|
357
|
+
maxlength: e.maxlength,
|
|
358
|
+
"show-word-limit": e.showWordLimit,
|
|
359
|
+
clearable: e.clearable,
|
|
360
|
+
type: "textarea",
|
|
361
|
+
resize: "none",
|
|
362
|
+
"input-style": {
|
|
363
|
+
height: `${e.maxHeight}px`
|
|
364
|
+
},
|
|
365
|
+
onInput: Z,
|
|
366
|
+
onBlur: se,
|
|
367
|
+
onChange: J,
|
|
368
|
+
onClear: F,
|
|
369
|
+
onKeydown: [
|
|
370
|
+
O(M, ["esc"]),
|
|
371
|
+
O(G, ["tab"])
|
|
372
|
+
]
|
|
373
|
+
}), null, 16, ["modelValue", "disabled", "readonly", "placeholder", "maxlength", "show-word-limit", "clearable", "input-style"])
|
|
374
|
+
], 38)) : te("", !0)
|
|
375
|
+
], 8, ["to"]))
|
|
376
|
+
], 2)), [
|
|
377
|
+
[C(_e), r.disabledTip]
|
|
378
|
+
]);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
export {
|
|
382
|
+
ct as default
|
|
383
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { InputProps } from 'element-plus';
|
|
2
|
+
import { TipConfig } from '../../directives/disabled-tip';
|
|
3
|
+
/**
|
|
4
|
+
* TtInputTextarea 组件属性定义
|
|
5
|
+
*/
|
|
6
|
+
export interface TtInputTextareaProps extends /* @vue-ignore */ Partial<Omit<InputProps, "type" | "modelValue">> {
|
|
7
|
+
/**
|
|
8
|
+
* 未激活时的最小高度(像素)
|
|
9
|
+
* @default 28
|
|
10
|
+
*/
|
|
11
|
+
minHeight?: number;
|
|
12
|
+
/**
|
|
13
|
+
* 激活展开时的最大高度(像素)
|
|
14
|
+
* @default 100
|
|
15
|
+
*/
|
|
16
|
+
maxHeight?: number;
|
|
17
|
+
/**
|
|
18
|
+
* 是否自动聚焦
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
autofocus?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 禁用提示配置
|
|
24
|
+
*/
|
|
25
|
+
disabledTip?: TipConfig | TipConfig[];
|
|
26
|
+
/**
|
|
27
|
+
* 是否显示边框
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
border?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 是否禁用
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 是否只读
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
readonly?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 占位提示文本
|
|
43
|
+
*/
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 最大输入字符数
|
|
47
|
+
*/
|
|
48
|
+
maxlength?: number | string;
|
|
49
|
+
/**
|
|
50
|
+
* 是否展示字数统计
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
showWordLimit?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* 是否可一键清空
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
clearable?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* 浮层挂载的目标容器
|
|
61
|
+
* @default "body"
|
|
62
|
+
*/
|
|
63
|
+
teleportTo?: string | HTMLElement;
|
|
64
|
+
/**
|
|
65
|
+
* 展开浮层的宽度(支持像素数字如 360,或带单位字符串如 '400px')
|
|
66
|
+
* 若不传,则默认保底取 Math.max(触发器宽度, minExpandWidth)
|
|
67
|
+
*/
|
|
68
|
+
expandWidth?: number | string;
|
|
69
|
+
/**
|
|
70
|
+
* 展开浮层的最小保底宽度(像素)
|
|
71
|
+
* @default 280
|
|
72
|
+
*/
|
|
73
|
+
minExpandWidth?: number;
|
|
74
|
+
/**
|
|
75
|
+
* 禁用状态下是否仍允许点击展开查看内容
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
expandOnDisabled?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 是否处于校验错误状态(红框)
|
|
81
|
+
* 支持外部显式传入,或由表单系统自动推导
|
|
82
|
+
*/
|
|
83
|
+
isInValid?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* TtInputTextarea 组件事件定义
|
|
87
|
+
*/
|
|
88
|
+
export interface TtInputTextareaEmits {
|
|
89
|
+
/**
|
|
90
|
+
* 输入值变化事件
|
|
91
|
+
* @param value 变化后的输入值
|
|
92
|
+
*/
|
|
93
|
+
change: [value: string | number];
|
|
94
|
+
/**
|
|
95
|
+
* 输入值实时输入事件
|
|
96
|
+
* @param value 当前输入值
|
|
97
|
+
*/
|
|
98
|
+
input: [value: string | number];
|
|
99
|
+
/**
|
|
100
|
+
* 聚焦事件
|
|
101
|
+
* @param event 原生聚焦事件对象
|
|
102
|
+
*/
|
|
103
|
+
focus: [event: FocusEvent];
|
|
104
|
+
/**
|
|
105
|
+
* 失焦事件
|
|
106
|
+
* @param event 原生失焦事件对象
|
|
107
|
+
*/
|
|
108
|
+
blur: [event: FocusEvent];
|
|
109
|
+
/**
|
|
110
|
+
* 清空事件
|
|
111
|
+
*/
|
|
112
|
+
clear: [];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* TtInputTextarea 组件向外暴露的实例属性与方法
|
|
116
|
+
*/
|
|
117
|
+
export interface TtInputTextareaExpose {
|
|
118
|
+
/**
|
|
119
|
+
* 单行触发输入框实例引用
|
|
120
|
+
*/
|
|
121
|
+
referenceRef: InstanceType<typeof import('element-plus').ElInput> | null;
|
|
122
|
+
/**
|
|
123
|
+
* 展开的多行文本框实例引用
|
|
124
|
+
*/
|
|
125
|
+
textareaRef: InstanceType<typeof import('element-plus').ElInput> | null;
|
|
126
|
+
/**
|
|
127
|
+
* 聚焦输入框
|
|
128
|
+
*/
|
|
129
|
+
focus: () => void;
|
|
130
|
+
/**
|
|
131
|
+
* 失焦输入框
|
|
132
|
+
*/
|
|
133
|
+
blur: () => void;
|
|
134
|
+
/**
|
|
135
|
+
* 选中输入框内的所有文本
|
|
136
|
+
*/
|
|
137
|
+
select: () => void;
|
|
138
|
+
/**
|
|
139
|
+
* 清空输入框内容
|
|
140
|
+
*/
|
|
141
|
+
clear: () => void;
|
|
142
|
+
}
|
|
@@ -19,6 +19,7 @@ import "../tt-radio-group/index.js";
|
|
|
19
19
|
import "../tt-panel-select/index.js";
|
|
20
20
|
import "../tt-upload/index.js";
|
|
21
21
|
import "../tt-api-component/index.js";
|
|
22
|
+
import "../tt-input-textarea/index.js";
|
|
22
23
|
import "vee-validate";
|
|
23
24
|
import "../../utils/uppercaseInput.js";
|
|
24
25
|
import { useForm as oe } from "../tt-form/src/useForm.js";
|
|
@@ -31,7 +32,7 @@ import { useGroupForm as te } from "../tt-form/src/group-form/useGroupForm.js";
|
|
|
31
32
|
import "../tt-modal/index.js";
|
|
32
33
|
import { useModalFormSlot as ie } from "./hooks/useModalFormSlot.js";
|
|
33
34
|
import { useModalRender as ne } from "../tt-modal/src/hooks/useModalRender.js";
|
|
34
|
-
const
|
|
35
|
+
const xe = /* @__PURE__ */ H({
|
|
35
36
|
name: "TtModalForm",
|
|
36
37
|
__name: "index",
|
|
37
38
|
props: {
|
|
@@ -58,7 +59,7 @@ const _e = /* @__PURE__ */ H({
|
|
|
58
59
|
emits: ["submit", "fetch", "getinfo"],
|
|
59
60
|
setup(I, { emit: D }) {
|
|
60
61
|
var w, F;
|
|
61
|
-
const o = I,
|
|
62
|
+
const o = I, p = D, L = J(), f = K(), r = K(!1), { getFormSlotKeys: T, getModalSlotKeys: E, replaceFormSlotKey: R, replaceModalSlotKey: _ } = ie(L), x = C(() => E.value.filter(Boolean)), $ = C(() => T.value.filter(Boolean)), v = {
|
|
62
63
|
showDefaultActions: !1,
|
|
63
64
|
...Q(o.formProps)
|
|
64
65
|
}, [z, s] = o.renderType === "groupForm" ? te(v) : oe(v), [N, a] = ne({
|
|
@@ -79,8 +80,8 @@ const _e = /* @__PURE__ */ H({
|
|
|
79
80
|
const t = {
|
|
80
81
|
...o.infoApiParams,
|
|
81
82
|
[o.infoApiIdKey]: e[o.infoApiIdKey]
|
|
82
|
-
}, n = m(o.infoApiBefore) ? await o.infoApiBefore(t) : t, l = await i(n),
|
|
83
|
-
k(u),
|
|
83
|
+
}, n = m(o.infoApiBefore) ? await o.infoApiBefore(t) : t, l = await i(n), c = o.dataField ? ee(l, o.dataField) : l, u = m(o.infoApiAfter) ? await o.infoApiAfter(c) : c;
|
|
84
|
+
k(u), p("getinfo", u), await y(), await s.resetForm({ values: u });
|
|
84
85
|
} finally {
|
|
85
86
|
a.changeLoading(!1);
|
|
86
87
|
}
|
|
@@ -104,10 +105,10 @@ const _e = /* @__PURE__ */ H({
|
|
|
104
105
|
const n = (u = o.checkedOptions) == null ? void 0 : u[t];
|
|
105
106
|
if (!Array.isArray(n) || n.length === 0)
|
|
106
107
|
return;
|
|
107
|
-
const [l,
|
|
108
|
-
!l || !
|
|
108
|
+
const [l, c] = n.length === 1 ? [n[0], n[0]] : n;
|
|
109
|
+
!l || !c || (e[t] = {
|
|
109
110
|
label: e[l],
|
|
110
|
-
value: e[
|
|
111
|
+
value: e[c]
|
|
111
112
|
});
|
|
112
113
|
});
|
|
113
114
|
}
|
|
@@ -121,14 +122,14 @@ const _e = /* @__PURE__ */ H({
|
|
|
121
122
|
}
|
|
122
123
|
async function G(e, i) {
|
|
123
124
|
const { editApi: t } = o;
|
|
124
|
-
!t || !m(t) || (e[o.infoApiIdKey] = f.value, await t(e, i.files), O.success("修改成功"),
|
|
125
|
+
!t || !m(t) || (e[o.infoApiIdKey] = f.value, await t(e, i.files), O.success("修改成功"), p("submit", {
|
|
125
126
|
...e,
|
|
126
127
|
continuousChecked: r.value
|
|
127
128
|
}), a.closeModal());
|
|
128
129
|
}
|
|
129
130
|
async function U(e, i) {
|
|
130
131
|
const { addApi: t } = o;
|
|
131
|
-
!t || !m(t) || (await t(e, i.files), O.success("新增成功"),
|
|
132
|
+
!t || !m(t) || (await t(e, i.files), O.success("新增成功"), p("submit", {
|
|
132
133
|
...e,
|
|
133
134
|
continuousChecked: r.value
|
|
134
135
|
}), (!r.value || !o.isContinuousChecked) && a.closeModal());
|
|
@@ -143,7 +144,7 @@ const _e = /* @__PURE__ */ H({
|
|
|
143
144
|
return;
|
|
144
145
|
const { addApi: n, editApi: l } = o;
|
|
145
146
|
if (!n && !l) {
|
|
146
|
-
|
|
147
|
+
p("submit", {
|
|
147
148
|
...i,
|
|
148
149
|
[o.infoApiIdKey]: f.value,
|
|
149
150
|
continuousChecked: r.value
|
|
@@ -164,7 +165,7 @@ const _e = /* @__PURE__ */ H({
|
|
|
164
165
|
if (e) {
|
|
165
166
|
await y();
|
|
166
167
|
const i = await s.getValues();
|
|
167
|
-
|
|
168
|
+
p("fetch", i);
|
|
168
169
|
} else
|
|
169
170
|
r.value = !1;
|
|
170
171
|
}
|
|
@@ -201,5 +202,5 @@ const _e = /* @__PURE__ */ H({
|
|
|
201
202
|
}
|
|
202
203
|
});
|
|
203
204
|
export {
|
|
204
|
-
|
|
205
|
+
xe as default
|
|
205
206
|
};
|
|
@@ -13,8 +13,8 @@ export declare const TtNavAnchor: import('../../../../utils/src').SFCWithInstall
|
|
|
13
13
|
title: string;
|
|
14
14
|
position: "fixed" | "static" | "sticky";
|
|
15
15
|
modelValue: string;
|
|
16
|
-
badgeCounts: Record<string, number>;
|
|
17
16
|
teleportTo: string | HTMLElement;
|
|
17
|
+
badgeCounts: Record<string, number>;
|
|
18
18
|
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
19
19
|
sourceRef: HTMLSpanElement;
|
|
20
20
|
navRef: HTMLDivElement;
|
|
@@ -37,8 +37,8 @@ export declare const TtNavAnchor: import('../../../../utils/src').SFCWithInstall
|
|
|
37
37
|
title: string;
|
|
38
38
|
position: "fixed" | "static" | "sticky";
|
|
39
39
|
modelValue: string;
|
|
40
|
-
badgeCounts: Record<string, number>;
|
|
41
40
|
teleportTo: string | HTMLElement;
|
|
41
|
+
badgeCounts: Record<string, number>;
|
|
42
42
|
}>;
|
|
43
43
|
__isFragment?: never;
|
|
44
44
|
__isTeleport?: never;
|
|
@@ -57,8 +57,8 @@ export declare const TtNavAnchor: import('../../../../utils/src').SFCWithInstall
|
|
|
57
57
|
title: string;
|
|
58
58
|
position: "fixed" | "static" | "sticky";
|
|
59
59
|
modelValue: string;
|
|
60
|
-
badgeCounts: Record<string, number>;
|
|
61
60
|
teleportTo: string | HTMLElement;
|
|
61
|
+
badgeCounts: Record<string, number>;
|
|
62
62
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
63
63
|
$slots: Readonly<{
|
|
64
64
|
description?: (scope: import('.').NavAnchorItemScope) => import('vue').VNodeChild;
|
|
@@ -31,8 +31,8 @@ declare const __VLS_component: import('vue').DefineComponent<TtNavAnchorProps, {
|
|
|
31
31
|
title: string;
|
|
32
32
|
position: "fixed" | "static" | "sticky";
|
|
33
33
|
modelValue: string;
|
|
34
|
-
badgeCounts: Record<string, number>;
|
|
35
34
|
teleportTo: string | HTMLElement;
|
|
35
|
+
badgeCounts: Record<string, number>;
|
|
36
36
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
37
37
|
sourceRef: HTMLSpanElement;
|
|
38
38
|
navRef: HTMLDivElement;
|
|
@@ -26,6 +26,7 @@ import "../tt-radio-group/index.js";
|
|
|
26
26
|
import "../tt-panel-select/index.js";
|
|
27
27
|
import "../tt-upload/index.js";
|
|
28
28
|
import "../tt-api-component/index.js";
|
|
29
|
+
import "../tt-input-textarea/index.js";
|
|
29
30
|
import "vee-validate";
|
|
30
31
|
import "../../utils/uppercaseInput.js";
|
|
31
32
|
import "es-toolkit/compat";
|
|
@@ -68,9 +69,9 @@ import "./src/emits.js";
|
|
|
68
69
|
import "./src/props.js";
|
|
69
70
|
import "./src/table-mutation-events.js";
|
|
70
71
|
import "./src/utils/context.js";
|
|
71
|
-
const
|
|
72
|
+
const At = t(o), Ct = t(r), It = t(m);
|
|
72
73
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
It as TtTable,
|
|
75
|
+
At as TtTableAction,
|
|
76
|
+
Ct as TtTableButton
|
|
76
77
|
};
|