@platforma-sdk/ui-vue 1.26.1 → 1.27.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/CHANGELOG.md +6 -0
- package/dist/lib.js +3067 -2940
- package/dist/lib.js.map +1 -1
- package/dist/lib.umd.cjs +19 -19
- package/dist/lib.umd.cjs.map +1 -1
- package/dist/src/AgGridVue/useAgGridOptions.d.ts +119 -3
- package/dist/src/AgGridVue/useAgGridOptions.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/AgGridVue/useAgGridOptions.ts +198 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/ui-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/lib.umd.cjs",
|
|
6
6
|
"module": "dist/lib.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"canonicalize": "~2.1.0",
|
|
24
24
|
"ag-grid-enterprise": "^33.0.4",
|
|
25
25
|
"ag-grid-vue3": "^33.0.4",
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
26
|
+
"@milaboratories/uikit": "^2.2.61",
|
|
27
|
+
"@platforma-sdk/model": "^1.26.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@faker-js/faker": "^9.2.0",
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import type { ColGroupDef, GridApi, GridOptions, GridReadyEvent } from 'ag-grid-enterprise';
|
|
2
|
+
import type { ColGroupDef, GridApi, GridOptions, GridReadyEvent, ICellRendererParams, RowSelectionOptions, ValueSetterParams } from 'ag-grid-enterprise';
|
|
3
|
+
import type { Component } from 'vue';
|
|
3
4
|
import { computed, shallowRef, watch } from 'vue';
|
|
4
5
|
import { AgGridTheme } from '../aggrid';
|
|
5
|
-
import PlAgOverlayLoading from '../components/PlAgDataTable
|
|
6
|
-
import PlAgOverlayNoRows from '../components/PlAgDataTable
|
|
6
|
+
import { PlAgOverlayLoading } from '../components/PlAgDataTable';
|
|
7
|
+
import { PlAgOverlayNoRows } from '../components/PlAgDataTable';
|
|
7
8
|
import type { ColDefExtended } from './createAgGridColDef';
|
|
8
9
|
import type { PlAgOverlayLoadingParams } from '../lib';
|
|
9
10
|
import { autoSizeRowNumberColumn, createAgGridColDef, makeRowNumberColDef } from '../lib';
|
|
10
11
|
import { whenever } from '@vueuse/core';
|
|
11
|
-
import PlAgCellFile from '../components/PlAgCellFile
|
|
12
|
-
|
|
12
|
+
import { PlAgCellFile } from '../components/PlAgCellFile';
|
|
13
|
+
import { PlAgChartStackedBarCell } from '../components/PlAgChartStackedBarCell';
|
|
14
|
+
import { PlAgChartHistogramCell } from '../components/PlAgChartHistogramCell';
|
|
15
|
+
import type { ImportFileHandle } from '@platforma-sdk/model';
|
|
16
|
+
import type { ImportProgress } from '@platforma-sdk/model';
|
|
17
|
+
import { PlAgCellStatusTag } from '../components/PlAgCellStatusTag';
|
|
13
18
|
interface GridOptionsExtended<TData = any> extends Omit<GridOptions<TData>, 'columnDefs'> {
|
|
14
19
|
/**
|
|
15
20
|
* Array of Column / Column Group definitions.
|
|
@@ -30,7 +35,7 @@ interface GridOptionsExtended<TData = any> extends Omit<GridOptions<TData>, 'col
|
|
|
30
35
|
/**
|
|
31
36
|
* Use "transparent" to make table headers visible below the loading layer (experimental)
|
|
32
37
|
*/
|
|
33
|
-
loadingOverlayType?: 'transparent';
|
|
38
|
+
loadingOverlayType?: 'transparent' | undefined;
|
|
34
39
|
/**
|
|
35
40
|
* Override standard 'Empty' text for the "no rows" overlay
|
|
36
41
|
*/
|
|
@@ -46,15 +51,198 @@ class Builder<TData> {
|
|
|
46
51
|
return this;
|
|
47
52
|
}
|
|
48
53
|
|
|
49
|
-
get columnDefs() {
|
|
54
|
+
private get columnDefs() {
|
|
50
55
|
return this.#options.columnDefs ?? [];
|
|
51
56
|
}
|
|
52
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Set default column definition
|
|
60
|
+
* @param def - column definition
|
|
61
|
+
* @returns this
|
|
62
|
+
*/
|
|
63
|
+
public setDefaultColDef(def: ColDefExtended<TData>) {
|
|
64
|
+
this.#options.defaultColDef = def;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Show loading overlay
|
|
70
|
+
* @param loading
|
|
71
|
+
* @returns this
|
|
72
|
+
*/
|
|
73
|
+
public setLoading(loading?: boolean) {
|
|
74
|
+
this.#options.loading = loading;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Show "not ready overlay
|
|
80
|
+
* @param notReady
|
|
81
|
+
* @returns this
|
|
82
|
+
*/
|
|
83
|
+
public setNotReady(notReady?: boolean) {
|
|
84
|
+
this.#options.notReady = notReady;
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Set loading overlay type
|
|
90
|
+
* @param type
|
|
91
|
+
* @returns this
|
|
92
|
+
*/
|
|
93
|
+
public setLoadingOverlayType(type?: 'transparent') {
|
|
94
|
+
this.#options.loadingOverlayType = type;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Set "not ready" text
|
|
100
|
+
* @param notReadyText
|
|
101
|
+
* @returns this
|
|
102
|
+
*/
|
|
103
|
+
public setNotReadyText(notReadyText?: string) {
|
|
104
|
+
this.#options.notReadyText = notReadyText;
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Set "no rows" text when there are no rows (default is "Empty")
|
|
110
|
+
* @param noRowsText
|
|
111
|
+
* @returns this
|
|
112
|
+
*/
|
|
113
|
+
public setNoRowsText(noRowsText?: string) {
|
|
114
|
+
this.#options.noRowsText = noRowsText;
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Set row selection options
|
|
120
|
+
* @param rowSelection
|
|
121
|
+
* @returns this
|
|
122
|
+
*/
|
|
123
|
+
public setRowSelection(rowSelection?: RowSelectionOptions) {
|
|
124
|
+
this.#options.rowSelection = rowSelection;
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Set row data
|
|
130
|
+
* @param rowData
|
|
131
|
+
* @returns this
|
|
132
|
+
*/
|
|
133
|
+
public setRowData(rowData: TData[]) {
|
|
134
|
+
this.#options.rowData = rowData;
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Set components
|
|
140
|
+
* @param components
|
|
141
|
+
* @returns this
|
|
142
|
+
*/
|
|
143
|
+
public setComponents(components?: Record<string, Component>) {
|
|
144
|
+
this.#options.components = components;
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Set an option
|
|
150
|
+
* @param key - option key
|
|
151
|
+
* @param value - option value
|
|
152
|
+
* @returns this
|
|
153
|
+
*/
|
|
154
|
+
public setOption<K extends keyof GridOptionsExtended<TData>>(key: K, value: GridOptionsExtended<TData>[K]) {
|
|
155
|
+
this.#options[key] = value;
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Add an extended column definition
|
|
161
|
+
* @param def - column definition
|
|
162
|
+
* @returns this
|
|
163
|
+
*/
|
|
53
164
|
public column<TValue = any>(def: ColDefExtended<TData, TValue>) {
|
|
54
165
|
this.#options.columnDefs = [...this.columnDefs, def];
|
|
55
166
|
return this;
|
|
56
167
|
}
|
|
57
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Show row numbers column
|
|
171
|
+
* @param show - show or hide row numbers column
|
|
172
|
+
* @returns this
|
|
173
|
+
*/
|
|
174
|
+
public columnRowNumbers(show: boolean = true) {
|
|
175
|
+
this.#options.rowNumbersColumn = show;
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Add a file input column
|
|
181
|
+
* @param def - column definition
|
|
182
|
+
* @param cb - callback to set params for the file input cell renderer
|
|
183
|
+
* @returns this
|
|
184
|
+
*/
|
|
185
|
+
public columnFileInput<TValue = any>(
|
|
186
|
+
def: ColDefExtended<TData, TValue> & {
|
|
187
|
+
/**
|
|
188
|
+
* Allowed file extensions (like ['fastq.gz'])
|
|
189
|
+
*/
|
|
190
|
+
extensions?: string[];
|
|
191
|
+
/**
|
|
192
|
+
* The resolveProgress function is an optional input parameter for the component
|
|
193
|
+
* that allows tracking the file upload progress in real-time.
|
|
194
|
+
* By passing resolveProgress, you can ensure that the component
|
|
195
|
+
* displays accurate progress values for each file as they upload.
|
|
196
|
+
* How to use it in AgGrid
|
|
197
|
+
* cellRendererParams: {
|
|
198
|
+
* resolveProgress: (cellData) => {
|
|
199
|
+
* const progresses = app.progresses;
|
|
200
|
+
* if (!cellData.value.importFileHandle) return undefined;
|
|
201
|
+
* else return progresses[cellData.value.importFileHandle];
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
*/
|
|
205
|
+
resolveImportProgress?: (cellData: ICellRendererParams<TData, TValue>) => ImportProgress | undefined;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The resolveFileHandle function is an optional input parameter for the component
|
|
209
|
+
* that allows tracking the file upload progress in real-time.
|
|
210
|
+
* By passing resolveFileHandle, you can ensure that the component
|
|
211
|
+
* displays accurate progress values for each file as they upload.
|
|
212
|
+
* How to use it in AgGrid
|
|
213
|
+
* cellRendererParams: {
|
|
214
|
+
* resolveFileHandle: (cellData) => {
|
|
215
|
+
* return cellData.value.importFileHandle;
|
|
216
|
+
* }
|
|
217
|
+
* }
|
|
218
|
+
*/
|
|
219
|
+
resolveImportFileHandle?: (cellData: ICellRendererParams<TData, TValue>) => ImportFileHandle | undefined;
|
|
220
|
+
|
|
221
|
+
setImportFileHandle?: (d: ValueSetterParams<TData, ImportFileHandle | undefined>) => void;
|
|
222
|
+
}) {
|
|
223
|
+
return this.column(Object.assign({
|
|
224
|
+
cellRenderer: 'PlAgCellFile',
|
|
225
|
+
headerComponentParams: { type: 'File' },
|
|
226
|
+
cellStyle: { padding: 0 },
|
|
227
|
+
valueSetter: (d: ValueSetterParams<TData, ImportFileHandle | undefined>) => {
|
|
228
|
+
def.setImportFileHandle?.(d);
|
|
229
|
+
return true;
|
|
230
|
+
},
|
|
231
|
+
cellRendererSelector: (cellData: ICellRendererParams<TData, TValue>) => {
|
|
232
|
+
return {
|
|
233
|
+
component: 'PlAgCellFile',
|
|
234
|
+
params: {
|
|
235
|
+
extensions: def.extensions,
|
|
236
|
+
value: def.resolveImportFileHandle?.(cellData),
|
|
237
|
+
resolveProgress: () => {
|
|
238
|
+
return def.resolveImportProgress?.(cellData);
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
}, def));
|
|
244
|
+
}
|
|
245
|
+
|
|
58
246
|
public build() {
|
|
59
247
|
return this.#options;
|
|
60
248
|
}
|
|
@@ -129,6 +317,9 @@ export function useAgGridOptions<TData>(
|
|
|
129
317
|
// Register all special components
|
|
130
318
|
options.components = Object.assign({}, options.components ?? {}, {
|
|
131
319
|
PlAgCellFile,
|
|
320
|
+
PlAgChartStackedBarCell,
|
|
321
|
+
PlAgChartHistogramCell,
|
|
322
|
+
PlAgCellStatusTag,
|
|
132
323
|
});
|
|
133
324
|
|
|
134
325
|
return options;
|