@milaboratories/milaboratories.ui-examples.ui 1.3.35 → 1.3.37

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/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-D8b88Naq.js"></script>
8
- <link rel="stylesheet" crossorigin href="./assets/index-DBOmIoaJ.css">
7
+ <script type="module" crossorigin src="./assets/index-CWDk_r34.js"></script>
8
+ <link rel="stylesheet" crossorigin href="./assets/index-DzFme_A9.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="app"></div>
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@milaboratories/milaboratories.ui-examples.ui",
3
- "version": "1.3.35",
3
+ "version": "1.3.37",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "vue": "^3.5.13",
7
- "@milaboratories/milaboratories.ui-examples.model": "1.1.19",
8
- "@platforma-sdk/model": "^1.22.18"
7
+ "@milaboratories/milaboratories.ui-examples.model": "1.1.20",
8
+ "@platforma-sdk/model": "^1.22.59"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@vitejs/plugin-vue": "^5.2.1",
@@ -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.4.3",
20
- "@platforma-sdk/ui-vue": "^1.22.52",
20
+ "@platforma-sdk/ui-vue": "^1.22.59",
21
21
  "@milaboratories/helpers": "^1.6.11"
22
22
  },
23
23
  "scripts": {
@@ -1,30 +1,22 @@
1
1
  <script setup lang="ts">
2
2
  import type { Component } from 'vue';
3
- import { computed, h, ref } from 'vue';
3
+ import { h, ref } from 'vue';
4
4
  import {
5
5
  PlBlockPage,
6
6
  PlAgDataTableToolsPanel,
7
7
  PlAgGridColumnManager,
8
- makeRowNumberColDef,
9
- PlAgCellFile,
10
- PlAgTextAndButtonCell,
11
- PlAgColumnHeader,
12
- type PlAgHeaderComponentParams,
13
8
  PlAgCsvExporter,
14
- PlAgCellProgress,
15
9
  defaultMainMenuItems,
16
10
  PlAgChartStackedBarCell,
17
11
  PlAgChartHistogramCell,
18
12
  PlCheckbox,
19
13
  PlRow,
20
- useAgGridOptionsSimple,
14
+ useAgGridOptions,
21
15
  makeEaseOut,
22
16
  animate,
23
17
  PlBtnPrimary,
24
- createAgGridColDef,
25
18
  } from '@platforma-sdk/ui-vue';
26
19
  import { AgGridVue } from 'ag-grid-vue3';
27
- import type { ColDef } from 'ag-grid-enterprise';
28
20
  import { times } from '@milaboratories/helpers';
29
21
  import { faker } from '@faker-js/faker';
30
22
  import { stackedSettings } from './stackedSettings';
@@ -79,190 +71,161 @@ const BlankComponent: Component = {
79
71
  },
80
72
  };
81
73
 
82
- const columnDefs = computed<ColDef<Row>[]>(() => {
83
- return [
84
- makeRowNumberColDef(),
85
- createAgGridColDef<Row>({
86
- colId: 'id',
87
- field: 'id',
88
- headerName: 'ID',
89
- mainMenuItems: defaultMainMenuItems,
90
- headerComponent: PlAgColumnHeader,
91
- headerComponentParams: { type: 'Number' } satisfies PlAgHeaderComponentParams,
92
- }),
93
- {
94
- colId: 'label',
95
- field: 'label',
96
- pinned: 'left',
97
- lockPinned: true,
98
- lockPosition: true,
99
- headerName: 'Sample label long text for overflow label long text for overflow',
100
- cellRenderer: 'PlAgTextAndButtonCell',
101
- headerComponent: PlAgColumnHeader,
102
- headerComponentParams: { type: 'Text' } satisfies PlAgHeaderComponentParams,
103
- cellRendererParams: {
104
- onClick: onClickHandler,
105
- invokeRowsOnDoubleClick: true,
74
+ const isOverlayTransparent = ref(false);
75
+
76
+ const rowNumbers = ref(true);
77
+
78
+ const loading = ref(false);
79
+
80
+ const notReady = ref(true);
81
+
82
+ const hasRows = ref(true);
83
+
84
+ const { gridOptions, gridApi } = useAgGridOptions<Row>(({ column }) => {
85
+ return {
86
+ columnDefs: [
87
+ {
88
+ field: 'id',
89
+ headerName: 'ID',
90
+ mainMenuItems: defaultMainMenuItems,
91
+ headerComponentParams: { type: 'Number' },
106
92
  },
107
- },
108
- createAgGridColDef(({
109
- colId: 'progress',
110
- field: 'progress',
111
- headerName: 'Progress',
112
- progress: (cellData) => {
113
- const percent = cellData.data?.progress ?? 0;
93
+ {
94
+ field: 'label',
95
+ pinned: 'left',
96
+ lockPinned: true,
97
+ lockPosition: true,
98
+ headerName: 'Sample label long text for overflow label long text for overflow',
99
+ headerComponentParams: { type: 'Text' },
100
+ textWithButton: true,
101
+ },
102
+ column<number | undefined>({
103
+ field: 'progress',
104
+ headerName: 'Progress',
105
+ progress(value, cellData) {
106
+ const percent = value as number ?? 0;
107
+
108
+ if (cellData.data?.id === 2) {
109
+ return {
110
+ status: 'not_started',
111
+ error: 'Test Error',
112
+ };
113
+ }
114
+
115
+ if (cellData.data?.id === 3) {
116
+ return {
117
+ status: 'running',
118
+ text: 'Infinite progress',
119
+ };
120
+ }
121
+
122
+ if (percent < 10) {
123
+ return {
124
+ status: 'not_started',
125
+ };
126
+ }
127
+
128
+ if (percent >= 100) {
129
+ return undefined;
130
+ }
131
+
132
+ if (percent > 90) {
133
+ return {
134
+ status: 'done',
135
+ };
136
+ }
114
137
 
115
- if (cellData.data?.id === 2) {
116
138
  return {
117
- status: 'not_started',
118
- error: 'Test Error',
139
+ status: 'running',
140
+ percent,
141
+ text: `Progress`,
142
+ suffix: `${percent.toFixed(1)}%`,
119
143
  };
120
- }
144
+ },
145
+ cellRendererSelector: (cellData) => {
146
+ return {
147
+ component: BlankComponent,
148
+ params: { value: cellData.value },
149
+ };
150
+ },
151
+ headerComponentParams: { type: 'Text' },
152
+ }), // But you could use builder
153
+ {
154
+ field: 'stacked_bar',
155
+ headerName: 'StackedBar',
156
+ progress: (value) => {
157
+ if (value) {
158
+ return undefined; // If no progress show main component
159
+ }
121
160
 
122
- if (cellData.data?.id === 3) {
123
161
  return {
124
162
  status: 'running',
125
- text: 'Infinite progress',
163
+ text: 'Loading data...',
126
164
  };
127
- }
128
-
129
- if (percent < 10) {
165
+ },
166
+ cellRendererSelector: (cellData) => {
130
167
  return {
131
- status: 'not_started',
168
+ component: PlAgChartStackedBarCell,
169
+ params: { value: cellData.value },
132
170
  };
133
- }
134
-
135
- if (percent >= 100) {
136
- return undefined;
137
- }
138
-
139
- if (percent > 90) {
171
+ },
172
+ },
173
+ {
174
+ colId: 'histogram',
175
+ headerName: 'Histogram',
176
+ cellRendererSelector: (cellData) => {
177
+ const value = (cellData.data?.id ?? 0 % 2 === 0)
178
+ ? histogramSettings.value
179
+ : undefined;
140
180
  return {
141
- status: 'done',
181
+ component: PlAgChartHistogramCell,
182
+ params: { value },
142
183
  };
143
- }
144
-
145
- return {
146
- status: 'running',
147
- percent,
148
- text: `Progress`,
149
- suffix: `${percent.toFixed(1)}%`,
150
- };
184
+ },
151
185
  },
152
- cellRendererSelector: (cellData) => {
153
- return {
154
- component: BlankComponent,
155
- params: { value: cellData.value },
156
- };
186
+ {
187
+ field: 'date',
188
+ headerName: 'Date',
189
+ headerComponentParams: { type: 'Date' },
157
190
  },
158
- headerComponent: PlAgColumnHeader,
159
- headerComponentParams: { type: 'Text' } satisfies PlAgHeaderComponentParams,
160
- })),
161
- createAgGridColDef<Row>(({
162
- colId: 'stacked_bar',
163
- field: 'stacked_bar',
164
- headerName: 'StackedBar',
165
- progress: (cellData) => {
166
- if (cellData.value) {
167
- return undefined;
168
- }
169
-
170
- return {
171
- status: 'running',
172
- text: 'Loading data...',
173
- };
191
+ {
192
+ field: 'file',
193
+ headerName: 'File input',
194
+ cellRenderer: 'PlAgCellFile',
195
+ headerComponentParams: { type: 'File' },
196
+ cellStyle: { padding: 0 },
174
197
  },
175
- cellRendererSelector: (cellData) => {
176
- console.log('cellData.value', cellData.value);
177
- return {
178
- component: PlAgChartStackedBarCell,
179
- params: { value: cellData.value },
180
- };
198
+ {
199
+ field: 'link',
200
+ headerName: 'Link',
201
+ headerComponentParams: { type: 'Text' },
202
+ cellRenderer: 'LinkComponent',
181
203
  },
182
- })),
183
- {
184
- colId: 'histogram',
185
- headerName: 'Histogram',
186
- cellRendererSelector: (cellData) => {
187
- const value = (cellData.data?.id ?? 0 % 2 === 0)
188
- ? histogramSettings.value
189
- : undefined;
190
- return {
191
- component: PlAgChartHistogramCell,
192
- params: { value },
193
- };
204
+ {
205
+ colId: 'time',
206
+ field: 'time',
207
+ headerName: 'Duration',
208
+ headerComponentParams: { type: 'Duration' },
194
209
  },
195
- },
196
- {
197
- colId: 'date',
198
- field: 'date',
199
- headerName: 'Date',
200
- headerComponent: PlAgColumnHeader,
201
- headerComponentParams: { type: 'Date' } satisfies PlAgHeaderComponentParams,
202
- },
203
- {
204
- colId: 'file',
205
- field: 'file',
206
- headerName: 'File input',
207
- cellRenderer: 'PlAgCellFile',
208
-
209
- headerComponent: PlAgColumnHeader,
210
- headerComponentParams: { type: 'File' } satisfies PlAgHeaderComponentParams,
211
- cellStyle: { padding: 0 },
212
- },
213
- {
214
- colId: 'link',
215
- field: 'link',
216
- headerName: 'Link',
217
- headerComponent: PlAgColumnHeader,
218
- headerComponentParams: { type: 'Text' } satisfies PlAgHeaderComponentParams,
219
- cellRenderer: 'LinkComponent',
220
- },
221
- {
222
- colId: 'time',
223
- field: 'time',
224
- headerName: 'Duration',
225
- headerComponent: PlAgColumnHeader,
226
- headerComponentParams: { type: 'Duration' } satisfies PlAgHeaderComponentParams,
227
- },
228
- ];
229
- });
230
-
231
- function onClickHandler() {
232
- // will be invoked when invokeRowsOnDoubleClick: false
233
- console.log('onClickHandler');
234
- }
235
-
236
- const isOverlayTransparent = ref(false);
237
-
238
- const loading = ref(false);
239
-
240
- const notReady = ref(false);
241
-
242
- const hasRows = ref(true);
243
-
244
- const { gridOptions, gridApi } = useAgGridOptionsSimple<Row>(() => {
245
- return {
246
- columnDefs: columnDefs.value,
210
+ ],
211
+ rowNumbersColumn: rowNumbers.value,
212
+ // @TODO (Now rowNumbersColumn && rowSelection enables rows selection with checkboxes)
247
213
  rowSelection: {
248
- mode: 'multiRow' as const,
214
+ mode: 'multiRow',
249
215
  checkboxes: false,
250
216
  headerCheckbox: false,
251
217
  },
252
218
  loading: loading.value,
219
+ loadingOverlayType: isOverlayTransparent.value ? 'transparent' : undefined,
220
+ notReady: notReady.value,
221
+ notReadyText: 'I am not ready(',
222
+ // noRowsText: 'No rows(',
253
223
  rowData: hasRows.value ? result.value : [],
254
- onRowDoubleClicked: (e) => {
255
- console.log('Example "Open" button was clicked', e);
256
- },
257
- loadingOverlayComponentParams: {
258
- notReady: notReady.value,
259
- overlayType: isOverlayTransparent.value ? 'transparent' : undefined,
224
+ onRowDoubleClicked: (_e) => {
225
+ alert('Example "Open" button was clicked');
260
226
  },
261
227
  components: {
262
- PlAgCellProgress,
263
228
  LinkComponent,
264
- PlAgCellFile,
265
- PlAgTextAndButtonCell,
266
229
  },
267
230
  };
268
231
  });
@@ -272,20 +235,20 @@ const { gridOptions, gridApi } = useAgGridOptionsSimple<Row>(() => {
272
235
  <PlBlockPage style="max-width: 100%">
273
236
  <template #title>AgGridVue</template>
274
237
  <template #append>
275
- <PlRow>
276
- <PlCheckbox v-model="isOverlayTransparent">Use transparent overlay</PlCheckbox>
277
- <PlCheckbox v-model="loading">Loading</PlCheckbox>
278
- <PlCheckbox v-model="notReady">Not Ready</PlCheckbox>
279
- <PlCheckbox v-model="hasRows">Has rows</PlCheckbox>
280
- <PlBtnPrimary @click="showProgress">Show progress</PlBtnPrimary>
281
- </PlRow>
238
+ <PlBtnPrimary @click="showProgress">Show progress</PlBtnPrimary>
282
239
  <PlAgDataTableToolsPanel>
283
240
  <PlAgGridColumnManager v-if="gridApi" :api="gridApi" />
284
241
  <PlAgCsvExporter v-if="gridApi" :api="gridApi" />
285
242
  </PlAgDataTableToolsPanel>
286
243
  </template>
287
244
 
288
- <pre v-if="false">{{ result }}</pre>
245
+ <PlRow wrap>
246
+ <PlCheckbox v-model="rowNumbers">Show row numbers</PlCheckbox>
247
+ <PlCheckbox v-model="isOverlayTransparent">Use transparent overlay</PlCheckbox>
248
+ <PlCheckbox v-model="loading">Loading</PlCheckbox>
249
+ <PlCheckbox v-model="notReady">Not Ready</PlCheckbox>
250
+ <PlCheckbox v-model="hasRows">Has rows</PlCheckbox>
251
+ </PlRow>
289
252
 
290
253
  <AgGridVue
291
254
  :style="{ height: '100%' }"