@aplus-frontend/ui 0.0.22 → 0.0.23
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/check-card/group.vue.d.ts +1 -1
- package/es/src/check-card/group.vue.mjs +1 -1
- package/es/src/check-card/index.vue.d.ts +1 -1
- package/es/src/check-card/index.vue2.mjs +40 -36
- package/es/src/check-card/interface.d.ts +1 -1
- package/es/src/editable-table/form-item.vue.d.ts +755 -105
- package/es/src/editable-table/form-item.vue.mjs +81 -64
- package/es/src/editable-table/index.vue.d.ts +527 -112
- package/es/src/editable-table/index.vue.mjs +93 -76
- package/es/src/editable-table/interface.d.ts +11 -5
- package/lib/src/check-card/group.vue.d.ts +1 -1
- package/lib/src/check-card/group.vue.js +1 -1
- package/lib/src/check-card/index.vue.d.ts +1 -1
- package/lib/src/check-card/index.vue2.js +1 -1
- package/lib/src/check-card/interface.d.ts +1 -1
- package/lib/src/editable-table/form-item.vue.d.ts +755 -105
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.d.ts +527 -112
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +11 -5
- package/package.json +3 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { cloneDeep as
|
|
1
|
+
import { defineComponent as I, useSlots as K, ref as M, watch as q, unref as o, openBlock as w, createBlock as G, withCtx as f, createVNode as y, mergeProps as H, createSlots as U, createElementBlock as W, Fragment as $, createElementVNode as v, normalizeClass as J, toDisplayString as Q, createCommentVNode as X, renderList as Y, renderSlot as Z, normalizeProps as ee, guardReactiveProps as te } from "vue";
|
|
2
|
+
import { Table as ae } from "ant-design-vue";
|
|
3
|
+
import { ApForm as p } from "../ap-form/index.mjs";
|
|
4
|
+
import { isNumber as c, cloneDeep as h, omit as ne } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
|
-
import { isDef as
|
|
8
|
-
import
|
|
7
|
+
import { isDef as x } from "../utils/index.mjs";
|
|
8
|
+
import oe from "./hooks/use-get-columns.mjs";
|
|
9
9
|
import "./style/index.css";
|
|
10
|
-
import { useNamespace as
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
import { useControllableValue as
|
|
13
|
-
const
|
|
10
|
+
import { useNamespace as le } from "../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
import { useGlobalConfig as re } from "../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
import { useControllableValue as se } from "../hooks/useControllableValue.mjs";
|
|
13
|
+
const ye = /* @__PURE__ */ I({
|
|
14
14
|
name: "EditableTable",
|
|
15
15
|
__name: "index",
|
|
16
16
|
props: {
|
|
@@ -109,94 +109,111 @@ const xe = /* @__PURE__ */ L({
|
|
|
109
109
|
onFieldChange: {}
|
|
110
110
|
},
|
|
111
111
|
emits: ["update:value"],
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
114
|
-
emit:
|
|
112
|
+
setup(b, {
|
|
113
|
+
expose: R,
|
|
114
|
+
emit: B
|
|
115
115
|
}) {
|
|
116
|
-
const l =
|
|
117
|
-
b:
|
|
118
|
-
em:
|
|
119
|
-
} =
|
|
120
|
-
value:
|
|
121
|
-
updateValue:
|
|
122
|
-
} =
|
|
123
|
-
|
|
116
|
+
const l = b, {
|
|
117
|
+
b: g,
|
|
118
|
+
em: F
|
|
119
|
+
} = le("editable-table"), D = re("uiMode", "aplus"), _ = K(), E = B, {
|
|
120
|
+
value: d,
|
|
121
|
+
updateValue: L
|
|
122
|
+
} = se(l, E), i = M(), k = p.useWatch(l.name, i);
|
|
123
|
+
q(() => k.value, (e) => {
|
|
124
124
|
var n;
|
|
125
|
-
|
|
125
|
+
L(e), (n = l.onChange) == null || n.call(l, e);
|
|
126
126
|
});
|
|
127
|
-
const
|
|
128
|
-
function
|
|
127
|
+
const N = oe(l);
|
|
128
|
+
function S() {
|
|
129
|
+
var e;
|
|
130
|
+
(e = i.value) == null || e.resetFields();
|
|
131
|
+
}
|
|
132
|
+
async function V(e, n) {
|
|
129
133
|
var t;
|
|
130
|
-
(t =
|
|
134
|
+
const a = await ((t = i.value) == null ? void 0 : t.validateFields(e, n));
|
|
135
|
+
return a == null ? void 0 : a[l.name];
|
|
131
136
|
}
|
|
132
|
-
|
|
133
|
-
var
|
|
134
|
-
const
|
|
135
|
-
|
|
137
|
+
function P(e, n) {
|
|
138
|
+
var r, s, u;
|
|
139
|
+
const a = ((r = o(d)) == null ? void 0 : r.length) || 0;
|
|
140
|
+
if (x(l.maxLength) && a >= l.maxLength)
|
|
141
|
+
return;
|
|
142
|
+
const t = [...o(d) || []];
|
|
143
|
+
x(n) ? t.splice(n, 0, {
|
|
144
|
+
...e || {}
|
|
145
|
+
}) : t.push({
|
|
146
|
+
...e || {}
|
|
147
|
+
}), (u = (s = i.value) == null ? void 0 : s.setFieldValue) == null || u.call(s, l.name, t);
|
|
136
148
|
}
|
|
137
|
-
function
|
|
138
|
-
var
|
|
139
|
-
const
|
|
140
|
-
|
|
149
|
+
function z(e, n = "suffix") {
|
|
150
|
+
var u, m, C;
|
|
151
|
+
const a = ((u = o(d)) == null ? void 0 : u.length) || 0, t = c(e) ? e : e.length;
|
|
152
|
+
if (x(l.maxLength) && a + t > l.maxLength)
|
|
153
|
+
return;
|
|
154
|
+
const r = [...o(d) || []], s = c(e) ? new Array(e).fill({}) : h(e);
|
|
155
|
+
n === "suffix" ? r.push(...s) : r.unshift(...s), (C = (m = i.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, l.name, r);
|
|
141
156
|
}
|
|
142
|
-
function
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
157
|
+
function j(e) {
|
|
158
|
+
var t, r;
|
|
159
|
+
let n = h(o(d) || []);
|
|
160
|
+
const a = c(e) ? [e] : e;
|
|
161
|
+
n = n.filter((s, u) => !a.includes(u)), (r = (t = i.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, n);
|
|
146
162
|
}
|
|
147
|
-
function
|
|
148
|
-
return o(
|
|
163
|
+
function A() {
|
|
164
|
+
return o(d);
|
|
149
165
|
}
|
|
150
|
-
function
|
|
166
|
+
function O(e) {
|
|
151
167
|
var n;
|
|
152
|
-
return (n = o(
|
|
168
|
+
return (n = o(d)) == null ? void 0 : n[e];
|
|
153
169
|
}
|
|
154
|
-
function
|
|
155
|
-
var
|
|
156
|
-
const
|
|
157
|
-
e
|
|
158
|
-
...e
|
|
170
|
+
function T(e, n) {
|
|
171
|
+
var t, r;
|
|
172
|
+
const a = h(o(d));
|
|
173
|
+
a[e] && (a[e] = {
|
|
174
|
+
...a[e],
|
|
159
175
|
...n
|
|
160
|
-
}, (r = (
|
|
176
|
+
}, (r = (t = i.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...a]));
|
|
161
177
|
}
|
|
162
|
-
return
|
|
163
|
-
resetFields:
|
|
164
|
-
validateFields:
|
|
165
|
-
add:
|
|
166
|
-
remove:
|
|
167
|
-
getRowData:
|
|
168
|
-
getRowsData:
|
|
169
|
-
setRowData:
|
|
170
|
-
|
|
178
|
+
return R({
|
|
179
|
+
resetFields: S,
|
|
180
|
+
validateFields: V,
|
|
181
|
+
add: P,
|
|
182
|
+
remove: j,
|
|
183
|
+
getRowData: O,
|
|
184
|
+
getRowsData: A,
|
|
185
|
+
setRowData: T,
|
|
186
|
+
addMultiple: z
|
|
187
|
+
}), (e, n) => (w(), G(o(p), {
|
|
171
188
|
"initial-values": {
|
|
172
|
-
[l.name]: o(
|
|
189
|
+
[l.name]: o(d)
|
|
173
190
|
},
|
|
174
191
|
ref_key: "formRef",
|
|
175
|
-
ref:
|
|
192
|
+
ref: i
|
|
176
193
|
}, {
|
|
177
|
-
default:
|
|
178
|
-
name:
|
|
194
|
+
default: f(() => [y(o(p).FormItem, {
|
|
195
|
+
name: e.name,
|
|
179
196
|
"no-style": ""
|
|
180
197
|
}, {
|
|
181
|
-
default:
|
|
182
|
-
class: [o(
|
|
183
|
-
columns: o(
|
|
184
|
-
"data-source": o(
|
|
185
|
-
}),
|
|
186
|
-
headerCell:
|
|
187
|
-
column:
|
|
198
|
+
default: f(() => [y(o(ae), H(o(ne)(l, ["name", "value", "onUpdate:value", "maxLength"]), {
|
|
199
|
+
class: [o(g)(), o(D) === "admin" ? o(g)("admin") : null],
|
|
200
|
+
columns: o(N),
|
|
201
|
+
"data-source": o(d)
|
|
202
|
+
}), U({
|
|
203
|
+
headerCell: f(({
|
|
204
|
+
column: a
|
|
188
205
|
}) => {
|
|
189
|
-
var
|
|
190
|
-
return [(
|
|
206
|
+
var t, r, s;
|
|
207
|
+
return [(t = a == null ? void 0 : a.fieldProps) != null && t.required || (s = (r = a == null ? void 0 : a.fieldProps) == null ? void 0 : r.rules) != null && s.length ? (w(), W($, {
|
|
191
208
|
key: 0
|
|
192
|
-
}, [
|
|
193
|
-
class:
|
|
194
|
-
}, "*", 2),
|
|
209
|
+
}, [v("span", {
|
|
210
|
+
class: J(o(F)("header-cell", "required"))
|
|
211
|
+
}, "*", 2), v("span", null, Q(a.title), 1)], 64)) : X("", !0)];
|
|
195
212
|
}),
|
|
196
213
|
_: 2
|
|
197
|
-
}, [
|
|
198
|
-
name:
|
|
199
|
-
fn:
|
|
214
|
+
}, [Y(_, (a, t) => ({
|
|
215
|
+
name: t,
|
|
216
|
+
fn: f((r) => [Z(e.$slots, t, ee(te(r || {})))])
|
|
200
217
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
201
218
|
_: 3
|
|
202
219
|
}, 8, ["name"])]),
|
|
@@ -205,5 +222,5 @@ const xe = /* @__PURE__ */ L({
|
|
|
205
222
|
}
|
|
206
223
|
});
|
|
207
224
|
export {
|
|
208
|
-
|
|
225
|
+
ye as default
|
|
209
226
|
};
|
|
@@ -124,17 +124,23 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
124
124
|
*/
|
|
125
125
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType>> | undefined;
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
* @param defaultValue
|
|
129
|
-
* @
|
|
127
|
+
* 添加单条数据
|
|
128
|
+
* @param defaultValue 默认值,如果需要设置`insertIndex`,可以设置`defaultValue`为`{}`
|
|
129
|
+
* @param insertIndex 数据插入的位置
|
|
130
|
+
*/
|
|
131
|
+
add: (defaultValue?: Partial<RecordType>, insertIndex?: number) => void;
|
|
132
|
+
/**
|
|
133
|
+
* 添加多条数据
|
|
134
|
+
* @param list 添加的条数或数据
|
|
135
|
+
* @param insetIn 插入的位置(前/后)
|
|
130
136
|
*/
|
|
131
|
-
|
|
137
|
+
addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
|
|
132
138
|
/**
|
|
133
139
|
* 删除一行数据
|
|
134
140
|
* @param index
|
|
135
141
|
* @returns
|
|
136
142
|
*/
|
|
137
|
-
remove: (index: number) => void;
|
|
143
|
+
remove: (index: number | number[]) => void;
|
|
138
144
|
/**
|
|
139
145
|
* 获取所有行的数据
|
|
140
146
|
* @returns
|
|
@@ -28,7 +28,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
28
28
|
size: "small" | "middle";
|
|
29
29
|
value: CheckCardValueType | CheckCardValueType[];
|
|
30
30
|
bordered: boolean;
|
|
31
|
-
stopPropagation: boolean;
|
|
31
|
+
stopPropagation: boolean | ((event: MouseEvent) => boolean);
|
|
32
32
|
}, {}>, {
|
|
33
33
|
default?(_: {}): any;
|
|
34
34
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue");require("../hooks/index.js");const m=require("./context.js"),v=require("lodash-unified"),b=require("../hooks/useControllableValue.js"),y=a.defineComponent({name:"CheckCardGroup",__name:"group",props:{bordered:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},loading:{type:Boolean,default:void 0},size:{default:void 0},stopPropagation:{type:Boolean,default:void 0},multiple:{type:Boolean,default:!1},defaultValue:{type:[String,Number,Boolean,Array]},value:{type:[String,Number,Boolean,Array],default:void 0},"onUpdate:Value":{}},emits:["update:value"],setup(n,{emit:d}){const o=n,s=d,{value:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue");require("../hooks/index.js");const m=require("./context.js"),v=require("lodash-unified"),b=require("../hooks/useControllableValue.js"),y=a.defineComponent({name:"CheckCardGroup",__name:"group",props:{bordered:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},loading:{type:Boolean,default:void 0},size:{default:void 0},stopPropagation:{type:[Boolean,Function],default:void 0},multiple:{type:Boolean,default:!1},defaultValue:{type:[String,Number,Boolean,Array]},value:{type:[String,Number,Boolean,Array],default:void 0},"onUpdate:Value":{}},emits:["update:value"],setup(n,{emit:d}){const o=n,s=d,{value:i,updateValue:u}=b.useControllableValue(o,s),r=new Map;function p(e){if(!o.multiple){let t=a.unref(i);t===e?t=void 0:t=e,u(t);return}let l=[...a.unref(i)||[]];const g=l.find(t=>t===e);v.isUndefined(g)?l.push(e):l=l.filter(t=>t!==e).filter(t=>r.has(t)),u(l)}function f(e){r.set(e,!0)}function c(e){r.delete(e)}return m.useProvideCheckCard(a.computed(()=>({toggleOption:p,registerValue:f,cancelValue:c,disabled:o.disabled,size:o.size,bordered:o.bordered,loading:o.loading,value:a.unref(i),multiple:o.multiple,stopPropagation:o.stopPropagation}))),(e,l)=>a.renderSlot(e.$slots,"default")}});exports.default=y;
|
|
@@ -27,7 +27,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
27
27
|
size: "small" | "middle";
|
|
28
28
|
bordered: boolean;
|
|
29
29
|
checked: boolean;
|
|
30
|
-
stopPropagation: boolean;
|
|
30
|
+
stopPropagation: boolean | ((event: MouseEvent) => boolean);
|
|
31
31
|
}, {}>, Readonly<CheckCardSlots> & CheckCardSlots>;
|
|
32
32
|
export default _default;
|
|
33
33
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -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"),S=require("ant-design-vue");require("../config-provider/index.js");require("../hooks/index.js");const b=require("lodash-unified"),_=require("./context.js");require("./style/index.css");const z=require("./checked.svg.js"),D=require("../config-provider/hooks/use-namespace.js"),w=require("../config-provider/hooks/use-global-config.js"),E=require("../hooks/useControllableValue.js"),M=["src"],T=e.defineComponent({name:"CheckCard",__name:"index",props:{bordered:{type:Boolean,default:!0},disabled:{type:Boolean},loading:{type:Boolean},size:{default:"middle"},stopPropagation:{type:[Boolean,Function],default:!1},checked:{type:Boolean,default:void 0},"onUpdate:checked":{},defaultChecked:{type:Boolean},value:{type:[String,Number,Boolean]},style:{default:()=>({})},title:{},content:{}},emits:["update:checked"],setup(h,{emit:C}){const n=h,{b:s,m:d,e:i,bm:y,em:p}=D.useNamespace("check-card"),f=w.useGlobalConfig("uiMode","aplus"),B=C,a=_.useInjectCheckCard(),{value:r,updateValue:m}=E.useControllableValue(n,B,{valuePropName:"checked",defaultValuePropName:"defaultChecked"}),l=e.computed(()=>{const t={...n},o=e.unref(a);return o&&(t.disabled=t.disabled||o.disabled,t.bordered=t.bordered||o.bordered,t.loading=t.loading||o.loading,t.size=t.size||o.size,t.stopPropagation=t.stopPropagation||o.stopPropagation),t}),N=e.computed(()=>{const t=e.unref(f),o=e.unref(l);return[s(),...o.disabled?[]:[s(t),e.unref(r)?y(t,"checked"):null],d(o.size),o.bordered?d("bordered"):null,o.disabled?d("disabled"):null]}),V=e.computed(()=>({...n.style,"--check-card-border-color":f.value==="admin"?"#D9D9D9":"#E9EDF3"})),v=e.computed(()=>{if(!n.title)return;const t=b.isFunction(n.title)?n.title(e.unref(r)):e.createVNode("span",null,[n.title]);return e.createVNode("div",{class:[i("title"),l.value.disabled?p("title","disabled"):null]},[t])}),g=e.computed(()=>{if(!n.content)return;const t=b.isFunction(n.content)?n.content(e.unref(r)):n.content;return e.createVNode("div",{class:[i("content"),l.value.disabled?p("content","disabled"):null]},[t])});function q(t){const o=e.unref(l).stopPropagation;return o?o===!0?t.target!==t.currentTarget:o(t):!1}function P(t){var o,u;q(t)||l.value.loading||l.value.disabled||(a.value?(u=(o=a.value)==null?void 0:o.toggleOption)==null||u.call(o,n.value):m(!e.unref(r)))}return e.watch(()=>a.value,t=>{if(!t)return;const o=t.multiple?(t.value||[]).includes(n.value):t.value===n.value;m(o)},{immediate:!0}),e.watchEffect(t=>{var o,u;(u=(o=a.value)==null?void 0:o.registerValue)==null||u.call(o,n.value),t(()=>{var c,k;return(k=(c=a.value)==null?void 0:c.cancelValue)==null?void 0:k.call(c,n.value)})}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(V.value),class:e.normalizeClass(N.value),onClick:e.withModifiers(P,["stop"])},[l.value.loading?(e.openBlock(),e.createBlock(e.unref(S.Skeleton),{key:0,active:""})):e.renderSlot(t.$slots,"default",{key:1,checked:e.unref(r)},()=>[v.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(v.value),{key:0})):e.createCommentVNode("",!0),g.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.value),{key:1})):e.createCommentVNode("",!0)]),e.unref(r)?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(e.unref(i)("checked-icon"))},[e.createElementVNode("img",{src:e.unref(z.default)},null,8,M)],2)):e.createCommentVNode("",!0)],6))}});exports.default=T;
|