I personally would keep a healthy professional distance from anybody who feels the need to behave that way in the workplace, particularly when they are doing that. As much as companies try to convince you, your coworkers are not your family. You cannot and should not be expected to provide emotional support to coworkers who are not your friends.
Behind closed doors with my manager, however, I would be asking about them and their situation. Is there something the company can do to make their lives easier? If there is a practical solution to the person’s problems, such a thing can only boost morale, not just in the department, but also across the whole company.
But hard experience has taught me that there often isn’t a practical solution to the problem. And companies are only set up to provide practical solutions. People that work in companies don’t do it for the emotional support, they do it for the money. And the money is often more important than the emotional problems.
You don’t want to be mean to the person by telling them to shut up or whatever. But it’s not really okay to dump out all of your emotional problems on the people around you. We had such a person at my last job. I was friendly, warm, cordial to her when I could. I asked and found out what she was dealing with. Once I’d verified that there wasn’t really anything I could do, that’s just how I settled on handling it. With kid gloves from a distance.
Nobody can fix anything and everything. As the saying goes, God grant me the courage to change what I can, the serenity to leave what I can’t, and the wisdom to know the difference.