@aplus-frontend/ui 0.2.9 → 0.2.10
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-descriptions/interface.d.ts +1 -1
- package/es/src/ap-form/list/index.vue.mjs +15 -15
- package/es/src/ap-form/search-form/index.vue.mjs +2 -2
- package/lib/src/ap-descriptions/interface.d.ts +1 -1
- package/lib/src/ap-form/list/index.vue.js +1 -1
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/package.json +4 -4
|
@@ -15,7 +15,7 @@ type Recordable = Record<string, any>;
|
|
|
15
15
|
/** 基本描述类型 */
|
|
16
16
|
export interface ItemSchema<T extends Recordable = Recordable> {
|
|
17
17
|
label: VNodeChild | VNode;
|
|
18
|
-
field: keyof T;
|
|
18
|
+
field: keyof T | (string & {}) | string[];
|
|
19
19
|
span?: number;
|
|
20
20
|
prefix?: VNodeChild | VNode;
|
|
21
21
|
suffix?: VNodeChild | VNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as V, onMounted as k, computed as f, unref as s, renderSlot as v } from "vue";
|
|
2
2
|
import { useInjectForm as h } from "../context.mjs";
|
|
3
3
|
import { isArray as j } from "lodash-unified";
|
|
4
|
-
const g = /* @__PURE__ */
|
|
4
|
+
const g = /* @__PURE__ */ V({
|
|
5
5
|
name: "ApFormList",
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
@@ -11,36 +11,36 @@ const g = /* @__PURE__ */ v({
|
|
|
11
11
|
},
|
|
12
12
|
setup(p) {
|
|
13
13
|
let o = 1;
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const a = [], t = p, { model: i, updateModel: r, internalInstance: c } = h();
|
|
15
|
+
k(() => {
|
|
16
16
|
c == null || c.registerField({
|
|
17
17
|
name: t.name,
|
|
18
18
|
initialValue: t.initialValue,
|
|
19
19
|
transform: t.transform
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const u = f(() => t.name ? j(t.name) ? t.name.reduce((e, n) => e == null ? void 0 : e[n], s(i)) : i == null ? void 0 : i.value[t.name] : null);
|
|
23
23
|
function y(e = void 0) {
|
|
24
|
-
const n =
|
|
25
|
-
|
|
24
|
+
const n = s(u) ? [...s(u), e] : [e];
|
|
25
|
+
a.push(o), o += 1, r == null || r(t.name, n);
|
|
26
26
|
}
|
|
27
27
|
function d(e) {
|
|
28
|
-
let n =
|
|
29
|
-
n = [...n.slice(0, e), ...n.slice(e + 1)],
|
|
28
|
+
let n = s(u) || [];
|
|
29
|
+
n = [...n.slice(0, e), ...n.slice(e + 1)], a.splice(e, 1), r == null || r(t.name, n);
|
|
30
30
|
}
|
|
31
31
|
const _ = {
|
|
32
32
|
add: y,
|
|
33
33
|
remove: d
|
|
34
|
-
}, F = f(() => (
|
|
35
|
-
let l =
|
|
36
|
-
return typeof l > "u" && (
|
|
34
|
+
}, F = f(() => (s(u) || []).map((n, m) => {
|
|
35
|
+
let l = a[m];
|
|
36
|
+
return typeof l > "u" && (a[m] = o, l = o, o += 1), {
|
|
37
37
|
key: l,
|
|
38
|
-
fieldName:
|
|
39
|
-
name: [t.name,
|
|
38
|
+
fieldName: m,
|
|
39
|
+
name: [t.name, m].flat(),
|
|
40
40
|
value: n
|
|
41
41
|
};
|
|
42
42
|
}));
|
|
43
|
-
return (e, n) =>
|
|
43
|
+
return (e, n) => v(e.$slots, "default", {
|
|
44
44
|
fields: F.value,
|
|
45
45
|
actions: _
|
|
46
46
|
});
|
|
@@ -127,7 +127,7 @@ const i = 24, qe = /* @__PURE__ */ le({
|
|
|
127
127
|
let v = [];
|
|
128
128
|
const S = V(D(s.default())), p = V((N = s.extra) == null ? void 0 : N.call(s)), w = g(() => Math.floor(i / a.countPerRow));
|
|
129
129
|
j(() => s.default(), (e) => {
|
|
130
|
-
v = S.value, S.value = D(e);
|
|
130
|
+
v = S.value, S.value = Ce(v, D(e));
|
|
131
131
|
}), j(() => {
|
|
132
132
|
var e;
|
|
133
133
|
return (e = s.extra) == null ? void 0 : e.call(s);
|
|
@@ -135,7 +135,7 @@ const i = 24, qe = /* @__PURE__ */ le({
|
|
|
135
135
|
p.value = e;
|
|
136
136
|
});
|
|
137
137
|
const X = (e) => $(e) ? (he(e) ? e : [e]).join("") : Date.now(), F = g(() => {
|
|
138
|
-
const e =
|
|
138
|
+
const e = S.value, t = [], l = [], r = o(w);
|
|
139
139
|
let d = 0;
|
|
140
140
|
e.forEach((c) => {
|
|
141
141
|
const f = c.props;
|
|
@@ -15,7 +15,7 @@ type Recordable = Record<string, any>;
|
|
|
15
15
|
/** 基本描述类型 */
|
|
16
16
|
export interface ItemSchema<T extends Recordable = Recordable> {
|
|
17
17
|
label: VNodeChild | VNode;
|
|
18
|
-
field: keyof T;
|
|
18
|
+
field: keyof T | (string & {}) | string[];
|
|
19
19
|
span?: number;
|
|
20
20
|
prefix?: VNodeChild | VNode;
|
|
21
21
|
suffix?: VNodeChild | VNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),v=require("../context.js"),F=require("lodash-unified"),V=r.defineComponent({name:"ApFormList",__name:"index",props:{name:{},initialValue:{},transform:{type:[Function,Object]}},setup(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),v=require("../context.js"),F=require("lodash-unified"),V=r.defineComponent({name:"ApFormList",__name:"index",props:{name:{},initialValue:{},transform:{type:[Function,Object]}},setup(m){let s=1;const i=[],t=m,{model:o,updateModel:u,internalInstance:l}=v.useInjectForm();r.onMounted(()=>{l==null||l.registerField({name:t.name,initialValue:t.initialValue,transform:t.transform})});const a=r.computed(()=>t.name?F.isArray(t.name)?t.name.reduce((e,n)=>e==null?void 0:e[n],r.unref(o)):o==null?void 0:o.value[t.name]:null);function d(e=void 0){const n=r.unref(a)?[...r.unref(a),e]:[e];i.push(s),s+=1,u==null||u(t.name,n)}function p(e){let n=r.unref(a)||[];n=[...n.slice(0,e),...n.slice(e+1)],i.splice(e,1),u==null||u(t.name,n)}const y={add:d,remove:p},_=r.computed(()=>(r.unref(a)||[]).map((n,c)=>{let f=i[c];return typeof f>"u"&&(i[c]=s,f=s,s+=1),{key:f,fieldName:c,name:[t.name,c].flat(),value:n}}));return(e,n)=>r.renderSlot(e.$slots,"default",{fields:_.value,actions:y})}});exports.default=V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("@aplus-frontend/antdv");require("../ap-form.vue.js");require("../item/index.vue2.js");require("../../hooks/index.js");const b=require("../item-group/helper.js"),J=require("@ant-design/icons-vue");require("../../config-provider/index.js");const y=require("lodash-unified"),w=require("../../utils/index.js"),K=require("./utils.js"),Q=require("../../hooks/useControllableValue.js"),X=require("../../config-provider/hooks/use-namespace.js"),Y=require("../../config-provider/hooks/use-global-config.js"),Z=require("../../config-provider/hooks/use-locale.js"),A=require("../item/index.vue.js"),ee=require("../ap-form.vue2.js");function te(m){return typeof m=="function"||Object.prototype.toString.call(m)==="[object Object]"&&!e.isVNode(m)}const s=24,ne=e.defineComponent({name:"ApFormSearchForm",__name:"index",props:{layout:{default:"horizontal"},labelCol:{},wrapperCol:{},colon:{type:Boolean,default:!0},labelAlign:{default:"right"},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean,default:!1},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean,default:!0},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{default:"change"},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},initialValues:{},collapse:{type:Boolean,default:void 0},defaultCollapse:{type:Boolean,default:!1},"onUpdate:collapse":{},searchText:{},resetText:{},onReset:{},customReset:{type:Boolean,default:!1},extraInAction:{type:Boolean,default:!1},forceExpand:{type:Boolean,default:!1},countPerRow:{default:4},submitLoading:{type:Boolean}},emits:["update:collapse"],setup(m,{expose:q,emit:E}){var v;const u=e.useSlots(),a=m,I=E,{value:c,updateValue:P}=Q.useControllableValue(a,I,{valuePropName:"collapse",defaultValuePropName:"defaultCollapse"}),{b:T}=X.useNamespace("ap-form-search-form"),O=Y.useGlobalConfig("uiMode"),{t:g}=Z.useLocale(),x=e.ref();function D(){P(!e.unref(c))}function M(){var t,n;(n=(t=x.value)==null?void 0:t.validateFields())==null||n.then(a.onSubmit)}function j(){var t,n,o;a.customReset||(n=(t=x.value)==null?void 0:t.resetFields)==null||n.call(t),(o=a.onReset)==null||o.call(a)}let N=[];const C=e.shallowRef(b.genRealChildren(u.default())),i=e.shallowRef((v=u.extra)==null?void 0:v.call(u)),B=e.computed(()=>Math.floor(s/a.countPerRow));e.watch(()=>u.default(),t=>{N=C.value,C.value=b.genRealChildren(t)}),e.watch(()=>{var t;return(t=u.extra)==null?void 0:t.call(u)},t=>{i.value=t});const L=t=>w.isDef(t)?(y.isArray(t)?t:[t]).join(""):Date.now(),_=e.computed(()=>{const t=
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("@aplus-frontend/antdv");require("../ap-form.vue.js");require("../item/index.vue2.js");require("../../hooks/index.js");const b=require("../item-group/helper.js"),J=require("@ant-design/icons-vue");require("../../config-provider/index.js");const y=require("lodash-unified"),w=require("../../utils/index.js"),K=require("./utils.js"),Q=require("../../hooks/useControllableValue.js"),X=require("../../config-provider/hooks/use-namespace.js"),Y=require("../../config-provider/hooks/use-global-config.js"),Z=require("../../config-provider/hooks/use-locale.js"),A=require("../item/index.vue.js"),ee=require("../ap-form.vue2.js");function te(m){return typeof m=="function"||Object.prototype.toString.call(m)==="[object Object]"&&!e.isVNode(m)}const s=24,ne=e.defineComponent({name:"ApFormSearchForm",__name:"index",props:{layout:{default:"horizontal"},labelCol:{},wrapperCol:{},colon:{type:Boolean,default:!0},labelAlign:{default:"right"},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean,default:!1},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean,default:!0},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{default:"change"},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},initialValues:{},collapse:{type:Boolean,default:void 0},defaultCollapse:{type:Boolean,default:!1},"onUpdate:collapse":{},searchText:{},resetText:{},onReset:{},customReset:{type:Boolean,default:!1},extraInAction:{type:Boolean,default:!1},forceExpand:{type:Boolean,default:!1},countPerRow:{default:4},submitLoading:{type:Boolean}},emits:["update:collapse"],setup(m,{expose:q,emit:E}){var v;const u=e.useSlots(),a=m,I=E,{value:c,updateValue:P}=Q.useControllableValue(a,I,{valuePropName:"collapse",defaultValuePropName:"defaultCollapse"}),{b:T}=X.useNamespace("ap-form-search-form"),O=Y.useGlobalConfig("uiMode"),{t:g}=Z.useLocale(),x=e.ref();function D(){P(!e.unref(c))}function M(){var t,n;(n=(t=x.value)==null?void 0:t.validateFields())==null||n.then(a.onSubmit)}function j(){var t,n,o;a.customReset||(n=(t=x.value)==null?void 0:t.resetFields)==null||n.call(t),(o=a.onReset)==null||o.call(a)}let N=[];const C=e.shallowRef(b.genRealChildren(u.default())),i=e.shallowRef((v=u.extra)==null?void 0:v.call(u)),B=e.computed(()=>Math.floor(s/a.countPerRow));e.watch(()=>u.default(),t=>{N=C.value,C.value=K.diffFormItem(N,b.genRealChildren(t))}),e.watch(()=>{var t;return(t=u.extra)==null?void 0:t.call(u)},t=>{i.value=t});const L=t=>w.isDef(t)?(y.isArray(t)?t:[t]).join(""):Date.now(),_=e.computed(()=>{const t=C.value,n=[],o=[],l=e.unref(B);let p=0;t.forEach(d=>{const f=d.props;(y.isBoolean(f.hidden)?!!f.hidden:w.isDef(f.hidden))?n.push(d):(p+=f.span||l,o.push(d))});const F=s-(p+l)%s,U=p%s<l,$=F<l?s:F,R=s-l*(e.unref(i)&&!a.extraInAction?2:1),z=!a.forceExpand&&p>R;let S=0,V=0;const G=o.map((d,f)=>{const h=d.props,k=h.span||l;if(S+=k,!a.forceExpand&&e.unref(c)&&S>R){n.push(e.cloneVNode(d,{class:"ant-form-item-hidden",hidden:!0}));return}return V+=k,{node:d,span:h.span||l,key:`ApFormSearchFormItem-${f}-${L(h.name)}-${h._signal}`}}).filter(Boolean),H=s-V-l;return{hideNode:e.createVNode(e.Fragment,null,[n]),nodes:G,defaultExtraSpan:$,actualExtraSpan:H,showCollapse:z,lastRowOnlyIncludeActionAndExtra:U}}),W=e.computed(()=>{let t;const n=e.unref(_),o=e.createVNode(r.Col,{span:e.unref(B),key:"actionWrapper"},{default:()=>[e.createVNode(A.default,null,{default:()=>[e.createVNode(r.Flex,{justify:!e.unref(c)&&n.lastRowOnlyIncludeActionAndExtra&&!(e.unref(i)&&a.extraInAction)?"flex-end":"space-between"},{default:()=>[e.createVNode(r.Space,null,{default:()=>[e.createVNode(r.Button,{type:"primary",onClick:M,loading:a.submitLoading,htmlType:"submit"},{default:()=>[a.searchText||g("ap.apForm.search.search")]}),e.createVNode(r.Button,{onClick:j},{default:()=>[a.resetText||g("ap.apForm.search.reset")]}),n.showCollapse?e.createVNode(r.Button,{onClick:D,icon:e.createVNode(J.DoubleRightOutlined,{style:O.value==="aplus"?"color:#B8C3D1":"color:#BFBFBF",rotate:e.unref(c)?90:-90},null)},null):null]}),a.extraInAction?e.unref(i):null]})]})]}),l=!a.extraInAction&&e.unref(i)?e.createVNode(r.Col,{span:e.unref(c)?n.actualExtraSpan:n.defaultExtraSpan,key:"extraNode"},{default:()=>[e.createVNode(A.default,null,{default:()=>[e.createVNode(r.Flex,{justify:!e.unref(c)&&(n.defaultExtraSpan===s||n.lastRowOnlyIncludeActionAndExtra)?"start":"flex-end"},te(t=e.unref(i))?t:{default:()=>[t]})]})]}):null,p=e.createVNode(r.Col,{span:n.defaultExtraSpan},null);return!e.unref(c)&&n.lastRowOnlyIncludeActionAndExtra?e.createVNode(e.Fragment,null,[l||p,o]):e.createVNode(e.Fragment,null,[o,l])});return q({apForm:e.computed(()=>e.unref(x))}),(t,n)=>(e.openBlock(),e.createBlock(ee.default,e.mergeProps({class:e.unref(T)(),ref_key:"apForm",ref:x},e.unref(y.omit)(a,["collapse","defaultCollapse","onUpdate:collapse","searchText","resetText","onSubmit","onReset","extraInAction","forceExpand","countPerRow"])),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(_.value.hideNode))),e.createVNode(e.unref(r.Row),{gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value.nodes,o=>(e.openBlock(),e.createBlock(e.unref(r.Col),{key:o.key,span:o.span},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.node)))]),_:2},1032,["span"]))),128)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(W.value)))]),_:1})]),_:1},16,["class"]))}});exports.default=ne;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"sortablejs": "^1.15.2",
|
|
64
64
|
"vuedraggable": "^4.1.0",
|
|
65
65
|
"rxjs": "^7.8.1",
|
|
66
|
-
"@aplus-frontend/
|
|
67
|
-
"@aplus-frontend/
|
|
66
|
+
"@aplus-frontend/utils": "1.0.42",
|
|
67
|
+
"@aplus-frontend/hooks": "1.0.7"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"vue": "3.4.38",
|
|
71
71
|
"@aplus-frontend/icon": "^1.0.21",
|
|
72
72
|
"@aplus-frontend/oss": "^1.1.2",
|
|
73
73
|
"@aplus-frontend/antdv": "^1.0.3",
|
|
74
|
-
"@aplus-frontend/ui-theme": "1.0.
|
|
74
|
+
"@aplus-frontend/ui-theme": "1.0.11"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"vue": "3.4.38",
|