@affino/datagrid-vue-app 0.1.1 → 0.1.2
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/dist/DataGrid.d.ts +9 -9
- package/dist/DataGridTableStage.vue.d.ts +112 -0
- package/dist/chunks/useDataGridAppRowModel-CcTL-h8L.js +11251 -0
- package/dist/gantt/DataGridGanttStage.vue.d.ts +21 -0
- package/dist/host/DataGridDefaultRenderer.d.ts +3 -3
- package/dist/host/DataGridRuntimeHost.d.ts +1 -1
- package/dist/index.js +1125 -4
- package/dist/internal.js +37 -14
- package/dist/overlays/DataGridAdvancedFilterPopover.vue.d.ts +62 -0
- package/dist/overlays/DataGridAggregationsPopover.vue.d.ts +62 -0
- package/dist/overlays/DataGridCellComboboxEditor.vue.d.ts +29 -0
- package/dist/overlays/DataGridColumnLayoutPopover.vue.d.ts +51 -0
- package/dist/overlays/DataGridColumnMenu.vue.d.ts +65 -0
- package/dist/overlays/DataGridFilterableCombobox.vue.d.ts +76 -0
- package/dist/stage/DataGridTableStage.vue.d.ts +115 -0
- package/dist/stage/DataGridTableStageCenterPane.vue.d.ts +121 -0
- package/dist/stage/DataGridTableStageFillActionMenu.vue.d.ts +30 -0
- package/dist/stage/DataGridTableStageHeader.vue.d.ts +84 -0
- package/dist/stage/DataGridTableStageOverlayLayer.vue.d.ts +34 -0
- package/dist/stage/DataGridTableStagePinnedPane.vue.d.ts +43 -0
- package/package.json +8 -5
- package/dist/DataGrid.js +0 -565
- package/dist/DataGridDefaultRenderer.js +0 -2
- package/dist/DataGridModuleHost.js +0 -2
- package/dist/DataGridRuntimeHost.js +0 -1
- package/dist/config/dataGridAdvancedFilter.js +0 -21
- package/dist/config/dataGridAggregations.js +0 -21
- package/dist/config/dataGridColumnLayout.js +0 -21
- package/dist/config/dataGridFormulaOptions.js +0 -137
- package/dist/config/dataGridPublicProps.js +0 -58
- package/dist/config/dataGridSavedView.js +0 -73
- package/dist/config/dataGridVirtualization.js +0 -32
- package/dist/dataGridAdvancedFilter.js +0 -1
- package/dist/dataGridAggregations.js +0 -1
- package/dist/dataGridAppContext.js +0 -1
- package/dist/dataGridCellComboboxState.d.ts +0 -10
- package/dist/dataGridCellComboboxState.js +0 -67
- package/dist/dataGridColumnLayout.js +0 -1
- package/dist/dataGridColumnMenu.d.ts +0 -9
- package/dist/dataGridColumnMenu.js +0 -21
- package/dist/dataGridEditability.js +0 -1
- package/dist/dataGridFilterableCombobox.js +0 -1
- package/dist/dataGridFormulaOptions.js +0 -1
- package/dist/dataGridGantt.d.ts +0 -3
- package/dist/dataGridGantt.js +0 -1
- package/dist/dataGridGanttDependencySelection.d.ts +0 -7
- package/dist/dataGridGanttDependencySelection.js +0 -46
- package/dist/dataGridGanttLabel.d.ts +0 -2
- package/dist/dataGridGanttLabel.js +0 -30
- package/dist/dataGridGanttSplit.d.ts +0 -20
- package/dist/dataGridGanttSplit.js +0 -31
- package/dist/dataGridGanttWheel.d.ts +0 -10
- package/dist/dataGridGanttWheel.js +0 -30
- package/dist/dataGridOverlayThemeVars.d.ts +0 -1
- package/dist/dataGridOverlayThemeVars.js +0 -32
- package/dist/dataGridPublicProps.js +0 -1
- package/dist/dataGridTableStage.types.js +0 -1
- package/dist/dataGridTableStageBody.types.js +0 -1
- package/dist/dataGridTableStageContext.js +0 -1
- package/dist/dataGridTheme.js +0 -1
- package/dist/dataGridVirtualization.js +0 -1
- package/dist/ensureDataGridAppStyles.js +0 -1
- package/dist/gantt/dataGridGantt.js +0 -1
- package/dist/gantt/dataGridGanttDependencySelection.js +0 -46
- package/dist/gantt/dataGridGanttLabel.js +0 -30
- package/dist/gantt/dataGridGanttSplit.js +0 -31
- package/dist/gantt/dataGridGanttWheel.js +0 -30
- package/dist/host/DataGridDefaultRenderer.js +0 -1847
- package/dist/host/DataGridModuleHost.js +0 -23
- package/dist/host/DataGridRuntimeHost.js +0 -174
- package/dist/overlays/dataGridCellComboboxState.js +0 -67
- package/dist/overlays/dataGridColumnMenu.js +0 -190
- package/dist/overlays/dataGridContextMenu.js +0 -218
- package/dist/overlays/dataGridFilterableCombobox.js +0 -74
- package/dist/overlays/dataGridOverlayThemeVars.js +0 -32
- package/dist/stage/dataGridTableStage.types.js +0 -1
- package/dist/stage/dataGridTableStageBody.types.js +0 -1
- package/dist/stage/dataGridTableStageContext.js +0 -88
- package/dist/stage/useDataGridTableStageBindings.js +0 -162
- package/dist/stage/useDataGridTableStageCellIo.js +0 -62
- package/dist/stage/useDataGridTableStageColumns.js +0 -124
- package/dist/stage/useDataGridTableStageFillAction.js +0 -28
- package/dist/stage/useDataGridTableStageHistory.js +0 -46
- package/dist/stage/useDataGridTableStageRowSelection.js +0 -107
- package/dist/stage/useDataGridTableStageRuntime.js +0 -526
- package/dist/stage/useDataGridTableStageScrollSync.js +0 -49
- package/dist/stage/useDataGridTableStageViewportKeyboard.js +0 -58
- package/dist/stage/useDataGridTableStageVisualSelection.js +0 -83
- package/dist/theme/dataGridTheme.js +0 -84
- package/dist/theme/ensureDataGridAppStyles.js +0 -2656
- package/dist/useDataGridAppControlledState.js +0 -390
- package/dist/useDataGridAppRowModel.js +0 -85
- package/dist/useDataGridTableStageBindings.js +0 -1
- package/dist/useDataGridTableStageCellIo.d.ts +0 -28
- package/dist/useDataGridTableStageCellIo.js +0 -62
- package/dist/useDataGridTableStageColumns.d.ts +0 -21
- package/dist/useDataGridTableStageColumns.js +0 -122
- package/dist/useDataGridTableStageFillAction.d.ts +0 -19
- package/dist/useDataGridTableStageFillAction.js +0 -28
- package/dist/useDataGridTableStageHistory.d.ts +0 -31
- package/dist/useDataGridTableStageHistory.js +0 -46
- package/dist/useDataGridTableStageRowSelection.d.ts +0 -28
- package/dist/useDataGridTableStageRowSelection.js +0 -103
- package/dist/useDataGridTableStageRuntime.js +0 -1
- package/dist/useDataGridTableStageScrollSync.d.ts +0 -17
- package/dist/useDataGridTableStageScrollSync.js +0 -49
- package/dist/useDataGridTableStageViewportKeyboard.d.ts +0 -20
- package/dist/useDataGridTableStageViewportKeyboard.js +0 -58
- package/dist/useDataGridTableStageVisualSelection.d.ts +0 -24
- package/dist/useDataGridTableStageVisualSelection.js +0 -70
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
const CLIENT_ROW_MODEL_OPTIONS_CACHE = new WeakMap();
|
|
2
|
-
const MERGED_ROW_MODEL_OPTIONS_CACHE = new WeakMap();
|
|
3
|
-
function cloneClientRowModelOptions(options) {
|
|
4
|
-
if (!options) {
|
|
5
|
-
return undefined;
|
|
6
|
-
}
|
|
7
|
-
const cached = CLIENT_ROW_MODEL_OPTIONS_CACHE.get(options);
|
|
8
|
-
if (cached) {
|
|
9
|
-
return cached;
|
|
10
|
-
}
|
|
11
|
-
const normalizedExpandedByDefault = options.initialTreeData?.expandedByDefault ?? false;
|
|
12
|
-
if (options.initialTreeData?.expandedByDefault === normalizedExpandedByDefault) {
|
|
13
|
-
CLIENT_ROW_MODEL_OPTIONS_CACHE.set(options, options);
|
|
14
|
-
return options;
|
|
15
|
-
}
|
|
16
|
-
const cloned = {
|
|
17
|
-
...options,
|
|
18
|
-
};
|
|
19
|
-
if (options.initialTreeData) {
|
|
20
|
-
cloned.initialTreeData = {
|
|
21
|
-
...options.initialTreeData,
|
|
22
|
-
expandedByDefault: normalizedExpandedByDefault,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
CLIENT_ROW_MODEL_OPTIONS_CACHE.set(options, cloned);
|
|
26
|
-
return cloned;
|
|
27
|
-
}
|
|
28
|
-
function cloneFormulas(formulas) {
|
|
29
|
-
if (!formulas || formulas.length === 0) {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
return formulas.map(entry => ({ ...entry }));
|
|
33
|
-
}
|
|
34
|
-
function cloneComputedFields(computedFields) {
|
|
35
|
-
if (!computedFields || computedFields.length === 0) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
return computedFields.map(entry => ({ ...entry }));
|
|
39
|
-
}
|
|
40
|
-
function cloneColumns(columns) {
|
|
41
|
-
if (!columns || columns.length === 0) {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
return columns.map(({ formula: _formula, ...column }) => ({ ...column }));
|
|
45
|
-
}
|
|
46
|
-
function extractEmbeddedFormulas(columns) {
|
|
47
|
-
if (!columns || columns.length === 0) {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
return columns.flatMap(column => {
|
|
51
|
-
const formula = typeof column.formula === "string" ? column.formula.trim() : "";
|
|
52
|
-
if (!formula) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
return [{
|
|
56
|
-
name: column.key,
|
|
57
|
-
formula,
|
|
58
|
-
}];
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function mergeFormulaDefinitions(embeddedFormulas, formulas) {
|
|
62
|
-
const merged = new Map();
|
|
63
|
-
for (const entry of embeddedFormulas) {
|
|
64
|
-
merged.set(entry.name, { ...entry });
|
|
65
|
-
}
|
|
66
|
-
for (const entry of cloneFormulas(formulas)) {
|
|
67
|
-
merged.set(entry.name, entry);
|
|
68
|
-
}
|
|
69
|
-
return Array.from(merged.values());
|
|
70
|
-
}
|
|
71
|
-
export function resolveDataGridColumns(columns) {
|
|
72
|
-
return cloneColumns(columns);
|
|
73
|
-
}
|
|
74
|
-
export function resolveDataGridFormulaRowModelOptions(input) {
|
|
75
|
-
const baseOptions = cloneClientRowModelOptions(input.clientRowModelOptions);
|
|
76
|
-
const enterpriseOptions = input.enterpriseClientRowModelOptions;
|
|
77
|
-
const embeddedFormulas = extractEmbeddedFormulas(input.columns);
|
|
78
|
-
const hasFormulaProp = input.formulas !== undefined;
|
|
79
|
-
const hasComputedFieldsProp = input.computedFields !== undefined;
|
|
80
|
-
const hasFormulaFunctionsProp = input.formulaFunctions !== undefined;
|
|
81
|
-
const hasEmbeddedFormulas = embeddedFormulas.length > 0;
|
|
82
|
-
const initialFormulaFields = hasFormulaProp || hasEmbeddedFormulas
|
|
83
|
-
? mergeFormulaDefinitions(embeddedFormulas, input.formulas)
|
|
84
|
-
: undefined;
|
|
85
|
-
const initialComputedFields = hasComputedFieldsProp ? cloneComputedFields(input.computedFields) : undefined;
|
|
86
|
-
const initialFormulaFunctionRegistry = hasFormulaFunctionsProp ? (input.formulaFunctions ?? {}) : undefined;
|
|
87
|
-
const hasFormulaOverrides = Boolean(hasEmbeddedFormulas
|
|
88
|
-
|| hasFormulaProp
|
|
89
|
-
|| hasComputedFieldsProp
|
|
90
|
-
|| hasFormulaFunctionsProp);
|
|
91
|
-
if (!baseOptions && !hasFormulaOverrides) {
|
|
92
|
-
if (!enterpriseOptions) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
...enterpriseOptions,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (!hasFormulaOverrides) {
|
|
100
|
-
if (baseOptions && !enterpriseOptions) {
|
|
101
|
-
return baseOptions;
|
|
102
|
-
}
|
|
103
|
-
if (!baseOptions && enterpriseOptions) {
|
|
104
|
-
return enterpriseOptions;
|
|
105
|
-
}
|
|
106
|
-
if (baseOptions && enterpriseOptions) {
|
|
107
|
-
let byEnterprise = MERGED_ROW_MODEL_OPTIONS_CACHE.get(baseOptions);
|
|
108
|
-
if (!byEnterprise) {
|
|
109
|
-
byEnterprise = new WeakMap();
|
|
110
|
-
MERGED_ROW_MODEL_OPTIONS_CACHE.set(baseOptions, byEnterprise);
|
|
111
|
-
}
|
|
112
|
-
const cached = byEnterprise.get(enterpriseOptions);
|
|
113
|
-
if (cached) {
|
|
114
|
-
return cached;
|
|
115
|
-
}
|
|
116
|
-
const merged = {
|
|
117
|
-
...baseOptions,
|
|
118
|
-
...enterpriseOptions,
|
|
119
|
-
};
|
|
120
|
-
byEnterprise.set(enterpriseOptions, merged);
|
|
121
|
-
return merged;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
...(baseOptions ?? {}),
|
|
126
|
-
...(hasComputedFieldsProp ? { initialComputedFields } : {}),
|
|
127
|
-
...(hasFormulaProp || hasEmbeddedFormulas ? { initialFormulaFields } : {}),
|
|
128
|
-
...(hasFormulaFunctionsProp ? { initialFormulaFunctionRegistry } : {}),
|
|
129
|
-
...(enterpriseOptions?.computeMode ? { computeMode: enterpriseOptions.computeMode } : {}),
|
|
130
|
-
...(enterpriseOptions?.workerPatchDispatchThreshold !== undefined
|
|
131
|
-
? { workerPatchDispatchThreshold: enterpriseOptions.workerPatchDispatchThreshold }
|
|
132
|
-
: {}),
|
|
133
|
-
...(enterpriseOptions?.formulaColumnCacheMaxColumns !== undefined
|
|
134
|
-
? { formulaColumnCacheMaxColumns: enterpriseOptions.formulaColumnCacheMaxColumns }
|
|
135
|
-
: {}),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
function normalizePageNumber(value, fallback) {
|
|
2
|
-
if (!Number.isFinite(value)) {
|
|
3
|
-
return fallback;
|
|
4
|
-
}
|
|
5
|
-
return Math.max(0, Math.trunc(value));
|
|
6
|
-
}
|
|
7
|
-
function normalizePageSize(value, fallback) {
|
|
8
|
-
if (!Number.isFinite(value)) {
|
|
9
|
-
return fallback;
|
|
10
|
-
}
|
|
11
|
-
return Math.max(1, Math.trunc(value));
|
|
12
|
-
}
|
|
13
|
-
export function resolveDataGridGroupBy(input) {
|
|
14
|
-
if (input === undefined) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
if (input == null) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
if (typeof input === "string") {
|
|
21
|
-
const field = input.trim();
|
|
22
|
-
return field ? { fields: [field], expandedByDefault: true } : null;
|
|
23
|
-
}
|
|
24
|
-
if (Array.isArray(input)) {
|
|
25
|
-
const fields = input
|
|
26
|
-
.map(field => field.trim())
|
|
27
|
-
.filter(field => field.length > 0);
|
|
28
|
-
return fields.length > 0 ? { fields: [...fields], expandedByDefault: true } : null;
|
|
29
|
-
}
|
|
30
|
-
return input;
|
|
31
|
-
}
|
|
32
|
-
export function resolveDataGridRenderMode(renderMode, pagination) {
|
|
33
|
-
if (pagination === true) {
|
|
34
|
-
return "pagination";
|
|
35
|
-
}
|
|
36
|
-
if (pagination && typeof pagination === "object") {
|
|
37
|
-
return "pagination";
|
|
38
|
-
}
|
|
39
|
-
return renderMode ?? "virtualization";
|
|
40
|
-
}
|
|
41
|
-
export function resolveDataGridPagination(pagination, renderMode, pageSize, currentPage) {
|
|
42
|
-
if (renderMode !== "pagination") {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
const fallbackPageSize = 100;
|
|
46
|
-
const resolvedPageSize = normalizePageSize(pageSize, fallbackPageSize);
|
|
47
|
-
const resolvedCurrentPage = normalizePageNumber(currentPage, 0);
|
|
48
|
-
if (pagination === true || pagination === false || pagination == null) {
|
|
49
|
-
return {
|
|
50
|
-
pageSize: resolvedPageSize,
|
|
51
|
-
currentPage: resolvedCurrentPage,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
pageSize: normalizePageSize(pageSize ?? pagination.pageSize, fallbackPageSize),
|
|
56
|
-
currentPage: normalizePageNumber(currentPage ?? pagination.currentPage, 0),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
function isRecord(value) {
|
|
2
|
-
return typeof value === "object" && value !== null;
|
|
3
|
-
}
|
|
4
|
-
export function migrateDataGridSavedView(value, migrateState, options) {
|
|
5
|
-
const record = isRecord(value) ? value : null;
|
|
6
|
-
const migratedState = migrateState(record && "state" in record ? record.state : value, options);
|
|
7
|
-
if (!migratedState) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
const rawViewMode = record?.viewMode;
|
|
11
|
-
const viewMode = rawViewMode === "gantt"
|
|
12
|
-
? "gantt"
|
|
13
|
-
: rawViewMode === "table"
|
|
14
|
-
? "table"
|
|
15
|
-
: undefined;
|
|
16
|
-
return {
|
|
17
|
-
state: migratedState,
|
|
18
|
-
...(viewMode ? { viewMode } : {}),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function serializeDataGridSavedView(savedView) {
|
|
22
|
-
return JSON.stringify(savedView);
|
|
23
|
-
}
|
|
24
|
-
export function parseDataGridSavedView(value, migrateState, options) {
|
|
25
|
-
if (typeof value !== "string" || value.trim().length === 0) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
return migrateDataGridSavedView(JSON.parse(value), migrateState, options);
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export function writeDataGridSavedViewToStorage(storage, key, savedView) {
|
|
36
|
-
if (!storage || typeof key !== "string" || key.trim().length === 0) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
try {
|
|
40
|
-
storage.setItem(key, serializeDataGridSavedView(savedView));
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export function readDataGridSavedViewFromStorage(storage, key, migrateState, options) {
|
|
48
|
-
if (!storage || typeof key !== "string" || key.trim().length === 0) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
const rawValue = storage.getItem(key);
|
|
53
|
-
if (!rawValue) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return parseDataGridSavedView(rawValue, migrateState, options);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export function clearDataGridSavedViewInStorage(storage, key) {
|
|
63
|
-
if (!storage || typeof key !== "string" || key.trim().length === 0) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
storage.removeItem(key);
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
function normalizeOverscan(value, fallback) {
|
|
2
|
-
if (!Number.isFinite(value)) {
|
|
3
|
-
return fallback;
|
|
4
|
-
}
|
|
5
|
-
return Math.max(0, Math.trunc(value));
|
|
6
|
-
}
|
|
7
|
-
export function resolveDataGridVirtualization(input, renderMode) {
|
|
8
|
-
const defaults = {
|
|
9
|
-
rows: true,
|
|
10
|
-
columns: false,
|
|
11
|
-
rowOverscan: 8,
|
|
12
|
-
columnOverscan: 2,
|
|
13
|
-
};
|
|
14
|
-
if (input === true) {
|
|
15
|
-
defaults.columns = true;
|
|
16
|
-
}
|
|
17
|
-
else if (input === false) {
|
|
18
|
-
defaults.rows = false;
|
|
19
|
-
defaults.columns = false;
|
|
20
|
-
}
|
|
21
|
-
else if (input && typeof input === "object") {
|
|
22
|
-
defaults.rows = input.rows ?? defaults.rows;
|
|
23
|
-
defaults.columns = input.columns ?? defaults.columns;
|
|
24
|
-
const sharedOverscan = normalizeOverscan(input.overscan, defaults.rowOverscan);
|
|
25
|
-
defaults.rowOverscan = normalizeOverscan(input.rowOverscan, sharedOverscan);
|
|
26
|
-
defaults.columnOverscan = normalizeOverscan(input.columnOverscan, normalizeOverscan(input.overscan, defaults.columnOverscan));
|
|
27
|
-
}
|
|
28
|
-
if (renderMode === "pagination") {
|
|
29
|
-
defaults.rows = false;
|
|
30
|
-
}
|
|
31
|
-
return defaults;
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./config/dataGridAdvancedFilter";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./config/dataGridAggregations";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const dataGridAppRootElementKey = Symbol("affino-datagrid-app-root-element");
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface DataGridCellComboboxState {
|
|
2
|
-
open: boolean;
|
|
3
|
-
filter: string;
|
|
4
|
-
activeIndex: number;
|
|
5
|
-
}
|
|
6
|
-
export declare function createDataGridCellComboboxState(initial?: Partial<DataGridCellComboboxState>): DataGridCellComboboxState;
|
|
7
|
-
export declare function setDataGridCellComboboxOpen(state: DataGridCellComboboxState, open: boolean): DataGridCellComboboxState;
|
|
8
|
-
export declare function setDataGridCellComboboxFilter(state: DataGridCellComboboxState, filter: string): DataGridCellComboboxState;
|
|
9
|
-
export declare function activateDataGridCellComboboxIndex(state: DataGridCellComboboxState, index: number, optionCount: number): DataGridCellComboboxState;
|
|
10
|
-
export declare function moveDataGridCellComboboxFocus(state: DataGridCellComboboxState, delta: number, optionCount: number, loop?: boolean): DataGridCellComboboxState;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export function createDataGridCellComboboxState(initial = {}) {
|
|
2
|
-
return {
|
|
3
|
-
open: initial.open ?? false,
|
|
4
|
-
filter: initial.filter ?? "",
|
|
5
|
-
activeIndex: initial.activeIndex ?? -1,
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export function setDataGridCellComboboxOpen(state, open) {
|
|
9
|
-
if (state.open === open) {
|
|
10
|
-
return state;
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
...state,
|
|
14
|
-
open,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export function setDataGridCellComboboxFilter(state, filter) {
|
|
18
|
-
if (state.filter === filter) {
|
|
19
|
-
return state;
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
...state,
|
|
23
|
-
filter,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export function activateDataGridCellComboboxIndex(state, index, optionCount) {
|
|
27
|
-
const nextIndex = clampIndex(index, optionCount);
|
|
28
|
-
if (nextIndex === state.activeIndex) {
|
|
29
|
-
return state;
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
...state,
|
|
33
|
-
activeIndex: nextIndex,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export function moveDataGridCellComboboxFocus(state, delta, optionCount, loop = true) {
|
|
37
|
-
if (optionCount <= 0 || delta === 0) {
|
|
38
|
-
return state;
|
|
39
|
-
}
|
|
40
|
-
if (state.activeIndex < 0) {
|
|
41
|
-
return activateDataGridCellComboboxIndex(state, delta > 0 ? 0 : optionCount - 1, optionCount);
|
|
42
|
-
}
|
|
43
|
-
const rawTarget = state.activeIndex + Math.trunc(delta);
|
|
44
|
-
if (loop) {
|
|
45
|
-
return activateDataGridCellComboboxIndex(state, modulo(rawTarget, optionCount), optionCount);
|
|
46
|
-
}
|
|
47
|
-
return activateDataGridCellComboboxIndex(state, rawTarget, optionCount);
|
|
48
|
-
}
|
|
49
|
-
function clampIndex(index, optionCount) {
|
|
50
|
-
if (optionCount <= 0) {
|
|
51
|
-
return -1;
|
|
52
|
-
}
|
|
53
|
-
if (!Number.isFinite(index)) {
|
|
54
|
-
return 0;
|
|
55
|
-
}
|
|
56
|
-
const normalized = Math.trunc(index);
|
|
57
|
-
if (normalized < 0) {
|
|
58
|
-
return 0;
|
|
59
|
-
}
|
|
60
|
-
if (normalized >= optionCount) {
|
|
61
|
-
return optionCount - 1;
|
|
62
|
-
}
|
|
63
|
-
return normalized;
|
|
64
|
-
}
|
|
65
|
-
function modulo(value, divisor) {
|
|
66
|
-
return ((value % divisor) + divisor) % divisor;
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./config/dataGridColumnLayout";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface DataGridColumnMenuOptions {
|
|
2
|
-
enabled: boolean;
|
|
3
|
-
maxFilterValues: number;
|
|
4
|
-
}
|
|
5
|
-
export type DataGridColumnMenuProp = boolean | {
|
|
6
|
-
enabled?: boolean;
|
|
7
|
-
maxFilterValues?: number;
|
|
8
|
-
} | null;
|
|
9
|
-
export declare function resolveDataGridColumnMenu(input: DataGridColumnMenuProp | undefined): DataGridColumnMenuOptions;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const DEFAULT_MAX_FILTER_VALUES = 120;
|
|
2
|
-
export function resolveDataGridColumnMenu(input) {
|
|
3
|
-
if (typeof input === "boolean") {
|
|
4
|
-
return {
|
|
5
|
-
enabled: input,
|
|
6
|
-
maxFilterValues: DEFAULT_MAX_FILTER_VALUES,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (!input) {
|
|
10
|
-
return {
|
|
11
|
-
enabled: false,
|
|
12
|
-
maxFilterValues: DEFAULT_MAX_FILTER_VALUES,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
enabled: input.enabled ?? true,
|
|
17
|
-
maxFilterValues: Number.isFinite(input.maxFilterValues)
|
|
18
|
-
? Math.max(20, Math.trunc(input.maxFilterValues))
|
|
19
|
-
: DEFAULT_MAX_FILTER_VALUES,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./overlays/dataGridFilterableCombobox";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./config/dataGridFormulaOptions";
|
package/dist/dataGridGantt.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export type DataGridAppViewMode = "table" | "gantt";
|
|
2
|
-
export { DAY_MS, addDataGridWorkingDays, applyDataGridGanttDragDelta, buildDataGridGanttDependencyPaths, buildDataGridGanttRowEditPatch, buildDataGridNonWorkingDaySpans, buildDataGridTimelineModel, buildDataGridTimelineRenderModels, buildDataGridGanttVisibleBars, clampDataGridGanttScrollLeft, clampDataGridTimelineScrollLeft, formatDataGridGanttDayLabel, hitTestDataGridGanttBar, isDataGridWorkingDay, normalizeDataGridGanttOptions, resolveDataGridGanttDateOffset, resolveDataGridGanttDateMs, resolveDataGridGanttDependencies, resolveDataGridGanttDependencyRefs, resolveDataGridGanttProgress, resolveDataGridGanttRangeFrame, resolveDataGridGanttSnapDays, resolveDataGridGanttCriticalTaskIds, resolveDataGridGanttScrollLeftForDate, resolveDataGridGanttTimelineState, resolveDataGridWorkingCalendar, snapDataGridGanttDateMs, snapDataGridGanttDayDelta, snapDataGridDateToWorkingDay, startOfUtcDay, startOfUtcWeek, resolveDataGridTimelineDateToPixel, resolveDataGridTimelinePixelToDate, resolveDataGridTimelineRange, resolveDataGridTimelineScrollLeftForDate, resolveDataGridTimelineViewport, } from "@affino/datagrid-gantt";
|
|
3
|
-
export type { BuildDataGridGanttDependencyPathsInput, BuildDataGridGanttVisibleBarsInput, BuildDataGridTimelineModelInput, BuildDataGridTimelineRenderModelsInput, DataGridGanttBarFrame, DataGridGanttBarLayout, DataGridGanttCriticalTaskNode, DataGridGanttDependencyPath, DataGridGanttDependencyRef, DataGridGanttDependencyType, DataGridGanttDependencyValue, DataGridGanttDragRange, DataGridGanttHorizontalAlign, DataGridGanttHitMode, DataGridGanttHitTarget, DataGridGanttOptions, DataGridGanttProp, DataGridGanttRowEditPatch, DataGridGanttRowReader, DataGridGanttTimelineState, DataGridGanttZoomLevel, DataGridResolvedGanttOptions, DataGridResolvedWorkingCalendar, DataGridTimelineHorizontalAlign, DataGridTimelineLine, DataGridTimelineModel, DataGridTimelineRange, DataGridTimelineRenderModels, DataGridTimelineSegment, DataGridTimelineSpan, DataGridTimelineViewport, DataGridWorkingCalendar, ResolveDataGridTimelineRangeInput, } from "@affino/datagrid-gantt";
|
package/dist/dataGridGantt.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DAY_MS, addDataGridWorkingDays, applyDataGridGanttDragDelta, buildDataGridGanttDependencyPaths, buildDataGridGanttRowEditPatch, buildDataGridNonWorkingDaySpans, buildDataGridTimelineModel, buildDataGridTimelineRenderModels, buildDataGridGanttVisibleBars, clampDataGridGanttScrollLeft, clampDataGridTimelineScrollLeft, formatDataGridGanttDayLabel, hitTestDataGridGanttBar, isDataGridWorkingDay, normalizeDataGridGanttOptions, resolveDataGridGanttDateOffset, resolveDataGridGanttDateMs, resolveDataGridGanttDependencies, resolveDataGridGanttDependencyRefs, resolveDataGridGanttProgress, resolveDataGridGanttRangeFrame, resolveDataGridGanttSnapDays, resolveDataGridGanttCriticalTaskIds, resolveDataGridGanttScrollLeftForDate, resolveDataGridGanttTimelineState, resolveDataGridWorkingCalendar, snapDataGridGanttDateMs, snapDataGridGanttDayDelta, snapDataGridDateToWorkingDay, startOfUtcDay, startOfUtcWeek, resolveDataGridTimelineDateToPixel, resolveDataGridTimelinePixelToDate, resolveDataGridTimelineRange, resolveDataGridTimelineScrollLeftForDate, resolveDataGridTimelineViewport, } from "@affino/datagrid-gantt";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { DataGridGanttDependencyPath } from "./dataGridGantt";
|
|
2
|
-
export declare const DATAGRID_GANTT_DEPENDENCY_HIT_SLOP_PX = 6;
|
|
3
|
-
export declare function resolveDataGridGanttDependencyPathKey<TRow>(path: Pick<DataGridGanttDependencyPath<TRow>, "dependencyTaskId" | "dependencyType" | "sourceBar" | "targetBar">): string;
|
|
4
|
-
export declare function hitTestDataGridGanttDependencyPath<TRow>(paths: readonly DataGridGanttDependencyPath<TRow>[], point: {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
}, hitSlopPx?: number): DataGridGanttDependencyPath<TRow> | null;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const DATAGRID_GANTT_DEPENDENCY_HIT_SLOP_PX = 6;
|
|
2
|
-
export function resolveDataGridGanttDependencyPathKey(path) {
|
|
3
|
-
return [
|
|
4
|
-
path.dependencyTaskId,
|
|
5
|
-
path.dependencyType,
|
|
6
|
-
path.sourceBar.rowId,
|
|
7
|
-
path.targetBar.rowId,
|
|
8
|
-
].join("::");
|
|
9
|
-
}
|
|
10
|
-
function resolveSquaredDistanceToSegment(point, start, end) {
|
|
11
|
-
const dx = end.x - start.x;
|
|
12
|
-
const dy = end.y - start.y;
|
|
13
|
-
if (dx === 0 && dy === 0) {
|
|
14
|
-
const distanceX = point.x - start.x;
|
|
15
|
-
const distanceY = point.y - start.y;
|
|
16
|
-
return (distanceX * distanceX) + (distanceY * distanceY);
|
|
17
|
-
}
|
|
18
|
-
const projection = (((point.x - start.x) * dx) + ((point.y - start.y) * dy)) / ((dx * dx) + (dy * dy));
|
|
19
|
-
const clampedProjection = Math.max(0, Math.min(1, projection));
|
|
20
|
-
const closestX = start.x + (dx * clampedProjection);
|
|
21
|
-
const closestY = start.y + (dy * clampedProjection);
|
|
22
|
-
const distanceX = point.x - closestX;
|
|
23
|
-
const distanceY = point.y - closestY;
|
|
24
|
-
return (distanceX * distanceX) + (distanceY * distanceY);
|
|
25
|
-
}
|
|
26
|
-
export function hitTestDataGridGanttDependencyPath(paths, point, hitSlopPx = DATAGRID_GANTT_DEPENDENCY_HIT_SLOP_PX) {
|
|
27
|
-
const maxDistanceSquared = Math.max(1, hitSlopPx) ** 2;
|
|
28
|
-
let bestPath = null;
|
|
29
|
-
let bestDistanceSquared = Number.POSITIVE_INFINITY;
|
|
30
|
-
for (const path of paths) {
|
|
31
|
-
for (let pointIndex = 1; pointIndex < path.points.length; pointIndex += 1) {
|
|
32
|
-
const start = path.points[pointIndex - 1];
|
|
33
|
-
const end = path.points[pointIndex];
|
|
34
|
-
if (!start || !end) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const distanceSquared = resolveSquaredDistanceToSegment(point, start, end);
|
|
38
|
-
if (distanceSquared > maxDistanceSquared || distanceSquared >= bestDistanceSquared) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
bestDistanceSquared = distanceSquared;
|
|
42
|
-
bestPath = path;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return bestPath;
|
|
46
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const DATAGRID_GANTT_MIN_INLINE_LABEL_WIDTH_PX = 44;
|
|
2
|
-
export function resolveDataGridGanttInlineLabel(label, availableWidth, measureTextWidth) {
|
|
3
|
-
const normalizedLabel = label.trim();
|
|
4
|
-
if (normalizedLabel.length === 0 || availableWidth < DATAGRID_GANTT_MIN_INLINE_LABEL_WIDTH_PX) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
if (measureTextWidth(normalizedLabel) <= availableWidth) {
|
|
8
|
-
return normalizedLabel;
|
|
9
|
-
}
|
|
10
|
-
const ellipsis = "...";
|
|
11
|
-
const ellipsisWidth = measureTextWidth(ellipsis);
|
|
12
|
-
if (ellipsisWidth > availableWidth) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
let low = 0;
|
|
16
|
-
let high = normalizedLabel.length;
|
|
17
|
-
let fitted = "";
|
|
18
|
-
while (low <= high) {
|
|
19
|
-
const middle = Math.floor((low + high) / 2);
|
|
20
|
-
const candidate = `${normalizedLabel.slice(0, middle).trimEnd()}${ellipsis}`;
|
|
21
|
-
if (measureTextWidth(candidate) <= availableWidth) {
|
|
22
|
-
fitted = candidate;
|
|
23
|
-
low = middle + 1;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
high = middle - 1;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return fitted.length > 0 ? fitted : null;
|
|
30
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface ClampDataGridGanttTablePaneWidthInput {
|
|
2
|
-
requestedWidth: number;
|
|
3
|
-
stageWidth: number;
|
|
4
|
-
minTableWidth?: number;
|
|
5
|
-
minTimelineWidth?: number;
|
|
6
|
-
maxTableWidth?: number | null;
|
|
7
|
-
}
|
|
8
|
-
export interface ResolveDataGridGanttTablePaneDragInput {
|
|
9
|
-
originWidth: number;
|
|
10
|
-
deltaX: number;
|
|
11
|
-
stageWidth: number;
|
|
12
|
-
minTableWidth?: number;
|
|
13
|
-
minTimelineWidth?: number;
|
|
14
|
-
maxTableWidth?: number | null;
|
|
15
|
-
}
|
|
16
|
-
export declare const DATAGRID_GANTT_SPLITTER_SIZE_PX = 12;
|
|
17
|
-
export declare const DATAGRID_GANTT_MIN_TABLE_PANE_WIDTH_PX = 280;
|
|
18
|
-
export declare const DATAGRID_GANTT_MIN_TIMELINE_PANE_WIDTH_PX = 240;
|
|
19
|
-
export declare function clampDataGridGanttTablePaneWidth(input: ClampDataGridGanttTablePaneWidthInput): number;
|
|
20
|
-
export declare function resolveDataGridGanttTablePaneDragWidth(input: ResolveDataGridGanttTablePaneDragInput): number;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export const DATAGRID_GANTT_SPLITTER_SIZE_PX = 12;
|
|
2
|
-
export const DATAGRID_GANTT_MIN_TABLE_PANE_WIDTH_PX = 280;
|
|
3
|
-
export const DATAGRID_GANTT_MIN_TIMELINE_PANE_WIDTH_PX = 240;
|
|
4
|
-
function normalizePositive(value, fallback) {
|
|
5
|
-
if (!Number.isFinite(value)) {
|
|
6
|
-
return fallback;
|
|
7
|
-
}
|
|
8
|
-
return Math.max(1, Math.round(Number(value)));
|
|
9
|
-
}
|
|
10
|
-
export function clampDataGridGanttTablePaneWidth(input) {
|
|
11
|
-
const minTableWidth = normalizePositive(input.minTableWidth, DATAGRID_GANTT_MIN_TABLE_PANE_WIDTH_PX);
|
|
12
|
-
const minTimelineWidth = normalizePositive(input.minTimelineWidth, DATAGRID_GANTT_MIN_TIMELINE_PANE_WIDTH_PX);
|
|
13
|
-
const requestedWidth = normalizePositive(input.requestedWidth, minTableWidth);
|
|
14
|
-
const stageWidth = Number.isFinite(input.stageWidth) ? Math.max(0, Number(input.stageWidth)) : 0;
|
|
15
|
-
const maxTableWidthByConfig = Number.isFinite(input.maxTableWidth)
|
|
16
|
-
? Math.max(minTableWidth, Math.round(Number(input.maxTableWidth)))
|
|
17
|
-
: Number.POSITIVE_INFINITY;
|
|
18
|
-
const maxTableWidthByStage = stageWidth > 0
|
|
19
|
-
? Math.max(minTableWidth, stageWidth - minTimelineWidth)
|
|
20
|
-
: Number.POSITIVE_INFINITY;
|
|
21
|
-
return Math.min(Math.max(requestedWidth, minTableWidth), Math.min(maxTableWidthByConfig, maxTableWidthByStage));
|
|
22
|
-
}
|
|
23
|
-
export function resolveDataGridGanttTablePaneDragWidth(input) {
|
|
24
|
-
return clampDataGridGanttTablePaneWidth({
|
|
25
|
-
requestedWidth: input.originWidth + input.deltaX,
|
|
26
|
-
stageWidth: input.stageWidth,
|
|
27
|
-
minTableWidth: input.minTableWidth,
|
|
28
|
-
minTimelineWidth: input.minTimelineWidth,
|
|
29
|
-
maxTableWidth: input.maxTableWidth,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ResolveDataGridGanttWheelIntentInput {
|
|
2
|
-
deltaX: number;
|
|
3
|
-
deltaY: number;
|
|
4
|
-
shiftKey: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface DataGridGanttWheelIntent {
|
|
7
|
-
horizontalDelta: number;
|
|
8
|
-
verticalDelta: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function resolveDataGridGanttWheelIntent(input: ResolveDataGridGanttWheelIntentInput): DataGridGanttWheelIntent;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const WHEEL_NOISE_THRESHOLD = 0.5;
|
|
2
|
-
const HORIZONTAL_DOMINANCE_RATIO = 1.25;
|
|
3
|
-
export function resolveDataGridGanttWheelIntent(input) {
|
|
4
|
-
const absX = Math.abs(input.deltaX);
|
|
5
|
-
const absY = Math.abs(input.deltaY);
|
|
6
|
-
if (input.shiftKey) {
|
|
7
|
-
const horizontalDelta = absX > WHEEL_NOISE_THRESHOLD
|
|
8
|
-
? input.deltaX
|
|
9
|
-
: input.deltaY;
|
|
10
|
-
return Math.abs(horizontalDelta) > WHEEL_NOISE_THRESHOLD
|
|
11
|
-
? { horizontalDelta, verticalDelta: 0 }
|
|
12
|
-
: { horizontalDelta: 0, verticalDelta: 0 };
|
|
13
|
-
}
|
|
14
|
-
if (absX <= WHEEL_NOISE_THRESHOLD && absY <= WHEEL_NOISE_THRESHOLD) {
|
|
15
|
-
return {
|
|
16
|
-
horizontalDelta: 0,
|
|
17
|
-
verticalDelta: 0,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
if (absX > WHEEL_NOISE_THRESHOLD && absX > absY * HORIZONTAL_DOMINANCE_RATIO) {
|
|
21
|
-
return {
|
|
22
|
-
horizontalDelta: input.deltaX,
|
|
23
|
-
verticalDelta: 0,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
horizontalDelta: 0,
|
|
28
|
-
verticalDelta: input.deltaY,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function readDataGridOverlayThemeVars(rootElement: HTMLElement | null): Record<string, string>;
|