@milaboratories/milaboratories.ui-examples.ui 1.5.14 → 1.5.16

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,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta http-equiv="Content-Security-Policy" content="script-src 'self' blob: data: 'unsafe-eval';">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <script type="module" crossorigin src="./assets/index-CSHp_ZxZ.js"></script>
7
+ <script type="module" crossorigin src="./assets/index--L9R7ajn.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-B0kMAAC0.css">
9
9
  </head>
10
10
  <body>
@@ -1 +1 @@
1
- {"version":3,"file":"PlAgDataTableV2Page.vue.d.ts","sourceRoot":"","sources":["../../src/pages/PlAgDataTableV2Page.vue"],"names":[],"mappings":";AA4dA,wBAKG"}
1
+ {"version":3,"file":"PlAgDataTableV2Page.vue.d.ts","sourceRoot":"","sources":["../../src/pages/PlAgDataTableV2Page.vue"],"names":[],"mappings":";AAkkBA,wBAKG"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@milaboratories/milaboratories.ui-examples.ui",
3
- "version": "1.5.14",
3
+ "version": "1.5.16",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "vue": "^3.5.13",
7
- "@milaboratories/milaboratories.ui-examples.model": "1.2.13",
8
- "@platforma-sdk/model": "^1.41.2"
7
+ "@platforma-sdk/model": "^1.41.4",
8
+ "@milaboratories/milaboratories.ui-examples.model": "1.2.15"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@vitejs/plugin-vue": "^5.2.3",
@@ -15,14 +15,14 @@
15
15
  "vue-tsc": "^2.2.10",
16
16
  "@faker-js/faker": "^9.2.0",
17
17
  "zod": "~3.23.8",
18
- "ag-grid-enterprise": "^33.3.2",
19
- "ag-grid-vue3": "^33.3.2",
18
+ "ag-grid-enterprise": "^34.0.2",
19
+ "ag-grid-vue3": "^34.0.2",
20
20
  "rollup-plugin-sourcemaps2": "^0.5.2",
21
21
  "@milaboratories/ts-configs": "1.0.4",
22
+ "@platforma-sdk/ui-vue": "^1.41.4",
22
23
  "@milaboratories/build-configs": "1.0.4",
23
- "@milaboratories/uikit": "^2.3.18",
24
- "@milaboratories/helpers": "^1.6.18",
25
- "@platforma-sdk/ui-vue": "^1.41.2"
24
+ "@milaboratories/uikit": "^2.3.20",
25
+ "@milaboratories/helpers": "^1.6.18"
26
26
  },
27
27
  "scripts": {
28
28
  "dev": "vite",
@@ -9,6 +9,7 @@ import {
9
9
  PlNumberField,
10
10
  PlBtnGhost,
11
11
  PlSlideModal,
12
+ PlBtnSecondary,
12
13
  usePlDataTableSettingsV2,
13
14
  type PlAgDataTableV2Controller,
14
15
  } from '@platforma-sdk/ui-vue';
@@ -17,10 +18,10 @@ import {
17
18
  computed,
18
19
  onWatcherCleanup,
19
20
  ref,
20
- toValue,
21
21
  watch,
22
22
  watchEffect,
23
23
  useTemplateRef,
24
+ toRaw,
24
25
  } from 'vue';
25
26
  import { useApp } from '../app';
26
27
 
@@ -82,13 +83,29 @@ const cellRendererSelector = computed(() => {
82
83
  };
83
84
  });
84
85
 
85
- const selection = ref<PlSelectionModel>({
86
- axesSpec: [],
87
- selectedKeys: [],
88
- });
86
+ const initialSelection: PlSelectionModel = {
87
+ axesSpec: [
88
+ {
89
+ name: 'part',
90
+ type: 'Int',
91
+ },
92
+ {
93
+ name: 'index',
94
+ type: 'Int',
95
+ },
96
+ {
97
+ name: 'linkedIndex',
98
+ type: 'Int',
99
+ },
100
+ ],
101
+ selectedKeys: [
102
+ [0, 51, 51],
103
+ ],
104
+ };
105
+ const selection = ref<PlSelectionModel>(initialSelection);
89
106
  watch(
90
107
  () => selection.value,
91
- (selection) => console.log(`selection changed`, toValue(selection)),
108
+ (selection) => console.log(`selection changed`, toRaw(selection)),
92
109
  );
93
110
 
94
111
  const reactiveText = ref(false);
@@ -120,16 +137,27 @@ watchEffect(() => {
120
137
  });
121
138
 
122
139
  const tableRef = useTemplateRef<PlAgDataTableV2Controller>('tableRef');
123
- watch(
124
- () => [tableRef.value, app.model.outputs.ptV2] as const,
125
- ([table]) => {
126
- if (!table) return;
127
- if (selection.value.selectedKeys.length > 0) {
128
- table.focusRow(selection.value.selectedKeys[0]);
140
+ const focusFirstSelectedRow = async () => {
141
+ if (selection.value.selectedKeys.length > 0) {
142
+ const key = selection.value.selectedKeys[0];
143
+ const focused = await tableRef.value?.focusRow(key);
144
+ if (focused) {
145
+ const row = await tableRef.value?.getRow(key);
146
+ console.log(`focused row`, row);
129
147
  }
130
- },
131
- );
132
-
148
+ }
149
+ };
150
+ const resetSelection = async () => {
151
+ await tableRef.value?.updateSelection(initialSelection);
152
+ await tableRef.value?.focusRow(selection.value.selectedKeys[0]);
153
+ };
154
+ const get10thRow = async () => {
155
+ const rowCount = await tableRef.value?.getRowCount();
156
+ if (rowCount && rowCount >= 10) {
157
+ const row = await tableRef.value?.getRow(9);
158
+ console.log(`total rows: ${rowCount}, 10th row`, row);
159
+ }
160
+ };
133
161
  </script>
134
162
 
135
163
  <template>
@@ -148,10 +176,11 @@ watch(
148
176
  :cell-renderer-selector="cellRendererSelector"
149
177
  v-bind="reactiveTextProps"
150
178
  show-export-button
179
+ @new-data-rendered="focusFirstSelectedRow"
151
180
  >
152
181
  <template #before-sheets>
153
182
  <PlDropdown v-model="app.model.ui.dataTableV2.sourceId" :options="sources" clearable />
154
- <PlNumberField v-model="app.model.args.tableNumRows" />
183
+ <PlNumberField v-model="app.model.ui.dataTableV2.numRows" />
155
184
  </template>
156
185
  </PlAgDataTableV2>
157
186
  </PlBlockPage>
@@ -160,5 +189,7 @@ watch(
160
189
  <PlCheckbox v-model="verbose">Apply custom cell renderer for numbers</PlCheckbox>
161
190
  <PlCheckbox v-model="loading">Display infinite loading</PlCheckbox>
162
191
  <PlCheckbox v-model="reactiveText">Show reactive loading message</PlCheckbox>
192
+ <PlBtnSecondary @click="resetSelection">Reset selection to default</PlBtnSecondary>
193
+ <PlBtnSecondary @click="get10thRow">Print data of 10th row</PlBtnSecondary>
163
194
  </PlSlideModal>
164
195
  </template>