@platforma-sdk/ui-vue 1.11.6 → 1.11.8

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.11.6",
3
+ "version": "1.11.8",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.cjs",
6
6
  "module": "dist/lib.js",
package/src/aggrid.ts CHANGED
@@ -48,6 +48,10 @@ export const AgGridTheme: Theme = themeQuartz
48
48
  borderColor: '#E1E3EB',
49
49
  cellHorizontalPaddingScale: 1,
50
50
  checkboxBorderRadius: '3px',
51
+ checkboxCheckedBackgroundColor: '#110529',
52
+ checkboxCheckedBorderColor: '#110529',
53
+ checkboxIndeterminateBackgroundColor: '#110529',
54
+ checkboxIndeterminateBorderColor: '#110529',
51
55
  checkboxUncheckedBorderColor: '#CFD1DB',
52
56
  columnBorder: true,
53
57
  columnHoverColor: '#9BABCC16',
@@ -43,6 +43,45 @@
43
43
  padding: 0;
44
44
  }
45
45
 
46
+ &__loader {
47
+ height: 4px;
48
+ background-color: transparent;
49
+ position: absolute;
50
+ top: 0;
51
+ right: 0;
52
+ left: 0;
53
+ overflow: hidden;
54
+ &:before {
55
+ content: "";
56
+ position: absolute;
57
+ left: -50%;
58
+ height: 4px;
59
+ width: 33%;
60
+ background-color: var(--border-color-focus);
61
+ animation: loader-animation 1.3s linear infinite;
62
+ }
63
+ }
64
+
65
+ &__progress {
66
+ --progress-width: 0%;
67
+ height: 4px;
68
+ background-color: transparent;
69
+ position: absolute;
70
+ top: 0;
71
+ right: 0;
72
+ left: 0;
73
+ overflow: hidden;
74
+ &:before {
75
+ content: "";
76
+ position: absolute;
77
+ left: 0;
78
+ height: 4px;
79
+ width: var(--progress-width);
80
+ background-color: var(--border-color-focus);
81
+ will-change: width;
82
+ }
83
+ }
84
+
46
85
  &__error {
47
86
  background: var(--txt-error);
48
87
  color: #fff;
@@ -69,4 +108,18 @@
69
108
  overflow: auto;
70
109
  }
71
110
  }
111
+
112
+ @keyframes loader-animation {
113
+ 0% {
114
+ left: -40%;
115
+ }
116
+ 50% {
117
+ left: 20%;
118
+ width: 38%;
119
+ }
120
+ 100% {
121
+ left: 100%;
122
+ width: 50%;
123
+ }
124
+ }
72
125
  }
@@ -6,6 +6,7 @@ import { useSdkPlugin } from '../defineApp';
6
6
  import NotFound from './NotFound.vue';
7
7
  import LoaderPage from './LoaderPage.vue';
8
8
  import { PlAppErrorNotificationAlert } from './PlAppErrorNotificationAlert';
9
+ import BlockLoader from './BlockLoader.vue';
9
10
 
10
11
  const sdk = useSdkPlugin();
11
12
 
@@ -35,10 +36,13 @@ const app = computed(() => (sdk.loaded ? sdk.useApp() : undefined));
35
36
  const errors = computed(() => (app.value ? app.value.model.outputErrors : {}));
36
37
 
37
38
  const showErrorsNotification = computed(() => app.value?.showErrorsNotification ?? true);
39
+
40
+ const progress = computed(() => app.value?.progress?.());
38
41
  </script>
39
42
 
40
43
  <template>
41
44
  <div class="block block__layout">
45
+ <BlockLoader :value="progress" />
42
46
  <div v-if="sdk.error">{{ sdk.error }}</div>
43
47
  <LoaderPage v-else-if="!sdk.loaded">Loading...</LoaderPage>
44
48
  <component :is="CurrentView" v-else-if="CurrentView" :key="href" />
@@ -0,0 +1,28 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue';
3
+
4
+ const props = defineProps<{
5
+ value: boolean | number | undefined;
6
+ }>();
7
+
8
+ const isLoader = computed(() => typeof props.value === 'boolean' && props.value);
9
+
10
+ const progressWidth = computed(() => {
11
+ const value = props.value;
12
+
13
+ if (typeof value === 'number') {
14
+ if (value >= 1) {
15
+ return undefined;
16
+ }
17
+
18
+ return (value * 100).toFixed(2) + '%';
19
+ }
20
+
21
+ return undefined;
22
+ });
23
+ </script>
24
+
25
+ <template>
26
+ <div v-if="isLoader" class="block__loader" />
27
+ <div v-else-if="progressWidth !== undefined" class="block__progress" :style="{ '--progress-width': progressWidth }" />
28
+ </template>
@@ -1,24 +1,57 @@
1
1
  <script lang="ts" setup>
2
- import type { ICellRendererParams } from '@ag-grid-community/core';
2
+ import type { ICellRendererParams, RowDoubleClickedEvent } from '@ag-grid-community/core';
3
3
  import type { MaskIconName16 } from '@milaboratories/uikit';
4
4
  import { PlMaskIcon16 } from '@milaboratories/uikit';
5
5
  import './pl-ag-text-and-button-cell.scss';
6
6
 
7
7
  const props = defineProps<{
8
- params: ICellRendererParams & { plIcon?: MaskIconName16; plBtnLabel?: string };
8
+ params: ICellRendererParams & {
9
+ /**
10
+ * Button icon MaskIconName16
11
+ */
12
+ icon?: MaskIconName16;
13
+ /**
14
+ * Button label
15
+ */
16
+ btnLabel?: string;
17
+ /**
18
+ * If invokeRowsOnDoubleClick = true, clicking a button inside the row
19
+ * triggers the doubleClick event for the entire row. In this case,
20
+ * the handler passed to the component is not called, even if it is defined.
21
+ *
22
+ * If invokeRowsOnDoubleClick = false, the doubleClick event for the row
23
+ * is not triggered, but the provided handler will be called, receiving
24
+ * the ICellRendererParams as an argument.
25
+ */
26
+ invokeRowsOnDoubleClick?: boolean;
27
+ /**
28
+ * plHandler parameter is a click handler that is invoked when
29
+ * the invokeRowsOnDoubleClick property is set to false.
30
+ */
31
+ onClick?: (params: ICellRendererParams) => void;
32
+ };
9
33
  }>();
10
34
 
35
+ console.log(props);
36
+
11
37
  function triggerRowDoubleClick() {
12
- const rowElement = document.querySelector(`.ag-row[row-index="${props.params.node.rowIndex}"]`);
13
- if (rowElement) {
14
- const dblClickEvent = new MouseEvent('dblclick', {
15
- bubbles: true,
16
- cancelable: true,
17
- view: window,
18
- });
19
- rowElement.dispatchEvent(dblClickEvent);
38
+ if (props.params.invokeRowsOnDoubleClick) {
39
+ const gridApi = props.params.api;
40
+
41
+ const event: RowDoubleClickedEvent = {
42
+ rowPinned: props.params.node.rowPinned,
43
+ api: gridApi,
44
+ rowIndex: props.params.node.rowIndex,
45
+ context: gridApi,
46
+ type: 'rowDoubleClicked',
47
+ node: props.params.node,
48
+ data: props.params.data,
49
+ event: null,
50
+ };
51
+
52
+ gridApi.dispatchEvent(event);
20
53
  } else {
21
- console.warn(`Row with index ${props.params.node.rowIndex} not found.`);
54
+ props.params.onClick && props.params.onClick(props.params);
22
55
  }
23
56
  }
24
57
  </script>
@@ -28,8 +61,8 @@ function triggerRowDoubleClick() {
28
61
  {{ params.value }}
29
62
  </div>
30
63
  <div class="pl-ag-grid-open-cell__activator text-caps11 align-center" @click.stop="triggerRowDoubleClick">
31
- <PlMaskIcon16 :name="params.plIcon ?? 'maximize'" />
32
- {{ params.plBtnLabel ?? 'Open' }}
64
+ <PlMaskIcon16 :name="params.icon ?? 'maximize'" />
65
+ {{ params.btnLabel ?? 'Open' }}
33
66
  </div>
34
67
  </div>
35
68
  </template>
@@ -29,7 +29,7 @@ watch(
29
29
  </script>
30
30
  <template>
31
31
  <div class="pl-app-notification-alert">
32
- <PlDialogModal v-model="isModalOpen" width="50%" style="max-height: 100vh">
32
+ <PlDialogModal v-model="isModalOpen" width="720px" style="max-height: 100vh">
33
33
  <template #title> Errors </template>
34
34
  <div class="pl-app-notification-alert__content">
35
35
  <template v-for="item in existingErrors" :key="item[0]">
package/src/types.ts CHANGED
@@ -63,7 +63,24 @@ export type AppSettings = {
63
63
  };
64
64
 
65
65
  export type ExtendSettings<Href extends `/${string}` = `/${string}`> = {
66
+ /**
67
+ * Displays a loader on top of the block.
68
+ * - If `true`: Shows an infinite loader.
69
+ * - If a number (0 <= n < 1): Displays a progress bar representing completion percentage.
70
+ * - If a number (n > 1): Hides the progress bar.
71
+ * - If `undefined`: No loader is displayed.
72
+ */
73
+ progress?: () => number | boolean | undefined;
74
+ /**
75
+ * Enables or disables a notification box for error messages.
76
+ * - If `true`: A notification box appears when there are errors in the outputs.
77
+ * - If `false`: No notification box is shown.
78
+ */
66
79
  showErrorsNotification?: boolean;
80
+ /**
81
+ * Maps application routes to their respective components.
82
+ * TODO: Consider moving route initialization logic to a dedicated method.
83
+ */
67
84
  routes: Routes<Href>;
68
85
  };
69
86