@platforma-sdk/ui-vue 1.3.10 → 1.3.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/ui-vue",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.cjs",
6
6
  "module": "dist/lib.js",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "vue": "^3.5.9",
22
22
  "@milaboratories/uikit": "^1.2.7",
23
- "@platforma-sdk/model": "^1.2.27"
23
+ "@platforma-sdk/model": "^1.2.28"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@ag-grid-community/client-side-row-model": "^32.2.1",
@@ -39,7 +39,9 @@ defineProps<{
39
39
  height: 200px !important;
40
40
  width: 300px !important;
41
41
  mask-size: contain !important;
42
+ mask-position: center !important;
42
43
  background-size: contain;
44
+ background-position: center;
43
45
  }
44
46
  .grid-overlay-container > span {
45
47
  color: var(--txt-mask);
@@ -22,6 +22,7 @@
22
22
  height: 300px;
23
23
  width: 300px;
24
24
  background-size: contain;
25
+ background-position: center;
25
26
  }
26
27
  .grid-overlay-container > span {
27
28
  color: var(--txt-mask);
@@ -77,10 +77,15 @@ function makeFilters(sheetsState: Record<string, string | number>): PTableRecord
77
77
  return (
78
78
  settings.value.sheets?.map((sheet) => ({
79
79
  type: 'bySingleColumn',
80
- column: {
81
- type: 'axis',
82
- id: sheet.axis,
83
- },
80
+ column: sheet.column
81
+ ? {
82
+ type: 'column',
83
+ id: sheet.column,
84
+ }
85
+ : {
86
+ type: 'axis',
87
+ id: sheet.axis,
88
+ },
84
89
  predicate: {
85
90
  operator: 'Equal',
86
91
  reference: sheetsState[makeSheetId(sheet.axis)],
@@ -127,9 +132,6 @@ watch(
127
132
  for (const sheet of sheets) {
128
133
  const sheetId = makeSheetId(sheet.axis);
129
134
  if (!state[sheetId]) {
130
- // @vadimpiven
131
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
132
- // @ts-expect-error
133
135
  state[sheetId] = sheet.defaultValue ?? sheet.options[0].value;
134
136
  }
135
137
  }
@@ -187,9 +189,6 @@ watch(
187
189
  const onSheetChanged = (sheetId: string, newValue: string | number) => {
188
190
  const state = sheetsState.value;
189
191
  if (state[sheetId] === newValue) return;
190
- // @vadimpiven
191
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
192
- // @ts-expect-error
193
192
  state[sheetId] = newValue;
194
193
  sheetsState.value = state;
195
194
  };
@@ -17,6 +17,8 @@ import {
17
17
  type PTableColumnSpec,
18
18
  type PTableHandle,
19
19
  type PTableVector,
20
+ type PColumnSpec,
21
+ getAxesId,
20
22
  } from '@platforma-sdk/model';
21
23
  import * as lodash from 'lodash';
22
24
  import canonicalize from 'canonicalize';
@@ -136,7 +138,7 @@ function toDisplayValue(value: string | number | bigint | Uint8Array, valueType:
136
138
  * @param nRows number of rows
137
139
  * @returns
138
140
  */
139
- function columns2rows(indices: number[], columns: PTableVector[]): unknown[] {
141
+ function columns2rows(fields: number[], columns: PTableVector[]): unknown[] {
140
142
  const nCols = columns.length;
141
143
  const rowData = [];
142
144
  for (let iRow = 0; iRow < columns[0].data.length; ++iRow) {
@@ -144,7 +146,7 @@ function columns2rows(indices: number[], columns: PTableVector[]): unknown[] {
144
146
 
145
147
  const index = [];
146
148
  for (let iCol = 0; iCol < nCols; ++iCol) {
147
- const field = indices[iCol].toString();
149
+ const field = fields[iCol].toString();
148
150
  const value = columns[iCol].data[iRow];
149
151
  const valueType = columns[iCol].type;
150
152
  if (isValueAbsent(columns[iCol].absent, iRow)) {
@@ -183,7 +185,22 @@ export async function updatePFrameGridOptions(
183
185
  const indices = specs
184
186
  .map((spec, i) => (!lodash.find(sheets, (sheet) => lodash.isEqual(sheet.axis, spec.id)) ? i : null))
185
187
  .filter((entry) => entry !== null);
186
- const columnDefs = indices.map((i) => getColDef(i, specs[i]));
188
+ const fields = lodash.cloneDeep(indices);
189
+
190
+ for (let i = indices.length - 1; i >= 0; --i) {
191
+ const idx = indices[i];
192
+ if (specs[idx].type !== 'column' || specs[idx].spec.name !== 'pl7.app/label') continue;
193
+
194
+ const axisId = getAxesId((specs[idx].spec as PColumnSpec).axesSpec).map(lodash.cloneDeep)[0];
195
+ const axisIdx = lodash.findIndex(indices, (idx) => lodash.isEqual(specs[idx].id, axisId));
196
+ if (axisIdx === -1) continue;
197
+
198
+ indices[axisIdx] = idx;
199
+ indices.splice(idx, 1);
200
+ fields.splice(idx, 1);
201
+ }
202
+
203
+ const columnDefs = fields.map((i) => getColDef(i, specs[i]));
187
204
 
188
205
  const ptShape = await pfDriver.getShape(pt);
189
206
  const rowCount = ptShape.rows;
@@ -216,7 +233,7 @@ export async function updatePFrameGridOptions(
216
233
  offset: params.startRow,
217
234
  length,
218
235
  });
219
- rowData = columns2rows(indices, data);
236
+ rowData = columns2rows(fields, data);
220
237
  }
221
238
 
222
239
  params.successCallback(rowData, ptShape.rows);
@@ -1,11 +1,13 @@
1
- import type { AxisId, LocalBlobHandleAndSize, PTableHandle, RemoteBlobHandleAndSize, ValueOrErrors } from '@platforma-sdk/model';
1
+ import type { AxisId, LocalBlobHandleAndSize, PObjectId, PTableHandle, RemoteBlobHandleAndSize, ValueOrErrors } from '@platforma-sdk/model';
2
2
 
3
3
  export type PlDataTableSheet = {
4
4
  /** id of the axis to use */
5
5
  axis: AxisId;
6
+ /** id of label column to use in filter instead of axis */
7
+ column?: PObjectId;
6
8
  /** options to show in the filter tan */
7
9
  options: {
8
- /** value of the option (should be one of the values in the axis) */
10
+ /** value of the option (should be one of the values in the axis or column) */
9
11
  value: string | number;
10
12
  /** corresponding label */
11
13
  text: string;