@aplus-frontend/ui 0.2.1 → 0.2.2
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/es/src/ap-upload/apUpload.vue.d.ts +2 -2
- package/es/src/ap-upload/components/Picture.vue2.mjs +10 -10
- package/es/src/business/ap-summary/style/css.js +1 -1
- package/es/src/business/ap-table-modal/table-modal.vue2.mjs +37 -37
- package/es/src/editable-table/interface.d.ts +2 -2
- package/lib/src/ap-upload/apUpload.vue.d.ts +2 -2
- package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/business/ap-summary/style/css.js +1 -1
- package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
- package/lib/src/editable-table/interface.d.ts +2 -2
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ declare const __VLS_component: DefineComponent<{
|
|
|
20
20
|
default: string;
|
|
21
21
|
};
|
|
22
22
|
value: {
|
|
23
|
-
type: (ObjectConstructor |
|
|
23
|
+
type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
|
|
24
24
|
default: undefined;
|
|
25
25
|
};
|
|
26
26
|
needName: {
|
|
@@ -68,7 +68,7 @@ declare const __VLS_component: DefineComponent<{
|
|
|
68
68
|
default: string;
|
|
69
69
|
};
|
|
70
70
|
value: {
|
|
71
|
-
type: (ObjectConstructor |
|
|
71
|
+
type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
|
|
72
72
|
default: undefined;
|
|
73
73
|
};
|
|
74
74
|
needName: {
|
|
@@ -14,7 +14,7 @@ const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture
|
|
|
14
14
|
}, ye = { class: "picture-title" }, we = { key: 0 }, ke = { key: 1 }, Te = /* @__PURE__ */ K({
|
|
15
15
|
__name: "Picture",
|
|
16
16
|
setup(Ce, { expose: E }) {
|
|
17
|
-
const { t: r } = pe(), { b: U } = de("ap-upload-picture"), { put: O } = ie(), B = u("theme"), L = u("dirName"), y = u("accept") || "image/*", w = u("maxSize") ?? 5,
|
|
17
|
+
const { t: r } = pe(), { b: U } = de("ap-upload-picture"), { put: O } = ie(), B = u("theme"), L = u("dirName"), y = u("accept") || "image/*", w = u("maxSize") ?? 5, S = u("title"), l = u("maxCount") ?? 10, v = u("uploadingCount"), A = u("beforeUpload"), N = u("customRequest"), P = u("getOssAccess"), x = R(null), c = u("value"), _ = u("needName");
|
|
18
18
|
let s = R([]);
|
|
19
19
|
const f = [];
|
|
20
20
|
Q(
|
|
@@ -33,7 +33,7 @@ const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture
|
|
|
33
33
|
W(async () => {
|
|
34
34
|
const a = [];
|
|
35
35
|
for (let t of e) {
|
|
36
|
-
const n = ne(_, t), o = ae(_, t), p = await D(
|
|
36
|
+
const n = ne(_, t), o = ae(_, t), p = await D(P), H = await p.getSignatureUrl(n), J = {
|
|
37
37
|
...typeof t == "string" ? {} : t,
|
|
38
38
|
...new File([t], o, {}),
|
|
39
39
|
uid: `${(/* @__PURE__ */ new Date()).getTime()}-${Math.random()}`,
|
|
@@ -83,8 +83,8 @@ const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture
|
|
|
83
83
|
r("ap.apUpload.maxUploadPicture", { maxCount: l })
|
|
84
84
|
);
|
|
85
85
|
}), !1;
|
|
86
|
-
if (typeof
|
|
87
|
-
if (
|
|
86
|
+
if (typeof A == "function") {
|
|
87
|
+
if (A(e) === !1)
|
|
88
88
|
return !1;
|
|
89
89
|
} else {
|
|
90
90
|
if (e.size > w * 1024 * 1024)
|
|
@@ -109,8 +109,8 @@ const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
async function G(e, a) {
|
|
112
|
-
if (v.value++, typeof
|
|
113
|
-
|
|
112
|
+
if (v.value++, typeof N == "function") {
|
|
113
|
+
N({
|
|
114
114
|
onProgress: (t) => {
|
|
115
115
|
const n = s.value.find((o) => o.uid === e.uid);
|
|
116
116
|
n && (n.percent = t);
|
|
@@ -137,7 +137,7 @@ const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture
|
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
try {
|
|
140
|
-
const t = await D(
|
|
140
|
+
const t = await D(P);
|
|
141
141
|
e.oss = t, s.value.push(e), O({
|
|
142
142
|
file: a,
|
|
143
143
|
dirName: L,
|
|
@@ -174,12 +174,12 @@ const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture
|
|
|
174
174
|
}
|
|
175
175
|
function I(e) {
|
|
176
176
|
var t;
|
|
177
|
-
if (e.path) {
|
|
177
|
+
if (e.path && c) {
|
|
178
178
|
if (Array.isArray(c.value)) {
|
|
179
179
|
const n = f.findIndex(
|
|
180
180
|
(o) => o.uid === e.uid
|
|
181
181
|
);
|
|
182
|
-
n >= 0 && (c == null
|
|
182
|
+
n >= 0 && (c.value = c == null ? void 0 : c.value.toSpliced(n, 1), f.splice(n, 1)), c.value.length === 0 && (c.value = void 0);
|
|
183
183
|
}
|
|
184
184
|
} else
|
|
185
185
|
(t = e == null ? void 0 : e.oss) == null || t.pauseUpload();
|
|
@@ -256,7 +256,7 @@ const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture
|
|
|
256
256
|
])) : $("", !0)
|
|
257
257
|
]),
|
|
258
258
|
d("div", ye, [
|
|
259
|
-
i(
|
|
259
|
+
i(S) ? (h(), g("div", we, C(i(S)), 1)) : (h(), g("div", ke, C(`${i(r)("ap.apUpload.supportExtension")}:${i(ue)(i(y))},${i(r)(
|
|
260
260
|
"ap.apUpload.maxUploadPictureSize",
|
|
261
261
|
{ maxSize: i(w) }
|
|
262
262
|
)}`), 1))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@aplus-frontend/ui-theme/dist/ap-summary/
|
|
1
|
+
import '@aplus-frontend/ui-theme/dist/ap-summary/index.css';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as F, ref as m, unref as
|
|
1
|
+
import { defineComponent as F, ref as m, unref as s, computed as U, h as q, openBlock as $, createBlock as z, mergeProps as b, withCtx as k, createVNode as T } from "vue";
|
|
2
2
|
import { message as h, Modal as H } from "@aplus-frontend/antdv";
|
|
3
3
|
import "../../index.mjs";
|
|
4
4
|
import { cloneDeep as V, omit as S } from "lodash-unified";
|
|
@@ -64,14 +64,14 @@ const fe = /* @__PURE__ */ F({
|
|
|
64
64
|
setup(B, { expose: R, emit: M }) {
|
|
65
65
|
const e = B, P = M, i = m(!1), y = m({}), d = m(null), a = m([]), C = m();
|
|
66
66
|
let c = null, n = null;
|
|
67
|
-
const K = Y("uiMode", "admin"), { t: g } = J(), _ = async (
|
|
68
|
-
var l, r,
|
|
69
|
-
switch (a.value = [...
|
|
67
|
+
const K = Y("uiMode", "admin"), { t: g } = J(), _ = async (o = [], t = {}) => {
|
|
68
|
+
var l, r, u;
|
|
69
|
+
switch (a.value = [...o], i.value = !0, y.value = t == null ? void 0 : t.extraParams, C.value = t.apTableDataSources || ((l = e.apTableProps) == null ? void 0 : l.dataSource), t.refreshMode || "reset") {
|
|
70
70
|
case "reset":
|
|
71
71
|
(r = d.value) == null || r.reset();
|
|
72
72
|
break;
|
|
73
73
|
case "submit":
|
|
74
|
-
(
|
|
74
|
+
(u = d.value) == null || u.submit();
|
|
75
75
|
break;
|
|
76
76
|
case "none":
|
|
77
77
|
break;
|
|
@@ -81,13 +81,13 @@ const fe = /* @__PURE__ */ F({
|
|
|
81
81
|
});
|
|
82
82
|
}, w = () => {
|
|
83
83
|
i.value = !1, c = null, n == null || n(x.ModalCancel), n = null;
|
|
84
|
-
}, I = async (
|
|
85
|
-
|
|
86
|
-
...
|
|
84
|
+
}, I = async (o) => {
|
|
85
|
+
o = W({
|
|
86
|
+
...o,
|
|
87
87
|
...y.value
|
|
88
88
|
});
|
|
89
|
-
const
|
|
90
|
-
return
|
|
89
|
+
const t = e.api, { records: l, total: r } = await t(o);
|
|
90
|
+
return {
|
|
91
91
|
data: l,
|
|
92
92
|
total: r
|
|
93
93
|
};
|
|
@@ -97,8 +97,8 @@ const fe = /* @__PURE__ */ F({
|
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
if (e.getRowKey) {
|
|
100
|
-
const
|
|
101
|
-
P("finish",
|
|
100
|
+
const o = V(s(a)), t = o.map(e.getRowKey);
|
|
101
|
+
P("finish", t, o), c == null || c({ keys: t, rows: o });
|
|
102
102
|
} else {
|
|
103
103
|
n == null || n(x.NotFineGetRowKey);
|
|
104
104
|
return;
|
|
@@ -106,28 +106,28 @@ const fe = /* @__PURE__ */ F({
|
|
|
106
106
|
i.value = !1;
|
|
107
107
|
}, A = U(() => {
|
|
108
108
|
if (!e.getRowKey) return;
|
|
109
|
-
const
|
|
109
|
+
const o = e.getRowKey;
|
|
110
110
|
return {
|
|
111
111
|
fixed: !0,
|
|
112
|
-
selectedRowKeys: a.value.map(
|
|
112
|
+
selectedRowKeys: a.value.map(o),
|
|
113
113
|
columnWidth: 50,
|
|
114
114
|
preserveSelectedRowKeys: !0,
|
|
115
|
-
onSelectAll(
|
|
116
|
-
var
|
|
115
|
+
onSelectAll(t, l) {
|
|
116
|
+
var u, p;
|
|
117
117
|
if (l.length > e.maxCount) {
|
|
118
118
|
h.warning(
|
|
119
119
|
g("ap.apTableModal.messageMaxCount", { maxCount: e.maxCount })
|
|
120
120
|
);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
const r = (
|
|
124
|
-
if (
|
|
125
|
-
const f =
|
|
123
|
+
const r = (u = d.value) == null ? void 0 : u.dataSource;
|
|
124
|
+
if (t) {
|
|
125
|
+
const f = s(r).filter((v) => !a.value.some((E) => o(E) === o(v)));
|
|
126
126
|
a.value = a.value.concat(f);
|
|
127
127
|
} else
|
|
128
|
-
a.value = (p = a.value) == null ? void 0 : p.filter((f) => !r.some((v) =>
|
|
128
|
+
a.value = (p = a.value) == null ? void 0 : p.filter((f) => !r.some((v) => o(v) === o(f)));
|
|
129
129
|
},
|
|
130
|
-
onSelect(
|
|
130
|
+
onSelect(t, l) {
|
|
131
131
|
if (l) {
|
|
132
132
|
if (a.value.length >= e.maxCount) {
|
|
133
133
|
h.warning(
|
|
@@ -135,16 +135,16 @@ const fe = /* @__PURE__ */ F({
|
|
|
135
135
|
);
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
|
-
a.value.push(
|
|
138
|
+
a.value.push(t);
|
|
139
139
|
} else {
|
|
140
140
|
const r = a.value.findIndex(
|
|
141
|
-
(
|
|
141
|
+
(u) => o(t) === o(u)
|
|
142
142
|
);
|
|
143
143
|
a.value.splice(r, 1);
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
|
-
getCheckboxProps: (
|
|
147
|
-
disabled: typeof e.disabledCheckbox == "function" ? e.disabledCheckbox(
|
|
146
|
+
getCheckboxProps: (t) => ({
|
|
147
|
+
disabled: typeof e.disabledCheckbox == "function" ? e.disabledCheckbox(t, a.value) : e.disabledCheckbox
|
|
148
148
|
// Column configuration not to be checked
|
|
149
149
|
}),
|
|
150
150
|
...e.rowSelection || {}
|
|
@@ -161,11 +161,11 @@ const fe = /* @__PURE__ */ F({
|
|
|
161
161
|
}
|
|
162
162
|
) : e.title, N = () => d.value, O = () => {
|
|
163
163
|
a.value = [];
|
|
164
|
-
}, G = (
|
|
165
|
-
const
|
|
166
|
-
if (!
|
|
164
|
+
}, G = (o) => {
|
|
165
|
+
const t = e.getRowKey;
|
|
166
|
+
if (!t) return;
|
|
167
167
|
const l = a.value.findIndex(
|
|
168
|
-
(r) => o
|
|
168
|
+
(r) => t(o) === t(r)
|
|
169
169
|
);
|
|
170
170
|
a.value.splice(l, 1);
|
|
171
171
|
};
|
|
@@ -173,14 +173,14 @@ const fe = /* @__PURE__ */ F({
|
|
|
173
173
|
open: _,
|
|
174
174
|
close: w,
|
|
175
175
|
getApTableInstance: N
|
|
176
|
-
}), (
|
|
176
|
+
}), (o, t) => ($(), z(s(H), b(
|
|
177
177
|
{
|
|
178
178
|
onOk: L,
|
|
179
179
|
onCancel: w,
|
|
180
180
|
open: i.value,
|
|
181
|
-
"onUpdate:open":
|
|
181
|
+
"onUpdate:open": t[0] || (t[0] = (l) => i.value = l)
|
|
182
182
|
},
|
|
183
|
-
|
|
183
|
+
s(S)(e, [
|
|
184
184
|
"api",
|
|
185
185
|
"getRowKey",
|
|
186
186
|
"centered",
|
|
@@ -207,15 +207,15 @@ const fe = /* @__PURE__ */ F({
|
|
|
207
207
|
onDeleteItem: G
|
|
208
208
|
}), {
|
|
209
209
|
default: k(() => [
|
|
210
|
-
T(
|
|
210
|
+
T(s(Z), b({
|
|
211
211
|
scroll: { y: "100%" },
|
|
212
212
|
style: { padding: "0px" },
|
|
213
|
-
columns:
|
|
213
|
+
columns: o.columns,
|
|
214
214
|
request: I,
|
|
215
|
-
"row-key":
|
|
215
|
+
"row-key": o.getRowKey,
|
|
216
216
|
"row-selection": A.value,
|
|
217
|
-
bordered:
|
|
218
|
-
},
|
|
217
|
+
bordered: s(K) === "admin"
|
|
218
|
+
}, s(S)(e.apTableProps, "dataSource"), {
|
|
219
219
|
ref_key: "apTableRef",
|
|
220
220
|
ref: d,
|
|
221
221
|
"data-source": C.value
|
|
@@ -2,11 +2,11 @@ import { ColumnType, TableProps } from '@aplus-frontend/antdv/es/table';
|
|
|
2
2
|
import { ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, FieldPropsType, ValueEnum } from '../ap-table';
|
|
3
3
|
import { NamePath, ValidateOptions } from '@aplus-frontend/antdv/es/form/interface';
|
|
4
4
|
import { DataIndex } from '@aplus-frontend/antdv/es/vc-table/interface';
|
|
5
|
-
import { FormItemProps } from '@aplus-frontend/antdv';
|
|
6
5
|
import { VNode } from 'vue';
|
|
7
6
|
import { EllipsisConfig } from '@aplus-frontend/antdv/es/typography/Base';
|
|
8
7
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
9
8
|
import { Recordable } from '../type';
|
|
9
|
+
import { ApFormItemProps } from '../ap-form';
|
|
10
10
|
export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
11
11
|
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
|
|
12
12
|
/**
|
|
@@ -100,7 +100,7 @@ export type EditableTableFormItemProps<RecordType = any> = Omit<EditableTablePro
|
|
|
100
100
|
/**
|
|
101
101
|
* 额外的表单项配置属性
|
|
102
102
|
*/
|
|
103
|
-
formItem?: Partial<Omit<
|
|
103
|
+
formItem?: Partial<Omit<ApFormItemProps, 'name' | 'label'>>;
|
|
104
104
|
};
|
|
105
105
|
export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
106
106
|
/**
|
|
@@ -20,7 +20,7 @@ declare const __VLS_component: DefineComponent<{
|
|
|
20
20
|
default: string;
|
|
21
21
|
};
|
|
22
22
|
value: {
|
|
23
|
-
type: (ObjectConstructor |
|
|
23
|
+
type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
|
|
24
24
|
default: undefined;
|
|
25
25
|
};
|
|
26
26
|
needName: {
|
|
@@ -68,7 +68,7 @@ declare const __VLS_component: DefineComponent<{
|
|
|
68
68
|
default: string;
|
|
69
69
|
};
|
|
70
70
|
value: {
|
|
71
|
-
type: (ObjectConstructor |
|
|
71
|
+
type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
|
|
72
72
|
default: undefined;
|
|
73
73
|
};
|
|
74
74
|
needName: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../config-provider/index.js");const v=require("../utils/returnData.js"),S=require("@ant-design/icons-vue"),y=require("../hooks/useOss.js"),j=require("../utils/accept.js"),l=require("@aplus-frontend/antdv"),T=require("lodash-unified"),L=require("../../config-provider/hooks/use-locale.js"),M=require("../../config-provider/hooks/use-namespace.js"),G=["accept"],H={class:"picture-context"},J={class:"picture-item-box"},K=["src"],Q={class:"picture-item-shadow"},W=["onClick"],X={key:0,class:"picture-item-uploading"},Y={class:"picture-title"},Z={key:0},F={key:1},ee=e.defineComponent({__name:"Picture",setup(te,{expose:q}){const{t:r}=L.useLocale(),{b:_}=M.useNamespace("ap-upload-picture"),{put:V}=y.useOss(),P=e.inject("theme"),b=e.inject("dirName"),h=e.inject("accept")||"image/*",k=e.inject("maxSize")??5,x=e.inject("title"),u=e.inject("maxCount")??10,f=e.inject("uploadingCount"),w=e.inject("beforeUpload"),C=e.inject("customRequest"),N=e.inject("getOssAccess"),m=e.ref(null),i=e.inject("value"),g=e.inject("needName");let o=e.ref([]);const p=[];e.watch(()=>i==null?void 0:i.value,async function(t){var s;!((s=o==null?void 0:o.value)!=null&&s.length)&&t&&U(t)},{immediate:!0});function U(t){if(!t){i.value=void 0,p.splice(0,p.length),o.value=[];return}e.nextTick(async()=>{const s=[];for(let n of t){const a=v.getPath(g,n),c=v.getName(g,n),d=await y.getOssInstance(N),z=await d.getSignatureUrl(a),O={...typeof n=="string"?{}:n,...new File([n],c,{}),uid:`${new Date().getTime()}-${Math.random()}`,thumbUrl:z,status:"success",percent:100,path:a};s.push(O),d.destroy()}if(u&&s.length>u){l.message.warning(r("ap.apUpload.fileInitializationException",{maxCount:u}));return}s.forEach(n=>{o.value.push(n),p.push({uid:n.uid,path:n.path})}),i.value=t})}q({setValue:U});function A(){var t;(t=m.value)==null||t.click()}function I(t){const s=t.target;D(s==null?void 0:s.files)}function D(t){if(t!=null&&t.length)for(let s=0;s<t.length;s++)R(t[s]);m.value&&(m.value.value="")}let E;function R(t){if(u&&u>1&&o.value.length>=u)return clearTimeout(E),E=setTimeout(()=>{l.message.warning(r("ap.apUpload.maxUploadPicture",{maxCount:u}))}),!1;if(typeof w=="function"){if(w(t)===!1)return!1}else{if(t.size>k*1024*1024)return l.message.warning(r("ap.apUpload.maxUploadFileSize",{maxSize:k})),!1;if(!/image\/\w+/.test(t.type)||!j.fileMatchesAccept(t,h))return l.message.warning(r("ap.apUpload.pictureFormatNotSupported")),!1}const s=new FileReader;s.readAsDataURL(t),s.onload=function(){const n={...t,uid:`${new Date().getTime()}-${Math.random()}`,thumbUrl:this.result,status:"uploading",percent:0};$(n,t)},s.onerror=function(){l.message.warning(r("ap.apUpload.imageParsingFailed"))}}async function $(t,s){if(f.value++,typeof C=="function"){C({onProgress:n=>{const a=o.value.find(c=>c.uid===t.uid);a&&(a.percent=n)},onError:n=>{l.message.warning(n||r("ap.apUpload.networkAnomaly"));const a=o.value.findIndex(c=>c.uid===t.uid);a>-1&&o.value.splice(a,1),f.value--},onSuccess:n=>{const a=o.value.find(c=>c.uid===t.uid);a&&(a.status="success",a.path=n),i.value=[...i.value||[],v.getReturnData(g,n,s.name)],p.push({uid:t.uid,path:n}),f.value--},file:s});return}try{const n=await y.getOssInstance(N);t.oss=n,o.value.push(t),V({file:s,dirName:b,oss:n,successCallBack(a){const c=o.value.find(d=>d.uid===t.uid);c&&(c.status="success",c.path=a),i.value=[...i.value||[],v.getReturnData(g,a,s.name)],p.push({uid:t.uid,path:a}),f.value--},errorCallBack(a){l.message.warning(a||r("ap.apUpload.networkAnomaly"));const c=o.value.findIndex(d=>d.uid===t.uid);c>-1&&o.value.splice(c,1),f.value--},progressCallBack(a){const c=o.value.find(d=>d.uid===t.uid);c&&(c.percent=a)}})}catch(n){l.message.warning(typeof(n==null?void 0:n.message)=="string"?n.message:r("ap.apUpload.networkAnomaly"));const a=o.value.findIndex(c=>c.uid===t.uid);a>-1&&o.value.splice(a,1),f.value--}}function B(t){var n;if(t.path){if(Array.isArray(i.value)){const a=p.findIndex(c=>c.uid===t.uid);a>=0&&(i==null
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../config-provider/index.js");const v=require("../utils/returnData.js"),S=require("@ant-design/icons-vue"),y=require("../hooks/useOss.js"),j=require("../utils/accept.js"),l=require("@aplus-frontend/antdv"),T=require("lodash-unified"),L=require("../../config-provider/hooks/use-locale.js"),M=require("../../config-provider/hooks/use-namespace.js"),G=["accept"],H={class:"picture-context"},J={class:"picture-item-box"},K=["src"],Q={class:"picture-item-shadow"},W=["onClick"],X={key:0,class:"picture-item-uploading"},Y={class:"picture-title"},Z={key:0},F={key:1},ee=e.defineComponent({__name:"Picture",setup(te,{expose:q}){const{t:r}=L.useLocale(),{b:_}=M.useNamespace("ap-upload-picture"),{put:V}=y.useOss(),P=e.inject("theme"),b=e.inject("dirName"),h=e.inject("accept")||"image/*",k=e.inject("maxSize")??5,x=e.inject("title"),u=e.inject("maxCount")??10,f=e.inject("uploadingCount"),w=e.inject("beforeUpload"),C=e.inject("customRequest"),N=e.inject("getOssAccess"),m=e.ref(null),i=e.inject("value"),g=e.inject("needName");let o=e.ref([]);const p=[];e.watch(()=>i==null?void 0:i.value,async function(t){var s;!((s=o==null?void 0:o.value)!=null&&s.length)&&t&&U(t)},{immediate:!0});function U(t){if(!t){i.value=void 0,p.splice(0,p.length),o.value=[];return}e.nextTick(async()=>{const s=[];for(let n of t){const a=v.getPath(g,n),c=v.getName(g,n),d=await y.getOssInstance(N),z=await d.getSignatureUrl(a),O={...typeof n=="string"?{}:n,...new File([n],c,{}),uid:`${new Date().getTime()}-${Math.random()}`,thumbUrl:z,status:"success",percent:100,path:a};s.push(O),d.destroy()}if(u&&s.length>u){l.message.warning(r("ap.apUpload.fileInitializationException",{maxCount:u}));return}s.forEach(n=>{o.value.push(n),p.push({uid:n.uid,path:n.path})}),i.value=t})}q({setValue:U});function A(){var t;(t=m.value)==null||t.click()}function I(t){const s=t.target;D(s==null?void 0:s.files)}function D(t){if(t!=null&&t.length)for(let s=0;s<t.length;s++)R(t[s]);m.value&&(m.value.value="")}let E;function R(t){if(u&&u>1&&o.value.length>=u)return clearTimeout(E),E=setTimeout(()=>{l.message.warning(r("ap.apUpload.maxUploadPicture",{maxCount:u}))}),!1;if(typeof w=="function"){if(w(t)===!1)return!1}else{if(t.size>k*1024*1024)return l.message.warning(r("ap.apUpload.maxUploadFileSize",{maxSize:k})),!1;if(!/image\/\w+/.test(t.type)||!j.fileMatchesAccept(t,h))return l.message.warning(r("ap.apUpload.pictureFormatNotSupported")),!1}const s=new FileReader;s.readAsDataURL(t),s.onload=function(){const n={...t,uid:`${new Date().getTime()}-${Math.random()}`,thumbUrl:this.result,status:"uploading",percent:0};$(n,t)},s.onerror=function(){l.message.warning(r("ap.apUpload.imageParsingFailed"))}}async function $(t,s){if(f.value++,typeof C=="function"){C({onProgress:n=>{const a=o.value.find(c=>c.uid===t.uid);a&&(a.percent=n)},onError:n=>{l.message.warning(n||r("ap.apUpload.networkAnomaly"));const a=o.value.findIndex(c=>c.uid===t.uid);a>-1&&o.value.splice(a,1),f.value--},onSuccess:n=>{const a=o.value.find(c=>c.uid===t.uid);a&&(a.status="success",a.path=n),i.value=[...i.value||[],v.getReturnData(g,n,s.name)],p.push({uid:t.uid,path:n}),f.value--},file:s});return}try{const n=await y.getOssInstance(N);t.oss=n,o.value.push(t),V({file:s,dirName:b,oss:n,successCallBack(a){const c=o.value.find(d=>d.uid===t.uid);c&&(c.status="success",c.path=a),i.value=[...i.value||[],v.getReturnData(g,a,s.name)],p.push({uid:t.uid,path:a}),f.value--},errorCallBack(a){l.message.warning(a||r("ap.apUpload.networkAnomaly"));const c=o.value.findIndex(d=>d.uid===t.uid);c>-1&&o.value.splice(c,1),f.value--},progressCallBack(a){const c=o.value.find(d=>d.uid===t.uid);c&&(c.percent=a)}})}catch(n){l.message.warning(typeof(n==null?void 0:n.message)=="string"?n.message:r("ap.apUpload.networkAnomaly"));const a=o.value.findIndex(c=>c.uid===t.uid);a>-1&&o.value.splice(a,1),f.value--}}function B(t){var n;if(t.path&&i){if(Array.isArray(i.value)){const a=p.findIndex(c=>c.uid===t.uid);a>=0&&(i.value=i==null?void 0:i.value.toSpliced(a,1),p.splice(a,1)),i.value.length===0&&(i.value=void 0)}}else(n=t==null?void 0:t.oss)==null||n.pauseUpload();const s=o.value.findIndex(a=>a.uid===t.uid);return o.value.splice(s,1),Promise.resolve(!0)}return(t,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({[e.unref(_)()]:!0,[e.unref(_)("admin")]:e.unref(P)==="admin"})},[e.createElementVNode("input",{style:{display:"none"},type:"file",ref_key:"fileRef",ref:m,accept:e.unref(h),onChange:I},null,40,G),e.createElementVNode("div",H,[e.renderSlot(t.$slots,"pictureContext",{fileList:e.unref(o).map(n=>{var a;return{...e.unref(T.omit)(n,"oss"),oss:{pauseUpload:(a=n==null?void 0:n.oss)==null?void 0:a.pauseUpload}}}),remove:B},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),n=>(e.openBlock(),e.createElementBlock("div",{key:n.uid,class:"picture-item"},[e.createElementVNode("div",J,[e.createElementVNode("img",{src:n.thumbUrl,alt:""},null,8,K),e.withDirectives(e.createElementVNode("div",Q,[e.createElementVNode("div",{class:"picture-item-close",onClick:a=>B(n)},[e.createVNode(e.unref(S.CloseOutlined))],8,W),n.status==="uploading"?(e.openBlock(),e.createElementBlock("div",X,[e.createVNode(e.unref(l.Progress),{percent:n.percent,strokeColor:"#ffffff",trailColor:"rgba(255, 255, 255, 0.3)",size:4,showInfo:!1},null,8,["percent"])])):e.createCommentVNode("",!0)],512),[[e.vShow,n.status==="uploading"]])])]))),128))]),e.unref(u)===void 0||e.unref(o).length<e.unref(u)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"picture-upload",onClick:A},[e.createVNode(e.unref(S.PlusOutlined)),e.createElementVNode("div",null,e.toDisplayString(e.unref(r)("ap.apUpload.update")),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Y,[e.unref(x)?(e.openBlock(),e.createElementBlock("div",Z,e.toDisplayString(e.unref(x)),1)):(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(`${e.unref(r)("ap.apUpload.supportExtension")}:${e.unref(j.getAcceptText)(e.unref(h))},${e.unref(r)("ap.apUpload.maxUploadPictureSize",{maxSize:e.unref(k)})}`),1))])],2))}});exports.default=ee;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@aplus-frontend/ui-theme/dist/ap-summary/
|
|
1
|
+
import '@aplus-frontend/ui-theme/dist/ap-summary/index.css';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),v=require("@aplus-frontend/antdv");require("../../index.js");const y=require("lodash-unified"),L=require("@aplus-frontend/utils");require("./modal-title.vue.js");const b=require("./interface.js");require("./table-layout/index.vue.js");const N=require("../../config-provider/hooks/use-global-config.js"),D=require("../../config-provider/hooks/use-locale.js"),E=require("./modal-title.vue2.js"),G=require("./table-layout/index.vue2.js"),U=require("../../ap-table/index.js"),F=o.defineComponent({__name:"table-modal",props:{columns:{},getRowKey:{},api:{type:Function,default:async()=>({records:[],total:0})},apTableProps:{},maxCount:{default:1/0},isRenderModalTitleSuffix:{type:Boolean,default:!0},renderModalTitleSuffix:{},disabledCheckbox:{type:[Boolean,Function]},rowSelection:{},tableLayoutConfig:{},prefixCls:{},confirmLoading:{type:Boolean,default:void 0},title:{},closable:{type:Boolean,default:void 0},closeIcon:{},onCancel:{},"onUpdate:visible":{},"onUpdate:open":{},onChange:{},afterClose:{},centered:{type:Boolean,default:void 0},width:{},footer:{},okText:{},okType:{},cancelText:{},icon:{},maskClosable:{type:Boolean,default:void 0},forceRender:{type:Boolean,default:void 0},okButtonProps:{},cancelButtonProps:{},destroyOnClose:{type:Boolean,default:void 0},wrapClassName:{},maskTransitionName:{},transitionName:{},getContainer:{type:[String,Boolean,Function],default:void 0},zIndex:{},bodyStyle:{},maskStyle:{},mask:{type:Boolean,default:void 0},keyboard:{type:Boolean,default:void 0},wrapProps:{},focusTriggerAfterClose:{type:Boolean,default:void 0},modalRender:{},mousePosition:{}},emits:["finish"],setup(k,{expose:T,emit:h}){const e=k,S=h,i=o.ref(!1),x=o.ref({}),d=o.ref(null),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),v=require("@aplus-frontend/antdv");require("../../index.js");const y=require("lodash-unified"),L=require("@aplus-frontend/utils");require("./modal-title.vue.js");const b=require("./interface.js");require("./table-layout/index.vue.js");const N=require("../../config-provider/hooks/use-global-config.js"),D=require("../../config-provider/hooks/use-locale.js"),E=require("./modal-title.vue2.js"),G=require("./table-layout/index.vue2.js"),U=require("../../ap-table/index.js"),F=o.defineComponent({__name:"table-modal",props:{columns:{},getRowKey:{},api:{type:Function,default:async()=>({records:[],total:0})},apTableProps:{},maxCount:{default:1/0},isRenderModalTitleSuffix:{type:Boolean,default:!0},renderModalTitleSuffix:{},disabledCheckbox:{type:[Boolean,Function]},rowSelection:{},tableLayoutConfig:{},prefixCls:{},confirmLoading:{type:Boolean,default:void 0},title:{},closable:{type:Boolean,default:void 0},closeIcon:{},onCancel:{},"onUpdate:visible":{},"onUpdate:open":{},onChange:{},afterClose:{},centered:{type:Boolean,default:void 0},width:{},footer:{},okText:{},okType:{},cancelText:{},icon:{},maskClosable:{type:Boolean,default:void 0},forceRender:{type:Boolean,default:void 0},okButtonProps:{},cancelButtonProps:{},destroyOnClose:{type:Boolean,default:void 0},wrapClassName:{},maskTransitionName:{},transitionName:{},getContainer:{type:[String,Boolean,Function],default:void 0},zIndex:{},bodyStyle:{},maskStyle:{},mask:{type:Boolean,default:void 0},keyboard:{type:Boolean,default:void 0},wrapProps:{},focusTriggerAfterClose:{type:Boolean,default:void 0},modalRender:{},mousePosition:{}},emits:["finish"],setup(k,{expose:T,emit:h}){const e=k,S=h,i=o.ref(!1),x=o.ref({}),d=o.ref(null),n=o.ref([]),g=o.ref();let c=null,r=null;const _=N.useGlobalConfig("uiMode","admin"),{t:C}=D.useLocale(),R=async(a=[],t={})=>{var l,u,s;switch(n.value=[...a],i.value=!0,x.value=t==null?void 0:t.extraParams,g.value=t.apTableDataSources||((l=e.apTableProps)==null?void 0:l.dataSource),t.refreshMode||"reset"){case"reset":(u=d.value)==null||u.reset();break;case"submit":(s=d.value)==null||s.submit();break;case"none":break}return new Promise((p,f)=>{c=p,r=f})},w=()=>{i.value=!1,c=null,r==null||r(b.AsyncOpenResultError.ModalCancel),r=null},M=async a=>{a=L.transformTableParams({...a,...x.value});const t=e.api,{records:l,total:u}=await t(a);return{data:l,total:u}},P=()=>{if(n.value.length>e.maxCount){r==null||r(b.AsyncOpenResultError.ExceedMaxCount);return}if(e.getRowKey){const a=y.cloneDeep(o.unref(n)),t=a.map(e.getRowKey);S("finish",t,a),c==null||c({keys:t,rows:a})}else{r==null||r(b.AsyncOpenResultError.NotFineGetRowKey);return}i.value=!1},B=o.computed(()=>{if(!e.getRowKey)return;const a=e.getRowKey;return{fixed:!0,selectedRowKeys:n.value.map(a),columnWidth:50,preserveSelectedRowKeys:!0,onSelectAll(t,l){var s,p;if(l.length>e.maxCount){v.message.warning(C("ap.apTableModal.messageMaxCount",{maxCount:e.maxCount}));return}const u=(s=d.value)==null?void 0:s.dataSource;if(t){const f=o.unref(u).filter(m=>!n.value.some(A=>a(A)===a(m)));n.value=n.value.concat(f)}else n.value=(p=n.value)==null?void 0:p.filter(f=>!u.some(m=>a(m)===a(f)))},onSelect(t,l){if(l){if(n.value.length>=e.maxCount){v.message.warning(C("ap.apTableModal.messageMaxCount",{maxCount:e.maxCount}));return}n.value.push(t)}else{const u=n.value.findIndex(s=>a(t)===a(s));n.value.splice(u,1)}},getCheckboxProps:t=>({disabled:typeof e.disabledCheckbox=="function"?e.disabledCheckbox(t,n.value):e.disabledCheckbox}),...e.rowSelection||{}}}),q=()=>e.isRenderModalTitleSuffix?o.h(E.default,{title:e.title,count:n.value.length||0,maxCount:e.maxCount},{default:e.renderModalTitleSuffix??void 0}):e.title,K=()=>d.value,I=()=>{n.value=[]},O=a=>{const t=e.getRowKey;if(!t)return;const l=n.value.findIndex(u=>t(a)===t(u));n.value.splice(l,1)};return T({open:R,close:w,getApTableInstance:K}),(a,t)=>(o.openBlock(),o.createBlock(o.unref(v.Modal),o.mergeProps({onOk:P,onCancel:w,open:i.value,"onUpdate:open":t[0]||(t[0]=l=>i.value=l)},o.unref(y.omit)(e,["api","getRowKey","centered","apTableProps","onOk","maxCount","title","renderModalTitleSuffix","isRenderModalTitleSuffix","rowSelection","disabledCheckbox","tableLayoutConfig"]),{title:q(),"body-style":{maxHeight:"calc(100vh - 205px)",overflowY:"scroll"},centered:e.centered??!0}),{default:o.withCtx(()=>[o.createVNode(G.default,o.mergeProps(e.tableLayoutConfig||{},{onClear:I,"selected-list":n.value,onDeleteItem:O}),{default:o.withCtx(()=>[o.createVNode(o.unref(U.ApTable),o.mergeProps({scroll:{y:"100%"},style:{padding:"0px"},columns:a.columns,request:M,"row-key":a.getRowKey,"row-selection":B.value,bordered:o.unref(_)==="admin"},o.unref(y.omit)(e.apTableProps,"dataSource"),{ref_key:"apTableRef",ref:d,"data-source":g.value}),null,16,["columns","row-key","row-selection","bordered","data-source"])]),_:1},16,["selected-list"])]),_:1},16,["open","title","centered"]))}});exports.default=F;
|
|
@@ -2,11 +2,11 @@ import { ColumnType, TableProps } from '@aplus-frontend/antdv/es/table';
|
|
|
2
2
|
import { ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, FieldPropsType, ValueEnum } from '../ap-table';
|
|
3
3
|
import { NamePath, ValidateOptions } from '@aplus-frontend/antdv/es/form/interface';
|
|
4
4
|
import { DataIndex } from '@aplus-frontend/antdv/es/vc-table/interface';
|
|
5
|
-
import { FormItemProps } from '@aplus-frontend/antdv';
|
|
6
5
|
import { VNode } from 'vue';
|
|
7
6
|
import { EllipsisConfig } from '@aplus-frontend/antdv/es/typography/Base';
|
|
8
7
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
9
8
|
import { Recordable } from '../type';
|
|
9
|
+
import { ApFormItemProps } from '../ap-form';
|
|
10
10
|
export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
11
11
|
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
|
|
12
12
|
/**
|
|
@@ -100,7 +100,7 @@ export type EditableTableFormItemProps<RecordType = any> = Omit<EditableTablePro
|
|
|
100
100
|
/**
|
|
101
101
|
* 额外的表单项配置属性
|
|
102
102
|
*/
|
|
103
|
-
formItem?: Partial<Omit<
|
|
103
|
+
formItem?: Partial<Omit<ApFormItemProps, 'name' | 'label'>>;
|
|
104
104
|
};
|
|
105
105
|
export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
106
106
|
/**
|