node-red-contrib-notification-better 1.2.0

An enhanced notification and dialog node for Node-RED Dashboard supporting exact button casing, preset notification levels, audio alerts, countdown progress bar, and multi-language UI.

npm install node-red-contrib-notification-better

node-red-contrib-notification-better

一個為 Node-RED Dashboard 設計的進階通知(Notification / Toast)與互動對話框(Dialog / Prompt)節點:noti-better。

徹底解決按鈕強制大寫的問題,支援完美暗黑主題相容介面、完整多語言、通知等級色彩、提示音效與倒數進度條!


✨ 核心特色 (Key Features)

  • 🔤 忠實保留按鈕原始大小寫 (Preserve Button Case):
    • 徹底解除 Angular Material 強制全大寫(text-transform: uppercase)的限制。
    • 輸入 Ok 顯示 Ok、輸入 Cancel 顯示 Cancel、輸入 確定 或 Close Now 皆忠實依字樣呈現!
  • 🌓 完美相容深色 / 淺色主題 (Dark & Light Theme Friendly):
    • 表單標題與排版無縫融入 Node-RED 介面,在暗黑模式下無突兀白底,文字清晰舒適。
  • 🛡️ 雙重多語言防呆機制 (Robust i18n & Fallback):
    • 完整支援 繁體中文 (zh-TW)、English (en-US)、日本語 (ja)、簡體中文 (zh-CN)。
    • 所有表單欄位與畫布標籤皆內嵌完整的預設降級文字,即使語系載入延遲也絕不出現空白或程式代碼字樣。
  • 🎯 五種通知等級預設 (Notification Levels):
    • 內建 Info (資訊)、Success (成功)、Warning (警告)、Error (錯誤) 與 Default (預設)。
    • 自動套用專屬主題色彩與外框線,亦可透過 msg.notificationType 動態切換。
  • 🔔 圖示支援 (Icon Support):
    • 自動根據通知等級配對 Font Awesome 圖示,亦可手動填寫或透過 msg.icon 自訂圖示。
  • 🔊 音效提示 (Audio Chime Alert):
    • 內建 Web Audio API 音效合成技術,無須外掛任何音訊檔案,勾選或由 msg.playSound: true 觸發即可發出清脆提示聲。
  • ⏳ 倒數進度條 (Countdown Progress Bar):
    • 在卡片底部以視覺化動態進度條呈現剩餘時間,何時關閉一目了然。
  • 💬 互動式對話框與輸入框 (Dialog & Prompt):
    • 支援確認 / 取消對話框,以及帶輸入框的 Prompt 模式,支援自訂預設值與 Placeholder。
  • 🚀 原生 HTML 與 JavaScript 支援:
    • 可勾選開啟,直接在通知內容中渲染自訂 HTML、動畫或樣式。

📦 安裝方式 (Installation)

依賴需求 (Prerequisites)

此節點搭配 node-red-dashboard 使用,請先確保已安裝 Dashboard 套件:

npm install node-red-dashboard

透過 Node-RED 調色盤管理員安裝 (推薦)

  1. 開啟 Node-RED 編輯器。
  2. 點擊右上角漢堡選單 ➔ 節點管理 (Manage palette) ➔ 安裝 (Install)。
  3. 搜尋 node-red-contrib-notification-better 並點選安裝。

透過 npm 命令列安裝

進入您的 Node-RED 使用者目錄(通常為 ~/.node-red):

cd ~/.node-red
npm install node-red-contrib-notification-better

🛠️ 使用與訊息屬性說明 (Message Properties)

安裝完成後,會在左側節點列表(Palette)的 dashboard 分類中顯示 noti-better 節點。

支援的輸入訊息屬性 (Inputs)

屬性名稱 型別 預設來源 說明
msg.payload string | object 必填 通知的內文訊息。若開啟原始 HTML 模式,將忠實解析標籤。
msg.topic / msg.title string 可選 通知的頂部標題。
msg.notificationType string 可選 通知等級:info、success、warning、error 或 default。
msg.timeout number 可選 顯示秒數(例如 5 代表 5 秒;設為 0 則立即消失)。
msg.ok string 可選 確認按鈕標籤文字(大小寫忠實保留)。
msg.cancel string 可選 取消按鈕標籤文字(大小寫忠實保留)。
msg.highlight / msg.border string 可選 外框高亮顏色(例如 #4CAF50 或 red)。
msg.icon string 可選 自訂 Font Awesome 圖示名稱(例如 fa-bell 或 fa-check)。
msg.playSound boolean 可選 是否在此次通知觸發時播放提示音效。
msg.position string 可選 覆蓋顯示位置(如 top right、dialog、prompt 等)。
msg.className string 可選 附加自訂 CSS 類別名稱。
msg.socketid string 可選 當關閉廣播所有連線時,指定特定使用者之 Socket ID。

輸出訊息 (Outputs)

當佈局選擇 Dialog (對話框) 或 Prompt (文字輸入框) 時:

  • 使用者點擊按鈕或送出輸入文字後,結果將由節點輸出點送出(確認按鈕輸出 msg.ok 或輸入文字;取消按鈕輸出 msg.cancel)。

📄 授權 (License)

MIT

Node Info

Version: 1.2.0
Updated 6 days ago
License: MIT
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • noti-better

Keywords

  • node-red
  • node-red-dashboard
  • notification
  • toast
  • dialog
  • prompt
  • alert
  • noti-better
  • ui

Maintainers