rowvia 0.2.3 → 0.3.0
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.
- package/README.md +29 -9
- package/dist/fields.css +1 -0
- package/dist/fields.es.js +1913 -0
- package/dist/fields.umd.cjs +1 -0
- package/dist/rowvia.css +1 -1
- package/dist/rowvia.es.js +10659 -10122
- package/dist/rowvia.umd.cjs +84 -103
- package/dist/types/api.d.ts +1 -1
- package/dist/types/components/cells.d.ts +25 -0
- package/dist/types/components/detailDialog.d.ts +7 -1
- package/dist/types/components/scrollbars.d.ts +10 -0
- package/dist/types/contracts/work-item.d.ts +335 -0
- package/dist/types/core/clientSideRowModel.d.ts +1 -2
- package/dist/types/core/columnModel.d.ts +2 -2
- package/dist/types/core/gridHost.d.ts +365 -0
- package/dist/types/core/remoteRowModels.d.ts +2 -10
- package/dist/types/core/rowNode.d.ts +1 -2
- package/dist/types/core/valueService.d.ts +1 -1
- package/dist/types/createGrid.d.ts +10 -0
- package/dist/types/features/chartService.d.ts +2 -11
- package/dist/types/features/columnMenu.d.ts +1 -1
- package/dist/types/features/contextMenu.d.ts +2 -13
- package/dist/types/features/editService.d.ts +3 -8
- package/dist/types/features/exportService.d.ts +3 -2
- package/dist/types/features/filterGui.d.ts +1 -1
- package/dist/types/features/filterService.d.ts +2 -14
- package/dist/types/features/findService.d.ts +1 -1
- package/dist/types/features/formulaEditor.d.ts +1 -1
- package/dist/types/features/notesService.d.ts +1 -5
- package/dist/types/features/overlays.d.ts +1 -1
- package/dist/types/features/paginationService.d.ts +1 -2
- package/dist/types/features/popupService.d.ts +1 -1
- package/dist/types/features/rangeSelection.d.ts +1 -8
- package/dist/types/features/rowDragService.d.ts +1 -1
- package/dist/types/features/rowGroupPanel.d.ts +1 -1
- package/dist/types/features/selectionService.d.ts +1 -1
- package/dist/types/features/sideBar.d.ts +2 -5
- package/dist/types/features/sortService.d.ts +1 -1
- package/dist/types/features/statusBar.d.ts +2 -3
- package/dist/types/features/undoRedoService.d.ts +2 -9
- package/dist/types/fields/attachment-control.d.ts +2 -0
- package/dist/types/fields/base-field.d.ts +62 -0
- package/dist/types/fields/cascade-control.d.ts +3 -0
- package/dist/types/fields/choice-control.d.ts +8 -0
- package/dist/types/fields/composite-control.d.ts +3 -0
- package/dist/types/fields/controls.d.ts +19 -0
- package/dist/types/{pages/work-items → fields}/date-control.d.ts +1 -1
- package/dist/types/fields/field-types.d.ts +114 -0
- package/dist/types/fields/index.d.ts +8 -0
- package/dist/types/fields/internal/dom.d.ts +1 -0
- package/dist/types/fields/internal/focus-boundary.d.ts +7 -0
- package/dist/types/fields/internal/interaction.d.ts +23 -0
- package/dist/types/fields/internal/lifecycle.d.ts +12 -0
- package/dist/types/fields/internal/textarea.d.ts +1 -0
- package/dist/types/fields/location-control.d.ts +3 -0
- package/dist/types/fields/popup.d.ts +38 -0
- package/dist/types/{pages/work-items → fields}/rich-control.d.ts +1 -1
- package/dist/types/fields/text-control.d.ts +3 -0
- package/dist/types/fields/types.d.ts +185 -0
- package/dist/types/fields/value-control.d.ts +12 -0
- package/dist/types/fields/vote-control.d.ts +2 -0
- package/dist/types/forms/form-conditions.d.ts +29 -0
- package/dist/types/forms/form-surface.d.ts +13 -0
- package/dist/types/gantt/component.d.ts +5 -4
- package/dist/types/gantt/ganttChart.d.ts +7 -7
- package/dist/types/gantt/index.d.ts +3 -3
- package/dist/types/gantt/scale.d.ts +18 -0
- package/dist/types/grid.d.ts +21 -17
- package/dist/types/index.d.ts +19 -20
- package/dist/types/node-flow/canvas.d.ts +26 -0
- package/dist/types/node-flow/card.d.ts +23 -0
- package/dist/types/node-flow/cardSections.d.ts +14 -0
- package/dist/types/node-flow/component.d.ts +9 -0
- package/dist/types/node-flow/contextBar.d.ts +20 -0
- package/dist/types/node-flow/demo.d.ts +6 -0
- package/dist/types/node-flow/index.d.ts +13 -0
- package/dist/types/node-flow/model.d.ts +48 -0
- package/dist/types/node-flow/timeline.d.ts +16 -0
- package/dist/types/node-flow/types.d.ts +220 -0
- package/dist/types/personnel/component.d.ts +3 -2
- package/dist/types/personnel/index.d.ts +1 -1
- package/dist/types/personnel/render.d.ts +22 -0
- package/dist/types/render/headerView.d.ts +1 -1
- package/dist/types/render/rowComponent.d.ts +29 -0
- package/dist/types/render/rowContext.d.ts +39 -0
- package/dist/types/render/rowRenderer.d.ts +6 -73
- package/dist/types/shared/dom.d.ts +1 -0
- package/dist/types/shared/interaction.d.ts +1 -0
- package/dist/types/shared/lifecycle.d.ts +1 -0
- package/dist/types/shared/markup.d.ts +5 -0
- package/dist/types/shared/state.d.ts +5 -0
- package/dist/types/types.d.ts +3 -2
- package/dist/types/work-items/action-surface.d.ts +17 -0
- package/dist/types/work-items/detail/detail-header.d.ts +23 -0
- package/dist/types/work-items/fields/control-base.d.ts +17 -0
- package/dist/types/work-items/fields/focus-editor.d.ts +3 -0
- package/dist/types/work-items/fields/registry.d.ts +5 -0
- package/dist/types/work-items/index.d.ts +19 -0
- package/dist/types/work-items/layers.d.ts +19 -0
- package/dist/types/work-items/model.d.ts +10 -0
- package/dist/types/work-items/selection-bar.d.ts +7 -0
- package/dist/types/work-items/style-scope.d.ts +1 -0
- package/dist/types/work-items/table/column-panels.d.ts +39 -0
- package/dist/types/work-items/table/columns.d.ts +28 -0
- package/dist/types/work-items/table/headers.d.ts +10 -0
- package/dist/types/work-items/table/table.d.ts +10 -0
- package/dist/types/work-items/tabs.d.ts +14 -0
- package/dist/types/work-items/toolbar.d.ts +11 -0
- package/dist/types/work-items/views/rule-panels.d.ts +28 -0
- package/package.json +24 -6
- package/dist/types/pages/finance/component.d.ts +0 -2
- package/dist/types/pages/finance/data.d.ts +0 -14
- package/dist/types/pages/hr/component.d.ts +0 -2
- package/dist/types/pages/hr/data.d.ts +0 -21
- package/dist/types/pages/index.d.ts +0 -12
- package/dist/types/pages/inventory/component.d.ts +0 -2
- package/dist/types/pages/inventory/data.d.ts +0 -26
- package/dist/types/pages/lifecycle.d.ts +0 -24
- package/dist/types/pages/performance/component.d.ts +0 -2
- package/dist/types/pages/performance/data.d.ts +0 -33
- package/dist/types/pages/server-side/component.d.ts +0 -2
- package/dist/types/pages/work-items/config.d.ts +0 -71
- package/dist/types/pages/work-items/controls.d.ts +0 -34
- package/dist/types/pages/work-items/model.d.ts +0 -72
- package/dist/types/pages/work-items/page.d.ts +0 -24
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type InteractionOptions, type InteractionSource } from '../shared/interaction';
|
|
1
2
|
import type { GridApi } from '../types';
|
|
2
|
-
import { GanttChart } from './ganttChart';
|
|
3
|
-
import type { GanttUnit } from './ganttChart';
|
|
4
3
|
import type { GanttTask, TeamMember } from './data';
|
|
5
|
-
|
|
4
|
+
import type { GanttUnit } from './ganttChart';
|
|
5
|
+
import { GanttChart } from './ganttChart';
|
|
6
|
+
export interface GanttOptions extends InteractionOptions {
|
|
6
7
|
tasks: GanttTask[];
|
|
7
8
|
members?: TeamMember[];
|
|
8
9
|
title?: string;
|
|
@@ -12,7 +13,7 @@ export interface GanttOptions {
|
|
|
12
13
|
/** Overrides the built-in text detail dialog when provided. */
|
|
13
14
|
onTaskOpen?: (task: GanttTask) => void;
|
|
14
15
|
}
|
|
15
|
-
export interface GanttApi {
|
|
16
|
+
export interface GanttApi extends InteractionSource {
|
|
16
17
|
grid: GridApi;
|
|
17
18
|
chart: GanttChart;
|
|
18
19
|
setTasks(tasks: GanttTask[]): void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { observeInteractions, type InteractionOptions } from '../shared/interaction';
|
|
1
2
|
import type { GanttTask, TeamMember } from './data';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare const UNIT_LABEL: Record<GanttUnit, string>;
|
|
3
|
+
import { type GanttTheme, type GanttUnit } from './scale';
|
|
4
|
+
export { GANTT_UNITS, UNIT_LABEL } from './scale';
|
|
5
|
+
export type { GanttTheme, GanttUnit } from './scale';
|
|
6
6
|
export interface ChartRow {
|
|
7
7
|
id: string;
|
|
8
8
|
group: boolean;
|
|
9
9
|
expanded: boolean;
|
|
10
10
|
}
|
|
11
|
-
export interface GanttChartOptions {
|
|
11
|
+
export interface GanttChartOptions extends InteractionOptions {
|
|
12
12
|
members: TeamMember[];
|
|
13
13
|
rowHeight: number;
|
|
14
14
|
onSelect: (id: string | null) => void;
|
|
@@ -17,6 +17,8 @@ export interface GanttChartOptions {
|
|
|
17
17
|
onAssign: (id: string, memberId: string | null) => void;
|
|
18
18
|
}
|
|
19
19
|
export declare class GanttChart {
|
|
20
|
+
private interactions;
|
|
21
|
+
onInteraction: ReturnType<typeof observeInteractions>['onInteraction'];
|
|
20
22
|
private options;
|
|
21
23
|
private eRoot;
|
|
22
24
|
private eHeader;
|
|
@@ -79,7 +81,6 @@ export declare class GanttChart {
|
|
|
79
81
|
scrollToToday(fraction?: number): void;
|
|
80
82
|
private computeDomain;
|
|
81
83
|
private dateX;
|
|
82
|
-
private xToDate;
|
|
83
84
|
private resizeCanvases;
|
|
84
85
|
private tick;
|
|
85
86
|
private onScroll;
|
|
@@ -96,7 +97,6 @@ export declare class GanttChart {
|
|
|
96
97
|
private drawBars;
|
|
97
98
|
private drawTaskBar;
|
|
98
99
|
private drawSummaryBar;
|
|
99
|
-
private firstVisibleChildIndex;
|
|
100
100
|
private drawMilestone;
|
|
101
101
|
private pushHit;
|
|
102
102
|
private drawLocateButtons;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createGantt } from './component';
|
|
2
2
|
export type { GanttApi, GanttOptions } from './component';
|
|
3
|
-
export type { GanttTask,
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
3
|
+
export type { GanttTask, TaskKind, TaskStatus, TeamMember } from './data';
|
|
4
|
+
export { GANTT_UNITS, GanttChart, UNIT_LABEL } from './ganttChart';
|
|
5
|
+
export type { GanttTheme, GanttUnit } from './ganttChart';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type GanttUnit = 'day' | 'week' | 'biweek' | 'month' | 'bimonth' | 'quarter' | 'halfyear' | 'year';
|
|
2
|
+
export type GanttTheme = 'content' | 'color';
|
|
3
|
+
export declare const GANTT_UNITS: GanttUnit[];
|
|
4
|
+
export declare const UNIT_LABEL: Record<GanttUnit, string>;
|
|
5
|
+
/** px per day at zoom 1 — smaller units need a denser canvas */
|
|
6
|
+
export declare const UNIT_BASE: Record<GanttUnit, number>;
|
|
7
|
+
/** Monday-based index of the week containing date */
|
|
8
|
+
export declare function weekStart(date: Date): Date;
|
|
9
|
+
/** business days between two dates, inclusive of the start day */
|
|
10
|
+
export declare function workDaysBetween(from: Date, to: Date): number;
|
|
11
|
+
export interface RulerCell {
|
|
12
|
+
start: Date;
|
|
13
|
+
end: Date;
|
|
14
|
+
primary: string;
|
|
15
|
+
secondary: string;
|
|
16
|
+
}
|
|
17
|
+
/** cells of the given unit covering [from, to) */
|
|
18
|
+
export declare function rulerCells(unit: GanttUnit, from: Date, to: Date): RulerCell[];
|
package/dist/types/grid.d.ts
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import type { Column, ColumnApi, GridApi, GridOptions, RowDataTransaction, RowNode, RowNodeTransactionResult } from './types';
|
|
2
|
-
import { EventService } from './core/eventService';
|
|
3
|
-
import { ColumnModel } from './core/columnModel';
|
|
4
1
|
import { RowModel } from './core/clientSideRowModel';
|
|
2
|
+
import { ColumnModel } from './core/columnModel';
|
|
3
|
+
import { EventService } from './core/eventService';
|
|
4
|
+
import type { GridHost } from './core/gridHost';
|
|
5
5
|
import { InfiniteRowModel, ServerSideRowModel, ViewportRowModel } from './core/remoteRowModels';
|
|
6
|
-
import {
|
|
7
|
-
import { HeaderView } from './render/headerView';
|
|
8
|
-
import { SelectionService } from './features/selectionService';
|
|
6
|
+
import { ChartService } from './features/chartService';
|
|
9
7
|
import { EditService } from './features/editService';
|
|
8
|
+
import { ExportService } from './features/exportService';
|
|
9
|
+
import { FilterGui } from './features/filterGui';
|
|
10
10
|
import { FilterService } from './features/filterService';
|
|
11
|
-
import {
|
|
11
|
+
import { FindService } from './features/findService';
|
|
12
|
+
import { FormulaEditorService } from './features/formulaEditor';
|
|
13
|
+
import { NotesService } from './features/notesService';
|
|
14
|
+
import { OverlayService } from './features/overlays';
|
|
12
15
|
import { PaginationService } from './features/paginationService';
|
|
13
16
|
import { PopupService } from './features/popupService';
|
|
14
|
-
import { FilterGui } from './features/filterGui';
|
|
15
|
-
import { SideBarService } from './features/sideBar';
|
|
16
|
-
import { FindService } from './features/findService';
|
|
17
17
|
import { RangeSelectionService } from './features/rangeSelection';
|
|
18
|
-
import {
|
|
19
|
-
import { OverlayService } from './features/overlays';
|
|
20
|
-
import { ExportService } from './features/exportService';
|
|
18
|
+
import { RowDragService } from './features/rowDragService';
|
|
21
19
|
import { RowGroupPanel } from './features/rowGroupPanel';
|
|
20
|
+
import { SelectionService } from './features/selectionService';
|
|
21
|
+
import { SideBarService } from './features/sideBar';
|
|
22
|
+
import { SortService } from './features/sortService';
|
|
22
23
|
import { UndoRedoService } from './features/undoRedoService';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
24
|
+
import { HeaderView } from './render/headerView';
|
|
25
|
+
import { RowRenderer } from './render/rowRenderer';
|
|
26
|
+
import { observeInteractions } from './shared/interaction';
|
|
27
|
+
import type { Column, ColumnApi, GridApi, GridOptions, RowDataTransaction, RowNode, RowNodeTransactionResult } from './types';
|
|
28
|
+
export declare class Grid implements GridHost {
|
|
29
|
+
private interactions;
|
|
30
|
+
onInteraction: ReturnType<typeof observeInteractions>['onInteraction'];
|
|
27
31
|
private options;
|
|
28
32
|
private eventService;
|
|
29
33
|
private columnModel;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { Grid } from './grid';
|
|
2
|
-
import type { GridOptions, GridApi, ColumnApi } from './types';
|
|
3
|
-
import { CELL_RENDERERS, CELL_EDITORS } from './render/cellRenderers';
|
|
4
|
-
import { createSparklineSvg } from './render/cellRenderers';
|
|
5
1
|
import { formatNumberCommas } from './core/utils';
|
|
2
|
+
import { Grid } from './grid';
|
|
3
|
+
import { CELL_EDITORS, CELL_RENDERERS, createSparklineSvg } from './render/cellRenderers';
|
|
4
|
+
export type { AggFunc, CellClassParams, CellRange, CellRendererParams, ColDef, Column, ColumnApi, ColumnState, ExportParams, FilterModelItem, GridApi, GridOptions, ICellEditor, ICellRenderer, RowDataTransaction, RowNode, SideBarDef, SortModelItem, StatusPanelDef, ValueFormatterParams, ValueGetterParams } from './types';
|
|
6
5
|
export { Grid };
|
|
7
|
-
export
|
|
8
|
-
/**
|
|
9
|
-
* Create a grid inside the given element. Mirrors ag-grid's createGrid().
|
|
10
|
-
*/
|
|
11
|
-
export declare function createGrid(eGridDiv: HTMLElement, gridOptions: GridOptions): {
|
|
12
|
-
api: GridApi;
|
|
13
|
-
columnApi: ColumnApi;
|
|
14
|
-
grid: Grid;
|
|
15
|
-
};
|
|
6
|
+
export { createGrid } from './createGrid';
|
|
16
7
|
/** Register custom cell renderers / editors (ag-grid module-style registry). */
|
|
17
8
|
export declare function registerRenderer(name: string, factory: (params: any) => any): void;
|
|
18
9
|
export declare function registerEditor(name: string, factory: (params: any) => any): void;
|
|
19
|
-
export {
|
|
20
|
-
export { computeStickyGroupRows } from './render/stickyGroupRows';
|
|
21
|
-
export { DEFAULT_LOCALE_TEXT } from './core/localeText';
|
|
22
|
-
export { evaluateFormula, isFormula, tokenize, parse, FORMULA_FUNCTIONS, registerFormulaFunction } from './core/formulaEngine';
|
|
10
|
+
export { evaluateFormula, FORMULA_FUNCTIONS, isFormula, parse, registerFormulaFunction, tokenize } from './core/formulaEngine';
|
|
23
11
|
export type { FormulaContext, FormulaValue } from './core/formulaEngine';
|
|
12
|
+
export { DEFAULT_LOCALE_TEXT } from './core/localeText';
|
|
13
|
+
export { computeStickyGroupRows } from './render/stickyGroupRows';
|
|
14
|
+
export { CELL_EDITORS, CELL_RENDERERS, createSparklineSvg, formatNumberCommas };
|
|
24
15
|
export default Grid;
|
|
16
|
+
export { createDetailDialog } from './components/detailDialog';
|
|
17
|
+
export type { DetailDialogContent, DetailDialogOptions } from './components/detailDialog';
|
|
25
18
|
export * from './gantt';
|
|
19
|
+
export * from './node-flow';
|
|
26
20
|
export * from './personnel';
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
21
|
+
export * from './work-items';
|
|
22
|
+
export { createControlRegistry, BaseFieldControl, sanitizeRichText } from './work-items/fields/registry';
|
|
23
|
+
export { createWorkItemFormSurface, evalFormCondition, evalFormScope } from './forms/form-surface';
|
|
24
|
+
export type { ComponentInteraction, InteractionOptions, InteractionSource } from './shared/interaction';
|
|
25
|
+
export { createTagCell, createMediaCell } from './components/cells';
|
|
26
|
+
export type { TagCellOptions, MediaCellOptions } from './components/cells';
|
|
27
|
+
export { BaseField, renderContent, createFieldRegistry, CustomField, TextField, NumberField, RichTextField, TextareaField, ChoiceField, MultiChoiceField, PersonField, MultiPersonField, RelationField, MultiRelationField, RadioField, CascadeField, MultiCascadeField, DateTimeField, DateField, DateRangeField, SwitchField, AttachmentField, LocationField, VoteField, SingleVoteField, MultiVoteField, ComputedField, SignalField, CompositeField, LinkField, EmailField, PhoneField, ActionField } from './fields/index';
|
|
28
|
+
export type { FieldDefinition, FieldOptions, FieldState, FieldContent, FieldView, FieldSnapshot, FieldEvent, FieldListener, FieldRenderContext, FieldRenderer } from './fields/index';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type InteractionOptions, type InteractionSource } from '../shared/interaction';
|
|
2
|
+
import type { FlowDefinition } from './types';
|
|
3
|
+
export interface FlowCanvasOptions extends InteractionOptions {
|
|
4
|
+
flow: FlowDefinition;
|
|
5
|
+
selectedNodeId?: string;
|
|
6
|
+
query?: string;
|
|
7
|
+
onSelectNode?: (nodeId: string) => void;
|
|
8
|
+
onZoomChange?: (zoom: number) => void;
|
|
9
|
+
/** 未命中「节点显示条件」的节点占位说明 */
|
|
10
|
+
hiddenHints?: {
|
|
11
|
+
name: string;
|
|
12
|
+
reason: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export interface FlowCanvasApi extends InteractionSource {
|
|
16
|
+
update(options: Partial<FlowCanvasOptions>): void;
|
|
17
|
+
focusNode(nodeId: string): void;
|
|
18
|
+
fit(): void;
|
|
19
|
+
getZoom(): number;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* ② 流程画布:分组(含并行段)、节点信息展示、缩放与定位。
|
|
24
|
+
* 对应配置:节点流水线设计(分组)、流程图信息显示、节点显示条件、里程碑。
|
|
25
|
+
*/
|
|
26
|
+
export declare function createFlowCanvas(container: HTMLElement, options: FlowCanvasOptions): FlowCanvasApi;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type InteractionOptions, type InteractionSource } from '../shared/interaction';
|
|
2
|
+
import type { FlowNode, GateCondition } from './types';
|
|
3
|
+
export interface NodeCardOptions extends InteractionOptions {
|
|
4
|
+
node?: FlowNode | null;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
/** 返回 false 阻止默认完成行为 */
|
|
7
|
+
onComplete?: (nodeId: string, gates: GateCondition[]) => boolean | void;
|
|
8
|
+
onAction?: (action: string, nodeId: string) => void;
|
|
9
|
+
onFieldChange?: (nodeId: string, fieldId: string, value: string) => void;
|
|
10
|
+
onFormChange?: (nodeId: string, formId: string, value: string) => void;
|
|
11
|
+
onTaskToggle?: (nodeId: string, taskId: string, done: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface NodeCardApi extends InteractionSource {
|
|
14
|
+
update(node: FlowNode | null, options?: Partial<NodeCardOptions>): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ③ 节点操作卡:身份与操作、通行条件、字段、表单、子任务、事件。
|
|
19
|
+
* 对应配置:节点核心规则、节点流转规则、节点子项管理、节点事件触发。
|
|
20
|
+
*/
|
|
21
|
+
export declare function createNodeCard(container: HTMLElement, options: NodeCardOptions): NodeCardApi;
|
|
22
|
+
/** 字段来源提示,跟随元素定位,2.6s 后自动消失 */
|
|
23
|
+
export declare function showTip(anchor: HTMLElement, text: string): () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FlowNode, GateCondition, NodeField } from './types';
|
|
2
|
+
interface FieldSection {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
fields: NodeField[];
|
|
6
|
+
}
|
|
7
|
+
/** 把节点上的系统字段与自定义字段整理成四个分组 */
|
|
8
|
+
export declare function collectSections(node: FlowNode): FieldSection[];
|
|
9
|
+
export declare function fieldRow(node: FlowNode, field: NodeField, readonly: boolean): string;
|
|
10
|
+
export declare function gateList(gates: GateCondition[]): string;
|
|
11
|
+
export declare function taskTable(node: FlowNode, readonly: boolean): string;
|
|
12
|
+
export declare function formSection(node: FlowNode, readonly: boolean): string;
|
|
13
|
+
export declare function eventSection(node: FlowNode): string;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeFlowApi, NodeFlowOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 节点流程管理面板:上下文条 + 流程画布 + 节点操作卡 + 节点时间线。
|
|
4
|
+
*
|
|
5
|
+
* 对应飞书项目「节点流程配置」的使用端表现。四个区块可以分别独立挂载
|
|
6
|
+
* (createFlowContextBar / createFlowCanvas / createNodeCard / createNodeTimeline),
|
|
7
|
+
* 也可以用本函数整体接入;卸载时调用返回对象的 destroy()。
|
|
8
|
+
*/
|
|
9
|
+
export declare function createNodeFlow(container: HTMLElement, options: NodeFlowOptions): NodeFlowApi;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type InteractionOptions, type InteractionSource } from '../shared/interaction';
|
|
2
|
+
import type { FlowDefinition } from './types';
|
|
3
|
+
export interface FlowContextBarOptions extends InteractionOptions {
|
|
4
|
+
flow: FlowDefinition;
|
|
5
|
+
query?: string;
|
|
6
|
+
onQuery?: (query: string) => void;
|
|
7
|
+
onFocusNode?: (nodeId: string) => void;
|
|
8
|
+
onOpenRules?: () => void;
|
|
9
|
+
onOpenDiff?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface FlowContextBarApi extends InteractionSource {
|
|
12
|
+
update(flow: FlowDefinition, query?: string): void;
|
|
13
|
+
getQuery(): string;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* ① 流程上下文条:流程类型、进度摘要、节点查找、只读规则与模板版本。
|
|
18
|
+
* 对应配置:流程类型管理、查找节点、状态计算规则、预览与保存。
|
|
19
|
+
*/
|
|
20
|
+
export declare function createFlowContextBar(container: HTMLElement, options: FlowContextBarOptions): FlowContextBarApi;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { createFlowCanvas } from './canvas';
|
|
2
|
+
export { createNodeCard, showTip } from './card';
|
|
3
|
+
export { createNodeFlow } from './component';
|
|
4
|
+
export { createFlowContextBar } from './contextBar';
|
|
5
|
+
export { videoFlow } from './demo';
|
|
6
|
+
export { COMPLETION_LABEL, STATUS_META, allGatesMet, escapeHtml, evaluateGates, groupNodes, matchNodes, summarize } from './model';
|
|
7
|
+
export type { FlowSummary, StatusMeta } from './model';
|
|
8
|
+
export { createNodeTimeline } from './timeline';
|
|
9
|
+
export type { FlowCanvasApi, FlowCanvasOptions } from './canvas';
|
|
10
|
+
export type { NodeCardApi, NodeCardOptions } from './card';
|
|
11
|
+
export type { FlowContextBarApi, FlowContextBarOptions } from './contextBar';
|
|
12
|
+
export type { NodeTimelineApi, NodeTimelineOptions } from './timeline';
|
|
13
|
+
export type { ButtonPlacement, ButtonVariant, CompletionMode, CustomButton, FlowDefinition, FlowGroup, FlowNode, FormItem, GateCondition, NodeEvent, NodeEventTrigger, NodeField, NodeFieldType, NodeFlowApi, NodeFlowOptions, NodeStatus, SubTask } from './types';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CompletionMode, FlowDefinition, FlowGroup, GateCondition, NodeStatus, SubTask } from './types';
|
|
2
|
+
export { escapeHtml } from '../core/utils';
|
|
3
|
+
export interface StatusMeta {
|
|
4
|
+
key: NodeStatus;
|
|
5
|
+
label: string;
|
|
6
|
+
className: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const STATUS_META: Record<NodeStatus, StatusMeta>;
|
|
9
|
+
export declare const COMPLETION_LABEL: Record<CompletionMode, string>;
|
|
10
|
+
/** 通行条件清单:系统必填项 + 业务自定义完成流转条件 */
|
|
11
|
+
export declare function evaluateGates(node: {
|
|
12
|
+
owner?: string;
|
|
13
|
+
schedule?: string;
|
|
14
|
+
estimate?: string;
|
|
15
|
+
milestone?: boolean;
|
|
16
|
+
form?: {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
value?: string;
|
|
21
|
+
}[];
|
|
22
|
+
gates?: GateCondition[];
|
|
23
|
+
}): GateCondition[];
|
|
24
|
+
export declare const allGatesMet: (gates: GateCondition[]) => boolean;
|
|
25
|
+
export interface FlowSummary {
|
|
26
|
+
total: number;
|
|
27
|
+
done: number;
|
|
28
|
+
current: number;
|
|
29
|
+
failed: number;
|
|
30
|
+
index: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function summarize(flow: FlowDefinition): FlowSummary;
|
|
33
|
+
/** 组内任务完成度,用于分组标题 x/y */
|
|
34
|
+
export declare function groupProgress(nodes: {
|
|
35
|
+
groupId?: string;
|
|
36
|
+
status: NodeStatus;
|
|
37
|
+
tasks?: SubTask[];
|
|
38
|
+
}[], group: FlowGroup): {
|
|
39
|
+
done: number;
|
|
40
|
+
total: number;
|
|
41
|
+
};
|
|
42
|
+
/** 按 flow.groups 归组,未知分组的节点落入首组,保证流程完整 */
|
|
43
|
+
export declare function groupNodes(flow: FlowDefinition): {
|
|
44
|
+
group: FlowGroup;
|
|
45
|
+
nodes: FlowDefinition['nodes'];
|
|
46
|
+
}[];
|
|
47
|
+
/** 模糊匹配节点名,返回命中的节点 id */
|
|
48
|
+
export declare function matchNodes(flow: FlowDefinition, query: string): Set<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type InteractionOptions, type InteractionSource } from '../shared/interaction';
|
|
2
|
+
import type { FlowDefinition } from './types';
|
|
3
|
+
export interface NodeTimelineOptions extends InteractionOptions {
|
|
4
|
+
flow: FlowDefinition;
|
|
5
|
+
selectedNodeId?: string;
|
|
6
|
+
onSelectNode?: (nodeId: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface NodeTimelineApi extends InteractionSource {
|
|
9
|
+
update(options: Partial<NodeTimelineOptions>): void;
|
|
10
|
+
destroy(): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* ④ 节点时间线:全部节点的只读总览,替代「卡片的列表化副本」。
|
|
14
|
+
* 对应配置:节点进度、排期估分、节点状态与状态计算规则。
|
|
15
|
+
*/
|
|
16
|
+
export declare function createNodeTimeline(container: HTMLElement, options: NodeTimelineOptions): NodeTimelineApi;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { InteractionOptions, InteractionSource } from '../shared/interaction';
|
|
2
|
+
/**
|
|
3
|
+
* 节点流程管理(Node Flow)数据模型。
|
|
4
|
+
*
|
|
5
|
+
* 字段命名对齐飞书项目「节点流程配置」帮助文档:
|
|
6
|
+
* 节点核心规则(展示什么)、节点流转规则(如何完成)、节点子项、节点事件。
|
|
7
|
+
* 业务项目只需构造这份纯数据结构,无需关心渲染细节。
|
|
8
|
+
*/
|
|
9
|
+
/** 节点状态,对应文档「节点流转状态」:未开始 / 进行中 / 已完成 / 未通过 */
|
|
10
|
+
export type NodeStatus = 'pending' | 'inProgress' | 'done' | 'failed';
|
|
11
|
+
/** 完成方式,对应文档「完成方式」:自动完成 / 单人确认(并签) / 多人确认(会签) */
|
|
12
|
+
export type CompletionMode = 'auto' | 'and' | 'or';
|
|
13
|
+
/** 自定义按钮样式,对应文档「按钮样式」:主操作 / 普通操作 / 警告操作 */
|
|
14
|
+
export type ButtonVariant = 'primary' | 'normal' | 'warning';
|
|
15
|
+
/** 按钮展示位置,对应文档「展示位置」:默认展示 / 收起到更多 */
|
|
16
|
+
export type ButtonPlacement = 'inline' | 'more';
|
|
17
|
+
/** 节点事件触发时机,对应文档「节点流转事件」 */
|
|
18
|
+
export type NodeEventTrigger = 'arrive' | 'complete';
|
|
19
|
+
/** 节点字段类型,对应文档「节点字段」 */
|
|
20
|
+
export type NodeFieldType = 'text' | 'number' | 'date' | 'select' | 'radio' | 'progress';
|
|
21
|
+
export interface FlowGroup {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
/** 组内节点是否并行展示(对应文档「节点分组」与并行段) */
|
|
25
|
+
layout?: 'sequence' | 'parallel';
|
|
26
|
+
}
|
|
27
|
+
/** 节点上的一个字段(系统字段或自定义字段) */
|
|
28
|
+
export interface NodeField {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
value?: string;
|
|
32
|
+
/** 必填字段未完成时进入通行条件清单(对应「节点字段必填」) */
|
|
33
|
+
required?: boolean;
|
|
34
|
+
/** 该字段的编辑权限说明,展示在字段的 ⓘ 提示里 */
|
|
35
|
+
permission?: string;
|
|
36
|
+
/** 字段来源,展示为配置溯源提示 */
|
|
37
|
+
source?: string;
|
|
38
|
+
/** 分组键,决定字段落在操作卡的哪一段 */
|
|
39
|
+
group?: 'schedule' | 'progress' | 'conclusion' | 'custom';
|
|
40
|
+
readonly?: boolean;
|
|
41
|
+
/** group === 'progress' 时的进度百分比 */
|
|
42
|
+
percent?: number;
|
|
43
|
+
/** 进度写入方式,对应文档「进度写入方式」 */
|
|
44
|
+
writeMode?: string;
|
|
45
|
+
}
|
|
46
|
+
/** 节点表单(交付物清单),对应文档「完成表单」 */
|
|
47
|
+
export interface FormItem {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
required?: boolean;
|
|
51
|
+
value?: string;
|
|
52
|
+
type?: NodeFieldType;
|
|
53
|
+
options?: string[];
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
/** 关联工作项控件;值为本地工作项 ID 列表(逗号分隔)。 */
|
|
56
|
+
control?: 'workItemSelect';
|
|
57
|
+
visibleWhen?: {
|
|
58
|
+
fieldId: string;
|
|
59
|
+
value: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** 子任务,对应文档「子任务」 */
|
|
63
|
+
export interface SubTask {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
deliverable?: string;
|
|
67
|
+
owner?: string;
|
|
68
|
+
estimate?: string;
|
|
69
|
+
schedule?: string;
|
|
70
|
+
done?: boolean;
|
|
71
|
+
/** 是否作为节点完成必要条件(阻塞项) */
|
|
72
|
+
blocking?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** 完成流转条件,对应文档「完成流转条件」 */
|
|
75
|
+
export interface GateCondition {
|
|
76
|
+
id: string;
|
|
77
|
+
label: string;
|
|
78
|
+
met: boolean;
|
|
79
|
+
/** 未满足时的引导文案 */
|
|
80
|
+
fixLabel?: string;
|
|
81
|
+
detail?: string;
|
|
82
|
+
/** 命中失败时可跳转的视图(对应「生成不符合条件的视图」) */
|
|
83
|
+
viewLink?: string;
|
|
84
|
+
}
|
|
85
|
+
/** 节点事件,对应文档「节点事件触发」 */
|
|
86
|
+
export interface NodeEvent {
|
|
87
|
+
trigger: NodeEventTrigger;
|
|
88
|
+
text: string;
|
|
89
|
+
}
|
|
90
|
+
/** 自定义按钮,对应文档「节点自定义按钮」 */
|
|
91
|
+
export interface CustomButton {
|
|
92
|
+
id: string;
|
|
93
|
+
label: string;
|
|
94
|
+
variant?: ButtonVariant;
|
|
95
|
+
placement?: ButtonPlacement;
|
|
96
|
+
/** 授权操作角色,hover 时展示 */
|
|
97
|
+
roles?: string[];
|
|
98
|
+
hint?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface FlowNode {
|
|
101
|
+
id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
status: NodeStatus;
|
|
104
|
+
groupId?: string;
|
|
105
|
+
/** 对应文档「设为里程碑」 */
|
|
106
|
+
milestone?: boolean;
|
|
107
|
+
/** 里程碑仅可填写截止时间 */
|
|
108
|
+
deadline?: string;
|
|
109
|
+
completionMode?: CompletionMode;
|
|
110
|
+
owner?: string;
|
|
111
|
+
/** 负责人来源,对应文档「节点负责人」三种方式 */
|
|
112
|
+
ownerSource?: string;
|
|
113
|
+
schedule?: string;
|
|
114
|
+
estimate?: string;
|
|
115
|
+
worklog?: string;
|
|
116
|
+
conclusion?: string;
|
|
117
|
+
conclusionOptions?: string[];
|
|
118
|
+
opinion?: string;
|
|
119
|
+
/** 流程图节点右侧统一展示信息(对应「流程图信息显示」) */
|
|
120
|
+
info?: string;
|
|
121
|
+
/** 节点延期标识 */
|
|
122
|
+
delayed?: boolean;
|
|
123
|
+
/** 进度 */
|
|
124
|
+
progress?: number;
|
|
125
|
+
/** 进度写入方式 */
|
|
126
|
+
progressMode?: string;
|
|
127
|
+
/** 前序节点名,用于未开始节点的依赖提示 */
|
|
128
|
+
predecessors?: string[];
|
|
129
|
+
fields?: NodeField[];
|
|
130
|
+
form?: FormItem[];
|
|
131
|
+
tasks?: SubTask[];
|
|
132
|
+
/** 业务自定义的完成流转条件,与系统必填项合并展示 */
|
|
133
|
+
gates?: GateCondition[];
|
|
134
|
+
events?: NodeEvent[];
|
|
135
|
+
buttons?: CustomButton[];
|
|
136
|
+
/** 节点显示条件未命中时的原因(对应「节点显示条件」) */
|
|
137
|
+
hiddenReason?: string;
|
|
138
|
+
/** 授权可完成/回滚的人员(对应「授权操作角色」) */
|
|
139
|
+
actionRoles?: string[];
|
|
140
|
+
/** 允许删除节点的角色(对应「允许删除节点」) */
|
|
141
|
+
deleteRoles?: string[];
|
|
142
|
+
}
|
|
143
|
+
export interface FlowDefinition {
|
|
144
|
+
id: string;
|
|
145
|
+
/** 流程类型名,对应文档「流程类型管理」 */
|
|
146
|
+
name: string;
|
|
147
|
+
groups: FlowGroup[];
|
|
148
|
+
nodes: FlowNode[];
|
|
149
|
+
/** 流程级统一展示字段(整条流程一致,保证横向可比) */
|
|
150
|
+
infoField?: {
|
|
151
|
+
label: string;
|
|
152
|
+
position: 'right' | 'below' | 'none';
|
|
153
|
+
};
|
|
154
|
+
/** 流程模板版本,用于升级模板提示 */
|
|
155
|
+
templateVersion?: string;
|
|
156
|
+
latestTemplateVersion?: string;
|
|
157
|
+
/** 状态计算规则摘要,只读展示(对应「状态计算规则」) */
|
|
158
|
+
statusRules?: string[];
|
|
159
|
+
/** 工作项详情页的流程展示配置,与独立 node-flow 面板分别渲染。 */
|
|
160
|
+
detail?: {
|
|
161
|
+
version?: number;
|
|
162
|
+
tags: {
|
|
163
|
+
id: string;
|
|
164
|
+
label: string;
|
|
165
|
+
color?: string;
|
|
166
|
+
nodeIds?: string[];
|
|
167
|
+
enabled?: boolean;
|
|
168
|
+
tooltip?: string;
|
|
169
|
+
}[];
|
|
170
|
+
switches: {
|
|
171
|
+
id: string;
|
|
172
|
+
label: string;
|
|
173
|
+
checked: boolean;
|
|
174
|
+
nodeIds?: string[];
|
|
175
|
+
}[];
|
|
176
|
+
fields: {
|
|
177
|
+
key: 'owner' | 'schedule' | 'estimate';
|
|
178
|
+
label: string;
|
|
179
|
+
}[];
|
|
180
|
+
menu: ('estimate' | 'group-chat' | 'delete-node')[];
|
|
181
|
+
/** 实例依赖图;控制项隐藏节点后由详情投影重连可见前后节点。 */
|
|
182
|
+
connections?: Record<string, string[]>;
|
|
183
|
+
/** 模块配置和节点实例值分开,两个节点呈现区域共用此配置。 */
|
|
184
|
+
nodes?: Record<string, {
|
|
185
|
+
sections: ('form' | 'tasks')[];
|
|
186
|
+
fields?: {
|
|
187
|
+
key: 'owner' | 'schedule' | 'estimate';
|
|
188
|
+
label: string;
|
|
189
|
+
}[];
|
|
190
|
+
completeLabel?: string;
|
|
191
|
+
deletable?: boolean;
|
|
192
|
+
}>;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export interface NodeFlowSearch {
|
|
196
|
+
query: string;
|
|
197
|
+
}
|
|
198
|
+
export interface NodeFlowOptions extends InteractionOptions {
|
|
199
|
+
flow: FlowDefinition;
|
|
200
|
+
title?: string;
|
|
201
|
+
selectedNodeId?: string;
|
|
202
|
+
/** 只读模式:隐藏所有写操作 */
|
|
203
|
+
readonly?: boolean;
|
|
204
|
+
onSelectNode?: (nodeId: string) => void;
|
|
205
|
+
/** 返回 false 阻止默认完成行为,用于后端校验 */
|
|
206
|
+
onComplete?: (nodeId: string, gates: GateCondition[]) => boolean | void;
|
|
207
|
+
onAction?: (action: string, nodeId: string) => void;
|
|
208
|
+
onFieldChange?: (nodeId: string, fieldId: string, value: string) => void;
|
|
209
|
+
onFormChange?: (nodeId: string, formId: string, value: string) => void;
|
|
210
|
+
onTaskToggle?: (nodeId: string, taskId: string, done: boolean) => void;
|
|
211
|
+
}
|
|
212
|
+
export interface NodeFlowApi extends InteractionSource {
|
|
213
|
+
selectNode(nodeId: string): void;
|
|
214
|
+
getSelectedNode(): FlowNode | null;
|
|
215
|
+
setFlow(flow: FlowDefinition): void;
|
|
216
|
+
updateNode(nodeId: string, patch: Partial<FlowNode>): void;
|
|
217
|
+
/** 定位并滚动到指定节点 */
|
|
218
|
+
focusNode(nodeId: string): void;
|
|
219
|
+
destroy(): void;
|
|
220
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type InteractionOptions, type InteractionSource } from '../shared/interaction';
|
|
1
2
|
import type { ScheduleItem, SchedulePerson } from './model';
|
|
2
|
-
export interface PersonnelScheduleOptions {
|
|
3
|
+
export interface PersonnelScheduleOptions extends InteractionOptions {
|
|
3
4
|
people: SchedulePerson[];
|
|
4
5
|
items: ScheduleItem[];
|
|
5
6
|
today?: string;
|
|
@@ -10,7 +11,7 @@ export interface PersonnelScheduleOptions {
|
|
|
10
11
|
onItemChange?: (item: ScheduleItem) => void;
|
|
11
12
|
onItemOpen?: (item: ScheduleItem) => void;
|
|
12
13
|
}
|
|
13
|
-
export interface PersonnelScheduleApi {
|
|
14
|
+
export interface PersonnelScheduleApi extends InteractionSource {
|
|
14
15
|
setData(people: SchedulePerson[], items: ScheduleItem[]): void;
|
|
15
16
|
getItems(): ScheduleItem[];
|
|
16
17
|
updateItem(id: string, changes: Partial<Omit<ScheduleItem, 'id'>>): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ScheduleItem, SchedulePerson } from './model';
|
|
2
|
+
export interface ScheduleView {
|
|
3
|
+
people: SchedulePerson[];
|
|
4
|
+
items: ScheduleItem[];
|
|
5
|
+
today: string;
|
|
6
|
+
selected: Set<string>;
|
|
7
|
+
onlyScheduled: boolean;
|
|
8
|
+
query: string;
|
|
9
|
+
status: string;
|
|
10
|
+
sort: string;
|
|
11
|
+
descending: boolean;
|
|
12
|
+
zoom: number;
|
|
13
|
+
expanded: boolean;
|
|
14
|
+
children: boolean;
|
|
15
|
+
loose: boolean;
|
|
16
|
+
colorFirst: boolean;
|
|
17
|
+
from: number;
|
|
18
|
+
days: number;
|
|
19
|
+
rangeStart: string;
|
|
20
|
+
rangeEnd: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function renderSchedule(root: HTMLElement, state: ScheduleView): void;
|