@milaboratories/milaboratories.ui-examples.ui 1.3.50 → 1.3.52
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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +15 -0
- package/dist/assets/{index-efPAwK5I.js → index-CE8cGuki.js} +184 -184
- package/dist/assets/{index-efPAwK5I.js.map → index-CE8cGuki.js.map} +1 -1
- package/dist/assets/{index-jXG7_ao0.css → index-hxiU8IBB.css} +1 -1
- package/dist/index.html +2 -2
- package/package.json +3 -3
- package/src/app.ts +2 -1
- package/src/pages/AgGridVuePage/AgGridVuePageWithBuilder.vue +275 -0
- package/src/pages/AgGridVuePage/index.ts +1 -0
package/dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta http-equiv="Content-Security-Policy" content="script-src 'self' blob:">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-CE8cGuki.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-hxiU8IBB.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/milaboratories.ui-examples.ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"vue": "^3.5.13",
|
|
7
|
-
"@milaboratories/milaboratories.ui-examples.model": "1.1.
|
|
7
|
+
"@milaboratories/milaboratories.ui-examples.model": "1.1.33",
|
|
8
8
|
"@platforma-sdk/model": "^1.26.0"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"ag-grid-enterprise": "^33.0.4",
|
|
18
18
|
"ag-grid-vue3": "^33.0.4",
|
|
19
19
|
"rollup-plugin-sourcemaps2": "^0.5.0",
|
|
20
|
-
"@platforma-sdk/ui-vue": "^1.
|
|
20
|
+
"@platforma-sdk/ui-vue": "^1.27.5",
|
|
21
21
|
"@milaboratories/helpers": "^1.6.11"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
package/src/app.ts
CHANGED
|
@@ -6,7 +6,7 @@ import ModalsPage from './pages/ModalsPage.vue';
|
|
|
6
6
|
import InjectEnvPage from './pages/InjectEnvPage.vue';
|
|
7
7
|
import UseWatchFetchPage from './pages/UseWatchFetchPage.vue';
|
|
8
8
|
import TypographyPage from './pages/TypographyPage.vue';
|
|
9
|
-
import { AgGridVuePage } from './pages/AgGridVuePage';
|
|
9
|
+
import { AgGridVuePage, AgGridVuePageWithBuilder } from './pages/AgGridVuePage';
|
|
10
10
|
import SelectFilesPage from './pages/SelectFilesPage.vue';
|
|
11
11
|
import ErrorsPage from './pages/ErrorsPage.vue';
|
|
12
12
|
import PlAgDataTablePage from './pages/PlAgDataTablePage.vue';
|
|
@@ -85,6 +85,7 @@ export const sdkPlugin = defineApp(platforma, (app) => {
|
|
|
85
85
|
'/form-components': () => FormComponentsPage,
|
|
86
86
|
'/typography': () => TypographyPage,
|
|
87
87
|
'/ag-grid-vue': () => AgGridVuePage,
|
|
88
|
+
'/ag-grid-vue-with-builder': () => AgGridVuePageWithBuilder,
|
|
88
89
|
'/pl-ag-data-table': () => PlAgDataTablePage,
|
|
89
90
|
'/pl-splash-page': () => PlSplashPage,
|
|
90
91
|
'/select-files': () => SelectFilesPage,
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Component } from 'vue';
|
|
3
|
+
import { computed, h, ref } from 'vue';
|
|
4
|
+
import {
|
|
5
|
+
PlBlockPage,
|
|
6
|
+
PlAgDataTableToolsPanel,
|
|
7
|
+
PlAgGridColumnManager,
|
|
8
|
+
PlAgCsvExporter,
|
|
9
|
+
defaultMainMenuItems,
|
|
10
|
+
PlAgChartStackedBarCell,
|
|
11
|
+
PlAgChartHistogramCell,
|
|
12
|
+
PlCheckbox,
|
|
13
|
+
PlRow,
|
|
14
|
+
useAgGridOptions,
|
|
15
|
+
makeEaseOut,
|
|
16
|
+
animate,
|
|
17
|
+
PlBtnPrimary,
|
|
18
|
+
} from '@platforma-sdk/ui-vue';
|
|
19
|
+
import { AgGridVue } from 'ag-grid-vue3';
|
|
20
|
+
import { times } from '@milaboratories/helpers';
|
|
21
|
+
import { faker } from '@faker-js/faker';
|
|
22
|
+
import { stackedSettings } from './stackedSettings';
|
|
23
|
+
import { histogramSettings } from './histogramSettings';
|
|
24
|
+
import { LinkComponent } from './LinkComponent';
|
|
25
|
+
import type { ImportFileHandle, ImportProgress } from '@platforma-sdk/model';
|
|
26
|
+
import { useApp } from '../../app';
|
|
27
|
+
|
|
28
|
+
type FileCell = {
|
|
29
|
+
importFileHandle: ImportFileHandle | undefined;
|
|
30
|
+
importProgress: ImportProgress | undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type Row = {
|
|
34
|
+
id: number;
|
|
35
|
+
label: string;
|
|
36
|
+
progress: number | undefined;
|
|
37
|
+
stacked_bar: unknown;
|
|
38
|
+
date: Date;
|
|
39
|
+
file: FileCell;
|
|
40
|
+
link: string;
|
|
41
|
+
time: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const app = useApp();
|
|
45
|
+
|
|
46
|
+
function generateData(): Row[] {
|
|
47
|
+
return times(10, (i) => {
|
|
48
|
+
const importFileHandle = app.model.args.handles[i];
|
|
49
|
+
const importProgress = importFileHandle ? app.model.outputs?.progresses?.[importFileHandle] : undefined;
|
|
50
|
+
return {
|
|
51
|
+
id: i,
|
|
52
|
+
label: faker.company.buzzNoun(),
|
|
53
|
+
progress: faker.number.int({ min: 24, max: 100 }),
|
|
54
|
+
stacked_bar: (i % 2 === 0) ? stackedSettings.value : undefined,
|
|
55
|
+
date: faker.date.birthdate(),
|
|
56
|
+
file: {
|
|
57
|
+
importFileHandle,
|
|
58
|
+
importProgress,
|
|
59
|
+
},
|
|
60
|
+
link: faker.internet.url(),
|
|
61
|
+
time: `${faker.number.int()} h`,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const result = computed(() => generateData());
|
|
67
|
+
|
|
68
|
+
function showProgress() {
|
|
69
|
+
animate({
|
|
70
|
+
duration: 10000,
|
|
71
|
+
timing: makeEaseOut((t) => t),
|
|
72
|
+
draw: (progress) => {
|
|
73
|
+
result.value.forEach((it) => {
|
|
74
|
+
it.progress = progress * 100;
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const BlankComponent: Component = {
|
|
81
|
+
props: ['params'],
|
|
82
|
+
setup(props) {
|
|
83
|
+
return () =>
|
|
84
|
+
h('div', { style: `padding: 0 15px` }, props.params.value);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const isOverlayTransparent = ref(false);
|
|
89
|
+
|
|
90
|
+
const rowNumbers = ref(true);
|
|
91
|
+
|
|
92
|
+
const loading = ref(false);
|
|
93
|
+
|
|
94
|
+
const notReady = ref(false);
|
|
95
|
+
|
|
96
|
+
const hasRows = ref(true);
|
|
97
|
+
|
|
98
|
+
const { gridOptions, gridApi } = useAgGridOptions<Row>(({ builder }) => {
|
|
99
|
+
return builder
|
|
100
|
+
.setComponents({
|
|
101
|
+
LinkComponent,
|
|
102
|
+
})
|
|
103
|
+
.setOption('onRowDoubleClicked', (_e) => {
|
|
104
|
+
alert('Example "Open" button was clicked');
|
|
105
|
+
})
|
|
106
|
+
.setRowSelection({
|
|
107
|
+
mode: 'multiRow',
|
|
108
|
+
checkboxes: false,
|
|
109
|
+
headerCheckbox: false,
|
|
110
|
+
})
|
|
111
|
+
.setLoading(loading.value)
|
|
112
|
+
.setNotReady(notReady.value)
|
|
113
|
+
.setNotReadyText('Not ready text (custom, default is "Not ready"')
|
|
114
|
+
.setRowData(hasRows.value ? result.value : [])
|
|
115
|
+
.setNoRowsText('No rows text (custom, default is "Empty")')
|
|
116
|
+
.setLoadingOverlayType(isOverlayTransparent.value ? 'transparent' : undefined)
|
|
117
|
+
.columnRowNumbers(rowNumbers.value)
|
|
118
|
+
.column({
|
|
119
|
+
field: 'id',
|
|
120
|
+
headerName: 'ID',
|
|
121
|
+
mainMenuItems: defaultMainMenuItems,
|
|
122
|
+
headerComponentParams: { type: 'Number' },
|
|
123
|
+
})
|
|
124
|
+
.column({
|
|
125
|
+
field: 'label',
|
|
126
|
+
pinned: 'left',
|
|
127
|
+
lockPinned: true,
|
|
128
|
+
lockPosition: true,
|
|
129
|
+
headerName: 'Sample label long text for overflow label long text for overflow',
|
|
130
|
+
headerComponentParams: { type: 'Text' },
|
|
131
|
+
textWithButton: true,
|
|
132
|
+
})
|
|
133
|
+
.column<number | undefined>({
|
|
134
|
+
field: 'progress',
|
|
135
|
+
headerName: 'Progress',
|
|
136
|
+
progress(value, cellData) {
|
|
137
|
+
const percent = value ?? 0;
|
|
138
|
+
|
|
139
|
+
if (cellData.data?.id === 2) {
|
|
140
|
+
return {
|
|
141
|
+
status: 'not_started',
|
|
142
|
+
error: 'Test Error',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (cellData.data?.id === 3) {
|
|
147
|
+
return {
|
|
148
|
+
status: 'running',
|
|
149
|
+
text: 'Infinite progress',
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (percent < 10) {
|
|
154
|
+
return {
|
|
155
|
+
status: 'not_started',
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (percent >= 100) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (percent > 90) {
|
|
164
|
+
return {
|
|
165
|
+
status: 'done',
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
status: 'running',
|
|
171
|
+
percent,
|
|
172
|
+
text: `Progress`,
|
|
173
|
+
suffix: `${percent.toFixed(1)}%`,
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
cellRendererSelector: (cellData) => {
|
|
177
|
+
return {
|
|
178
|
+
component: BlankComponent,
|
|
179
|
+
params: { value: cellData.value },
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
headerComponentParams: { type: 'Progress' },
|
|
183
|
+
})
|
|
184
|
+
.columnFileInput<FileCell>({
|
|
185
|
+
field: 'file',
|
|
186
|
+
headerName: 'File input',
|
|
187
|
+
extensions: ['fastq.gz'],
|
|
188
|
+
setImportFileHandle: (params) => {
|
|
189
|
+
app.model.args.handles[params.data.id] = params.newValue ?? undefined;
|
|
190
|
+
},
|
|
191
|
+
resolveImportProgress: (cellData) => {
|
|
192
|
+
return cellData.value?.importProgress;
|
|
193
|
+
},
|
|
194
|
+
resolveImportFileHandle: (cellData) => {
|
|
195
|
+
return cellData.value?.importFileHandle;
|
|
196
|
+
},
|
|
197
|
+
})
|
|
198
|
+
.column({
|
|
199
|
+
field: 'stacked_bar',
|
|
200
|
+
headerName: 'StackedBar',
|
|
201
|
+
progress: (value) => {
|
|
202
|
+
if (value) {
|
|
203
|
+
return undefined; // If no progress show main component
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
status: 'running',
|
|
208
|
+
text: 'Loading data...',
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
cellRendererSelector: (cellData) => {
|
|
212
|
+
return {
|
|
213
|
+
component: PlAgChartStackedBarCell,
|
|
214
|
+
params: { value: cellData.value },
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
})
|
|
218
|
+
.column({
|
|
219
|
+
colId: 'histogram',
|
|
220
|
+
headerName: 'Histogram',
|
|
221
|
+
cellRendererSelector: (cellData) => {
|
|
222
|
+
const value = (cellData.data?.id ?? 0 % 2 === 0)
|
|
223
|
+
? histogramSettings.value
|
|
224
|
+
: undefined;
|
|
225
|
+
return {
|
|
226
|
+
component: PlAgChartHistogramCell,
|
|
227
|
+
params: { value },
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
})
|
|
231
|
+
.column({
|
|
232
|
+
field: 'date',
|
|
233
|
+
headerName: 'Date',
|
|
234
|
+
headerComponentParams: { type: 'Date' },
|
|
235
|
+
})
|
|
236
|
+
.column({
|
|
237
|
+
field: 'link',
|
|
238
|
+
headerName: 'Link',
|
|
239
|
+
headerComponentParams: { type: 'Text' },
|
|
240
|
+
cellRenderer: 'LinkComponent',
|
|
241
|
+
})
|
|
242
|
+
.column({
|
|
243
|
+
field: 'time',
|
|
244
|
+
headerName: 'Duration',
|
|
245
|
+
headerComponentParams: { type: 'Duration' },
|
|
246
|
+
});
|
|
247
|
+
;
|
|
248
|
+
});
|
|
249
|
+
</script>
|
|
250
|
+
|
|
251
|
+
<template>
|
|
252
|
+
<PlBlockPage style="max-width: 100%">
|
|
253
|
+
<template #title>AgGridVue</template>
|
|
254
|
+
<template #append>
|
|
255
|
+
<PlBtnPrimary @click="showProgress">Show progress</PlBtnPrimary>
|
|
256
|
+
<PlAgDataTableToolsPanel>
|
|
257
|
+
<PlAgGridColumnManager v-if="gridApi" :api="gridApi" />
|
|
258
|
+
<PlAgCsvExporter v-if="gridApi" :api="gridApi" />
|
|
259
|
+
</PlAgDataTableToolsPanel>
|
|
260
|
+
</template>
|
|
261
|
+
|
|
262
|
+
<PlRow wrap>
|
|
263
|
+
<PlCheckbox v-model="rowNumbers">Show row numbers</PlCheckbox>
|
|
264
|
+
<PlCheckbox v-model="isOverlayTransparent">Use transparent overlay</PlCheckbox>
|
|
265
|
+
<PlCheckbox v-model="loading">Loading</PlCheckbox>
|
|
266
|
+
<PlCheckbox v-model="notReady">Not Ready</PlCheckbox>
|
|
267
|
+
<PlCheckbox v-model="hasRows">Has rows</PlCheckbox>
|
|
268
|
+
</PlRow>
|
|
269
|
+
|
|
270
|
+
<AgGridVue
|
|
271
|
+
:style="{ height: '100%' }"
|
|
272
|
+
v-bind="gridOptions"
|
|
273
|
+
/>
|
|
274
|
+
</PlBlockPage>
|
|
275
|
+
</template>
|