@aplus-frontend/ui 0.3.5 → 0.3.6

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,6 +1,6 @@
1
1
  import "../../config-provider/index.mjs";
2
2
  import { useElementSize as y } from "@vueuse/core";
3
- import { ref as f, computed as v, unref as h, onUpdated as q } from "vue";
3
+ import { ref as h, computed as v, unref as u, onUpdated as q } from "vue";
4
4
  import { useGlobalConfig as N } from "../../config-provider/hooks/use-global-config.mjs";
5
5
  function p(t) {
6
6
  if (!t)
@@ -15,13 +15,13 @@ function m(t) {
15
15
  return t.clientHeight + p(e.marginTop) + p(e.marginBottom);
16
16
  }
17
17
  const _ = (t) => {
18
- const e = f(), { height: d } = y(e), H = N("namespace"), a = f();
18
+ const e = h(), { height: d } = y(e), H = N("namespace"), a = h();
19
19
  let i = !1;
20
20
  const S = v(() => {
21
- var u, c, l, g, s;
22
- const n = ((c = (u = e.value) == null ? void 0 : u.querySelector(`.${H}-ap-table-header-wrapper`)) == null ? void 0 : c.clientHeight) || 0, r = ((g = (l = e.value) == null ? void 0 : l.querySelector(".ant-table-header")) == null ? void 0 : g.clientHeight) || 47, o = (s = e.value) == null ? void 0 : s.querySelector(".ant-pagination"), b = o ? m(o) : h(a);
21
+ var c, l, g, s, f;
22
+ const n = ((l = (c = e.value) == null ? void 0 : c.querySelector(`.${u(H)}-ap-table-header-wrapper`)) == null ? void 0 : l.clientHeight) || 0, r = ((s = (g = e.value) == null ? void 0 : g.querySelector(".ant-table-header")) == null ? void 0 : s.clientHeight) || 47, o = (f = e.value) == null ? void 0 : f.querySelector(".ant-pagination"), b = o ? m(o) : u(a);
23
23
  return o && (i = !0), Math.ceil(
24
- h(d) - r - n - (b || 0) - ((t == null ? void 0 : t.offset) || 0)
24
+ u(d) - r - n - (b || 0) - ((t == null ? void 0 : t.offset) || 0)
25
25
  );
26
26
  });
27
27
  return q(() => {
@@ -57,11 +57,11 @@ const Te = ({
57
57
  }
58
58
  }), a;
59
59
  }, X = async (e) => {
60
- var n, i, g, d, m, f, h;
60
+ var n, i, d, g, m, f, h;
61
61
  const a = ((i = (n = u.value) == null ? void 0 : n.apForm) == null ? void 0 : i.getFieldsValueTransformed(!0)) || {}, t = {};
62
62
  Object.entries(a).forEach(([v, x]) => {
63
63
  D && D.indexOf(v) > -1 && (t[v] = x);
64
- }), await ((d = (g = u.value) == null ? void 0 : g.apForm) == null ? void 0 : d.resetFields()), (h = (f = (m = u.value) == null ? void 0 : m.apForm) == null ? void 0 : f.setFieldsValue) == null || h.call(f, t), ae(() => {
64
+ }), await ((g = (d = u.value) == null ? void 0 : d.apForm) == null ? void 0 : g.resetFields()), (h = (f = (m = u.value) == null ? void 0 : m.apForm) == null ? void 0 : f.setFieldsValue) == null || h.call(f, t), ae(() => {
65
65
  e == null || e();
66
66
  });
67
67
  }, S = (e) => {
@@ -96,16 +96,16 @@ const Te = ({
96
96
  var f, h, v, x;
97
97
  const n = ((h = (f = u.value) == null ? void 0 : f.apForm) == null ? void 0 : h.getFieldsValueTransformed(!0)) || {};
98
98
  c.value = e.current, p.value = e.pageSize, H(a, t);
99
- const i = q(t) ? [...t] : [t], g = {};
99
+ const i = q(t) ? [...t] : [t], d = {};
100
100
  for (const l of i)
101
- (v = o(L)) != null && v.includes(l.columnKey || l.field) && (g[ne(l.columnKey || l.field)] = l.order);
102
- const d = {};
101
+ (v = o(L)) != null && v.includes(l.columnKey || l.field) && l.order && (d[ne(l.columnKey || l.field)] = l.order);
102
+ const g = {};
103
103
  for (const l of Object.keys(a))
104
- (x = o(J)) != null && x.includes(l) && (d[l] = a[l]);
104
+ (x = o(J)) != null && x.includes(l) && a[l] && (g[l] = a[l]);
105
105
  const m = {
106
106
  ...n,
107
- filter: d,
108
- sort: g,
107
+ filter: g,
108
+ sort: d,
109
109
  current: e.current,
110
110
  pageSize: e.pageSize
111
111
  };
@@ -73,40 +73,40 @@ export interface ApLadderProps {
73
73
  * 重要信息
74
74
  * @description 如 操作人名称、供应商名称...
75
75
  */
76
- major: string;
76
+ major?: string;
77
77
  /**
78
78
  * 次要信息
79
79
  * @description 如 操作人邮箱、供应商编码...
80
80
  */
81
- minor: string;
81
+ minor?: string;
82
82
  /**
83
83
  * 自定义重要信息颜色
84
84
  */
85
- majorColor: string;
85
+ majorColor?: string;
86
86
  /**
87
87
  * 自定义次要信息颜色
88
88
  */
89
- minorColor: string;
89
+ minorColor?: string;
90
90
  /**
91
91
  * 布局方式
92
92
  * - `vertical` 垂直布局
93
93
  * - `horizontal` 水平布局
94
94
  * @default `vertical`
95
95
  */
96
- layout: 'vertical' | 'horizontal';
96
+ layout?: 'vertical' | 'horizontal';
97
97
  /**
98
98
  * 是否展示气泡
99
99
  * @description 默认展示
100
100
  */
101
- tooltip: boolean;
101
+ tooltip?: boolean;
102
102
  /**
103
103
  * 健值对 - 数组展示
104
104
  */
105
- labelValues: Array<ApLadderLabelValue>;
105
+ labelValues?: Array<ApLadderLabelValue>;
106
106
  /**
107
107
  * 扩展 Tooltip
108
108
  */
109
- tooltipProps: TooltipNeedProps;
109
+ tooltipProps?: TooltipNeedProps;
110
110
  }
111
111
  /**
112
112
  * ApLadder Slots 类型声明
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("../../config-provider/index.js");const S=require("@vueuse/core"),n=require("vue"),q=require("../../config-provider/hooks/use-global-config.js");function h(t){if(!t)return 0;const e=parseFloat(t);return Number.isNaN(e)?0:e}function d(t){if(!t)return 0;const e=getComputedStyle(t);return t.clientHeight+h(e.marginTop)+h(e.marginBottom)}const v=t=>{const e=n.ref(),{height:p}=S.useElementSize(e),m=q.useGlobalConfig("namespace"),i=n.ref();let u=!1;const H=n.computed(()=>{var c,l,s,g,f;const r=((l=(c=e.value)==null?void 0:c.querySelector(`.${m}-ap-table-header-wrapper`))==null?void 0:l.clientHeight)||0,a=((g=(s=e.value)==null?void 0:s.querySelector(".ant-table-header"))==null?void 0:g.clientHeight)||47,o=(f=e.value)==null?void 0:f.querySelector(".ant-pagination"),b=o?d(o):n.unref(i);return o&&(u=!0),Math.ceil(n.unref(p)-a-r-(b||0)-((t==null?void 0:t.offset)||0))});return n.onUpdated(()=>{var a;if(u)return;const r=(a=e.value)==null?void 0:a.querySelector(".ant-pagination");if(!r){i.value=0;return}i.value=d(r),u=!0}),{contentRef:e,height:H}};exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("../../config-provider/index.js");const S=require("@vueuse/core"),n=require("vue"),q=require("../../config-provider/hooks/use-global-config.js");function h(t){if(!t)return 0;const e=parseFloat(t);return Number.isNaN(e)?0:e}function d(t){if(!t)return 0;const e=getComputedStyle(t);return t.clientHeight+h(e.marginTop)+h(e.marginBottom)}const v=t=>{const e=n.ref(),{height:p}=S.useElementSize(e),m=q.useGlobalConfig("namespace"),i=n.ref();let u=!1;const H=n.computed(()=>{var c,l,s,g,f;const r=((l=(c=e.value)==null?void 0:c.querySelector(`.${n.unref(m)}-ap-table-header-wrapper`))==null?void 0:l.clientHeight)||0,a=((g=(s=e.value)==null?void 0:s.querySelector(".ant-table-header"))==null?void 0:g.clientHeight)||47,o=(f=e.value)==null?void 0:f.querySelector(".ant-pagination"),b=o?d(o):n.unref(i);return o&&(u=!0),Math.ceil(n.unref(p)-a-r-(b||0)-((t==null?void 0:t.offset)||0))});return n.onUpdated(()=>{var a;if(u)return;const r=(a=e.value)==null?void 0:a.querySelector(".ant-pagination");if(!r){i.value=0;return}i.value=d(r),u=!0}),{contentRef:e,height:H}};exports.default=v;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),x=require("../utils.js"),V=require("lodash-unified");require("../../config-provider/index.js");const ee=require("./use-sorted-filtered.js"),te=require("../../config-provider/hooks/use-locale.js"),ae=require("../../config-provider/hooks/use-namespace.js"),re=({manual:D=!1,defaultCurrent:E=1,defaultPageSize:y=10,request:R,defaultParams:M={},defaultData:B=[],formatParams:z,paramsValueTypeMap:C,resetFieldsIgnores:N,filterFields:K,sortFields:L,showLessItems:P=!1,showTotal:$=!0})=>{let q=0,s={};const J=e=>z?z(e):e,c=t.ref(),l=t.ref(E),d=t.ref(y),{getColumnSFConfig:Q,setSF:U,clearAll:W}=ee.useTableSortedAndFiltered(),{t:S}=te.useLocale(),{b:T}=ae.useNamespace("ap-table"),n=t.ref({total:0,records:B,loading:!1}),w=async e=>{var o;const r=J(e),a=Date.now();q=a,n.value.loading=!0;try{const u=await R({...M,...r});q===a&&(n.value.total=u.total||((o=u.data)==null?void 0:o.length)||0,n.value.records=[...u.data||[]])}catch{q===a&&(n.value.records=[],n.value.total=0)}finally{n.value.loading=!1}},A=e=>{const r={};return Object.entries(e).forEach(([a,o])=>{if(r[a]=o,C&&o){const u=C[a];u&&(r[a]=x.parseFieldValue(u,o))}}),r},G=async e=>{var o,u,g,p,m,f,h;const r=((u=(o=c.value)==null?void 0:o.apForm)==null?void 0:u.getFieldsValueTransformed(!0))||{},a={};Object.entries(r).forEach(([v,b])=>{N&&N.indexOf(v)>-1&&(a[v]=b)}),await((p=(g=c.value)==null?void 0:g.apForm)==null?void 0:p.resetFields()),(h=(f=(m=c.value)==null?void 0:m.apForm)==null?void 0:f.setFieldsValue)==null||h.call(f,a),t.nextTick(()=>{e==null||e()})},F=e=>{s=e;const r=A(e);w(r)},H=e=>{F({...s,...e})},O=()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};l.value=1,F({...e,filter:s.filter,sort:s.sort,current:1,pageSize:s.pageSize||y})},X=()=>{W(),s.sort={},s.filter={},G(O)},Y=()=>{F(s)},Z=e=>{const r=t.unref(n).total-e,a=Math.ceil(r/t.unref(d)),o=t.unref(l)>a?a:t.unref(l);H({current:o>0?o:1})},j=(e,r,a)=>{var f,h,v,b;const o=((h=(f=c.value)==null?void 0:f.apForm)==null?void 0:h.getFieldsValueTransformed(!0))||{};l.value=e.current,d.value=e.pageSize,U(r,a);const u=V.isArray(a)?[...a]:[a],g={};for(const i of u)(v=t.unref(L))!=null&&v.includes(i.columnKey||i.field)&&(g[x.dataIndexToStr(i.columnKey||i.field)]=i.order);const p={};for(const i of Object.keys(r))(b=t.unref(K))!=null&&b.includes(i)&&(p[i]=r[i]);const m={...o,filter:p,sort:g,current:e.current,pageSize:e.pageSize};V.isEqualWith(s,m,x.isEqualCustom)||F(m)};t.onMounted(()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};if(s={current:t.unref(l),pageSize:t.unref(d),filter:{},sort:{},...e},!D){const o=A(s);w(o)}});const _=t.computed(()=>t.unref(n).total===0?"-":`${t.unref(l.value)}/${Math.ceil(t.unref(n).total/t.unref(d))}`);function I(e){V.isArray(e)&&(n.value.records=e,n.value.total=e.length)}const k=t.computed(()=>({loading:t.unref(n).loading,pagination:{current:t.unref(l),pageSize:t.unref(d),total:t.unref(n).total,showSizeChanger:!P,showQuickJumper:!P,showLessItems:P,size:"default",showTotal:$?e=>t.createVNode("span",{class:T("pagination-total-wrapper")},[S("ap.apTable.pagination.totalLeftPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[e])," ",S("ap.apTable.pagination.totalLeftSuffix"),t.createVNode("span",{class:T("pagination--total-right")},[S("ap.apTable.pagination.totalRightPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[t.unref(_)])," ",S("ap.apTable.pagination.totalRightSuffix")])]):void 0},onChange:j,dataSource:t.unref(n).records}));return{formRef:c,submit:O,reset:X,refresh:Y,refreshByDelete:Z,data:n,current:l,pageSize:d,handleTableChange:j,tableProps:k,dataSource:t.computed(()=>t.unref(n).records),setDataSource:I,getColumnSFConfig:Q}};exports.useTablePaging=re;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),x=require("../utils.js"),V=require("lodash-unified");require("../../config-provider/index.js");const ee=require("./use-sorted-filtered.js"),te=require("../../config-provider/hooks/use-locale.js"),ae=require("../../config-provider/hooks/use-namespace.js"),re=({manual:D=!1,defaultCurrent:E=1,defaultPageSize:y=10,request:R,defaultParams:M={},defaultData:B=[],formatParams:z,paramsValueTypeMap:C,resetFieldsIgnores:N,filterFields:K,sortFields:L,showLessItems:P=!1,showTotal:$=!0})=>{let q=0,s={};const J=e=>z?z(e):e,c=t.ref(),l=t.ref(E),d=t.ref(y),{getColumnSFConfig:Q,setSF:U,clearAll:W}=ee.useTableSortedAndFiltered(),{t:S}=te.useLocale(),{b:T}=ae.useNamespace("ap-table"),n=t.ref({total:0,records:B,loading:!1}),w=async e=>{var o;const r=J(e),a=Date.now();q=a,n.value.loading=!0;try{const u=await R({...M,...r});q===a&&(n.value.total=u.total||((o=u.data)==null?void 0:o.length)||0,n.value.records=[...u.data||[]])}catch{q===a&&(n.value.records=[],n.value.total=0)}finally{n.value.loading=!1}},A=e=>{const r={};return Object.entries(e).forEach(([a,o])=>{if(r[a]=o,C&&o){const u=C[a];u&&(r[a]=x.parseFieldValue(u,o))}}),r},G=async e=>{var o,u,g,p,m,f,h;const r=((u=(o=c.value)==null?void 0:o.apForm)==null?void 0:u.getFieldsValueTransformed(!0))||{},a={};Object.entries(r).forEach(([v,b])=>{N&&N.indexOf(v)>-1&&(a[v]=b)}),await((p=(g=c.value)==null?void 0:g.apForm)==null?void 0:p.resetFields()),(h=(f=(m=c.value)==null?void 0:m.apForm)==null?void 0:f.setFieldsValue)==null||h.call(f,a),t.nextTick(()=>{e==null||e()})},F=e=>{s=e;const r=A(e);w(r)},H=e=>{F({...s,...e})},O=()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};l.value=1,F({...e,filter:s.filter,sort:s.sort,current:1,pageSize:s.pageSize||y})},X=()=>{W(),s.sort={},s.filter={},G(O)},Y=()=>{F(s)},Z=e=>{const r=t.unref(n).total-e,a=Math.ceil(r/t.unref(d)),o=t.unref(l)>a?a:t.unref(l);H({current:o>0?o:1})},j=(e,r,a)=>{var f,h,v,b;const o=((h=(f=c.value)==null?void 0:f.apForm)==null?void 0:h.getFieldsValueTransformed(!0))||{};l.value=e.current,d.value=e.pageSize,U(r,a);const u=V.isArray(a)?[...a]:[a],g={};for(const i of u)(v=t.unref(L))!=null&&v.includes(i.columnKey||i.field)&&i.order&&(g[x.dataIndexToStr(i.columnKey||i.field)]=i.order);const p={};for(const i of Object.keys(r))(b=t.unref(K))!=null&&b.includes(i)&&r[i]&&(p[i]=r[i]);const m={...o,filter:p,sort:g,current:e.current,pageSize:e.pageSize};V.isEqualWith(s,m,x.isEqualCustom)||F(m)};t.onMounted(()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};if(s={current:t.unref(l),pageSize:t.unref(d),filter:{},sort:{},...e},!D){const o=A(s);w(o)}});const _=t.computed(()=>t.unref(n).total===0?"-":`${t.unref(l.value)}/${Math.ceil(t.unref(n).total/t.unref(d))}`);function I(e){V.isArray(e)&&(n.value.records=e,n.value.total=e.length)}const k=t.computed(()=>({loading:t.unref(n).loading,pagination:{current:t.unref(l),pageSize:t.unref(d),total:t.unref(n).total,showSizeChanger:!P,showQuickJumper:!P,showLessItems:P,size:"default",showTotal:$?e=>t.createVNode("span",{class:T("pagination-total-wrapper")},[S("ap.apTable.pagination.totalLeftPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[e])," ",S("ap.apTable.pagination.totalLeftSuffix"),t.createVNode("span",{class:T("pagination--total-right")},[S("ap.apTable.pagination.totalRightPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[t.unref(_)])," ",S("ap.apTable.pagination.totalRightSuffix")])]):void 0},onChange:j,dataSource:t.unref(n).records}));return{formRef:c,submit:O,reset:X,refresh:Y,refreshByDelete:Z,data:n,current:l,pageSize:d,handleTableChange:j,tableProps:k,dataSource:t.computed(()=>t.unref(n).records),setDataSource:I,getColumnSFConfig:Q}};exports.useTablePaging=re;
@@ -73,40 +73,40 @@ export interface ApLadderProps {
73
73
  * 重要信息
74
74
  * @description 如 操作人名称、供应商名称...
75
75
  */
76
- major: string;
76
+ major?: string;
77
77
  /**
78
78
  * 次要信息
79
79
  * @description 如 操作人邮箱、供应商编码...
80
80
  */
81
- minor: string;
81
+ minor?: string;
82
82
  /**
83
83
  * 自定义重要信息颜色
84
84
  */
85
- majorColor: string;
85
+ majorColor?: string;
86
86
  /**
87
87
  * 自定义次要信息颜色
88
88
  */
89
- minorColor: string;
89
+ minorColor?: string;
90
90
  /**
91
91
  * 布局方式
92
92
  * - `vertical` 垂直布局
93
93
  * - `horizontal` 水平布局
94
94
  * @default `vertical`
95
95
  */
96
- layout: 'vertical' | 'horizontal';
96
+ layout?: 'vertical' | 'horizontal';
97
97
  /**
98
98
  * 是否展示气泡
99
99
  * @description 默认展示
100
100
  */
101
- tooltip: boolean;
101
+ tooltip?: boolean;
102
102
  /**
103
103
  * 健值对 - 数组展示
104
104
  */
105
- labelValues: Array<ApLadderLabelValue>;
105
+ labelValues?: Array<ApLadderLabelValue>;
106
106
  /**
107
107
  * 扩展 Tooltip
108
108
  */
109
- tooltipProps: TooltipNeedProps;
109
+ tooltipProps?: TooltipNeedProps;
110
110
  }
111
111
  /**
112
112
  * ApLadder Slots 类型声明
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -64,8 +64,8 @@
64
64
  "sortablejs": "^1.15.2",
65
65
  "vue-virtual-scroller": "2.0.0-beta.8",
66
66
  "vuedraggable": "^4.1.0",
67
- "@aplus-frontend/utils": "1.0.43",
68
- "@aplus-frontend/hooks": "1.0.7"
67
+ "@aplus-frontend/hooks": "1.0.7",
68
+ "@aplus-frontend/utils": "1.0.43"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@aplus-frontend/antdv": "^1.0.8",