@platforma-sdk/ui-vue 1.22.24 → 1.22.29

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.22.24",
3
+ "version": "1.22.29",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.cjs",
6
6
  "module": "dist/lib.js",
@@ -23,7 +23,7 @@
23
23
  "canonicalize": "^2.0.0",
24
24
  "ag-grid-enterprise": "^33.0.4",
25
25
  "ag-grid-vue3": "^33.0.4",
26
- "@milaboratories/uikit": "^2.2.56",
26
+ "@milaboratories/uikit": "^2.2.57",
27
27
  "@platforma-sdk/model": "^1.22.18"
28
28
  },
29
29
  "devDependencies": {
@@ -45,8 +45,8 @@
45
45
  "semver": "^7.6.3",
46
46
  "@types/semver": "^7.5.8",
47
47
  "rollup-plugin-sourcemaps2": "^0.4.3",
48
- "@milaboratories/helpers": "^1.6.11",
49
- "@milaboratories/eslint-config": "^1.0.1"
48
+ "@milaboratories/eslint-config": "^1.0.1",
49
+ "@milaboratories/helpers": "^1.6.11"
50
50
  },
51
51
  "scripts": {
52
52
  "test": "vitest run --passWithNoTests",
@@ -10,21 +10,38 @@ defineProps<{
10
10
  /**
11
11
  * Required flag, that shows catInBag icon with message if `true`, shows PlSplash component if `false`.
12
12
  */
13
- notReady: Readonly<boolean>;
13
+ notReady: boolean;
14
14
  /**
15
- * Optional prop that provide custom text message under catInBag icon.
15
+ * Prop to override default "Loading" text
16
16
  */
17
- message?: Readonly<string>;
17
+ loadingText?: string;
18
+ /**
19
+ * Prop to override default "No datasource" text (So why props name is notReady? Good question)
20
+ */
21
+ notReadyText?: string;
22
+ /**
23
+ * @deprecated
24
+ * Use notReadyText
25
+ */
26
+ message?: string;
27
+ /**
28
+ * Use "transparent" to make table headers visible below the loading layer
29
+ */
30
+ overlayType?: 'transparent';
18
31
  };
19
32
  }>();
20
33
  </script>
21
34
 
22
35
  <template>
23
- <div :class="style.container">
24
- <div v-if="params.notReady" :class="style.wrapper">
36
+ <PlSplash
37
+ :loading="!params.notReady"
38
+ :type="params.overlayType ?? 'table'"
39
+ :loading-text="params.loadingText ?? 'Loading'"
40
+ :class="style.container"
41
+ >
42
+ <div v-if="params.notReady" :class="style.notReadyWrapper">
25
43
  <div :class="style.iconCatInBag" />
26
- <h3 :class="style.text">{{ params.message || 'No datasource' }}</h3>
44
+ <h3 :class="style.text">{{ params.notReadyText || params.message || 'No datasource' }}</h3>
27
45
  </div>
28
- <PlSplash v-else size="48" text="Loading" />
29
- </div>
46
+ </PlSplash>
30
47
  </template>
@@ -14,6 +14,7 @@
14
14
  flex-direction: column;
15
15
  align-items: center;
16
16
  justify-content: center;
17
+ background-color: var(--bg-base-light);
17
18
  }
18
19
  .grid-icon-sad-cat {
19
20
  background-image: url(./assets/no-data-cat.png);
@@ -6,3 +6,4 @@ export * from './types';
6
6
  export * from './sources/row-number';
7
7
  export * from './sources/focus-row';
8
8
  export * from './sources/menu-items';
9
+ export * from './useAgDataTableOptionsSimple';
@@ -1,29 +1,32 @@
1
1
  .container {
2
- height: calc(100% - 1px);
3
- margin-top: 1px;
4
- width: 100%;
5
- display: flex;
6
- align-items: center;
7
- justify-content: center;
8
- background-color: var(--bg-base-light);
9
- color: var(--txt-mask);
10
- }
2
+ height: 100%;
3
+ margin-top: 1px;
4
+ width: 100%;
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ color: var(--txt-mask);
9
+ }
11
10
 
12
- .wrapper {
13
- display: flex;
14
- align-items: center;
15
- flex-direction: column;
16
- }
17
-
18
- .iconCatInBag {
19
- background-image: url(./assets/loading-cat.png);
20
- background-repeat: no-repeat;
21
- height: 212px;
22
- width: 400px;
23
- background-size: contain;
24
- }
25
-
26
- .text {
27
- margin-top: 24px;
28
- white-space: pre;
29
- }
11
+ .notReadyWrapper {
12
+ height: 100%;
13
+ width: 100%;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ flex-direction: column;
18
+ background-color: var(--bg-base-light);
19
+ }
20
+
21
+ .iconCatInBag {
22
+ background-image: url(./assets/loading-cat.png);
23
+ background-repeat: no-repeat;
24
+ height: 212px;
25
+ width: 400px;
26
+ background-size: contain;
27
+ }
28
+
29
+ .text {
30
+ margin-top: 24px;
31
+ white-space: pre;
32
+ }
@@ -0,0 +1,56 @@
1
+ import type { GridApi, GridOptions, GridReadyEvent } from 'ag-grid-enterprise';
2
+ import { computed, shallowRef, watch } from 'vue';
3
+ import { AgGridTheme } from '../../aggrid';
4
+ import PlAgOverlayLoading from './PlAgOverlayLoading.vue';
5
+ import PlAgOverlayNoRows from './PlAgOverlayNoRows.vue';
6
+ import { autoSizeRowNumberColumn } from './sources/row-number';
7
+
8
+ /**
9
+ * Returns a set of Ag Grid options along with a reference to the Ag Grid API.
10
+ * (This is a fast prototype)
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const { gridOptions, gridApi } = useAgDataTableOptionsSimple(() => ({
15
+ * // custom grid options here
16
+ * }));
17
+ *
18
+ * // Usage in a template (v-bind is required!)
19
+ * <template>
20
+ * <AgGridVue :style="{ height: '100%' }" v-bind="gridOptions" />
21
+ * </template>
22
+ * ```
23
+ */
24
+ export function useAgDataTableOptionsSimple<TData>(
25
+ factory: () => GridOptions<TData>,
26
+ ) {
27
+ const gridApi = shallowRef<GridApi>();
28
+
29
+ const gridOptions = computed<GridOptions>(() => {
30
+ const def: GridOptions<TData> = {
31
+ theme: AgGridTheme,
32
+ loadingOverlayComponent: PlAgOverlayLoading,
33
+ noRowsOverlayComponent: PlAgOverlayNoRows,
34
+ onGridReady: (e: GridReadyEvent) => {
35
+ gridApi.value = e.api;
36
+ autoSizeRowNumberColumn(e.api);
37
+ },
38
+ };
39
+
40
+ return Object.assign({}, def, factory());
41
+ });
42
+
43
+ watch(() => gridOptions.value.loadingOverlayComponentParams, (newParams) => {
44
+ // Hack to apply loadingOverlayComponentParams
45
+ gridApi.value?.updateGridOptions({
46
+ loading: !gridOptions.value.loading,
47
+ });
48
+
49
+ gridApi.value?.updateGridOptions({
50
+ loading: gridOptions.value.loading,
51
+ loadingOverlayComponentParams: newParams,
52
+ });
53
+ }, { deep: true });
54
+
55
+ return { gridOptions, gridApi };
56
+ };
package/src/lib.ts CHANGED
@@ -15,10 +15,7 @@ export * from './components/PlAgCellStatusTag';
15
15
  export * from './components/PlAgChartStackedBarCell';
16
16
  export * from './components/PlAgChartHistogramCell';
17
17
 
18
- export * from './components/PlAgDataTable/types';
19
- export * from './components/PlAgDataTable/sources/row-number';
20
- export * from './components/PlAgDataTable/sources/focus-row';
21
- export * from './components/PlAgDataTable/sources/menu-items';
18
+ export * from './components/PlAgDataTable';
22
19
 
23
20
  export * from './components/PlAgCsvExporter';
24
21