匯入

import-scheduler.ts
import { NuiScheduler, type NuiSchedulerEvent } from '@needless-ui/angular/scheduler';

NuiScheduler

依月、週、日、活動列表或時間軸顯示的活動。

選擇器
nui-scheduler
匯出為
nuiScheduler
NuiScheduler: 屬性
名稱型別預設值說明
events輸入NuiSchedulerEvent<T>[][]要顯示的活動。
resources輸入NuiSchedulerResource[][]會議室、人員或設備:時間軸的列,以及日檢視和週檢視的欄。
view雙向繫結'month' | 'week' | 'day' | 'agenda' | 'timeline''week'目前顯示的檢視。
views輸入NuiSchedulerView[]all使用者可以切換的檢視。預設為全部檢視,其中時間軸只在有資源時提供。
timelineSpan輸入'day' | 'week' | 'month''day'時間軸顯示的範圍:按時段顯示一天,或按日顯示一週或一個月。
date雙向繫結NuiDatetoday顯示的日期,也是鍵盤焦點所在的日期。
slotMinutes輸入number30時間網格每列的分鐘數,或單日時間軸每欄的分鐘數。
snapMinutes輸入numberslotMinutes活動移動和調整時間長度的間隔。
dayStart, dayEnd輸入number0, 24時間網格顯示的起訖時間。
scrollHour輸入number8時間網格開啟時捲動到的小時。
agendaDays輸入number30活動列表往後顯示的天數。
businessHours輸入NuiSchedulerHours[]工作時間,例如 { days: [1, 2, 3, 4, 5], start: '09:00', end: '17:00' }。其他時間會以灰底標示。
weekends輸入booleantrue顯示週末。關閉時,所有檢視都會省略地區設定中的週末。
weekNumbers輸入booleanfalse在月檢視中和時間欄上方顯示 ISO 週數。
editable輸入booleanfalse可以用指標和鍵盤移動活動及調整時間長度。
selectable輸入booleanfalse可以在網格上選取時間,用來建立活動。
allow輸入(time) => boolean決定移動、調整時間長度或選取時間能否進行。
toolbar輸入booleantrue顯示工具列。關閉時可以自己打造工具列。
firstDay輸入1 … 7一週的第一天,1 代表星期一。預設依循地區設定。
headingLevel輸入number2標題的層級;活動列表中各天的標題再低一層。
locale輸入stringLOCALE_ID用來格式化日期和時間。
labels輸入Partial<NuiSchedulerLabels>行事曆顯示或朗讀的所有文字,供翻譯使用。
corners輸入NuiCorners邊角的形狀:round、squircle、bevel、scoop、notch 或 square。
radius輸入NuiRadius邊角的大小:none、small、medium、large 或 full。
density輸入NuiDensity佔用的空間:compact、regular 或 roomy。
eventClick輸出NuiSchedulerEvent<T>發出被點選或按 Enter 鍵開啟的活動。
eventChange輸出{ event, start, end, resource? }移動活動或調整時間長度後,發出活動的新時間;資源有變更時,也會發出新的資源。
slotSelect輸出{ start, end, allDay, resource? }發出在網格上選取的時間及其資源。
rangeChange輸出{ start, end }顯示的第一天和最後一天變更時,發出這兩天。
previous, next, goToday方法() => void顯示上一頁、下一頁或今天,供自訂的工具列使用。
title屬性Signal<string>目前顯示的內容,說法和工具列的標題相同。

用於客製化的輸入屬性如果未設定,會沿用最近的 data-nui-* 屬性。詳見客製化指南。

NuiSchedulerEvent

一個活動。有具體時間的活動不包含結束時刻;全天活動的結束日期就是它的最後一天。

NuiSchedulerEvent: 屬性
名稱型別預設值說明
id, title屬性string它的鍵值,以及顯示的內容。
start, end屬性NuiDateTime | NuiDate日期和時間;全天活動只用日期。
allDay屬性boolean預設取決於 start 是否不含時間。
tone屬性'accent' | 'neutral' | 'success' | 'warning' | 'danger''accent'它的配色。
color, class屬性string任何 CSS 顏色(優先於配色),以及用來設定樣式的類別。
resource屬性string | string[]它所屬的資源。
rrule屬性stringRFC 5545 的重複規則,例如 FREQ=WEEKLY;BYDAY=MO。
exdate屬性string[]不會發生的各次活動的開始時間。
recurrenceId屬性NuiDateTime | NuiDate出現在行事曆回報的單次活動上:規則為它排定的開始時間。
editable屬性boolean無論行事曆如何設定,它能否被移動。
data屬性T需要和它一起保存的其他資料。

NuiSchedulerResource

活動所屬的會議室、人員或設備。

NuiSchedulerResource: 屬性
名稱型別預設值說明
id, title屬性string它的鍵值,以及顯示的名稱。
tone, color屬性NuiSchedulerTone, string其活動的顏色,除非活動有自己的顏色。
businessHours屬性NuiSchedulerHours[]它的可用時間,用來取代行事曆的工作時間。
data屬性R需要和它一起保存的其他資料。

NuiSchedulerEventTemplate

繪製活動。其 context 包含活動,以及文字形式的時間。

選擇器
ng-template[nuiSchedulerEvent]

NuiSchedulerResourceTemplate

繪製資源的標題。其 context 包含資源。

選擇器
ng-template[nuiSchedulerResource]

Helpers

處理週期性活動和 iCalendar 檔案的函式。

Helpers: 屬性
名稱型別預設值說明
nuiSchedulerOccurrences方法(event, first, last) => NuiSchedulerEvent[]活動在指定日期中的顯示方式:週期性活動會展開為其中的每一次。
nuiSchedulerRule方法(text: string) => NuiSchedulerRule | null解析重複規則,無法解析時傳回 null。
nuiSchedulerToIcs方法(events, options?) => string把活動寫成 iCalendar 檔案。
nuiSchedulerFromIcs方法(text, { timeZone? }) => NuiSchedulerEvent[]讀取 iCalendar 檔案中的活動,並把時間統一到同一個時區。