@platforma-sdk/ui-vue 1.7.1 → 1.7.2

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.7.1",
3
+ "version": "1.7.2",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.cjs",
6
6
  "module": "dist/lib.js",
@@ -21,8 +21,8 @@
21
21
  "lru-cache": "^11.0.1",
22
22
  "vue": "^3.5.11",
23
23
  "canonicalize": "^2.0.0",
24
- "@platforma-sdk/model": "^1.7.0",
25
- "@milaboratories/uikit": "^1.2.20"
24
+ "@milaboratories/uikit": "^1.2.20",
25
+ "@platforma-sdk/model": "^1.7.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@ag-grid-community/client-side-row-model": "^32.2.2",
@@ -8,10 +8,10 @@ import { ClipboardModule } from '@ag-grid-enterprise/clipboard';
8
8
  import { RangeSelectionModule } from '@ag-grid-enterprise/range-selection';
9
9
  import { PlDropdownLine } from '@milaboratories/uikit';
10
10
  import type { AxisId, PlDataTableState, PTableRecordFilter, PTableSorting } from '@platforma-sdk/model';
11
- import { computedAsync } from '@vueuse/core';
12
11
  import canonicalize from 'canonicalize';
13
12
  import * as lodash from 'lodash';
14
13
  import { computed, ref, shallowRef, toRefs, watch } from 'vue';
14
+ import { useWatchFetch } from '../../lib';
15
15
  import './ag-theme.css';
16
16
  import PlOverlayLoading from './PlAgOverlayLoading.vue';
17
17
  import PlOverlayNoRows from './PlAgOverlayNoRows.vue';
@@ -70,8 +70,9 @@ watch(
70
70
  }
71
71
  );
72
72
 
73
- const sheets = computedAsync<PlDataTableSheet[]>(
74
- async () => {
73
+ const sheets = useWatchFetch<any, PlDataTableSheet[]>(
74
+ () => settings.value.sourceType,
75
+ async (_) => {
75
76
  const sourceType = settings.value.sourceType;
76
77
  switch (sourceType) {
77
78
  case 'pframe': {
@@ -97,8 +98,7 @@ const sheets = computedAsync<PlDataTableSheet[]>(
97
98
  }
98
99
  default: throw Error(`unsupported source type: ${sourceType satisfies never}`);
99
100
  }
100
- },
101
- []
101
+ }
102
102
  );
103
103
 
104
104
  function makeSorting(state?: SortState): PTableSorting[] | undefined {
@@ -152,7 +152,7 @@ const makeSheetId = (axis: AxisId) => canonicalize(axis)!;
152
152
  function makeFilters(sheetsState: Record<string, string | number>): PTableRecordFilter[] | undefined {
153
153
  if (settings.value.sourceType !== 'ptable' && settings.value.sourceType !== 'pframe') return undefined;
154
154
  return (
155
- sheets.value.map((sheet) => ({
155
+ sheets.value?.map((sheet) => ({
156
156
  type: 'bySingleColumn',
157
157
  column: sheet.column
158
158
  ? {
@@ -198,6 +198,9 @@ watch(
198
198
  () => [settings.value, sheets.value] as const,
199
199
  (state, oldState) => {
200
200
  const [settings, sheets] = state;
201
+ if (!sheets) {
202
+ return;
203
+ }
201
204
  if (oldState) {
202
205
  const [oldSettings, oldSheets] = oldState;
203
206
  if ((settings.sourceType === 'ptable' || settings.sourceType === 'pframe') && settings.sourceType === oldSettings?.sourceType && lodash.isEqual(sheets, oldSheets)) return;
@@ -292,7 +295,7 @@ watch(
292
295
  if (!pfDriver) throw Error('platforma.pFrameDriver not set');
293
296
 
294
297
  const pTable = settings.pTable;
295
- if (!pTable) {
298
+ if (!pTable || !sheets) {
296
299
  return gridApi.updateGridOptions({
297
300
  loading: true,
298
301
  loadingOverlayComponentParams: { notReady: true },
@@ -341,8 +344,8 @@ watch(
341
344
  <template>
342
345
  <div class="ap-ag-data-table-container">
343
346
  <Transition name="ap-ag-data-table-sheets-transition">
344
- <div v-if="sheets.length > 0" class="ap-ag-data-table-sheets">
345
- <PlDropdownLine v-for="(sheet, i) in sheets" :key="i" :model-value="sheetsState[makeSheetId(sheet.axis)]"
347
+ <div v-if="sheets.value && sheets.value.length > 0" class="ap-ag-data-table-sheets">
348
+ <PlDropdownLine v-for="(sheet, i) in sheets.value" :key="i" :model-value="sheetsState[makeSheetId(sheet.axis)]"
346
349
  :options="sheet.options"
347
350
  @update:model-value="(newValue) => onSheetChanged(makeSheetId(sheet.axis), newValue)" />
348
351
  </div>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="grid-overlay-container">
3
3
  <div class="grid-icon-sad-cat"></div>
4
- <span class="text-subtitle-m">Not calculated</span>
4
+ <span class="text-subtitle-m">Empty</span>
5
5
  </div>
6
6
  </template>
7
7