@milaboratories/uikit 2.4.1 → 2.4.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/.turbo/turbo-build.log +30 -29
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/components/DataTable/TableComponent.vue.js +1 -1
- package/dist/components/PlAccordion/{ExpandTransition.vue.js → ExpandTransition.vue2.js} +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +1 -0
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +1 -1
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.js +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +1 -1
- package/dist/components/PlFileDialog/Local.vue.js +4 -4
- package/dist/components/PlFileInput/PlFileInput.vue.js +14 -14
- package/dist/components/PlLogView/PlLogView.vue.d.ts +8 -0
- package/dist/components/PlLogView/PlLogView.vue.d.ts.map +1 -1
- package/dist/components/PlLogView/PlLogView.vue.js +85 -59
- package/dist/components/PlLogView/PlLogView.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +1 -1
- package/dist/components/PlTextArea/PlTextArea.vue.js +1 -1
- package/dist/components/PlTextField/PlTextField.vue.js +1 -1
- package/dist/generated/components/svg/images/{SvgRequired.vue.js → SvgRequired.vue2.js} +1 -1
- package/dist/generated/components/svg/images/SvgRequired.vue2.js.map +1 -0
- package/dist/helpers/dom.d.ts +1 -0
- package/dist/helpers/dom.d.ts.map +1 -1
- package/dist/helpers/dom.js.map +1 -1
- package/dist/helpers/downloadContent.d.ts +5 -0
- package/dist/helpers/downloadContent.d.ts.map +1 -0
- package/dist/helpers/downloadContent.js +32 -0
- package/dist/helpers/downloadContent.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/model/common/dist/index.js +258 -198
- package/dist/lib/model/common/dist/index.js.map +1 -1
- package/dist/sdk/model/dist/index.js +486 -482
- package/dist/sdk/model/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/PlLogView/PlLogView.vue +29 -6
- package/src/components/PlLogView/pl-log-view.scss +3 -7
- package/src/helpers/dom.ts +2 -0
- package/src/helpers/downloadContent.ts +75 -0
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +0 -1
- package/dist/generated/components/svg/images/SvgRequired.vue.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/uikit",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"d3-selection": "^3.0.0",
|
|
31
31
|
"d3-axis": "^3.0.0",
|
|
32
32
|
"resize-observer-polyfill": "^1.5.1",
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
33
|
+
"@milaboratories/helpers": "^1.6.19",
|
|
34
|
+
"@platforma-sdk/model": "^1.42.16"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"vue-tsc": "^2.2.10",
|
|
42
42
|
"yarpm": "^1.2.0",
|
|
43
43
|
"svgo": "^3.3.2",
|
|
44
|
-
"@milaboratories/eslint-config": "^1.0.4",
|
|
45
44
|
"@milaboratories/ts-configs": "1.0.5",
|
|
45
|
+
"@milaboratories/eslint-config": "^1.0.4",
|
|
46
46
|
"@milaboratories/build-configs": "1.0.5"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
@@ -17,6 +17,8 @@ import { useLogHandle } from './useLogHandle';
|
|
|
17
17
|
import { useLabelNotch } from '../../utils/useLabelNotch';
|
|
18
18
|
import DoubleContour from '../../utils/DoubleContour.vue';
|
|
19
19
|
import { PlTooltip } from '../PlTooltip';
|
|
20
|
+
import { PlIcon24 } from '../PlIcon24';
|
|
21
|
+
import { downloadContent } from '../../helpers/dom';
|
|
20
22
|
|
|
21
23
|
const getOutputError = <T>(o?: ValueOrErrors<T>) => {
|
|
22
24
|
if (o && o.ok === false) {
|
|
@@ -67,6 +69,10 @@ const props = defineProps<{
|
|
|
67
69
|
* Do not scroll to bottom on content change. Default is false (scroll to bottom).
|
|
68
70
|
*/
|
|
69
71
|
disableAutoScroll?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* If provided, a download icon will be shown and the content will be downloaded when clicked.
|
|
74
|
+
*/
|
|
75
|
+
downloadFilename?: string;
|
|
70
76
|
}>();
|
|
71
77
|
|
|
72
78
|
const logState = useLogHandle(props);
|
|
@@ -81,6 +87,16 @@ const computedError = computed(() => logState.value?.error ?? props.error ?? get
|
|
|
81
87
|
|
|
82
88
|
const computedValue = computed(() => logState.value?.lines ?? props.value ?? okOptional(props.output));
|
|
83
89
|
|
|
90
|
+
const computedValueToCopy = computed(() => {
|
|
91
|
+
if (props.valueToCopy) {
|
|
92
|
+
return props.valueToCopy;
|
|
93
|
+
}
|
|
94
|
+
if (computedValue.value && typeof computedValue.value === 'string') {
|
|
95
|
+
return computedValue.value;
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
});
|
|
99
|
+
|
|
84
100
|
const copyActive = ref(false);
|
|
85
101
|
|
|
86
102
|
useLabelNotch(root);
|
|
@@ -93,18 +109,21 @@ const onClickCopy = () => {
|
|
|
93
109
|
copyActive.value = false;
|
|
94
110
|
}, 1200);
|
|
95
111
|
|
|
96
|
-
|
|
97
|
-
if (props.valueToCopy) {
|
|
98
|
-
toCopy = props.valueToCopy;
|
|
99
|
-
} else if (computedValue.value && typeof computedValue.value === 'string') {
|
|
100
|
-
toCopy = computedValue.value;
|
|
101
|
-
}
|
|
112
|
+
const toCopy = computedValueToCopy.value;
|
|
102
113
|
|
|
103
114
|
if (toCopy !== undefined) {
|
|
104
115
|
navigator.clipboard.writeText(toCopy);
|
|
105
116
|
}
|
|
106
117
|
};
|
|
107
118
|
|
|
119
|
+
const onClickDownload = (filename: string) => {
|
|
120
|
+
const toDownload = computedValueToCopy.value;
|
|
121
|
+
|
|
122
|
+
if (toDownload !== undefined) {
|
|
123
|
+
downloadContent([toDownload, 'text/plain'], filename);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
108
127
|
const optionallyScrollDown = () => {
|
|
109
128
|
if (props.disableAutoScroll) {
|
|
110
129
|
return;
|
|
@@ -149,6 +168,10 @@ const onContentScroll = (ev: Event) => {
|
|
|
149
168
|
<PlMaskIcon24 title="Copy content" :name="iconName" @click="onClickCopy" />
|
|
150
169
|
<template #tooltip>{{ copyActive ? 'copied' : 'copy' }}</template>
|
|
151
170
|
</PlTooltip>
|
|
171
|
+
<PlTooltip v-if="downloadFilename" :close-delay="800" position="top">
|
|
172
|
+
<PlIcon24 name="download" @click="() => onClickDownload(downloadFilename!)" />
|
|
173
|
+
<template #tooltip>download</template>
|
|
174
|
+
</PlTooltip>
|
|
152
175
|
</div>
|
|
153
176
|
<div v-if="computedError" class="pl-log-view__error">{{ computedError }}</div>
|
|
154
177
|
<div v-else ref="contentRef" class="pl-log-view__content" @scroll="onContentScroll">{{ computedValue }}</div>
|
|
@@ -48,14 +48,10 @@
|
|
|
48
48
|
right: 12px;
|
|
49
49
|
cursor: pointer;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
--icon-color: var(--ic-02);
|
|
53
|
-
}
|
|
51
|
+
--icon-color: var(--ic-02);
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
--icon-color: var(--txt-01);
|
|
58
|
-
}
|
|
53
|
+
> *:hover {
|
|
54
|
+
--icon-color: var(--txt-01);
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
|
package/src/helpers/dom.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { animate, makeEaseOut } from './utils';
|
|
2
2
|
|
|
3
|
+
export { downloadContent } from './downloadContent';
|
|
4
|
+
|
|
3
5
|
export function isElementVisible(parent: HTMLElement, el: HTMLElement) {
|
|
4
6
|
const scrollTop = parent.scrollTop;
|
|
5
7
|
const parentHeight = parent.getBoundingClientRect().height;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
type MimeType =
|
|
2
|
+
| 'text/plain'
|
|
3
|
+
| 'text/html'
|
|
4
|
+
| 'text/css'
|
|
5
|
+
| 'text/javascript'
|
|
6
|
+
| 'text/csv'
|
|
7
|
+
| 'application/json'
|
|
8
|
+
| 'application/xml'
|
|
9
|
+
| 'application/pdf'
|
|
10
|
+
| 'application/zip'
|
|
11
|
+
| 'application/octet-stream'
|
|
12
|
+
| 'image/png'
|
|
13
|
+
| 'image/jpeg'
|
|
14
|
+
| 'image/gif'
|
|
15
|
+
| 'image/svg+xml'
|
|
16
|
+
| 'audio/mpeg'
|
|
17
|
+
| 'audio/wav'
|
|
18
|
+
| 'video/mp4'
|
|
19
|
+
| 'video/webm'
|
|
20
|
+
| (string & {});
|
|
21
|
+
|
|
22
|
+
type DownloadableContent =
|
|
23
|
+
| [string, MimeType]
|
|
24
|
+
| [Blob, MimeType]
|
|
25
|
+
| [ArrayBuffer, MimeType]
|
|
26
|
+
| [Uint8Array, MimeType]
|
|
27
|
+
| [Int8Array, MimeType]
|
|
28
|
+
| [Uint16Array, MimeType]
|
|
29
|
+
| [Int16Array, MimeType]
|
|
30
|
+
| [Uint32Array, MimeType]
|
|
31
|
+
| [Int32Array, MimeType]
|
|
32
|
+
| [Float32Array, MimeType]
|
|
33
|
+
| [Float64Array, MimeType]
|
|
34
|
+
| [DataView, MimeType]
|
|
35
|
+
| Blob // Blob already has mimeType
|
|
36
|
+
| File; // File already has mimeType
|
|
37
|
+
|
|
38
|
+
export const downloadContent = (content: DownloadableContent, filename: string) => {
|
|
39
|
+
let blob: Blob;
|
|
40
|
+
|
|
41
|
+
if (content instanceof Blob) {
|
|
42
|
+
blob = content;
|
|
43
|
+
} else if (content instanceof File) {
|
|
44
|
+
blob = content;
|
|
45
|
+
} else if (Array.isArray(content) && content.length === 2) {
|
|
46
|
+
const [data, mimeType] = content;
|
|
47
|
+
if (typeof data === 'string') {
|
|
48
|
+
blob = new Blob([data], { type: mimeType });
|
|
49
|
+
} else if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
|
|
50
|
+
blob = new Blob([data], { type: mimeType });
|
|
51
|
+
} else if (data instanceof Blob) {
|
|
52
|
+
blob = new Blob([data], { type: mimeType });
|
|
53
|
+
} else {
|
|
54
|
+
throw new Error(`Unsupported data type for download. Received data of type ${typeof data}.`);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
throw new Error('Invalid content type. Content must be a Blob, File, or [data, mimeType] tuple.');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const link = document.createElement('a');
|
|
64
|
+
link.href = objectUrl;
|
|
65
|
+
link.download = filename;
|
|
66
|
+
|
|
67
|
+
document.body.appendChild(link);
|
|
68
|
+
link.click();
|
|
69
|
+
document.body.removeChild(link);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
throw new Error(`Failed to download ${filename}`, { cause: error });
|
|
72
|
+
} finally {
|
|
73
|
+
URL.revokeObjectURL(objectUrl);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandTransition.vue.js","sources":["../../../src/components/PlAccordion/ExpandTransition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nconst onStart = (el: Element) => {\n el.classList.add('expand-collapse-fix');\n (el as HTMLElement).style.setProperty('--component-height', el.scrollHeight + 'px');\n};\n\nconst onAfter = (el: Element) => {\n (el as HTMLElement).style.removeProperty('--component-height');\n el.classList.remove('expand-collapse-fix');\n};\n</script>\n\n<template>\n <Transition name=\"expand-collapse\" @enter=\"onStart\" @leave=\"onStart\" @after-enter=\"onAfter\" @after-leave=\"onAfter\">\n <slot/>\n </Transition>\n</template>\n\n<style>\n.expand-collapse-fix {\n overflow: hidden;\n}\n\n.expand-collapse-enter-active,\n.expand-collapse-leave-active {\n transition:\n height 0.2s ease-in-out,\n opacity 0.2s ease-in-out;\n height: var(--component-height);\n}\n\n.expand-collapse-enter-from,\n.expand-collapse-leave-to {\n opacity: 0.5;\n height: 0;\n}\n</style>\n"],"names":["onStart","el","onAfter"],"mappings":";;;;AACM,UAAAA,IAAU,CAACC,MAAgB;AAC5B,MAAAA,EAAA,UAAU,IAAI,qBAAqB,GACrCA,EAAmB,MAAM,YAAY,sBAAsBA,EAAG,eAAe,IAAI;AAAA,IACpF,GAEMC,IAAU,CAACD,MAAgB;AAC9B,MAAAA,EAAmB,MAAM,eAAe,oBAAoB,GAC1DA,EAAA,UAAU,OAAO,qBAAqB;AAAA,IAC3C;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SvgRequired.vue.js","sources":["../../../../../src/generated/components/svg/images/SvgRequired.vue"],"sourcesContent":["<!-- ⚠️ AUTOGENERATED. DO NOT EDIT. -->\n<script lang=\"ts\">\nimport '../svg-styles.css';\nexport default { name: 'SvgRequired' };\n</script>\n\n<template>\n <div class=\"svg-icon SvgRequired\" style=\"width: 5px; height: 12px\" />\n</template>\n\n<style>\n .SvgRequired { background-image: url(\"data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2212%22%20viewBox%3D%220%200%205%2012%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M1.51685%204.8L2.5%203.34159L3.47612%204.8L4.39607%204.12743L3.31461%202.7469L5%202.25133L4.64888%201.16106L3.00562%201.77699L3.06882%200H1.93118L1.99438%201.77699L0.351124%201.16106L0%202.25133L1.68539%202.7469L0.59691%204.12743L1.51685%204.8Z%22%20fill%3D%22%23F1222F%22%2F%3E%3C%2Fsvg%3E\"); }\n</style>\n"],"names":["_hoisted_1"],"mappings":";;;;AAOoC,MAAAA,IAAA;AAAA,EAAA,OAAA;AAAA;;;;;;"}
|