@nocobase/plugin-notification-in-app-message 1.4.0-beta.5 → 1.4.0-beta.7

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.
@@ -14,7 +14,7 @@
14
14
  &:hover {
15
15
  background-color: ${e.colorBgTextHover}};
16
16
  }
17
- `,style:Ka(an({padding:"10px 10px",color:s},r===o.name?{backgroundColor:e.colorPrimaryBg}:{}),{cursor:"pointer",marginTop:"10px",border:"none",borderRadius:"10px",display:"flex",flexDirection:"column",justifyContent:"space-between"}),onClick:()=>{te.value=o.name},children:[S.jsxs($.Flex,{justify:"space-between",style:{width:"100%"},children:[S.jsx("div",{style:{width:"150px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontWeight:"bold"},children:o.title}),S.jsx("div",{style:{width:"120px",fontWeight:400,textAlign:"right",fontFamily:"monospace",color:u},children:be.dayjs(o.latestMsgReceiveTimestamp).fromNow()})]}),S.jsxs($.Flex,{justify:"space-between",style:{width:"100%",marginTop:e.margin},children:[S.jsxs("div",{style:{width:"80%",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:u},children:[" ",o.latestMsgTitle]}),ge.value!=="read"?S.jsx($.Badge,{style:{border:"none"},count:o.unreadMsgCnt}):null]})]})}})]}),S.jsx($.Layout.Content,{style:{padding:e.paddingLG,height:"100%",overflowY:"auto"},children:r?S.jsx(im,{}):null})]})},um=ve.observer(sm),am=gr.createStyles(({token:e})=>({button:{color:e.colorTextHeaderMenu+" !important"}})),cm=e=>{var u,a;const{t}=Ze(),{styles:n}=am(),i=(a=(u=j.useCurrentUserContext().data)==null?void 0:u.data)==null?void 0:a.id;v.useEffect(()=>{Di()},[]),v.useEffect(()=>{kr.value=i!=null?i:null},[i]);const l=v.useCallback(()=>{xr.value=!0,Ft({})},[]);v.useEffect(()=>{const h=[];h.push(Ho());const f=()=>{for(;h.length>0;){const g=h.pop();g&&g()}},p=()=>{document.visibilityState==="visible"?h.push(Ho()):f()};return document.addEventListener("visibilitychange",p),()=>{f(),document.removeEventListener("visibilitychange",p)}},[]);const o=S.jsx("div",{style:{padding:"0"},children:t("Message")}),s=S.jsx("div",{style:{marginLeft:"15px"},children:S.jsx(Fi.CloseOutlined,{})});return v.useEffect(()=>W.reaction(()=>Qo.value,f=>{if(f&&["message:created","message:updated"].includes(f.type)){const{data:p}=f;Ln.value[p.id]=p,f.type==="message:created"&&$.notification.info({message:S.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:p.title}),description:p.content.slice(0,100)+(p.content.length>100?"...":""),onClick:()=>{xr.value=!0,te.value=p.channelName,$.notification.destroy()}})}}),[]),S.jsxs($.ConfigProvider,{theme:{components:{Drawer:{paddingLG:0}}},children:[S.jsx($.Tooltip,{title:t("Message"),children:S.jsx($.Badge,{count:Sr.value,size:"small",offset:[-12,14],children:S.jsx($.Button,{className:n.button,title:t("Message"),icon:S.jsx(j.Icon,{type:"BellOutlined"}),onClick:l})})}),S.jsx($.Drawer,{title:o,open:xr.value,closeIcon:s,width:900,onClose:()=>{xr.value=!1},children:S.jsx(um,{})})]})},fm=ve.observer(cm),dm=e=>S.jsx(j.PinnedPluginListProvider,{items:{inbox:{order:301,component:"Inbox",pin:!0,snippet:"*"}},children:S.jsx(j.SchemaComponentOptions,{components:{Inbox:fm},children:e.children})});function pm(e){return e.isForeignKey?e.target==="users":e.collectionName==="users"&&e.name==="id"}function hm(e){return typeof e.value==="object"&&e.value?S.jsx(vm,an({},e)):S.jsx(mm,an({},e))}function mm({value:e,onChange:t}){const n=Uo.useWorkflowVariableOptions({types:[pm]});return S.jsx(j.Variable.Input,{scope:n,value:e,onChange:t,children:S.jsx(j.RemoteSelect,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1,value:e,onChange:t})})}function vm(e){const t=qa.useField(),n=j.useCollectionFilterOptions("users"),{token:r}=j.useToken();return S.jsx("div",{style:{border:`1px dashed ${r.colorBorder}`,padding:r.paddingSM},children:S.jsx(j.SchemaComponent,{basePath:t.address,schema:{type:"void",properties:{filter:{type:"object","x-component":"Filter","x-component-props":{options:n,dynamicComponent:Uo.FilterDynamicComponent}}}}})})}function gm(){const e=Uo.useWorkflowExecuted(),[t,n]=v.useState(!1),{t:r}=Ze(),i=qa.useField(),{receivers:l}=i.form.values,o=v.useCallback(()=>{l.push(""),n(!1)},[l]),s=v.useCallback(()=>{l.push({filter:{}}),n(!1)},[l]),u=S.jsx($.Button,{icon:S.jsx(Fi.PlusOutlined,{}),type:"dashed",block:!0,disabled:e,className:"ant-formily-array-base-addition",children:r("Add user")});return e?u:S.jsx($.Popover,{open:t,onOpenChange:n,content:S.jsxs($.Space,{direction:"vertical",size:"small",children:[S.jsx($.Button,{type:"text",onClick:o,children:r("Select users")}),S.jsx($.Button,{type:"text",onClick:s,children:r("Query users")})]}),children:u})}const ym=({variableOptions:e})=>{const{t}=Ze();return S.jsx(j.SchemaComponent,{scope:{t},components:{UsersSelect:hm,UsersAddition:gm},schema:{type:"void",properties:{receivers:{type:"array",title:'{{t("Receivers")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"void","x-component":"Space","x-component-props":{className:j.css`
17
+ `,style:Ka(an({padding:"10px 10px",color:s},r===o.name?{backgroundColor:e.colorPrimaryBg}:{}),{cursor:"pointer",marginTop:"10px",border:"none",borderRadius:"10px",display:"flex",flexDirection:"column",justifyContent:"space-between"}),onClick:()=>{te.value=o.name},children:[S.jsxs($.Flex,{justify:"space-between",style:{width:"100%"},children:[S.jsx("div",{style:{width:"150px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontWeight:"bold"},children:o.title}),S.jsx("div",{style:{width:"120px",fontWeight:400,textAlign:"right",fontFamily:"monospace",color:u},children:be.dayjs(o.latestMsgReceiveTimestamp).fromNow()})]}),S.jsxs($.Flex,{justify:"space-between",style:{width:"100%",marginTop:e.margin},children:[S.jsxs("div",{style:{width:"80%",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:u},children:[" ",o.latestMsgTitle]}),ge.value!=="read"?S.jsx($.Badge,{style:{border:"none"},count:o.unreadMsgCnt}):null]})]})}})]}),S.jsx($.Layout.Content,{style:{padding:e.paddingLG,height:"100%",overflowY:"auto"},children:r?S.jsx(im,{}):null})]})},um=ve.observer(sm),am=gr.createStyles(({token:e})=>({button:{color:e.colorTextHeaderMenu+" !important"}})),cm=e=>{var u,a;const{t}=Ze(),{styles:n}=am(),i=(a=(u=j.useCurrentUserContext().data)==null?void 0:u.data)==null?void 0:a.id;v.useEffect(()=>{Di()},[]),v.useEffect(()=>{kr.value=i!=null?i:null},[i]);const l=v.useCallback(()=>{xr.value=!0,Ft({})},[]);v.useEffect(()=>{const h=[];h.push(Ho());const f=()=>{for(;h.length>0;){const g=h.pop();g&&g()}},p=()=>{document.visibilityState==="visible"?h.push(Ho()):f()};return document.addEventListener("visibilitychange",p),()=>{f(),document.removeEventListener("visibilitychange",p)}},[]);const o=S.jsx("div",{style:{padding:"0"},children:t("Message")}),s=S.jsx("div",{style:{marginLeft:"15px"},children:S.jsx(Fi.CloseOutlined,{})});return v.useEffect(()=>W.reaction(()=>Qo.value,f=>{if(f&&["message:created","message:updated"].includes(f.type)){const{data:p}=f;Ln.value[p.id]=p,f.type==="message:created"&&$.notification.info({message:S.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:p.title}),description:p.content.slice(0,100)+(p.content.length>100?"...":""),onClick:()=>{xr.value=!0,te.value=p.channelName,$.notification.destroy()}})}}),[]),S.jsxs($.ConfigProvider,{theme:{components:{Drawer:{paddingLG:0}}},children:[S.jsx($.Tooltip,{title:t("Message"),children:S.jsx($.Badge,{count:Sr.value,size:"small",offset:[-12,14],children:S.jsx($.Button,{className:n.button,title:t("Message"),icon:S.jsx(j.Icon,{type:"BellOutlined"}),onClick:l})})}),S.jsx($.Drawer,{title:o,open:xr.value,closeIcon:s,width:900,onClose:()=>{xr.value=!1},children:S.jsx(um,{})})]})},fm=ve.observer(cm),dm=e=>S.jsx(j.PinnedPluginListProvider,{items:{inbox:{order:301,component:"Inbox",pin:!0,snippet:"*"}},children:S.jsx(j.SchemaComponentOptions,{components:{Inbox:fm},children:e.children})});function pm(e){return e.isForeignKey?e.target==="users":e.collectionName==="users"&&e.name==="id"}function hm(e){return typeof e.value==="object"&&e.value?S.jsx(vm,an({},e)):S.jsx(mm,an({},e))}function mm({value:e,onChange:t}){const n=Uo.useWorkflowVariableOptions({types:[pm]});return S.jsx(j.Variable.Input,{scope:n,value:e,onChange:t,children:S.jsx(j.RemoteSelect,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users",defaultParams:e?{filter:{id:e}}:void 0},manual:!1,value:e,onChange:t})})}function vm(e){const t=qa.useField(),n=j.useCollectionFilterOptions("users"),{token:r}=j.useToken();return S.jsx("div",{style:{border:`1px dashed ${r.colorBorder}`,padding:r.paddingSM},children:S.jsx(j.SchemaComponent,{basePath:t.address,schema:{type:"void",properties:{filter:{type:"object","x-component":"Filter","x-component-props":{options:n,dynamicComponent:Uo.FilterDynamicComponent}}}}})})}function gm(){const e=Uo.useWorkflowExecuted(),[t,n]=v.useState(!1),{t:r}=Ze(),i=qa.useField(),{receivers:l}=i.form.values,o=v.useCallback(()=>{l.push(""),n(!1)},[l]),s=v.useCallback(()=>{l.push({filter:{}}),n(!1)},[l]),u=S.jsx($.Button,{icon:S.jsx(Fi.PlusOutlined,{}),type:"dashed",block:!0,disabled:e,className:"ant-formily-array-base-addition",children:r("Add user")});return e?u:S.jsx($.Popover,{open:t,onOpenChange:n,content:S.jsxs($.Space,{direction:"vertical",size:"small",children:[S.jsx($.Button,{type:"text",onClick:o,children:r("Select users")}),S.jsx($.Button,{type:"text",onClick:s,children:r("Query users")})]}),children:u})}const ym=({variableOptions:e})=>{const{t}=Ze();return S.jsx(j.SchemaComponent,{scope:{t},components:{UsersSelect:hm,UsersAddition:gm},schema:{type:"void",properties:{receivers:{type:"array",title:'{{t("Receivers")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"void","x-component":"Space","x-component-props":{className:j.css`
18
18
  width: 100%;
19
19
  &.ant-space.ant-space-horizontal {
20
20
  flex-wrap: nowrap;
@@ -9,14 +9,14 @@
9
9
 
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
- "@nocobase/client": "1.4.0-beta.5",
13
- "@nocobase/plugin-notification-manager": "1.4.0-beta.5",
14
- "@nocobase/plugin-mobile": "1.4.0-beta.5",
15
- "@nocobase/utils": "1.4.0-beta.5",
12
+ "@nocobase/client": "1.4.0-beta.7",
13
+ "@nocobase/plugin-notification-manager": "1.4.0-beta.7",
14
+ "@nocobase/plugin-mobile": "1.4.0-beta.7",
15
+ "@nocobase/utils": "1.4.0-beta.7",
16
16
  "react-i18next": "11.18.6",
17
- "@nocobase/server": "1.4.0-beta.5",
17
+ "@nocobase/server": "1.4.0-beta.7",
18
18
  "sequelize": "6.35.2",
19
- "@nocobase/database": "1.4.0-beta.5",
19
+ "@nocobase/database": "1.4.0-beta.7",
20
20
  "antd": "5.12.8",
21
21
  "@formily/reactive-react": "2.3.0",
22
22
  "@formily/reactive": "2.3.0",
@@ -26,6 +26,6 @@ module.exports = {
26
26
  "react-router-dom": "6.21.0",
27
27
  "@formily/react": "2.3.0",
28
28
  "@formily/core": "2.3.0",
29
- "@nocobase/plugin-workflow": "1.4.0-beta.5",
29
+ "@nocobase/plugin-workflow": "1.4.0-beta.7",
30
30
  "@formily/shared": "2.3.2"
31
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-notification-in-app-message",
3
- "version": "1.4.0-beta.5",
3
+ "version": "1.4.0-beta.7",
4
4
  "displayName": "Notification: In-app message",
5
5
  "displayName.zh-CN": "通知:站内信",
6
6
  "description": "It supports users in receiving real-time message notifications within the NocoBase application.",
@@ -24,5 +24,5 @@
24
24
  "@nocobase/test": "1.x",
25
25
  "react-router-dom": "^6.x"
26
26
  },
27
- "gitHead": "f5d1207519ab2b82db0ced0369ed88e09d09d88b"
27
+ "gitHead": "8a518a9a0354e5e9ea5caa7c45779654fb517f0a"
28
28
  }