@aplus-frontend/ui 0.6.5 → 0.6.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.
@@ -28,7 +28,10 @@ const w = (s) => {
28
28
  };
29
29
  }));
30
30
  function i(a) {
31
- const n = l(a, s.value);
31
+ const n = l(
32
+ a || [],
33
+ s.value || []
34
+ );
32
35
  r.value = !0, s.value = n;
33
36
  }
34
37
  return {
@@ -86,7 +86,7 @@ const _e = /* @__PURE__ */ Q({
86
86
  const i = r.value.find((l) => l.viewKey === V.value);
87
87
  i && setTimeout(() => {
88
88
  var l, o, m, f, n, u, y, x, h;
89
- i.viewKey === c ? ((l = e == null ? void 0 : e.resetSearchFormSorterItems) == null || l.call(e), d ? (o = e == null ? void 0 : e.submit) == null || o.call(e) : (m = e == null ? void 0 : e.reset) == null || m.call(e)) : ((u = e == null ? void 0 : e.setSearchFormValues) == null || u.call(e, {
89
+ i.viewKey === c ? d ? (l = e == null ? void 0 : e.submit) == null || l.call(e) : ((o = e == null ? void 0 : e.resetSearchFormSorterItems) == null || o.call(e), (m = e == null ? void 0 : e.reset) == null || m.call(e)) : ((u = e == null ? void 0 : e.setSearchFormValues) == null || u.call(e, {
90
90
  ...Object.fromEntries(Object.keys(((f = e == null ? void 0 : e.getSearchFormValues) == null ? void 0 : f.call(e)) ?? {}).map((J) => [J, void 0])) ?? {},
91
91
  ...((n = i.viewConfig) == null ? void 0 : n.searchForm) ?? {}
92
92
  }), (x = e == null ? void 0 : e.setSearchFormSorterItems) == null || x.call(e, ((y = i.viewConfig) == null ? void 0 : y.sorterItems) ?? []), (h = e == null ? void 0 : e.submit) == null || h.call(e)), d = !1;
@@ -1,2 +1,2 @@
1
- declare const _default: "0.6.5";
1
+ declare const _default: "0.6.6";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "0.6.5";
1
+ const e = "0.6.6";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("lodash-unified"),c=require("vue"),d=require("../../item-group/helper.js"),f=require("../../../utils/index.js");function p(s,r){var e;const u=new Set(s.map(n=>n.name)),a=new Map;for(const n of r){const o=String(d.getStringName((e=n.props)==null?void 0:e.name));o&&u.has(o)&&a.set(o,n)}const i=new Set,t=[];for(const n of s){const o=a.get(n.name);o&&(t.push(o),i.add(o))}for(const n of r)i.has(n)||t.push(n);return t}const m=s=>{const r=c.ref(!1),u=c.computed(()=>(s.value||[]).map(t=>{const e=t.props;return{label:e.description||e.label||e.placeholder,name:d.getStringName(e.name),isHidden:l.isBoolean(e.hidden)?!!e.hidden:f.isDef(e.hidden)}}));function a(i){const t=p(i,s.value);r.value=!0,s.value=t}return{items:u,handleClickConfirm:a,sorted:r}};exports.useSorter=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("lodash-unified"),c=require("vue"),d=require("../../item-group/helper.js"),f=require("../../../utils/index.js");function p(s,r){var e;const u=new Set(s.map(n=>n.name)),a=new Map;for(const n of r){const o=String(d.getStringName((e=n.props)==null?void 0:e.name));o&&u.has(o)&&a.set(o,n)}const i=new Set,t=[];for(const n of s){const o=a.get(n.name);o&&(t.push(o),i.add(o))}for(const n of r)i.has(n)||t.push(n);return t}const m=s=>{const r=c.ref(!1),u=c.computed(()=>(s.value||[]).map(t=>{const e=t.props;return{label:e.description||e.label||e.placeholder,name:d.getStringName(e.name),isHidden:l.isBoolean(e.hidden)?!!e.hidden:f.isDef(e.hidden)}}));function a(i){const t=p(i||[],s.value||[]);r.value=!0,s.value=t}return{items:u,handleClickConfirm:a,sorted:r}};exports.useSorter=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue");require("../../config-provider/index.js");const z=require("./icons/line-down.vue.js"),$=require("../ap-batch-action-group/index.js");require("./components/main-button-content.vue.js");require("./components/menu-list-content.vue.js");const H=require("./hooks/use-view-provide.js"),J=require("../../ap-table/context.js"),d=require("./utils/enum.js"),Q=require("@aplus-frontend/utils"),X=require("../../config-provider/hooks/use-global-config.js"),Z=require("../../config-provider/hooks/use-namespace.js"),C=require("../../config-provider/hooks/use-locale.js"),U=require("./components/main-button-content.vue2.js"),R=require("./components/menu-list-content.vue2.js"),O=i.defineComponent({name:"ApView",__name:"ap-view",props:{tableKey:{},saveDataSource:{},viewCacheOption:{},maxViewNum:{default:20},isDefaultSystemView:{type:Boolean,default:!1},isFirstDefaultSystemView:{type:Boolean,default:!1}},setup(I,{expose:N}){const f=I,Y=X.useGlobalConfig("viewCacheOption"),{b:K}=Z.useNamespace("ap-view"),{t:S}=C.useLocale(),v=i.computed(()=>({viewKey:d.SYSTEM_VIEW_KEY,viewName:S("ap.apView.systemView")})),{getSearchFormValues:T,setSearchFormValues:M,submit:x,reset:B,getSearchFormSorterItems:P,setSearchFormSorterItems:W,resetSearchFormSorterItems:h}=J.useInjectApTable(),L=i.ref(!1),b=i.ref(!1),p=i.ref("");let _=!1,g=!1;const j={dropdownType:"dropdown",content:i.createVNode(U.default,{maxViewNum:f.maxViewNum},null)},r=i.ref([v.value]),k=i.computed(()=>r.value.map(t=>({id:t.viewKey,content:i.createVNode(R.default,{view:t},null)}))),e={getSearchFormValues:T,setSearchFormValues:M,submit:x,reset:B,getSearchFormSorterItems:P,setSearchFormSorterItems:W,resetSearchFormSorterItems:h,...f.saveDataSource},l={...Y.value,...f.viewCacheOption},E=()=>{if(f.isDefaultSystemView||(f.isFirstDefaultSystemView||g)&&_)return d.SYSTEM_VIEW_KEY;const t=r.value.find(s=>s.isDefault);return(t==null?void 0:t.viewKey)??d.SYSTEM_VIEW_KEY},w=t=>{p.value=t;const s=r.value.find(n=>n.viewKey===p.value);s&&setTimeout(()=>{var n,u,o,m,a,c,V,q,F;s.viewKey===d.SYSTEM_VIEW_KEY?((n=e==null?void 0:e.resetSearchFormSorterItems)==null||n.call(e),_?(u=e==null?void 0:e.submit)==null||u.call(e):(o=e==null?void 0:e.reset)==null||o.call(e)):((c=e==null?void 0:e.setSearchFormValues)==null||c.call(e,{...Object.fromEntries(Object.keys(((m=e==null?void 0:e.getSearchFormValues)==null?void 0:m.call(e))??{}).map(G=>[G,void 0]))??{},...((a=s.viewConfig)==null?void 0:a.searchForm)??{}}),(q=e==null?void 0:e.setSearchFormSorterItems)==null||q.call(e,((V=s.viewConfig)==null?void 0:V.sorterItems)??[]),(F=e==null?void 0:e.submit)==null||F.call(e)),_=!1})},y={getViewList:async t=>{var s;try{const{tableKey:n}=t,u=await((s=l==null?void 0:l.getViewList)==null?void 0:s.call(l,{tableKey:n}));return r.value=[v.value,...u??[]],w(E()),r.value}catch{return r.value=[v.value],w(d.SYSTEM_VIEW_KEY),r.value}},addView:async t=>{var a;const{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m}=t;await((a=l==null?void 0:l.addView)==null?void 0:a.call(l,{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m})),o&&(r.value=r.value.map(c=>({...c,isDefault:!1}))),r.value=[...r.value,{viewKey:n,viewName:u,isDefault:o,viewConfig:m}],w(n)},changeView:async t=>{var c;const{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m}=t;await((c=l==null?void 0:l.changeView)==null?void 0:c.call(l,{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m})),o&&(r.value=r.value.map(V=>({...V,isDefault:!1})));const a=r.value.find(V=>V.viewKey===n);a&&(a.viewName=u,a.isDefault=o,a.viewConfig=m),w(n)},removeView:async t=>{var u;const{tableKey:s,viewKey:n}=t;await((u=l==null?void 0:l.removeView)==null?void 0:u.call(l,{tableKey:s,viewKey:n})),r.value=r.value.filter(o=>o.viewKey!==n),n===p.value&&w(E())}},A={tableKey:f.tableKey,currentViewKey:p,changeCurrentViewKey:w,popoverOpen:L,menuOpen:b,viewList:r,viewListCRUD:y,saveDataSource:e};return H.useViewProvide(A),i.watch(()=>f.tableKey,t=>{var s;Q.isValid(t)&&(_=!0,(s=y==null?void 0:y.getViewList)==null||s.call(y,{tableKey:t}))},{immediate:!0}),N({setFirstDefaultSystemView:t=>{g=t}}),(t,s)=>(i.openBlock(),i.createBlock(i.unref($.ApBatchActionGroup),i.mergeProps({...t.$attrs},{open:b.value,"onUpdate:open":s[0]||(s[0]=n=>b.value=n),class:[i.unref(K)()],"button-props":j,"menu-list":k.value,"overlay-class-name":[i.unref(K)("overlay")],trigger:"click",placement:"bottom"}),{icon:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([i.unref(K)("icon")])},[i.createVNode(z.default)],2)]),_:1},16,["open","class","menu-list","overlay-class-name"]))}});exports.default=O;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue");require("../../config-provider/index.js");const z=require("./icons/line-down.vue.js"),$=require("../ap-batch-action-group/index.js");require("./components/main-button-content.vue.js");require("./components/menu-list-content.vue.js");const H=require("./hooks/use-view-provide.js"),J=require("../../ap-table/context.js"),d=require("./utils/enum.js"),Q=require("@aplus-frontend/utils"),X=require("../../config-provider/hooks/use-global-config.js"),Z=require("../../config-provider/hooks/use-namespace.js"),C=require("../../config-provider/hooks/use-locale.js"),U=require("./components/main-button-content.vue2.js"),R=require("./components/menu-list-content.vue2.js"),O=i.defineComponent({name:"ApView",__name:"ap-view",props:{tableKey:{},saveDataSource:{},viewCacheOption:{},maxViewNum:{default:20},isDefaultSystemView:{type:Boolean,default:!1},isFirstDefaultSystemView:{type:Boolean,default:!1}},setup(I,{expose:N}){const f=I,Y=X.useGlobalConfig("viewCacheOption"),{b:K}=Z.useNamespace("ap-view"),{t:S}=C.useLocale(),v=i.computed(()=>({viewKey:d.SYSTEM_VIEW_KEY,viewName:S("ap.apView.systemView")})),{getSearchFormValues:T,setSearchFormValues:M,submit:x,reset:B,getSearchFormSorterItems:P,setSearchFormSorterItems:W,resetSearchFormSorterItems:h}=J.useInjectApTable(),L=i.ref(!1),b=i.ref(!1),p=i.ref("");let _=!1,g=!1;const j={dropdownType:"dropdown",content:i.createVNode(U.default,{maxViewNum:f.maxViewNum},null)},r=i.ref([v.value]),k=i.computed(()=>r.value.map(t=>({id:t.viewKey,content:i.createVNode(R.default,{view:t},null)}))),e={getSearchFormValues:T,setSearchFormValues:M,submit:x,reset:B,getSearchFormSorterItems:P,setSearchFormSorterItems:W,resetSearchFormSorterItems:h,...f.saveDataSource},l={...Y.value,...f.viewCacheOption},E=()=>{if(f.isDefaultSystemView||(f.isFirstDefaultSystemView||g)&&_)return d.SYSTEM_VIEW_KEY;const t=r.value.find(s=>s.isDefault);return(t==null?void 0:t.viewKey)??d.SYSTEM_VIEW_KEY},w=t=>{p.value=t;const s=r.value.find(n=>n.viewKey===p.value);s&&setTimeout(()=>{var n,u,o,m,a,c,V,q,F;s.viewKey===d.SYSTEM_VIEW_KEY?_?(n=e==null?void 0:e.submit)==null||n.call(e):((u=e==null?void 0:e.resetSearchFormSorterItems)==null||u.call(e),(o=e==null?void 0:e.reset)==null||o.call(e)):((c=e==null?void 0:e.setSearchFormValues)==null||c.call(e,{...Object.fromEntries(Object.keys(((m=e==null?void 0:e.getSearchFormValues)==null?void 0:m.call(e))??{}).map(G=>[G,void 0]))??{},...((a=s.viewConfig)==null?void 0:a.searchForm)??{}}),(q=e==null?void 0:e.setSearchFormSorterItems)==null||q.call(e,((V=s.viewConfig)==null?void 0:V.sorterItems)??[]),(F=e==null?void 0:e.submit)==null||F.call(e)),_=!1})},y={getViewList:async t=>{var s;try{const{tableKey:n}=t,u=await((s=l==null?void 0:l.getViewList)==null?void 0:s.call(l,{tableKey:n}));return r.value=[v.value,...u??[]],w(E()),r.value}catch{return r.value=[v.value],w(d.SYSTEM_VIEW_KEY),r.value}},addView:async t=>{var a;const{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m}=t;await((a=l==null?void 0:l.addView)==null?void 0:a.call(l,{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m})),o&&(r.value=r.value.map(c=>({...c,isDefault:!1}))),r.value=[...r.value,{viewKey:n,viewName:u,isDefault:o,viewConfig:m}],w(n)},changeView:async t=>{var c;const{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m}=t;await((c=l==null?void 0:l.changeView)==null?void 0:c.call(l,{tableKey:s,viewKey:n,viewName:u,isDefault:o,viewConfig:m})),o&&(r.value=r.value.map(V=>({...V,isDefault:!1})));const a=r.value.find(V=>V.viewKey===n);a&&(a.viewName=u,a.isDefault=o,a.viewConfig=m),w(n)},removeView:async t=>{var u;const{tableKey:s,viewKey:n}=t;await((u=l==null?void 0:l.removeView)==null?void 0:u.call(l,{tableKey:s,viewKey:n})),r.value=r.value.filter(o=>o.viewKey!==n),n===p.value&&w(E())}},A={tableKey:f.tableKey,currentViewKey:p,changeCurrentViewKey:w,popoverOpen:L,menuOpen:b,viewList:r,viewListCRUD:y,saveDataSource:e};return H.useViewProvide(A),i.watch(()=>f.tableKey,t=>{var s;Q.isValid(t)&&(_=!0,(s=y==null?void 0:y.getViewList)==null||s.call(y,{tableKey:t}))},{immediate:!0}),N({setFirstDefaultSystemView:t=>{g=t}}),(t,s)=>(i.openBlock(),i.createBlock(i.unref($.ApBatchActionGroup),i.mergeProps({...t.$attrs},{open:b.value,"onUpdate:open":s[0]||(s[0]=n=>b.value=n),class:[i.unref(K)()],"button-props":j,"menu-list":k.value,"overlay-class-name":[i.unref(K)("overlay")],trigger:"click",placement:"bottom"}),{icon:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([i.unref(K)("icon")])},[i.createVNode(z.default)],2)]),_:1},16,["open","class","menu-list","overlay-class-name"]))}});exports.default=O;
@@ -1,2 +1,2 @@
1
- declare const _default: "0.6.5";
1
+ declare const _default: "0.6.6";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="0.6.5";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="0.6.6";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [