@milaboratories/uikit 2.4.0 → 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.
Files changed (34) hide show
  1. package/.turbo/turbo-build.log +26 -25
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +13 -0
  4. package/dist/components/DataTable/TableComponent.vue.js +1 -1
  5. package/dist/components/PlAccordion/ExpandTransition.vue3.js +1 -1
  6. package/dist/components/PlAccordion/PlAccordionSection.vue2.js +1 -1
  7. package/dist/components/PlFileDialog/Local.vue.js +4 -4
  8. package/dist/components/PlFileInput/PlFileInput.vue.js +17 -17
  9. package/dist/components/PlLogView/PlLogView.vue.d.ts +8 -0
  10. package/dist/components/PlLogView/PlLogView.vue.d.ts.map +1 -1
  11. package/dist/components/PlLogView/PlLogView.vue.js +85 -59
  12. package/dist/components/PlLogView/PlLogView.vue.js.map +1 -1
  13. package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +1 -1
  14. package/dist/helpers/dom.d.ts +1 -0
  15. package/dist/helpers/dom.d.ts.map +1 -1
  16. package/dist/helpers/dom.js.map +1 -1
  17. package/dist/helpers/downloadContent.d.ts +5 -0
  18. package/dist/helpers/downloadContent.d.ts.map +1 -0
  19. package/dist/helpers/downloadContent.js +32 -0
  20. package/dist/helpers/downloadContent.js.map +1 -0
  21. package/dist/index.js +2 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/model/common/dist/index.js +262 -179
  24. package/dist/lib/model/common/dist/index.js.map +1 -1
  25. package/dist/sdk/model/dist/index.js +481 -465
  26. package/dist/sdk/model/dist/index.js.map +1 -1
  27. package/package.json +2 -2
  28. package/src/components/PlLogView/PlLogView.vue +29 -6
  29. package/src/components/PlLogView/pl-log-view.scss +3 -7
  30. package/src/helpers/dom.ts +2 -0
  31. package/src/helpers/downloadContent.ts +75 -0
  32. package/.turbo/turbo-test.log +0 -133
  33. package/dist/components/PlAccordion/ExpandTransition.vue.js +0 -27
  34. package/dist/components/PlAccordion/ExpandTransition.vue.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/uikit",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "d3-axis": "^3.0.0",
32
32
  "resize-observer-polyfill": "^1.5.1",
33
33
  "@milaboratories/helpers": "^1.6.19",
34
- "@platforma-sdk/model": "^1.42.10"
34
+ "@platforma-sdk/model": "^1.42.16"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@vitejs/plugin-vue": "^5.2.3",
@@ -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
- let toCopy: string | undefined = undefined;
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
- .mask-24 {
52
- --icon-color: var(--ic-02);
53
- }
51
+ --icon-color: var(--ic-02);
54
52
 
55
- &:hover {
56
- .mask-24 {
57
- --icon-color: var(--txt-01);
58
- }
53
+ > *:hover {
54
+ --icon-color: var(--txt-01);
59
55
  }
60
56
  }
61
57
 
@@ -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,133 +0,0 @@
1
-  WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
-
3
- > @milaboratories/uikit@2.4.0 test /home/runner/_work/platforma/platforma/lib/ui/uikit
4
- > vitest run
5
-
6
-
7
-  RUN  v2.1.9 /home/runner/_work/platforma/platforma/lib/ui/uikit
8
-
9
- stdout | src/components/PlChartHistogram/scales.spec.ts > Scales > logspace
10
- res [
11
- 1,
12
- 2.7825594022071245,
13
- 7.742636826811269,
14
- 21.544346900318835,
15
- 59.94842503189409,
16
- 166.8100537200059,
17
- 464.15888336127773,
18
- 1291.5496650148827,
19
- 3593.813663804626,
20
- 10000
21
- ]
22
-
23
- ✓ src/components/PlChartHistogram/scales.spec.ts (1 test) 6ms
24
- TAP version 13
25
- # Subtest: Test useValidation
26
- ok 1 - Test useValidation
27
- ---
28
- duration_ms: 2.370136
29
- type: 'suite'
30
- ...
31
- ✓ src/__tests__/compositions/useValidation.spec.ts (5 tests) 6ms
32
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
33
-
34
- More info: https://sass-lang.com/d/legacy-js-api
35
-
36
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
37
-
38
- More info: https://sass-lang.com/d/legacy-js-api
39
-
40
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
41
-
42
- More info: https://sass-lang.com/d/legacy-js-api
43
-
44
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
45
-
46
- More info: https://sass-lang.com/d/legacy-js-api
47
-
48
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
49
-
50
- More info: https://sass-lang.com/d/legacy-js-api
51
-
52
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
53
-
54
- More info: https://sass-lang.com/d/legacy-js-api
55
-
56
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
57
-
58
- More info: https://sass-lang.com/d/legacy-js-api
59
-
60
- TAP version 13
61
- # Subtest: Colors
62
- ok 1 - Colors
63
- ---
64
- duration_ms: 2.024173
65
- type: 'suite'
66
- ...
67
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
68
-
69
- More info: https://sass-lang.com/d/legacy-js-api
70
-
71
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
72
-
73
- More info: https://sass-lang.com/d/legacy-js-api
74
-
75
- ✓ src/colors/__tests__/colors.spec.ts (2 tests) 8ms
76
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
77
-
78
- More info: https://sass-lang.com/d/legacy-js-api
79
-
80
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
81
-
82
- More info: https://sass-lang.com/d/legacy-js-api
83
-
84
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
85
-
86
- More info: https://sass-lang.com/d/legacy-js-api
87
-
88
- ✓ src/components/PlRadio/__tests__/PlRadioGroup.spec.ts (7 tests | 1 skipped) 54ms
89
- ✓ src/components/PlCheckbox/__tests__/PlCheckbox.spec.ts (1 test) 44ms
90
- ↓ src/__tests__/use-debounce-fn.test.ts (1 test | 1 skipped)
91
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
92
-
93
- More info: https://sass-lang.com/d/legacy-js-api
94
-
95
- ✓ src/components/PlFileDialog/utils.test.ts (5 tests) 5ms
96
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
97
-
98
- More info: https://sass-lang.com/d/legacy-js-api
99
-
100
- ✓ src/components/PlBtnPrimary/__tests__/BtnPrimary.spec.ts (1 test) 20ms
101
- stdout | src/components/PlBtnSplit/__tests__/PlBtnSplit.spec.ts > PlBtnSplit.vue > Toggles dropdown on menu activator click
102
- DOMWrapper {
103
- isDisabled: [Function (anonymous)],
104
- wrapperElement: HTMLDivElement { [Symbol(_vei)]: { onClick: [Function] } }
105
- }
106
-
107
- ✓ src/components/PlNumberField/__tests__/PlNumberField.spec.ts (10 tests) 132ms
108
- ✓ src/components/PlBtnSplit/__tests__/PlBtnSplit.spec.ts (9 tests) 106ms
109
- DEPRECATION WARNING [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
110
-
111
- More info: https://sass-lang.com/d/legacy-js-api
112
-
113
- ✓ src/components/PlTextArea/__tests__/PlTextArea.spec.ts (2 tests) 98ms
114
- ✓ src/components/PlDropdownLegacy/__tests__/PlDropdownLegacy.spec.ts (1 test) 86ms
115
- ✓ src/components/PlTextField/__tests__/TextField.spec.ts (3 tests) 89ms
116
- stdout | src/components/PlDropdownMulti/__tests__/PlDropdownMulti.spec.ts > PlDropdownMulti > modelValue
117
- options [
118
- HTMLDivElement { [Symbol(_vei)]: { onClick: [Function] } },
119
- HTMLDivElement { [Symbol(_vei)]: { onClick: [Function] } }
120
- ]
121
-
122
- ✓ src/components/PlDropdownMulti/__tests__/PlDropdownMulti.spec.ts (1 test) 109ms
123
- ✓ src/components/PlDropdownMultiRef/__tests__/PlDropdownMultiRef.spec.ts (1 test) 160ms
124
- ✓ src/components/PlDropdown/__tests__/PlDropdown.spec.ts (1 test) 106ms
125
- ✓ src/components/PlDropdownRef/__tests__/PlDropdownRef.spec.ts (1 test) 113ms
126
- ✓ src/components/PlAutocomplete/__tests__/PlAutocomplete.spec.ts (1 test) 728ms
127
- ✓ PlAutocomplete > modelValue 726ms
128
-
129
-  Test Files  17 passed | 1 skipped (18)
130
-  Tests  51 passed | 2 skipped (53)
131
-  Start at  10:52:58
132
-  Duration  4.83s (transform 7.98s, setup 1.05s, collect 20.47s, tests 1.87s, environment 25.23s, prepare 9.86s)
133
-
@@ -1,27 +0,0 @@
1
- import { defineComponent as n, createBlock as r, openBlock as a, Transition as s, withCtx as p, renderSlot as c } from "vue";
2
- const f = /* @__PURE__ */ n({
3
- __name: "ExpandTransition",
4
- setup(l) {
5
- const t = (e) => {
6
- e.classList.add("expand-collapse-fix"), e.style.setProperty("--component-height", e.scrollHeight + "px");
7
- }, o = (e) => {
8
- e.style.removeProperty("--component-height"), e.classList.remove("expand-collapse-fix");
9
- };
10
- return (e, i) => (a(), r(s, {
11
- name: "expand-collapse",
12
- onEnter: t,
13
- onLeave: t,
14
- onAfterEnter: o,
15
- onAfterLeave: o
16
- }, {
17
- default: p(() => [
18
- c(e.$slots, "default")
19
- ]),
20
- _: 3
21
- }));
22
- }
23
- });
24
- export {
25
- f as default
26
- };
27
- //# sourceMappingURL=ExpandTransition.vue.js.map
@@ -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;;;;;;;;;;;;;;;"}