mvframe 1.0.4
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/README.md +163 -0
- package/dist/composition.js +190 -0
- package/dist/cpt/BtnGroup.js +65 -0
- package/dist/cpt/Form.js +90 -0
- package/dist/cpt/Frame.js +78 -0
- package/dist/cpt/Icon.js +34 -0
- package/dist/cpt/Input.js +68 -0
- package/dist/cpt/Page.js +55 -0
- package/dist/cpt/Select.js +186 -0
- package/dist/cpt/SelectV2.js +189 -0
- package/dist/cpt/Table.js +334 -0
- package/dist/cpt/Tabs.js +80 -0
- package/dist/cpt/Textarea.js +103 -0
- package/dist/cpt/chip.js +809 -0
- package/dist/css/cpt.css +1 -0
- package/dist/directive.js +50 -0
- package/dist/index.js +7 -0
- package/dist/sortablejs.js +1612 -0
- package/dist/store.js +155 -0
- package/dist/util.js +196 -0
- package/dist/vendor.js +87 -0
- package/dist/vuedraggable.js +2819 -0
- package/package.json +50 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { reactive as z, markRaw as N, ref as ne, getCurrentInstance as ae, onBeforeMount as le, onMounted as re, computed as _, onUnmounted as se, resolveComponent as b, openBlock as f, createElementBlock as S, normalizeClass as $, createElementVNode as w, renderSlot as D, unref as n, createBlock as C, withCtx as m, createTextVNode as x, toDisplayString as v, createCommentVNode as g, createVNode as k, mergeProps as ie } from "vue";
|
|
2
|
+
import { C as ue, _ as de, a as ce } from "./chip.js";
|
|
3
|
+
import { useRemoteSummary as fe } from "../composition.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { _ as me } from "../vendor.js";
|
|
6
|
+
const pe = { class: "MvcTable" }, ge = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "flexMode vc"
|
|
9
|
+
}, ye = { class: "tableArea relative radius ctx-auto" }, he = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "flexMode vc h56 p16 xscroll nobar fadeout"
|
|
12
|
+
}, be = /* @__PURE__ */ Object.assign({
|
|
13
|
+
name: "MvcTable",
|
|
14
|
+
inheritAttrs: !1
|
|
15
|
+
}, {
|
|
16
|
+
__name: "index",
|
|
17
|
+
props: {
|
|
18
|
+
defaultLoading: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !0
|
|
21
|
+
},
|
|
22
|
+
tableName: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
autoHeader: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !0
|
|
29
|
+
},
|
|
30
|
+
headerClass: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ""
|
|
33
|
+
},
|
|
34
|
+
height: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: 0
|
|
37
|
+
},
|
|
38
|
+
minusHeight: {
|
|
39
|
+
type: [String, Number],
|
|
40
|
+
default: 0
|
|
41
|
+
},
|
|
42
|
+
defer: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !1
|
|
45
|
+
},
|
|
46
|
+
rowKey: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: ""
|
|
49
|
+
},
|
|
50
|
+
defaultExpandAll: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: !1
|
|
53
|
+
},
|
|
54
|
+
tool: {
|
|
55
|
+
type: [Object, Boolean],
|
|
56
|
+
default: () => ({
|
|
57
|
+
download: !0,
|
|
58
|
+
refresh: !0,
|
|
59
|
+
column: !0
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
noheader: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: !1
|
|
65
|
+
},
|
|
66
|
+
nofooter: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1
|
|
69
|
+
},
|
|
70
|
+
loadData: {
|
|
71
|
+
type: Function,
|
|
72
|
+
default: () => ({
|
|
73
|
+
list: [],
|
|
74
|
+
total: 0
|
|
75
|
+
})
|
|
76
|
+
},
|
|
77
|
+
pageSize: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 0
|
|
80
|
+
},
|
|
81
|
+
pageSizes: {
|
|
82
|
+
type: Array,
|
|
83
|
+
default: () => [10, 20, 50, 100]
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* 远程汇总行按列格式化:与 util `$fu` 的 metric 形态一致。
|
|
87
|
+
* 未传时使用全局 `$config.table.summaryMetric`(应用入口一次配置即可)。
|
|
88
|
+
* 对象:`{ spend: { unit: 'currency', precision: 2 }, rate: { unit: '%', precision: 2 } }`
|
|
89
|
+
* 函数:`(prop) => ({ unit, precision, currency })`。
|
|
90
|
+
*/
|
|
91
|
+
summaryMetric: {
|
|
92
|
+
type: [Object, Function],
|
|
93
|
+
default: null
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
emits: ["selection-change", "refresh"],
|
|
97
|
+
setup(E, { expose: L, emit: R }) {
|
|
98
|
+
const a = E, r = z({
|
|
99
|
+
loading: !0,
|
|
100
|
+
selection: []
|
|
101
|
+
}), t = z({
|
|
102
|
+
list: [],
|
|
103
|
+
total: 0,
|
|
104
|
+
page: 1,
|
|
105
|
+
pageSize: 50,
|
|
106
|
+
summary: !1,
|
|
107
|
+
summaryType: "remote",
|
|
108
|
+
nopagination: !1,
|
|
109
|
+
params: {}
|
|
110
|
+
}), y = z({
|
|
111
|
+
tabelKey: 0,
|
|
112
|
+
current: "",
|
|
113
|
+
list: [
|
|
114
|
+
{
|
|
115
|
+
title: "Table Column Customization",
|
|
116
|
+
size: 1024,
|
|
117
|
+
cpt: N(ue)
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
title: "Download from Current Table",
|
|
121
|
+
cpt: N(de)
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}), T = ne(null), { proxy: H } = ae();
|
|
125
|
+
le(() => {
|
|
126
|
+
I();
|
|
127
|
+
}), re(() => {
|
|
128
|
+
j();
|
|
129
|
+
});
|
|
130
|
+
const M = R, I = () => {
|
|
131
|
+
r.loading = a.defaultLoading, a.pageSize && (t.pageSize = a.pageSize);
|
|
132
|
+
}, j = () => {
|
|
133
|
+
X(), a.defer === !1 && h();
|
|
134
|
+
}, A = (e) => {
|
|
135
|
+
h(e);
|
|
136
|
+
}, h = async (e = {}) => {
|
|
137
|
+
if (e.refresh && r.loading)
|
|
138
|
+
return;
|
|
139
|
+
r.loading = !0;
|
|
140
|
+
const o = {
|
|
141
|
+
pageSize: e.pageSize || t.pageSize,
|
|
142
|
+
pageStart: e.pageStart || t.page
|
|
143
|
+
};
|
|
144
|
+
e.refresh && (o.remote = !0);
|
|
145
|
+
const { list: i = [], total: l, summary: s } = await a.loadData(o) || {};
|
|
146
|
+
t.list = i.map((d, c) => (d.index = c, d)), l === void 0 ? (t.total = t.list.length, t.nopagination = !0) : (t.total = l, t.nopagination = !1), window.config.table.scrollToTop && P(), O(s), r.loading = !1;
|
|
147
|
+
}, O = (e) => {
|
|
148
|
+
e ? t.summary = e : t.summary = !1;
|
|
149
|
+
}, F = (e) => {
|
|
150
|
+
if (t.summaryType === "locale")
|
|
151
|
+
return [];
|
|
152
|
+
if (t.summaryType === "remote") {
|
|
153
|
+
const o = (l, s) => {
|
|
154
|
+
if (l != null)
|
|
155
|
+
return typeof l == "function" ? l(s) : l[s];
|
|
156
|
+
}, i = (l) => {
|
|
157
|
+
var d, c;
|
|
158
|
+
const s = o(a.summaryMetric, l);
|
|
159
|
+
return s !== void 0 ? s : o((c = (d = globalThis.$config) == null ? void 0 : d.table) == null ? void 0 : c.summaryMetric, l);
|
|
160
|
+
};
|
|
161
|
+
return fe(e, t.summary, { resolveMetric: i });
|
|
162
|
+
}
|
|
163
|
+
return [];
|
|
164
|
+
}, P = () => {
|
|
165
|
+
T.value.$refs.scrollBarRef.setScrollTop(0);
|
|
166
|
+
}, V = () => {
|
|
167
|
+
h({
|
|
168
|
+
pageStart: 1
|
|
169
|
+
});
|
|
170
|
+
}, U = () => {
|
|
171
|
+
h();
|
|
172
|
+
}, G = (e) => {
|
|
173
|
+
if (r.selection = e, M("selection-change", e), r.shiftKey) {
|
|
174
|
+
const o = e[e.length - 2], i = e[e.length - 1], l = t.list.filter1((u) => u.id === o.id).index || 0, s = t.list.filter1((u) => u.id === i.id).index;
|
|
175
|
+
let d = l, c = s;
|
|
176
|
+
l > s && (d = s, c = l);
|
|
177
|
+
for (let u = d; u <= c; u++)
|
|
178
|
+
H.$refs.body.toggleRowSelection(t.list[u], !0);
|
|
179
|
+
}
|
|
180
|
+
}, q = () => {
|
|
181
|
+
r.loading || (h({ refresh: !0 }), M("refresh"));
|
|
182
|
+
}, J = () => {
|
|
183
|
+
y.current = 0;
|
|
184
|
+
}, Q = () => {
|
|
185
|
+
y.current = 1;
|
|
186
|
+
}, W = () => {
|
|
187
|
+
r.tableKey++;
|
|
188
|
+
}, X = () => {
|
|
189
|
+
document.addEventListener("keydown", B), document.addEventListener("keyup", K);
|
|
190
|
+
}, B = (e) => {
|
|
191
|
+
e.keyCode === 16 && (r.shiftKey = !0);
|
|
192
|
+
}, K = (e) => {
|
|
193
|
+
e.keyCode === 16 && (r.shiftKey = !1);
|
|
194
|
+
}, Y = () => {
|
|
195
|
+
document.removeEventListener("keydown", B), document.removeEventListener("keyup", K);
|
|
196
|
+
}, Z = ({ i: e, row: o }) => {
|
|
197
|
+
t.list[e] = o;
|
|
198
|
+
}, ee = _(() => {
|
|
199
|
+
let e = a.height || window.config.options.pageHeight;
|
|
200
|
+
return a.noheader === !1 && (e -= 64), a.nofooter === !1 && (e -= 56), e -= a.minusHeight, e;
|
|
201
|
+
}), te = _(() => !!t.summary), oe = _(() => t.nopagination === !0 ? "total" : "total,->,prev,pager,next,sizes"), p = _(() => {
|
|
202
|
+
if (a.tool) {
|
|
203
|
+
const { column: e = !0, download: o = !0, refresh: i = !0 } = a.tool;
|
|
204
|
+
return {
|
|
205
|
+
column: e,
|
|
206
|
+
download: o,
|
|
207
|
+
refresh: i
|
|
208
|
+
};
|
|
209
|
+
} else
|
|
210
|
+
return !1;
|
|
211
|
+
});
|
|
212
|
+
return se(() => {
|
|
213
|
+
Y();
|
|
214
|
+
}), L({
|
|
215
|
+
initTable: A,
|
|
216
|
+
editRow: Z
|
|
217
|
+
}), (e, o) => {
|
|
218
|
+
const i = b("el-button"), l = b("Loading"), s = b("el-table"), d = b("el-pagination"), c = b("Drawer");
|
|
219
|
+
return f(), S("div", pe, [
|
|
220
|
+
a.noheader === !1 ? (f(), S("div", {
|
|
221
|
+
key: 0,
|
|
222
|
+
class: $(["flexMode hb g12 p16 bg-white", a.autoHeader ? "minh64" : "h64"])
|
|
223
|
+
}, [
|
|
224
|
+
w("div", {
|
|
225
|
+
class: $(["flexMode vc flexGrow maxwp100", a.headerClass])
|
|
226
|
+
}, [
|
|
227
|
+
D(e.$slots, "header", {}, void 0, !0)
|
|
228
|
+
], 2),
|
|
229
|
+
n(p) ? (f(), S("div", ge, [
|
|
230
|
+
n(p).refresh ? (f(), C(i, {
|
|
231
|
+
key: 0,
|
|
232
|
+
onClick: q
|
|
233
|
+
}, {
|
|
234
|
+
icon: m(() => [...o[2] || (o[2] = [
|
|
235
|
+
w("i", { class: "imicon im-sync" }, null, -1)
|
|
236
|
+
])]),
|
|
237
|
+
default: m(() => [
|
|
238
|
+
x(" " + v(e.$l("Refresh")), 1)
|
|
239
|
+
]),
|
|
240
|
+
_: 1
|
|
241
|
+
})) : g("", !0),
|
|
242
|
+
n(p).column ? (f(), C(i, {
|
|
243
|
+
key: 1,
|
|
244
|
+
onClick: J
|
|
245
|
+
}, {
|
|
246
|
+
icon: m(() => [...o[3] || (o[3] = [
|
|
247
|
+
w("i", { class: "imicon im-column" }, null, -1)
|
|
248
|
+
])]),
|
|
249
|
+
default: m(() => [
|
|
250
|
+
x(" " + v(e.$l("Columns")), 1)
|
|
251
|
+
]),
|
|
252
|
+
_: 1
|
|
253
|
+
})) : g("", !0),
|
|
254
|
+
n(p).download ? (f(), C(i, {
|
|
255
|
+
key: 2,
|
|
256
|
+
onClick: Q
|
|
257
|
+
}, {
|
|
258
|
+
icon: m(() => [...o[4] || (o[4] = [
|
|
259
|
+
w("i", { class: "imicon im-download1" }, null, -1)
|
|
260
|
+
])]),
|
|
261
|
+
default: m(() => [
|
|
262
|
+
x(" " + v(e.$l("Download")), 1)
|
|
263
|
+
]),
|
|
264
|
+
_: 1
|
|
265
|
+
})) : g("", !0)
|
|
266
|
+
])) : g("", !0)
|
|
267
|
+
], 2)) : g("", !0),
|
|
268
|
+
w("div", ye, [
|
|
269
|
+
k(l, {
|
|
270
|
+
loading: n(r).loading
|
|
271
|
+
}, null, 8, ["loading"]),
|
|
272
|
+
(f(), C(s, {
|
|
273
|
+
ref_key: "body",
|
|
274
|
+
ref: T,
|
|
275
|
+
key: n(r).tableKey,
|
|
276
|
+
height: n(ee),
|
|
277
|
+
data: n(t).list,
|
|
278
|
+
"default-expand-all": a.defaultExpandAll,
|
|
279
|
+
"row-key": a.rowKey,
|
|
280
|
+
stripe: "",
|
|
281
|
+
border: "",
|
|
282
|
+
"show-summary": n(te),
|
|
283
|
+
"summary-method": F,
|
|
284
|
+
class: "MainTable",
|
|
285
|
+
onSelectionChange: G
|
|
286
|
+
}, {
|
|
287
|
+
default: m(() => [
|
|
288
|
+
k(n(ce), ie({
|
|
289
|
+
"table-name": a.tableName,
|
|
290
|
+
column: n(p) ? n(p).column : !1
|
|
291
|
+
}, e.$attrs), {
|
|
292
|
+
default: m(() => [
|
|
293
|
+
D(e.$slots, "default", {}, void 0, !0)
|
|
294
|
+
]),
|
|
295
|
+
_: 3
|
|
296
|
+
}, 16, ["table-name", "column"])
|
|
297
|
+
]),
|
|
298
|
+
_: 3
|
|
299
|
+
}, 8, ["height", "data", "default-expand-all", "row-key", "show-summary"]))
|
|
300
|
+
]),
|
|
301
|
+
a.nofooter === !1 ? (f(), S("div", he, [
|
|
302
|
+
k(d, {
|
|
303
|
+
"current-page": n(t).page,
|
|
304
|
+
"onUpdate:currentPage": o[0] || (o[0] = (u) => n(t).page = u),
|
|
305
|
+
background: "",
|
|
306
|
+
total: n(t).total,
|
|
307
|
+
"default-page-size": n(t).pageSize,
|
|
308
|
+
"page-sizes": a.pageSizes,
|
|
309
|
+
"pager-count": 5,
|
|
310
|
+
layout: n(oe),
|
|
311
|
+
class: "wp100",
|
|
312
|
+
onSizeChange: V,
|
|
313
|
+
onCurrentChange: U
|
|
314
|
+
}, null, 8, ["current-page", "total", "default-page-size", "page-sizes", "layout"])
|
|
315
|
+
])) : g("", !0),
|
|
316
|
+
k(c, {
|
|
317
|
+
current: n(y).current,
|
|
318
|
+
"onUpdate:current": o[1] || (o[1] = (u) => n(y).current = u),
|
|
319
|
+
"table-name": a.tableName,
|
|
320
|
+
drawer: n(y).list,
|
|
321
|
+
list: n(t).list,
|
|
322
|
+
selection: n(r).selection,
|
|
323
|
+
onInitColumn: W
|
|
324
|
+
}, null, 8, ["current", "table-name", "drawer", "list", "selection"])
|
|
325
|
+
]);
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}), we = /* @__PURE__ */ me(be, [["__scopeId", "data-v-e72098dd"]]), xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
329
|
+
__proto__: null,
|
|
330
|
+
default: we
|
|
331
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
332
|
+
export {
|
|
333
|
+
xe as _
|
|
334
|
+
};
|
package/dist/cpt/Tabs.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useAttrs as b, computed as l, resolveComponent as g, openBlock as p, createElementBlock as v, mergeProps as i, unref as o, createVNode as V, createElementVNode as T, createBlock as h, resolveDynamicComponent as K, normalizeProps as k, createCommentVNode as O } from "vue";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { _ as P } from "../vendor.js";
|
|
4
|
+
const x = { class: "panelWrap" }, B = /* @__PURE__ */ Object.assign({
|
|
5
|
+
name: "MvcTabs",
|
|
6
|
+
inheritAttrs: !1
|
|
7
|
+
}, {
|
|
8
|
+
__name: "index",
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: [String, Number, Boolean],
|
|
12
|
+
default: void 0
|
|
13
|
+
},
|
|
14
|
+
/** 与 BtnGroup 一致;每项需含 `component`(或 `componentKey` 指定字段)指向要渲染的组件 */
|
|
15
|
+
options: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
valueKey: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "value"
|
|
22
|
+
},
|
|
23
|
+
labelKey: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "label"
|
|
26
|
+
},
|
|
27
|
+
componentKey: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "component"
|
|
30
|
+
},
|
|
31
|
+
/** 选项对象上用于 `v-bind` 到当前面板的字段名,如 `{ paneProps: { id: 1 } }` */
|
|
32
|
+
panePropsKey: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "paneProps"
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:modelValue", "change"],
|
|
42
|
+
setup(d, { emit: m }) {
|
|
43
|
+
const t = d, a = m, y = b(), r = (e) => e == null ? e : ["Object", "Array"].includes(globalThis.$getType(e)) ? e[t.valueKey] : e, f = (e) => {
|
|
44
|
+
a("update:modelValue", e);
|
|
45
|
+
const u = t.options.find((n) => r(n) === e);
|
|
46
|
+
a("change", e, u);
|
|
47
|
+
}, s = l(
|
|
48
|
+
() => t.options.find((e) => r(e) === t.modelValue)
|
|
49
|
+
), c = l(() => {
|
|
50
|
+
const e = s.value;
|
|
51
|
+
if (!(!e || !["Object", "Array"].includes(globalThis.$getType(e))))
|
|
52
|
+
return e[t.componentKey];
|
|
53
|
+
}), _ = l(() => {
|
|
54
|
+
const e = s.value;
|
|
55
|
+
return !e || !["Object", "Array"].includes(globalThis.$getType(e)) ? {} : e[t.panePropsKey] ?? {};
|
|
56
|
+
});
|
|
57
|
+
return (e, u) => {
|
|
58
|
+
const n = g("BtnGroup");
|
|
59
|
+
return p(), v("div", i({ class: "MvcTabs flexMode flexV g12" }, o(y)), [
|
|
60
|
+
V(n, {
|
|
61
|
+
"model-value": t.modelValue,
|
|
62
|
+
options: t.options,
|
|
63
|
+
"value-key": t.valueKey,
|
|
64
|
+
"label-key": t.labelKey,
|
|
65
|
+
disabled: t.disabled,
|
|
66
|
+
"onUpdate:modelValue": f
|
|
67
|
+
}, null, 8, ["model-value", "options", "value-key", "label-key", "disabled"]),
|
|
68
|
+
T("div", x, [
|
|
69
|
+
o(c) ? (p(), h(K(o(c)), k(i({ key: 0 }, o(_))), null, 16)) : O("", !0)
|
|
70
|
+
])
|
|
71
|
+
], 16);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}), S = /* @__PURE__ */ P(B, [["__scopeId", "data-v-62303cd8"]]), M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
75
|
+
__proto__: null,
|
|
76
|
+
default: S
|
|
77
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
78
|
+
export {
|
|
79
|
+
M as _
|
|
80
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ref as S, reactive as $, getCurrentInstance as C, onMounted as V, nextTick as j, computed as u, watch as E, onUnmounted as I, resolveComponent as L, openBlock as k, createBlock as A, mergeProps as M, unref as a } from "vue";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { _ as O } from "../vendor.js";
|
|
4
|
+
const T = /* @__PURE__ */ Object.assign({
|
|
5
|
+
name: "MvcTextarea",
|
|
6
|
+
inheritAttrs: !1
|
|
7
|
+
}, {
|
|
8
|
+
__name: "index",
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: [String, Number, Array],
|
|
12
|
+
default: ""
|
|
13
|
+
},
|
|
14
|
+
rows: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: 3
|
|
17
|
+
},
|
|
18
|
+
height: {
|
|
19
|
+
type: [String, Number],
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
output: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "string",
|
|
25
|
+
validator: (i) => ["string", "array"].includes(i)
|
|
26
|
+
},
|
|
27
|
+
resize: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "vertical",
|
|
30
|
+
validator: (i) => ["none", "vertical"].includes(i)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
emits: [
|
|
34
|
+
"update:modelValue",
|
|
35
|
+
"input",
|
|
36
|
+
"change",
|
|
37
|
+
"blur",
|
|
38
|
+
"focus"
|
|
39
|
+
],
|
|
40
|
+
setup(i, { emit: y }) {
|
|
41
|
+
const r = i, p = S(null);
|
|
42
|
+
let n = null;
|
|
43
|
+
const o = $({
|
|
44
|
+
val: "",
|
|
45
|
+
isComposing: !1
|
|
46
|
+
}), c = y, { proxy: s } = C();
|
|
47
|
+
V(() => {
|
|
48
|
+
var e, l;
|
|
49
|
+
const t = (e = p.value) == null ? void 0 : e.$el;
|
|
50
|
+
n = (l = t == null ? void 0 : t.querySelector) == null ? void 0 : l.call(t, "textarea"), n && (n.addEventListener("compositionstart", m), n.addEventListener("compositionend", d));
|
|
51
|
+
});
|
|
52
|
+
const m = () => {
|
|
53
|
+
o.isComposing = !0;
|
|
54
|
+
}, d = () => {
|
|
55
|
+
o.isComposing = !1, j(() => f(o.val));
|
|
56
|
+
}, h = (t) => {
|
|
57
|
+
o.isComposing || f(t);
|
|
58
|
+
}, v = (t) => {
|
|
59
|
+
const e = String(t ?? "").split(/\r?\n/);
|
|
60
|
+
return r.output === "array" ? e : e.join(",");
|
|
61
|
+
}, _ = (t) => Array.isArray(t) ? t.join(`
|
|
62
|
+
`) : String(t ?? "").replace(/,/g, `
|
|
63
|
+
`), f = (t) => {
|
|
64
|
+
const e = v(t);
|
|
65
|
+
c("update:modelValue", e), c("input", e);
|
|
66
|
+
}, b = u(() => {
|
|
67
|
+
if (!r.height) return s.$attrs["input-style"];
|
|
68
|
+
const t = typeof r.height == "number" ? `${r.height}px` : r.height;
|
|
69
|
+
return { ...s.$attrs["input-style"] && typeof s.$attrs["input-style"] == "object" ? { ...s.$attrs["input-style"] } : {}, height: t, minHeight: t };
|
|
70
|
+
}), x = u(() => !!(s.$attrs.maxlength || g.value)), g = u(() => s.$attrs.max);
|
|
71
|
+
return E(
|
|
72
|
+
() => r.modelValue,
|
|
73
|
+
(t) => {
|
|
74
|
+
const e = _(t);
|
|
75
|
+
o.val !== e && (o.val = e);
|
|
76
|
+
},
|
|
77
|
+
{ immediate: !0 }
|
|
78
|
+
), I(() => {
|
|
79
|
+
n && (n.removeEventListener("compositionstart", m), n.removeEventListener("compositionend", d), n = null);
|
|
80
|
+
}), (t, e) => {
|
|
81
|
+
const l = L("el-input");
|
|
82
|
+
return k(), A(l, M({
|
|
83
|
+
ref_key: "inputRef",
|
|
84
|
+
ref: p,
|
|
85
|
+
type: "textarea",
|
|
86
|
+
modelValue: a(o).val,
|
|
87
|
+
"onUpdate:modelValue": e[0] || (e[0] = (w) => a(o).val = w),
|
|
88
|
+
rows: r.rows,
|
|
89
|
+
style: t.$attrs.style,
|
|
90
|
+
"input-style": a(b),
|
|
91
|
+
"show-word-limit": a(x),
|
|
92
|
+
maxlength: a(g),
|
|
93
|
+
class: "MvcTextarea"
|
|
94
|
+
}, t.$attrs, { onInput: h }), null, 16, ["modelValue", "rows", "style", "input-style", "show-word-limit", "maxlength"]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}), B = /* @__PURE__ */ O(T, [["__scopeId", "data-v-4dba94bf"]]), P = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
98
|
+
__proto__: null,
|
|
99
|
+
default: B
|
|
100
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
101
|
+
export {
|
|
102
|
+
P as _
|
|
103
|
+
};
|