@milaboratories/uikit 2.2.61 → 2.2.62

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": "@milaboratories/uikit",
3
- "version": "2.2.61",
3
+ "version": "2.2.62",
4
4
  "type": "module",
5
5
  "main": "dist/pl-uikit.umd.js",
6
6
  "module": "dist/pl-uikit.js",
@@ -35,8 +35,8 @@
35
35
  "svgo": "^3.3.2",
36
36
  "@types/d3": "^7.4.3",
37
37
  "@milaboratories/helpers": "^1.6.11",
38
- "@platforma-sdk/model": "^1.26.0",
39
- "@milaboratories/eslint-config": "^1.0.4"
38
+ "@milaboratories/eslint-config": "^1.0.4",
39
+ "@platforma-sdk/model": "^1.27.10"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "vite",
@@ -3,7 +3,7 @@ import style from './pl-file-dialog.module.scss';
3
3
  import type { ImportedFiles } from '@/types';
4
4
  import { PlIcon24 } from '../PlIcon24';
5
5
  import { computed, reactive } from 'vue';
6
- import type { OpenDialogFilter } from '@platforma-sdk/model';
6
+ import { getRawPlatformaInstance, type OpenDialogFilter } from '@platforma-sdk/model';
7
7
  import { normalizeExtensions } from './utils';
8
8
 
9
9
  const props = defineProps<{
@@ -19,10 +19,10 @@ const data = reactive({
19
19
  const label = computed(() => (props.multi ? 'Drag & Drop files here or click to add' : 'Drag & Drop file here or click to add'));
20
20
 
21
21
  const onDrop = async (ev: DragEvent) => {
22
- const fileToImportHandle = window.platforma?.lsDriver?.fileToImportHandle;
22
+ const fileToImportHandle = getRawPlatformaInstance()?.lsDriver?.fileToImportHandle;
23
23
 
24
24
  if (!fileToImportHandle) {
25
- return console.error('API platforma.lsDriver.fileToImportHandle is not available');
25
+ return console.error('API getPlatformaRawInstance().lsDriver.fileToImportHandle is not available');
26
26
  }
27
27
 
28
28
  const extensions = normalizeExtensions(props.extensions);
@@ -54,7 +54,7 @@ const openNativeDialog = async () => {
54
54
  : [];
55
55
 
56
56
  if (props.multi) {
57
- window.platforma?.lsDriver
57
+ getRawPlatformaInstance()?.lsDriver
58
58
  .showOpenMultipleFilesDialog({
59
59
  title: 'Select files to import',
60
60
  filters,
@@ -68,7 +68,7 @@ const openNativeDialog = async () => {
68
68
  })
69
69
  .catch((err) => (data.error = err));
70
70
  } else {
71
- window.platforma?.lsDriver
71
+ getRawPlatformaInstance()?.lsDriver
72
72
  .showOpenSingleFileDialog({
73
73
  title: 'Select file to import',
74
74
  filters,
@@ -2,7 +2,7 @@
2
2
  import { useEventListener } from '@/composition/useEventListener';
3
3
  import type { ImportedFiles } from '@/types';
4
4
  import { between, notEmpty, tapIf } from '@milaboratories/helpers';
5
- import type { StorageHandle } from '@platforma-sdk/model';
5
+ import { getRawPlatformaInstance, type StorageHandle } from '@platforma-sdk/model';
6
6
  import { computed, onMounted, reactive, toRef, watch } from 'vue';
7
7
  import { PlDropdown } from '../PlDropdown';
8
8
  import { PlIcon16 } from '../PlIcon16';
@@ -58,7 +58,7 @@ const lookup = computed(() => {
58
58
  });
59
59
 
60
60
  const query = (storageHandle: StorageHandle, dirPath: string) => {
61
- if (!window.platforma) {
61
+ if (!getRawPlatformaInstance()) {
62
62
  return;
63
63
  }
64
64
 
@@ -68,7 +68,7 @@ const query = (storageHandle: StorageHandle, dirPath: string) => {
68
68
 
69
69
  data.currentLoadingPath = dirPath;
70
70
 
71
- window.platforma.lsDriver
71
+ getRawPlatformaInstance().lsDriver
72
72
  .listFiles(storageHandle, dirPath)
73
73
  .then((res) => {
74
74
  if (dirPath !== data.dirPath) {
@@ -186,11 +186,11 @@ const deselectAll = () => changeAll(false);
186
186
  const loadAvailableStorages = () => {
187
187
  resetData();
188
188
  deselectAll();
189
- if (!window.platforma) {
189
+ if (!getRawPlatformaInstance()) {
190
190
  console.warn('platforma API is not found');
191
191
  return;
192
192
  }
193
- window.platforma.lsDriver
193
+ getRawPlatformaInstance().lsDriver
194
194
  .getStorageList()
195
195
  .then((storageEntries) => {
196
196
  // local storage is always returned by the ML, so we need to remove it from remote dialog manually
@@ -31,6 +31,10 @@ const props = defineProps<{
31
31
  * String contents
32
32
  */
33
33
  value?: string;
34
+ /**
35
+ * The content to copy (Note: it takes precedence over value property)
36
+ */
37
+ valueToCopy?: string;
34
38
  /**
35
39
  * AnyLogHandle
36
40
  */
@@ -85,8 +89,15 @@ const onClickCopy = () => {
85
89
  copyActive.value = false;
86
90
  }, 1200);
87
91
 
88
- if (computedValue.value && typeof computedValue.value === 'string') {
89
- navigator.clipboard.writeText(computedValue.value);
92
+ let toCopy: string | undefined = undefined;
93
+ if (props.valueToCopy) {
94
+ toCopy = props.valueToCopy;
95
+ } else if (computedValue.value && typeof computedValue.value === 'string') {
96
+ toCopy = computedValue.value;
97
+ }
98
+
99
+ if (toCopy !== undefined) {
100
+ navigator.clipboard.writeText(toCopy);
90
101
  }
91
102
  };
92
103
 
@@ -1,6 +1,6 @@
1
1
  import { reactive, type Reactive, ref, watch } from 'vue';
2
2
  import { useTimeoutPoll, whenever } from '@vueuse/core';
3
- import type { AnyLogHandle, Platforma } from '@platforma-sdk/model';
3
+ import { getRawPlatformaInstance, type AnyLogHandle, type Platforma } from '@platforma-sdk/model';
4
4
 
5
5
  type LogState = {
6
6
  logHandle: AnyLogHandle;
@@ -32,7 +32,7 @@ export function useLogHandle(
32
32
 
33
33
  if (currentLogState === undefined) return;
34
34
 
35
- const platforma = props.mockPlatforma ?? window.platforma;
35
+ const platforma = props.mockPlatforma ?? getRawPlatformaInstance();
36
36
 
37
37
  if (!platforma) {
38
38
  console.warn('Platforma API is not available');