@fieldia/chatter
v0.20.0
Published
A record's conversation and to-dos beside its Fieldia form: messages, notes, attachments, activities and followers, through an interface your app implements.
Readme
@fieldia/chatter
A record's conversation and to-dos beside its Fieldia form: messages to its followers, notes for the team, files, reactions, replies, @mentions, activities and followers. Plain DOM, so it works the same in plain JavaScript, React, Vue and Angular.
npm install @fieldia/chatterimport { mountViewer } from '@fieldia/viewer';
import { chatterSlot } from '@fieldia/chatter';
mountViewer(host, { page, dataSource, recordId: 7, slots: { chatter: chatterSlot({ source }) } });A sheet whose sidePanel is the slot chatter shows it beside the record. It
waits while the record is new, starts once it is saved, and fetches again
after each save. On its own: mountChatter(element, { source, record: { model, id } }).
The chatter reaches your server only through a source you write for your
backend, as you write a data source. messages and post are all it needs;
each other method adds a part — upload, react, people (mentions,
assignees, followers), activityTypes / activities / schedule / markDone
/ cancel, followers / follow / unfollow — and a part whose method is
missing is not shown. createMemoryChatter keeps everything in memory, for
demos and tests.
A record's history, as a work item's History tab shows it, fills a slot of
its own from the same source: historySlot({ source, stateField: 'state',
reasonField: 'reason', kind: 'work item' }). The State Graph shows how the
state moved and why; under it, each change grouped by age, the one chosen
beside the list with its new values and those they replaced.
Message HTML is cleaned before it is shown; what people type is posted as escaped text. MIT.
