@aplus-frontend/ui 7.10.2 → 7.10.3
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.
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isEqual as
|
|
3
|
-
import { ApForm as
|
|
1
|
+
import { defineComponent as $, useSlots as q, ref as b, watch as J, unref as n, createBlock as Q, openBlock as X, withCtx as c, createVNode as R, mergeProps as Y, createSlots as Z, renderList as ee, renderSlot as oe, normalizeProps as ae, guardReactiveProps as te } from "vue";
|
|
2
|
+
import { isEqual as ne, isArray as v, omit as le } from "lodash-unified";
|
|
3
|
+
import { ApForm as f } from "../../ap-form/index.mjs";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import "../../hooks/index.mjs";
|
|
6
|
-
import { useEditableApi as
|
|
7
|
-
import { useGetEditableColumns as
|
|
6
|
+
import { useEditableApi as re } from "../hooks/use-editable-api.mjs";
|
|
7
|
+
import { useGetEditableColumns as se } from "../hooks/use-editable-columns.mjs";
|
|
8
8
|
import "../index.vue2.mjs";
|
|
9
|
-
import
|
|
10
|
-
import { arrayToObject as
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
import { useControllableValue as
|
|
13
|
-
import { useGlobalConfig as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
9
|
+
import ie from "../style/editable.mjs";
|
|
10
|
+
import { arrayToObject as y, getRowKey as de } from "./utils.mjs";
|
|
11
|
+
import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useControllableValue as pe } from "../../hooks/useControllableValue.mjs";
|
|
13
|
+
import { useGlobalConfig as me } from "../../config-provider/hooks/use-global-config.mjs";
|
|
14
|
+
import ce from "../index.vue.mjs";
|
|
15
|
+
const Fe = /* @__PURE__ */ $({
|
|
16
16
|
name: "EditableGrid",
|
|
17
17
|
__name: "index",
|
|
18
18
|
props: {
|
|
@@ -131,107 +131,113 @@ const xe = /* @__PURE__ */ G({
|
|
|
131
131
|
onFieldChange: {}
|
|
132
132
|
},
|
|
133
133
|
emits: ["update:value"],
|
|
134
|
-
setup(
|
|
135
|
-
expose:
|
|
136
|
-
emit:
|
|
134
|
+
setup(C, {
|
|
135
|
+
expose: x,
|
|
136
|
+
emit: B
|
|
137
137
|
}) {
|
|
138
|
-
const
|
|
139
|
-
b:
|
|
140
|
-
} =
|
|
138
|
+
const S = q(), o = C, {
|
|
139
|
+
b: T
|
|
140
|
+
} = ue("editable-aggrid"), _ = ie("editable-aggrid"), F = B, d = b(), {
|
|
141
141
|
value: r,
|
|
142
|
-
updateValue:
|
|
143
|
-
} =
|
|
144
|
-
|
|
145
|
-
const a =
|
|
146
|
-
|
|
142
|
+
updateValue: w
|
|
143
|
+
} = pe(o, F), l = b(), E = f.useWatch(o.name, l);
|
|
144
|
+
J(r, (e) => {
|
|
145
|
+
const a = y(e, o.rowKey);
|
|
146
|
+
ne(a, n(E)) || l.value?.setFieldValue(o.name, a);
|
|
147
147
|
}, {
|
|
148
148
|
deep: !0
|
|
149
149
|
});
|
|
150
|
-
const
|
|
151
|
-
add:
|
|
152
|
-
addMultiple:
|
|
153
|
-
remove:
|
|
154
|
-
removeByKey:
|
|
155
|
-
getRowData:
|
|
156
|
-
getRowsData:
|
|
157
|
-
setRowData:
|
|
158
|
-
clear:
|
|
159
|
-
refreshRowIds:
|
|
160
|
-
} =
|
|
161
|
-
function
|
|
162
|
-
const e =
|
|
163
|
-
if (!
|
|
150
|
+
const K = me("valueTypeMap"), k = se(o, K), {
|
|
151
|
+
add: N,
|
|
152
|
+
addMultiple: j,
|
|
153
|
+
remove: A,
|
|
154
|
+
removeByKey: D,
|
|
155
|
+
getRowData: I,
|
|
156
|
+
getRowsData: V,
|
|
157
|
+
setRowData: H,
|
|
158
|
+
clear: O,
|
|
159
|
+
refreshRowIds: p
|
|
160
|
+
} = re(o, l, r, w);
|
|
161
|
+
function z() {
|
|
162
|
+
const e = d.value?._internalGridApi;
|
|
163
|
+
if (!p.value?.length || !e)
|
|
164
164
|
return;
|
|
165
|
-
const a =
|
|
165
|
+
const a = p.value.map((t) => e.getRowNode(t)).filter((t) => !!t);
|
|
166
166
|
e.refreshCells({
|
|
167
167
|
rowNodes: a,
|
|
168
168
|
force: !0
|
|
169
|
-
}),
|
|
169
|
+
}), p.value = [];
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function L() {
|
|
172
172
|
l.value?.resetFields();
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
return e ? (
|
|
174
|
+
function P(e) {
|
|
175
|
+
return e ? (v(e) ? e : [e]).map((t) => v(t) ? [o.name, ...t] : [o.name, t]) : void 0;
|
|
176
176
|
}
|
|
177
|
-
async function
|
|
178
|
-
|
|
177
|
+
async function G(e, a) {
|
|
178
|
+
const s = (await l.value?.validateFields(P(e), a))?.[o.name];
|
|
179
|
+
try {
|
|
180
|
+
const u = Object.keys(s), h = r.value.map((i) => de(i, void 0, o.rowKey));
|
|
181
|
+
return u.sort((i, M) => h.findIndex((m) => String(m) === i) - h.findIndex((m) => String(m) === M)), u.map((i) => s[i]);
|
|
182
|
+
} catch {
|
|
183
|
+
return s;
|
|
184
|
+
}
|
|
179
185
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
182
|
-
const a =
|
|
186
|
+
function U(e) {
|
|
187
|
+
w(e);
|
|
188
|
+
const a = y(e, o.rowKey);
|
|
183
189
|
l.value?.setFieldValue(o.name, a);
|
|
184
190
|
}
|
|
185
|
-
function
|
|
191
|
+
function g(e, a) {
|
|
186
192
|
const t = e === "end" ? r.value.length - 1 : e;
|
|
187
|
-
|
|
193
|
+
d.value?.scrollToRow(t, a);
|
|
188
194
|
}
|
|
189
|
-
function
|
|
190
|
-
|
|
195
|
+
function W(e, a) {
|
|
196
|
+
d.value?.scrollToColumn(e, a);
|
|
191
197
|
}
|
|
192
|
-
return
|
|
193
|
-
resetFields:
|
|
194
|
-
validateFields:
|
|
195
|
-
add:
|
|
196
|
-
addMultiple:
|
|
197
|
-
remove:
|
|
198
|
-
removeByKey:
|
|
199
|
-
getRowData:
|
|
200
|
-
getRowsData:
|
|
201
|
-
setRowData:
|
|
202
|
-
clear:
|
|
203
|
-
setTableData:
|
|
204
|
-
scrollTo:
|
|
205
|
-
scrollToRow:
|
|
206
|
-
scrollToColumn:
|
|
207
|
-
}), (e, a) => (
|
|
198
|
+
return x({
|
|
199
|
+
resetFields: L,
|
|
200
|
+
validateFields: G,
|
|
201
|
+
add: N,
|
|
202
|
+
addMultiple: j,
|
|
203
|
+
remove: A,
|
|
204
|
+
removeByKey: D,
|
|
205
|
+
getRowData: I,
|
|
206
|
+
getRowsData: V,
|
|
207
|
+
setRowData: H,
|
|
208
|
+
clear: O,
|
|
209
|
+
setTableData: U,
|
|
210
|
+
scrollTo: g,
|
|
211
|
+
scrollToRow: g,
|
|
212
|
+
scrollToColumn: W
|
|
213
|
+
}), (e, a) => (X(), Q(n(f), {
|
|
208
214
|
ref_key: "formRef",
|
|
209
215
|
ref: l,
|
|
210
216
|
"initial-values": {
|
|
211
|
-
[o.name]: n(
|
|
217
|
+
[o.name]: n(y)(n(r), o.rowKey)
|
|
212
218
|
},
|
|
213
219
|
style: {
|
|
214
220
|
height: "100%"
|
|
215
221
|
}
|
|
216
222
|
}, {
|
|
217
|
-
default:
|
|
223
|
+
default: c(() => [R(n(f).FormItem, {
|
|
218
224
|
name: e.name,
|
|
219
225
|
"no-style": ""
|
|
220
226
|
}, {
|
|
221
|
-
default:
|
|
227
|
+
default: c(() => [R(ce, Y(n(le)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue"]), {
|
|
222
228
|
ref_key: "tableRef",
|
|
223
|
-
ref:
|
|
224
|
-
class: [n(
|
|
229
|
+
ref: d,
|
|
230
|
+
class: [n(T)(), n(_)],
|
|
225
231
|
size: "mini",
|
|
226
|
-
columns: n(
|
|
232
|
+
columns: n(k),
|
|
227
233
|
"data-source": n(r),
|
|
228
234
|
"search-form": !1,
|
|
229
|
-
onUpdate:
|
|
230
|
-
}),
|
|
235
|
+
onUpdate: z
|
|
236
|
+
}), Z({
|
|
231
237
|
_: 2
|
|
232
|
-
}, [
|
|
233
|
-
name:
|
|
234
|
-
fn:
|
|
238
|
+
}, [ee(S, (t, s) => ({
|
|
239
|
+
name: s,
|
|
240
|
+
fn: c((u) => [oe(e.$slots, s, ae(te(u || {})))])
|
|
235
241
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
236
242
|
_: 3
|
|
237
243
|
}, 8, ["name"])]),
|
|
@@ -240,5 +246,5 @@ const xe = /* @__PURE__ */ G({
|
|
|
240
246
|
}
|
|
241
247
|
});
|
|
242
248
|
export {
|
|
243
|
-
|
|
249
|
+
Fe as default
|
|
244
250
|
};
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.10.
|
|
1
|
+
declare const _default: "7.10.3";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("lodash-unified"),y=require("../../ap-form/index.js");require("../../config-provider/index.js");require("../../hooks/index.js");const L=require("../hooks/use-editable-api.js"),M=require("../hooks/use-editable-columns.js");require("../index.vue2.js");const U=require("../style/editable.js"),p=require("./utils.js"),W=require("../../config-provider/hooks/use-namespace.js"),$=require("../../hooks/useControllableValue.js"),J=require("../../config-provider/hooks/use-global-config.js"),Q=require("../index.vue.js"),X=e.defineComponent({name:"EditableGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},customRow:{},theme:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{}},emits:["update:value"],setup(h,{expose:v,emit:C}){const R=e.useSlots(),a=h,{b:x}=W.useNamespace("editable-aggrid"),B=U.default("editable-aggrid"),_=C,i=e.ref(),{value:r,updateValue:w}=$.useControllableValue(a,_),l=e.ref(),S=y.ApForm.useWatch(a.name,l);e.watch(r,o=>{const t=p.arrayToObject(o,a.rowKey);c.isEqual(t,e.unref(S))||l.value?.setFieldValue(a.name,t)},{deep:!0});const T=J.useGlobalConfig("valueTypeMap"),q=M.useGetEditableColumns(a,T),{add:F,addMultiple:E,remove:A,removeByKey:j,getRowData:N,getRowsData:K,setRowData:V,clear:k,refreshRowIds:f}=L.useEditableApi(a,l,r,w);function O(){const o=i.value?._internalGridApi;if(!f.value?.length||!o)return;const t=f.value.map(n=>o.getRowNode(n)).filter(n=>!!n);o.refreshCells({rowNodes:t,force:!0}),f.value=[]}function D(){l.value?.resetFields()}function I(o){return o?(c.isArray(o)?o:[o]).map(n=>c.isArray(n)?[a.name,...n]:[a.name,n]):void 0}async function H(o,t){const s=(await l.value?.validateFields(I(o),t))?.[a.name];try{const d=Object.keys(s),g=r.value.map(u=>p.getRowKey(u,void 0,a.rowKey));return d.sort((u,G)=>g.findIndex(m=>String(m)===u)-g.findIndex(m=>String(m)===G)),d.map(u=>s[u])}catch{return s}}function P(o){w(o);const t=p.arrayToObject(o,a.rowKey);l.value?.setFieldValue(a.name,t)}function b(o,t){const n=o==="end"?r.value.length-1:o;i.value?.scrollToRow(n,t)}function z(o,t){i.value?.scrollToColumn(o,t)}return v({resetFields:D,validateFields:H,add:F,addMultiple:E,remove:A,removeByKey:j,getRowData:N,getRowsData:K,setRowData:V,clear:k,setTableData:P,scrollTo:b,scrollToRow:b,scrollToColumn:z}),(o,t)=>(e.openBlock(),e.createBlock(e.unref(y.ApForm),{ref_key:"formRef",ref:l,"initial-values":{[a.name]:e.unref(p.arrayToObject)(e.unref(r),a.rowKey)},style:{height:"100%"}},{default:e.withCtx(()=>[e.createVNode(e.unref(y.ApForm).FormItem,{name:o.name,"no-style":""},{default:e.withCtx(()=>[e.createVNode(Q.default,e.mergeProps(e.unref(c.omit)(a,["name","value","onUpdate:value","maxLength","onChange","defaultValue"]),{ref_key:"tableRef",ref:i,class:[e.unref(x)(),e.unref(B)],size:"mini",columns:e.unref(q),"data-source":e.unref(r),"search-form":!1,onUpdate:O}),e.createSlots({_:2},[e.renderList(R,(n,s)=>({name:s,fn:e.withCtx(d=>[e.renderSlot(o.$slots,s,e.normalizeProps(e.guardReactiveProps(d||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=X;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.10.
|
|
1
|
+
declare const _default: "7.10.3";
|
|
2
2
|
export default _default;
|
package/lib/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.10.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.10.3";exports.default=e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "7.10.
|
|
3
|
+
"version": "7.10.3",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@aplus-frontend/antdv": "^1.3.5",
|
|
48
48
|
"@aplus-frontend/icon": "^2.0.4",
|
|
49
|
-
"@aplus-frontend/oss": "^1.1.
|
|
49
|
+
"@aplus-frontend/oss": "^1.1.10",
|
|
50
50
|
"vue": "^3.5.21",
|
|
51
51
|
"vxe-table": "^4.13.37"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@aplus-frontend/antdv": "^1.3.5",
|
|
55
55
|
"@aplus-frontend/icon": "^2.0.4",
|
|
56
|
-
"@aplus-frontend/oss": "^1.1.
|
|
56
|
+
"@aplus-frontend/oss": "^1.1.10",
|
|
57
57
|
"@emotion/serialize": "^1.3.3",
|
|
58
58
|
"@types/sortablejs": "^1.15.8",
|
|
59
59
|
"axios": "^1.7.2",
|