@aplus-frontend/ui 0.1.27 → 0.1.29
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-download/ap-download.vue.d.ts +6 -2
- package/es/src/ap-download/ap-download.vue.mjs +48 -28
- package/es/src/ap-download/interface.d.ts +3 -2
- package/es/src/ap-download/style/ap-download.css +3 -0
- package/es/src/ap-field/date-range/index.vue.mjs +154 -109
- package/es/src/ap-field/interface.d.ts +4 -0
- package/es/src/ap-field/select/index.vue.mjs +67 -63
- package/es/src/ap-form/style/ap-form-item.css +2 -0
- package/es/src/ap-table/components/setting/modal/index.vue2.mjs +72 -97
- package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +37 -33
- package/es/src/ap-table/components/setting/sorter/index.vue2.mjs +91 -87
- package/es/src/ap-table/components/setting/utils.d.ts +7 -1
- package/es/src/ap-table/components/setting/utils.mjs +37 -22
- package/es/src/ap-table/constants.d.ts +12 -0
- package/es/src/ap-table/hooks/use-table-column-state.d.ts +6 -2
- package/es/src/ap-table/hooks/use-table-column-state.mjs +101 -33
- package/es/src/ap-table/interface.d.ts +8 -1
- package/es/src/business/ap-attachment/ApAttachment.mjs +79 -59
- package/es/src/business/ap-attachment/interface.d.ts +1 -1
- package/es/src/business/ap-attachment/style.css +4 -0
- package/es/src/business/ap-input-radio/interface.d.ts +1 -1
- package/es/src/business/index.d.ts +0 -2
- package/es/src/editable-table/form-item.vue.d.ts +1 -0
- package/es/src/editable-table/form-item.vue.mjs +63 -59
- package/es/src/editable-table/index.vue.d.ts +1 -0
- package/es/src/editable-table/index.vue.mjs +77 -72
- package/es/src/editable-table/interface.d.ts +6 -0
- package/es/src/theme/ap-attachment/ap-attachment.css +4 -0
- package/es/src/theme/ap-download/ap-download.css +3 -0
- package/es/src/theme/ap-form/ap-form-item.css +2 -0
- package/lib/src/ap-download/ap-download.vue.d.ts +6 -2
- package/lib/src/ap-download/ap-download.vue.js +1 -1
- package/lib/src/ap-download/interface.d.ts +3 -2
- package/lib/src/ap-download/style/ap-download.css +3 -0
- package/lib/src/ap-field/date-range/index.vue.js +1 -1
- package/lib/src/ap-field/interface.d.ts +4 -0
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-form/style/ap-form-item.css +2 -0
- package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/sorter/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/utils.d.ts +7 -1
- package/lib/src/ap-table/components/setting/utils.js +1 -1
- package/lib/src/ap-table/constants.d.ts +12 -0
- package/lib/src/ap-table/hooks/use-table-column-state.d.ts +6 -2
- package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
- package/lib/src/ap-table/interface.d.ts +8 -1
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-attachment/interface.d.ts +1 -1
- package/lib/src/business/ap-attachment/style.css +4 -0
- package/lib/src/business/ap-input-radio/interface.d.ts +1 -1
- package/lib/src/business/index.d.ts +0 -2
- package/lib/src/editable-table/form-item.vue.d.ts +1 -0
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.d.ts +1 -0
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +6 -0
- package/lib/src/theme/ap-attachment/ap-attachment.css +4 -0
- package/lib/src/theme/ap-download/ap-download.css +3 -0
- package/lib/src/theme/ap-form/ap-form-item.css +2 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),j=require("../../utils/index.js"),f=require("../components/setting/utils.js"),K=require("../context.js"),i=require("lodash-unified");function d(r,o){r.forEach(t=>{var c;o(t),(c=t.children)!=null&&c.length&&d(t.children,o)})}function M(r,o){if(!o)return{};const t=r.getItem(o);return t?JSON.parse(t):{}}function k(r,o){if(i.isObject(r)&&i.isObject(o))return i.mergeWith({},r,o,k)}const T=Number.MAX_SAFE_INTEGER,J=(r,o)=>{const t=u.ref(o);let c=f.customCloneColumnStates(o);const{columnsBackup:C,updateColumns:S}=K.useInjectApTable(),O=r.persistenceType||"localStorage",m=window[O];function q(){const e=M(m,r.persistenceKey),n=i.mergeWith({},r.defaultValue||{},e,k),l=u.unref(C);function x(F,h,A){return F.map(s=>{var N;const a=(h==null?void 0:h[s.key])||{},g={key:s.key,label:s.title,show:!0,fixed:A?A.fixed:i.isBoolean(s.fixed)?s.fixed?"left":void 0:s.fixed,disabled:!1,...i.omit(a,"children")};return g.children=(N=s.children)!=null&&N.length?x(s.children,a.children,g):void 0,g}).sort((s,a)=>(i.isNumber(s.order)?s.order:T)-(i.isNumber(a.order)?a.order:T))}return x(l||[],n)}const b=u.computed(()=>u.unref(t).every(e=>e.show));function p(){const e=u.unref(t);d(e,n=>{!n.disabled&&(n.show=!0)})}function y(){const e=u.unref(t);d(e,n=>{!n.disabled&&(n.show=!1)})}function E(){u.unref(b)?y():p()}function I(e,n){d(u.unref(t),l=>{l.key===e&&(l.show=j.isDef(n)?n:!l.show)})}function w(e){t.value=e}function B(e){c=e}function v(e){if(r.persistenceKey){const n=f.getColumnStateString(e);m.setItem(r.persistenceKey,JSON.stringify(n))}}return u.watchEffect(()=>{const e=q();w(e),S==null||S(f.default(u.unref(C),u.unref(e))),c=f.customCloneColumnStates(e),v(e)}),{columnState:t,selectAll:p,unSelectAll:y,toggleSelect:I,setColumnState:w,isAllSelected:b,toggleSelectAll:E,columnStateBackup:c,setColumnStateBackup:B,cacheColumnStateIfNeeded:v}};exports.useTableColumnState=J;
|
|
@@ -84,7 +84,7 @@ export type ApTableSettingType = {
|
|
|
84
84
|
/**
|
|
85
85
|
* 列的默认状态
|
|
86
86
|
*/
|
|
87
|
-
defaultValue?:
|
|
87
|
+
defaultValue?: ApTableSettingDefaultValueType;
|
|
88
88
|
/**
|
|
89
89
|
* 列状态变更时的回调(注意,返回的是全量状态)
|
|
90
90
|
* @param val
|
|
@@ -92,6 +92,9 @@ export type ApTableSettingType = {
|
|
|
92
92
|
*/
|
|
93
93
|
onChange?: (val: ApColumnState[]) => void;
|
|
94
94
|
};
|
|
95
|
+
export type ApTableSettingDefaultValueType = Recordable<Omit<ApColumnState, 'label' | 'key' | 'children'> & {
|
|
96
|
+
children?: ApTableSettingDefaultValueType;
|
|
97
|
+
}>;
|
|
95
98
|
export type ApColumnState = {
|
|
96
99
|
/**
|
|
97
100
|
* 列的唯一标识
|
|
@@ -117,6 +120,10 @@ export type ApColumnState = {
|
|
|
117
120
|
* 子节点状态
|
|
118
121
|
*/
|
|
119
122
|
children?: ApColumnState[];
|
|
123
|
+
/**
|
|
124
|
+
* 字段排序(和其同级的表头排序)
|
|
125
|
+
*/
|
|
126
|
+
order?: number;
|
|
120
127
|
};
|
|
121
128
|
export type FieldPropsType<ReturnType, RecordType, ExtraValueType, ValueType extends ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType> = ReturnType | ((opt: Partial<{
|
|
122
129
|
value: any;
|
|
@@ -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"),h=require("ant-design-vue");require("../../config-provider/index.js");const x=require("./constans.js"),N=require("../../ap-download/utils/getFileInfo.js");require("./style.css");const P=require("../../ap-download/hooks/index.js"),S=require("lodash-unified"),m=require("@ant-design/icons-vue"),I=require("../../config-provider/hooks/use-namespace.js"),p=require("../../config-provider/hooks/use-global-config.js"),M=require("../../config-provider/hooks/use-locale.js"),_=e.defineComponent({name:"ApAttachment",props:x.ApAttachmentProps(),setup(t){const{b:V,e:l}=I.useNamespace("ap-attachment"),A=p.useGlobalConfig("uiMode"),L=p.useGlobalConfig("apUpload"),{lang:w,t:i}=M.useLocale(),n=e.ref(!1),c=e.ref(""),r=e.useSlots(),y=e.computed(()=>w.value==="zh-cn"?"zh_CN":"en_US"),u=e.computed(()=>t.attachmentList.length===1),v=e.computed(()=>t.attachmentList.length>0?t.attachmentList[0].fileName:""),C=e.computed(()=>u.value?v.value:i("ap.apAttachment.downloadall")),f=e.computed(()=>t.color?t.color:A.value==="aplus"?"#0070FF":"#1890FF"),q=e.computed(()=>({width:u.value?"auto":"266px"})),g=e.computed(()=>({"--download-main-color":f.value,"--download-main-color-opacity":N.getHexWithOpacity(f.value,.6)})),F=e.computed(()=>{var a;return t.getOssAccess||((a=L.value)==null?void 0:a.getOssAccess)}),O=e.computed(()=>{const a=r.default?r.default()[0]:null;return a?e.cloneVNode(a,{style:{"font-size":"16px"}}):null}),d=async(a,s)=>{if(!t.disabled){n.value=!0,s&&(c.value=s);try{const o=await P.useOssInit(F.value,e.unref(y)),T=S.isArray(e.toRaw(a))?e.toRaw(a):[e.toRaw(a)];await o.downloadFile(N.getFileInfo(t.needName,T))}catch(o){console.error(o)}finally{n.value=!1,c.value=""}}},b=a=>a&&a.length>0?e.createVNode("ul",{class:[l("file-list")],style:g.value},[a.map((s,o)=>e.createVNode("li",{key:o,class:[l("file-item")],onClick:()=>d(s,o+1)},[n.value&&c.value===o+1?e.createVNode("span",{class:[l("spin")]},[e.createVNode(m.LoadingOutlined,{spin:!0},null)]):null,s.fileName])),e.createVNode("li",{class:[l("down-load-all")],onClick:()=>d(t.attachmentList,"all")},[n.value&&c.value==="all"?e.createVNode("span",{class:[l("spin")]},[e.createVNode(m.LoadingOutlined,{spin:!0},null)]):null,i("ap.apAttachment.downloadall")])]):null;return()=>{var a;return((a=t.attachmentList)==null?void 0:a.length)>0&&e.createVNode("div",{class:[V()],style:[q.value,g.value]},[e.createVNode(h.Tooltip,{title:C.value,placement:t.textToolTipPlacement,color:t.toolTipBgColor},{default:()=>[e.createVNode("div",{class:[l("content")],onClick:()=>d(u.value?t.attachmentList[0]:t.attachmentList,"global")},[n.value&&c.value==="global"?e.createVNode("div",{class:[l("spin")]},[e.createVNode(m.LoadingOutlined,{spin:!0},null)]):null,r.default?e.createVNode("div",{class:[l("text-render")]},[O.value,e.createTextVNode(" ")]):null,e.createVNode("div",{class:[l("text-inner")]},[v.value])])]}),e.createVNode(h.Popover,{content:b(t.attachmentList),placement:t.fileMorePopoverPlacement,color:"#fff"},{default:()=>[!u.value&&e.createVNode("div",{class:[l("more")]},[i("ap.apAttachment.more")])]})])}}});exports.default=_;
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
.aplus-ap-attachment__text-render:hover {
|
|
14
14
|
color: var(--download-main-color-opacity);
|
|
15
15
|
}
|
|
16
|
+
.aplus-ap-attachment__spin {
|
|
17
|
+
float: left;
|
|
18
|
+
margin-right: 5px;
|
|
19
|
+
}
|
|
16
20
|
.aplus-ap-attachment__text-inner {
|
|
17
21
|
max-width: 190px;
|
|
18
22
|
display: inline-block;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputNumberProps } from 'ant-design-vue/es/input-number';
|
|
2
2
|
type ApInputProps = Pick<InputNumberProps, 'disabled' | 'stringMode' | 'precision' | 'max' | 'min' | 'step' | 'bordered' | 'autofocus' | 'decimalSeparator' | 'controls' | 'formatter' | 'onInput' | 'onChange' | 'onPressEnter' | 'onStep' | 'onBlur' | 'onFocus'>;
|
|
3
3
|
export type ApInputValType = {
|
|
4
|
-
value
|
|
4
|
+
value?: {
|
|
5
5
|
inputVal: string | number;
|
|
6
6
|
radioVal: string | number;
|
|
7
7
|
};
|
|
@@ -1110,7 +1110,6 @@ export declare const ApInputRadio: DefineComponent<{
|
|
|
1110
1110
|
inputVal: string | number;
|
|
1111
1111
|
radioVal: string | number;
|
|
1112
1112
|
}>;
|
|
1113
|
-
required: true;
|
|
1114
1113
|
};
|
|
1115
1114
|
disabled: {
|
|
1116
1115
|
type: PropType<boolean>;
|
|
@@ -1194,7 +1193,6 @@ export declare const ApInputRadio: DefineComponent<{
|
|
|
1194
1193
|
inputVal: string | number;
|
|
1195
1194
|
radioVal: string | number;
|
|
1196
1195
|
}>;
|
|
1197
|
-
required: true;
|
|
1198
1196
|
};
|
|
1199
1197
|
disabled: {
|
|
1200
1198
|
type: PropType<boolean>;
|
|
@@ -12,6 +12,7 @@ declare const _default: <RecordType = any>(__VLS_props: NonNullable<Awaited<type
|
|
|
12
12
|
setRowData: (index: number, payload: any) => void;
|
|
13
13
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
14
14
|
scrollTo: (index: number | "end", options?: StandardBehaviorOptions) => void;
|
|
15
|
+
setTableData: (nextTableData: RecordType[]) => void;
|
|
15
16
|
}>): void;
|
|
16
17
|
attrs: any;
|
|
17
18
|
slots: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("ant-design-vue"),g=require("../ap-form/index.js"),i=require("lodash-unified");require("../config-provider/index.js");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("ant-design-vue"),g=require("../ap-form/index.js"),i=require("lodash-unified");require("../config-provider/index.js");const P=require("../ap-form/context.js");require("./style/index.css");const d=require("../utils/index.js"),j=require("./hooks/use-get-columns.js"),h=require("./utils.js"),z=require("@ant-design/icons-vue"),A=require("ant-design-vue/es/theme/internal"),O=require("../config-provider/hooks/use-namespace.js"),M=require("../config-provider/hooks/use-global-config.js"),G=e.defineComponent({name:"EditableTableInner",__name:"form-item",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{default:()=>({})}},setup(x,{expose:C}){const a=x;function b(t,o){return i.isArray(o)?o.reduce((n,r)=>n==null?void 0:n[r],t):t==null?void 0:t[o]}const{internalInstance:l,model:y}=P.useInjectForm(),u=e.ref(b(e.unref(y),a.name)||[]),w=e.useSlots(),R=g.ApForm.useWatch(a.name);e.watch(()=>R.value,t=>{var o;u.value=t,(o=a.onChange)==null||o.call(a,t)},{deep:!0});const{b:B,em:D}=O.useNamespace("editable-table"),c=e.ref(),q=M.useGlobalConfig("valueTypeMap"),[,k]=A.useToken(),N=j.default(a,q);function T(t,o){var s;const n=((s=e.unref(u))==null?void 0:s.length)||0;if(d.isDef(a.maxLength)&&n>=a.maxLength)return;const r=[...e.unref(u)||[]];d.isDef(o)?r.splice(o,0,{...t||{}}):r.push({...t||{}}),l==null||l.setFieldValue(a.name,r)}function V(t,o="suffix"){var m;const n=((m=e.unref(u))==null?void 0:m.length)||0,r=i.isNumber(t)?t:t.length;if(d.isDef(a.maxLength)&&n+r>a.maxLength)return;const s=[...e.unref(u)||[]],f=i.isNumber(t)?new Array(t).fill({}):i.cloneDeep(t);o==="suffix"?s.push(...f):s.unshift(...f),l==null||l.setFieldValue(a.name,s)}function F(t){let o=i.cloneDeep(e.unref(u)||[]);const n=i.isNumber(t)?[t]:t;o=o.filter((r,s)=>!n.includes(s)),l==null||l.setFieldValue(a.name,o)}function S(){return e.unref(u)}function v(t){var o;return(o=e.unref(u))==null?void 0:o[t]}function L(t,o){const n=i.cloneDeep(e.unref(u));n[t]&&(n[t]={...n[t],...o},l==null||l.setFieldValue(a.name,[...n]))}function _(t){l==null||l.setFieldValue(a.name,t)}function E(t,o){var r;const n=t==="end"?u.value.length-1:t;h.scrollToRowIndex(n,(r=c.value)==null?void 0:r.$el,o)}return C({add:T,remove:F,getRowData:v,getRowsData:S,setRowData:L,addMultiple:V,scrollTo:E,setTableData:_}),(t,o)=>(e.openBlock(),e.createBlock(e.unref(g.ApForm).FormItem,e.mergeProps(t.formItem,{name:t.name,label:t.label}),{default:e.withCtx(()=>[e.createVNode(e.unref(p.Table),e.mergeProps(e.unref(i.omit)(a,["name","maxLength","onChange"]),{class:e.unref(B)(),columns:e.unref(N),"data-source":u.value,ref_key:"tableRef",ref:c}),e.createSlots({headerCell:e.withCtx(({column:n})=>[e.unref(h.getColumnIsRequired)(n)?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(D)("header-cell","required"))},"*",2)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(n.title),1),n.tooltip?(e.openBlock(),e.createBlock(e.unref(p.Tooltip),{key:1,title:n.tooltip,placement:"bottom"},{default:e.withCtx(()=>[e.createVNode(e.unref(z.QuestionCircleOutlined),{style:e.normalizeStyle({paddingLeft:"4px",color:e.unref(k).colorPrimary})},null,8,["style"])]),_:2},1032,["title"])):e.createCommentVNode("",!0)]),_:2},[e.renderList(w,(n,r)=>({name:r,fn:e.withCtx(s=>[e.renderSlot(t.$slots,r,e.normalizeProps(e.guardReactiveProps(s||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["name","label"]))}});exports.default=G;
|
|
@@ -20,6 +20,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: NonNu
|
|
|
20
20
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
21
21
|
scrollTo: (index: number | "end", options?: StandardBehaviorOptions) => void;
|
|
22
22
|
clear: () => void;
|
|
23
|
+
setTableData: (nextTableData: RecordType[]) => void;
|
|
23
24
|
}>): void;
|
|
24
25
|
attrs: any;
|
|
25
26
|
slots: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("ant-design-vue"),p=require("../ap-form/index.js"),i=require("lodash-unified");require("../config-provider/index.js");require("../hooks/index.js");const x=require("../utils/index.js"),y=require("./utils.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("ant-design-vue"),p=require("../ap-form/index.js"),i=require("lodash-unified");require("../config-provider/index.js");require("../hooks/index.js");const x=require("../utils/index.js"),y=require("./utils.js"),G=require("./hooks/use-get-columns.js");require("./style/index.css");const K=require("ant-design-vue/es/theme/internal"),U=require("@ant-design/icons-vue"),$=require("../config-provider/hooks/use-namespace.js"),H=require("../hooks/useControllableValue.js"),W=require("../config-provider/hooks/use-global-config.js"),Q=e.defineComponent({name:"EditableTable",__name:"index",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{}},emits:["update:value"],setup(v,{expose:w,emit:b}){const l=v,{b:R,em:q}=$.useNamespace("editable-table"),B=e.useSlots(),F=b,h=e.ref(),{value:u,updateValue:V}=H.useControllableValue(l,F),s=e.ref(),[,N]=K.useToken(),k=W.useGlobalConfig("valueTypeMap"),m=p.ApForm.useWatch(l.name,s);e.watch(()=>m.value,t=>{var n;V(t),(n=l.onChange)==null||n.call(l,t)},{deep:!0}),e.watch(u,t=>{var n;t!==e.unref(m)&&(i.isEqual(t,e.unref(m))||(n=s.value)==null||n.setFieldValue(l.name,t))},{deep:!0});const D=G.default(l,k);function T(){var t;(t=s.value)==null||t.resetFields()}function _(t){return t?(i.isArray(t)?t:[t]).map(a=>i.isArray(a)?[l.name,...a]:[l.name,a]):void 0}async function S(t,n){var o;const a=await((o=s.value)==null?void 0:o.validateFields(_(t),n));return a==null?void 0:a[l.name]}function A(t,n){var r,d,c;const a=((r=e.unref(u))==null?void 0:r.length)||0;if(x.isDef(l.maxLength)&&a>=l.maxLength)return;const o=[...e.unref(u)||[]];x.isDef(n)?o.splice(n,0,{...t||{}}):o.push({...t||{}}),(c=(d=s.value)==null?void 0:d.setFieldValue)==null||c.call(d,l.name,o)}function E(t,n="suffix"){var c,f,C;const a=((c=e.unref(u))==null?void 0:c.length)||0,o=i.isNumber(t)?t:t.length;if(x.isDef(l.maxLength)&&a+o>l.maxLength)return;const r=[...e.unref(u)||[]],d=i.isNumber(t)?new Array(t).fill({}):i.cloneDeep(t);n==="suffix"?r.push(...d):r.unshift(...d),(C=(f=s.value)==null?void 0:f.setFieldValue)==null||C.call(f,l.name,r)}function L(t){var o,r;let n=i.cloneDeep(e.unref(u)||[]);const a=i.isNumber(t)?[t]:t;n=n.filter((d,c)=>!a.includes(c)),(r=(o=s.value)==null?void 0:o.setFieldValue)==null||r.call(o,l.name,n)}function P(){return e.unref(u)}function z(t){var n;(n=s.value)==null||n.setFieldValue(l.name,t)}function I(t){var n;return(n=e.unref(u))==null?void 0:n[t]}function O(t,n){var o,r;const a=i.cloneDeep(e.unref(u));a[t]&&(a[t]={...a[t],...n},(r=(o=s.value)==null?void 0:o.setFieldValue)==null||r.call(o,l.name,[...a]))}function j(t,n){var o;const a=t==="end"?u.value.length-1:t;y.scrollToRowIndex(a,(o=h.value)==null?void 0:o.$el,n)}function M(){var t,n;(n=(t=s.value)==null?void 0:t.setFieldValue)==null||n.call(t,l.name,[])}return w({resetFields:T,validateFields:S,add:A,remove:L,getRowData:I,getRowsData:P,setRowData:O,addMultiple:E,scrollTo:j,clear:M,setTableData:z}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(p.ApForm),{"initial-values":{[l.name]:e.unref(u)},ref_key:"formRef",ref:s},{default:e.withCtx(()=>[e.createVNode(e.unref(p.ApForm).FormItem,{name:t.name,"no-style":""},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Table),e.mergeProps(e.unref(i.omit)(l,["name","value","onUpdate:value","maxLength","onChange"]),{class:e.unref(R)(),columns:e.unref(D),"data-source":e.unref(u),ref_key:"tableRef",ref:h}),e.createSlots({headerCell:e.withCtx(({column:a})=>[e.unref(y.getColumnIsRequired)(a)?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(q)("header-cell","required"))},"*",2)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(a.title),1),a.tooltip?(e.openBlock(),e.createBlock(e.unref(g.Tooltip),{key:1,title:a.tooltip,placement:"bottom"},{default:e.withCtx(()=>[e.createVNode(e.unref(U.QuestionCircleOutlined),{style:e.normalizeStyle({paddingLeft:"4px",color:e.unref(N).colorPrimary})},null,8,["style"])]),_:2},1032,["title"])):e.createCommentVNode("",!0)]),_:2},[e.renderList(B,(a,o)=>({name:o,fn:e.withCtx(r=>[e.renderSlot(t.$slots,o,e.normalizeProps(e.guardReactiveProps(r||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=Q;
|
|
@@ -163,6 +163,12 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
163
163
|
* @returns
|
|
164
164
|
*/
|
|
165
165
|
scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
|
|
166
|
+
/**
|
|
167
|
+
* 设置表格数据
|
|
168
|
+
* @param nextTableData
|
|
169
|
+
* @returns
|
|
170
|
+
*/
|
|
171
|
+
setTableData: (nextTableData: RecordType[]) => void;
|
|
166
172
|
};
|
|
167
173
|
/**
|
|
168
174
|
* 可编辑表格作为表单项暴露的实例
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
.aplus-ap-attachment__text-render:hover {
|
|
14
14
|
color: var(--download-main-color-opacity);
|
|
15
15
|
}
|
|
16
|
+
.aplus-ap-attachment__spin {
|
|
17
|
+
float: left;
|
|
18
|
+
margin-right: 5px;
|
|
19
|
+
}
|
|
16
20
|
.aplus-ap-attachment__text-inner {
|
|
17
21
|
max-width: 190px;
|
|
18
22
|
display: inline-block;
|