@milaboratories/uikit 2.6.0 → 2.6.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 +43 -43
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/components/DataTable/TableComponent.vue.js +4 -2
- package/dist/components/DataTable/TableComponent.vue.js.map +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.d.ts +4 -0
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +74 -68
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.d.ts +4 -0
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +52 -46
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.d.ts +8 -0
- package/dist/components/PlDropdown/PlDropdown.vue.js +67 -60
- package/dist/components/PlDropdown/PlDropdown.vue.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +21 -19
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js.map +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.d.ts +4 -0
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +47 -41
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js.map +1 -1
- package/dist/components/PlElementList/PlElementList.vue.d.ts +20 -0
- package/dist/components/PlElementList/PlElementList.vue2.js +180 -135
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue.d.ts +20 -0
- package/dist/components/PlElementList/PlElementListItem.vue2.js +99 -74
- package/dist/components/PlElementList/PlElementListItem.vue2.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +24 -22
- package/dist/components/PlFileInput/PlFileInput.vue.js.map +1 -1
- package/dist/components/PlLogView/PlLogView.vue.js +24 -22
- package/dist/components/PlLogView/PlLogView.vue.js.map +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.d.ts +5 -0
- package/dist/components/PlNumberField/PlNumberField.vue.js +60 -54
- package/dist/components/PlNumberField/PlNumberField.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +4 -2
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -1
- package/dist/components/PlSvg/PlSvg.vue2.js +15 -11
- package/dist/components/PlSvg/PlSvg.vue2.js.map +1 -1
- package/dist/components/PlTextArea/PlTextArea.vue.js +15 -13
- package/dist/components/PlTextArea/PlTextArea.vue.js.map +1 -1
- package/dist/components/PlTextField/PlTextField.vue.d.ts +4 -0
- package/dist/components/PlTextField/PlTextField.vue.js +45 -39
- package/dist/components/PlTextField/PlTextField.vue.js.map +1 -1
- package/dist/composition/filters/metadata.d.ts +205 -0
- package/dist/composition/filters/metadata.js +129 -19
- package/dist/composition/filters/metadata.js.map +1 -1
- package/dist/utils/DoubleContour.vue.d.ts +7 -1
- package/dist/utils/DoubleContour.vue.js +20 -13
- package/dist/utils/DoubleContour.vue.js.map +1 -1
- package/dist/utils/DoubleContour.vue2.js +19 -3
- package/dist/utils/DoubleContour.vue2.js.map +1 -1
- package/dist/utils/DoubleContour.vue3.js +7 -0
- package/dist/utils/DoubleContour.vue3.js.map +1 -0
- package/package.json +4 -4
- package/src/components/PlAutocomplete/PlAutocomplete.vue +6 -1
- package/src/components/PlAutocompleteMulti/PlAutocompleteMulti.vue +6 -1
- package/src/components/PlDropdown/PlDropdown.vue +12 -2
- package/src/components/PlDropdownMulti/PlDropdownMulti.vue +6 -1
- package/src/components/PlElementList/PlElementList.vue +40 -6
- package/src/components/PlElementList/PlElementListItem.vue +64 -47
- package/src/components/PlNumberField/PlNumberField.vue +4 -1
- package/src/components/PlSvg/PlSvg.vue +13 -10
- package/src/components/PlTextField/PlTextField.vue +7 -3
- package/src/composition/filters/metadata.ts +105 -0
- package/src/utils/DoubleContour.vue +68 -2
- package/dist/components/PlAccordion/ExpandTransition.vue.js +0 -27
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as E, useSlots as P, computed as $, createElementBlock as n, openBlock as i, createCommentVNode as o, createElementVNode as r, normalizeClass as l, renderSlot as y, createBlock as w, createVNode as m, unref as a, withModifiers as g } from "vue";
|
|
2
|
+
import b from "../PlIcon16/PlIcon16.vue.js";
|
|
3
|
+
import k from "../PlIcon24/PlIcon24.vue.js";
|
|
4
|
+
const h = ["data-draggable"], A = /* @__PURE__ */ E({
|
|
5
|
+
inheritAttrs: !1,
|
|
5
6
|
__name: "PlElementListItem",
|
|
6
7
|
props: {
|
|
7
8
|
item: {},
|
|
@@ -15,93 +16,117 @@ const f = ["data-draggable"], h = /* @__PURE__ */ c({
|
|
|
15
16
|
isToggable: { type: Boolean },
|
|
16
17
|
isToggled: { type: Boolean },
|
|
17
18
|
isPinnable: { type: Boolean },
|
|
18
|
-
isPinned: { type: Boolean }
|
|
19
|
+
isPinned: { type: Boolean },
|
|
20
|
+
titleClass: {},
|
|
21
|
+
contentClass: {},
|
|
22
|
+
afterClass: {},
|
|
23
|
+
beforeClass: {}
|
|
19
24
|
},
|
|
20
25
|
emits: ["expand", "toggle", "pin", "remove"],
|
|
21
|
-
setup(
|
|
22
|
-
const s =
|
|
23
|
-
return (e,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
[e.$style.opened]: s.isExpanded,
|
|
28
|
-
[e.$style.disabled]: s.isToggled
|
|
29
|
-
}])
|
|
30
|
-
}, [
|
|
31
|
-
p("div", {
|
|
32
|
-
class: l([e.$style.head, {
|
|
33
|
-
[e.$style.clickable]: $.value
|
|
34
|
-
}]),
|
|
35
|
-
onClick: i[3] || (i[3] = (y) => e.isExpandable && d("expand", s.item, s.index))
|
|
26
|
+
setup(f, { emit: C }) {
|
|
27
|
+
const s = f, p = P(), u = $(() => p.content !== void 0), B = $(() => p.after !== void 0), c = $(() => p.before !== void 0), d = C;
|
|
28
|
+
return (e, t) => (i(), n("div", null, [
|
|
29
|
+
c.value ? (i(), n("div", {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: l(e.beforeClass)
|
|
36
32
|
}, [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
], 2),
|
|
57
|
-
p("div", {
|
|
58
|
-
class: l([e.$style.actions, e.$style.showOnHover])
|
|
33
|
+
y(e.$slots, "before", {
|
|
34
|
+
item: s.item,
|
|
35
|
+
index: s.index
|
|
36
|
+
})
|
|
37
|
+
], 2)) : o("", !0),
|
|
38
|
+
r("div", {
|
|
39
|
+
class: l([e.$style.root, e.$attrs.class, {
|
|
40
|
+
[e.$style.active]: s.isActive,
|
|
41
|
+
[e.$style.pinned]: s.isPinned,
|
|
42
|
+
[e.$style.opened]: s.isExpanded,
|
|
43
|
+
[e.$style.disabled]: s.isToggled
|
|
44
|
+
}])
|
|
45
|
+
}, [
|
|
46
|
+
r("div", {
|
|
47
|
+
class: l([e.$style.head, e.titleClass, {
|
|
48
|
+
[e.$style.clickable]: u.value
|
|
49
|
+
}]),
|
|
50
|
+
onClick: t[3] || (t[3] = (v) => e.isExpandable && d("expand", s.item, s.index))
|
|
59
51
|
}, [
|
|
60
|
-
s.
|
|
52
|
+
s.showDragHandle ? (i(), n("div", {
|
|
61
53
|
key: 0,
|
|
62
|
-
class: l([e.$style.action, e.$style.
|
|
63
|
-
|
|
54
|
+
class: l([e.$style.action, e.$style.draggable, { [e.$style.disable]: !s.isDraggable }]),
|
|
55
|
+
"data-draggable": s.isDraggable
|
|
64
56
|
}, [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}, null, 8, ["name"])
|
|
69
|
-
], 2)) : t("", !0),
|
|
70
|
-
s.isPinnable ? (n(), o("div", {
|
|
57
|
+
m(a(b), { name: "drag-dots" })
|
|
58
|
+
], 10, h)) : o("", !0),
|
|
59
|
+
e.isExpandable ? (i(), w(a(b), {
|
|
71
60
|
key: 1,
|
|
72
|
-
class: l([e.$style.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
class: l([e.$style.contentChevron, { [e.$style.opened]: s.isExpanded }]),
|
|
62
|
+
name: "chevron-down"
|
|
63
|
+
}, null, 8, ["class"])) : o("", !0),
|
|
64
|
+
r("div", {
|
|
65
|
+
class: l(e.$style.title)
|
|
77
66
|
}, [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
y(e.$slots, "title", {
|
|
68
|
+
item: s.item,
|
|
69
|
+
index: s.index
|
|
81
70
|
})
|
|
82
|
-
], 2)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class: l([e.$style.action, e.$style.clickable]),
|
|
86
|
-
onClick: i[2] || (i[2] = m((y) => d("remove", s.item, s.index), ["stop"]))
|
|
71
|
+
], 2),
|
|
72
|
+
r("div", {
|
|
73
|
+
class: l([e.$style.actions, e.$style.showOnHover])
|
|
87
74
|
}, [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
s.isToggable ? (i(), n("div", {
|
|
76
|
+
key: 0,
|
|
77
|
+
class: l([e.$style.action, e.$style.clickable, { [e.$style.disable]: !s.isToggable }]),
|
|
78
|
+
onClick: t[0] || (t[0] = g((v) => d("toggle", s.item, s.index), ["stop"]))
|
|
79
|
+
}, [
|
|
80
|
+
m(a(k), {
|
|
81
|
+
name: s.isToggled === !0 ? "view-hide" : "view-show",
|
|
82
|
+
size: "16"
|
|
83
|
+
}, null, 8, ["name"])
|
|
84
|
+
], 2)) : o("", !0),
|
|
85
|
+
s.isPinnable ? (i(), n("div", {
|
|
86
|
+
key: 1,
|
|
87
|
+
class: l([e.$style.action, e.$style.clickable, {
|
|
88
|
+
[e.$style.disable]: !s.isPinnable,
|
|
89
|
+
[e.$style.activated]: s.isPinned
|
|
90
|
+
}]),
|
|
91
|
+
onClick: t[1] || (t[1] = g((v) => d("pin", s.item, s.index), ["stop"]))
|
|
92
|
+
}, [
|
|
93
|
+
m(a(k), {
|
|
94
|
+
name: "pin",
|
|
95
|
+
size: "16"
|
|
96
|
+
})
|
|
97
|
+
], 2)) : o("", !0),
|
|
98
|
+
s.isRemovable ? (i(), n("div", {
|
|
99
|
+
key: 2,
|
|
100
|
+
class: l([e.$style.action, e.$style.clickable]),
|
|
101
|
+
onClick: t[2] || (t[2] = g((v) => d("remove", s.item, s.index), ["stop"]))
|
|
102
|
+
}, [
|
|
103
|
+
m(a(b), { name: "close" })
|
|
104
|
+
], 2)) : o("", !0)
|
|
105
|
+
], 2)
|
|
106
|
+
], 2),
|
|
107
|
+
u.value && s.isExpanded ? (i(), n("div", {
|
|
108
|
+
key: 0,
|
|
109
|
+
class: l([e.$style.body, e.contentClass, { [e.$style.disabled]: s.isToggled }])
|
|
110
|
+
}, [
|
|
111
|
+
y(e.$slots, "content", {
|
|
112
|
+
item: s.item,
|
|
113
|
+
index: s.index
|
|
114
|
+
})
|
|
115
|
+
], 2)) : o("", !0)
|
|
91
116
|
], 2),
|
|
92
|
-
|
|
93
|
-
key:
|
|
94
|
-
class: l(
|
|
117
|
+
B.value ? (i(), n("div", {
|
|
118
|
+
key: 1,
|
|
119
|
+
class: l(e.afterClass)
|
|
95
120
|
}, [
|
|
96
|
-
|
|
121
|
+
y(e.$slots, "after", {
|
|
97
122
|
item: s.item,
|
|
98
123
|
index: s.index
|
|
99
124
|
})
|
|
100
|
-
], 2)) :
|
|
101
|
-
]
|
|
125
|
+
], 2)) : o("", !0)
|
|
126
|
+
]));
|
|
102
127
|
}
|
|
103
128
|
});
|
|
104
129
|
export {
|
|
105
|
-
|
|
130
|
+
A as default
|
|
106
131
|
};
|
|
107
132
|
//# sourceMappingURL=PlElementListItem.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlElementListItem.vue2.js","sources":["../../../src/components/PlElementList/PlElementListItem.vue"],"sourcesContent":["<script generic=\"T extends unknown = unknown\" lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlIcon24 } from '../PlIcon24';\n\nconst props = defineProps<{\n item: T;\n index: number;\n showDragHandle: boolean;\n isActive: boolean;\n isDraggable: boolean;\n isRemovable: boolean;\n isExpandable: boolean;\n isExpanded: boolean;\n isToggable: boolean;\n isToggled: boolean;\n isPinnable: boolean;\n isPinned: boolean;\n}>();\n\nconst slots = defineSlots<{\n title: (props: { item: T; index: number }) => unknown;\n content?: (props: { item: T; index: number }) => unknown;\n}>();\nconst hasContentSlot = computed(() => slots['content'] !== undefined);\n\nconst emit = defineEmits<{\n (e: 'expand', item: T, index: number): void;\n (e: 'toggle', item: T, index: number): void;\n (e: 'pin', item: T, index: number): void;\n (e: 'remove', item: T, index: number): void;\n}>();\n</script>\n\n<template>\n <div\n :class=\"[$style.root, {\n
|
|
1
|
+
{"version":3,"file":"PlElementListItem.vue2.js","sources":["../../../src/components/PlElementList/PlElementListItem.vue"],"sourcesContent":["<script generic=\"T extends unknown = unknown\" lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlIcon24 } from '../PlIcon24';\n\nconst props = defineProps<{\n item: T;\n index: number;\n showDragHandle: boolean;\n isActive: boolean;\n isDraggable: boolean;\n isRemovable: boolean;\n isExpandable: boolean;\n isExpanded: boolean;\n isToggable: boolean;\n isToggled: boolean;\n isPinnable: boolean;\n isPinned: boolean;\n titleClass: string | string[] | null;\n contentClass: string | string[] | null;\n afterClass: string | string[] | null;\n beforeClass: string | string[] | null;\n}>();\ndefineOptions({ inheritAttrs: false });\n\nconst slots = defineSlots<{\n title: (props: { item: T; index: number }) => unknown;\n content?: (props: { item: T; index: number }) => unknown;\n after?: (props: { item: T; index: number }) => unknown;\n before?: (props: { item: T; index: number }) => unknown;\n}>();\nconst hasContentSlot = computed(() => slots['content'] !== undefined);\nconst hasAfterSlot = computed(() => slots['after'] !== undefined);\nconst hasBeforeSlot = computed(() => slots['before'] !== undefined);\n\nconst emit = defineEmits<{\n (e: 'expand', item: T, index: number): void;\n (e: 'toggle', item: T, index: number): void;\n (e: 'pin', item: T, index: number): void;\n (e: 'remove', item: T, index: number): void;\n}>();\n</script>\n\n<template>\n <div>\n <div v-if=\"hasBeforeSlot\" :class=\"beforeClass\">\n <slot name=\"before\" :item=\"props.item\" :index=\"props.index\" />\n </div>\n <div\n :class=\"[$style.root, $attrs.class, {\n [$style.active]: props.isActive,\n [$style.pinned]: props.isPinned,\n [$style.opened]: props.isExpanded,\n [$style.disabled]: props.isToggled,\n }]\"\n >\n <div\n :class=\"[$style.head, titleClass, {\n [$style.clickable]: hasContentSlot,\n }]\"\n @click=\"isExpandable && emit('expand', props.item, props.index)\"\n >\n <div\n v-if=\"props.showDragHandle\"\n :class=\"[$style.action, $style.draggable, { [$style.disable]: !props.isDraggable } ]\"\n :data-draggable=\"props.isDraggable\"\n >\n <PlIcon16 name=\"drag-dots\" />\n </div>\n <PlIcon16 v-if=\"isExpandable\" :class=\"[$style.contentChevron, { [$style.opened]: props.isExpanded }]\" name=\"chevron-down\" />\n\n <div :class=\"$style.title\">\n <slot name=\"title\" :item=\"props.item\" :index=\"props.index\" />\n </div>\n\n <div :class=\"[$style.actions, $style.showOnHover]\">\n <div\n v-if=\"props.isToggable\"\n :class=\"[$style.action, $style.clickable, { [$style.disable]: !props.isToggable }]\"\n @click.stop=\"emit('toggle', props.item, props.index)\"\n >\n <PlIcon24 :name=\"props.isToggled === true ? 'view-hide' : 'view-show'\" size=\"16\" />\n </div>\n <div\n v-if=\"props.isPinnable\"\n :class=\"[$style.action, $style.clickable, {\n [$style.disable]: !props.isPinnable,\n [$style.activated]: props.isPinned,\n }]\"\n @click.stop=\"emit('pin', props.item, props.index)\"\n >\n <PlIcon24 name=\"pin\" size=\"16\" />\n </div>\n <div\n v-if=\"props.isRemovable\"\n :class=\"[$style.action, $style.clickable]\"\n @click.stop=\"emit('remove', props.item, props.index)\"\n >\n <PlIcon16 name=\"close\" />\n </div>\n </div>\n </div>\n <div\n v-if=\"hasContentSlot && props.isExpanded\"\n :class=\"[$style.body, contentClass, { [$style.disabled]: props.isToggled }]\"\n >\n <slot name=\"content\" :item=\"props.item\" :index=\"props.index\" />\n </div>\n </div>\n <div v-if=\"hasAfterSlot\" :class=\"afterClass\">\n <slot name=\"after\" :item=\"props.item\" :index=\"props.index\" />\n </div>\n </div>\n</template>\n\n<style module>\n@use '../../assets/variables.scss' as *;\n\n.root {\n --background: rgba(255, 255, 255, 0.8);\n --border-color: var(--color-div-grey);\n --head-background: unset;\n --box-shadow: none;\n --box-shadow-active: 0 0 0 4px color-mix(in srgb, var(--border-color-focus) 50%, transparent);\n\n &:global(.sortable-drag),\n &:global(.sortable-chosen) {\n --head-background: var(--gradient-light-lime);\n --border-color: var(--border-color-focus);\n --box-shadow: var(--box-shadow-active)\n }\n}\n.root {\n display: flex;\n flex-direction: column;\n justify-content: center;\n border-radius: var(--border-radius);\n border: 1px solid var(--border-color);\n background-color: var(--background);\n transition: box-shadow 0.15s;\n box-shadow: var(--box-shadow);;\n overflow: hidden;\n\n &:hover {\n --border-color: var(--border-color-focus);\n --head-background: var(--gradient-light-lime);\n }\n\n &.opened {\n --head-background: var(--gradient-light-lime);\n }\n\n &.disabled {\n --icon-color: var(--ic-02);\n --border-color: var(--border-color-div-grey);\n color: var(--txt-03);\n filter: grayscale(1);\n }\n\n &.pinned {\n --background: var(--bg-base-light);\n }\n\n &.active {\n --border-color: var(--border-color-focus);\n --head-background: var(--btn-accent-positive-500);\n }\n}\n\n.head {\n position: relative;\n display: flex;\n align-items: center;\n padding: 8px;\n min-height: 40px;\n border-radius: var(--border-radius) var(--border-radius) 0 0;\n background: var(--head-background);\n}\n\n.contentChevron {\n display: block;\n width: 16px;\n height: 16px;\n margin-right: 4px;\n transform: rotate(-90deg);\n transition: transform 0.15s;\n\n &.opened {\n transform: rotate(0deg);\n }\n}\n\n.title {\n display: flex;\n flex-direction: row;\n flex: 1 1 0;\n gap: 8px;\n text-overflow: ellipsis;\n}\n\n.body {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 24px;\n border-radius: 0 0 var(--border-radius) var(--border-radius);\n\n &.disabled {\n pointer-events: none;\n }\n}\n\n.actions {\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n background-color: var(--background);\n border-radius: var(--border-radius);\n}\n\n.action {\n width: 24px;\n height: 24px;\n padding: 4px; /* use padding instead of gap on parent, for better accessibility */\n opacity: 0.6;\n border-radius: var(--border-radius);\n transition: all 0.15s;\n\n svg {\n width: 16px;\n height: 16px;\n }\n\n &:hover {\n opacity: 1;\n background-color: var(--bg-elevated-02);\n }\n\n &.activated {\n opacity: 0.8;\n }\n\n &.disable {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n.clickable {\n cursor: pointer;\n}\n\n.draggable {\n cursor: grab;\n}\n\n.showOnHover {\n opacity: 0;\n transition: opacity 0.15s;\n}\n\n.root:hover .showOnHover {\n opacity: 1;\n}\n</style>\n"],"names":["props","__props","slots","_useSlots","hasContentSlot","computed","hasAfterSlot","hasBeforeSlot","emit","__emit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,UAAMA,IAAQC,GAoBRC,IAAQC,EAAA,GAMRC,IAAiBC,EAAS,MAAMH,EAAM,YAAe,MAAS,GAC9DI,IAAeD,EAAS,MAAMH,EAAM,UAAa,MAAS,GAC1DK,IAAgBF,EAAS,MAAMH,EAAM,WAAc,MAAS,GAE5DM,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`.pl-file-input{--contour-color: var(--txt-01);--label-color: var(--txt-01);--text-color: var(--txt-01);--contour-border-width: 1px;--contour-box-shadow: none;--label-offset-left-x: 8px;--label-offset-right-x: 8px;--prefix-color: var(--color-placeholder);--contour-offset: 2px;--icon-color: #000;position:relative;z-index:0;width:100%;height:var(--control-height, 40px);border-radius:var(--border-radius-control);display:flex;flex-direction:row;align-items:center;outline:none;padding:0 8px;gap:8px;cursor:pointer}.pl-file-input__envelope{font-family:var(--font-family-base);display:flex;flex-direction:column;min-width:160px}.pl-file-input .mask-24{display:block;min-width:24px}.pl-file-input .mask-close{cursor:pointer}.pl-file-input__progress{position:absolute;z-index:-1;top:0;bottom:0;left:0;right:0;background:linear-gradient(90deg,#fff,#d8fac8);pointer-events:none;width:0}.pl-file-input__clear{--icon-color: var(--ic-02)}.pl-file-input__filename{width:100%;border:none;font-size:inherit;background-color:transparent;color:var(--text-color);caret-color:var(--border-color-focus);z-index:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:18px}.pl-file-input__filename:empty:before{color:var(--color-placeholder);content:attr(data-placeholder);color:var(--txt-03);font-size:14px;font-weight:500;line-height:20px}.pl-file-input__stats{white-space:nowrap;z-index:1;font-size:11px;font-weight:600;letter-spacing:.44px;text-transform:uppercase;color:var(--txt-03)}.pl-file-input label{display:flex;align-items:center;gap:4px;position:absolute;top:0;transform:translateY(-60%);left:var(--label-offset-left-x);padding:0 4px;max-width:calc(100% - 16px);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit;color:var(--label-color);font-size:12px;font-weight:500;border-bottom-right-radius:4px;border-bottom-left-radius:4px;background:var(--bg-elevated-01)}.pl-file-input label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-file-input__contour{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:var(--border-radius-control);border-width:var(--contour-border-width);border-color:var(--contour-color);border-style:solid;box-shadow:var(--contour-box-shadow);z-index:0;pointer-events:none}.pl-file-input__prefix{padding-left:12px;white-space:nowrap;margin-right:-12px;color:var(--prefix-color)}.pl-file-input__helper{font-size:12px;color:var(--txt-03);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-file-input__error{font-size:12px;color:var(--txt-error);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-file-input:hover{--contour-color: var(--control-hover-color)}.pl-file-input:focus-within:not(.error){--label-color: var(--txt-focus);--contour-color: var(--border-color-focus);--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--border-color-focus-shadow)}.pl-file-input:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.pl-file-input.dashed .pl-file-input__contour{border-style:dashed}.pl-file-input.nonEmpty{--prefix-color: var(--txt-01)}.pl-file-input.error{--contour-color: var(--txt-error);--label-color: var(--txt-error);--text-color: var(--txt-error);--icon-color: var(--txt-error)}.pl-file-input.error .pl-file-input__progress{display:none}.pl-file-input.disabled{--contour-color: var(--color-dis-01);cursor:not-allowed}.pl-file-input__cell-style{--border-radius-control: 0px;--input-active-color: var(--bg-base-light);--border-color: var(--border-color-div-grey);background-color:var(--input-active-color);padding:4px;height:100%;position:relative}.pl-file-input__cell-style .mask-paper-clip{display:none}.pl-file-input__cell-style .pl-file-input{height:100%!important;position:unset}.pl-file-input__cell-style .pl-file-input .double-contour{top:2px;right:2px;bottom:2px;left:2px}.pl-file-input__cell-style .pl-file-input__contour{border-width:1px;box-shadow:unset!important;border-color:var(--border-color);border-style:dashed}.pl-file-input__cell-style .pl-file-input__filename{text-align:center!important}.pl-file-input__cell-style .pl-file-input__error{margin-top:0;margin-right:8px}.pl-file-input__cell-style:hover{--border-color: var(--border-color-focus);background-color:#d9f8ca}.pl-file-input__cell-style:hover .pl-file-input__filename:before{color:#110529!important}.pl-file-input__cell-style.has-file:hover{background-color:var(--input-active-color)}.pl-file-input__cell-style.has-file{padding-left:0;padding-right:0}.pl-file-input__cell-style.has-file .pl-file-input__contour{border:unset}.pl-file-input__cell-style.has-file .pl-file-input__filename{text-align:left!important}.pl-file-input__cell-style.has-file .mask-paper-clip{display:block}
|
|
2
|
+
.double-contour.top>div{border-bottom-right-radius:0;border-bottom-left-radius:0}.double-contour.bottom>div{border-top-right-radius:0;border-top-left-radius:0}.double-contour.left>div{border-top-right-radius:0;border-bottom-right-radius:0}.double-contour.right>div{border-top-left-radius:0;border-bottom-left-radius:0}.double-contour.top-left>div{border-top-right-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.double-contour.top-right>div{border-bottom-right-radius:0;border-top-left-radius:0;border-top-right-radius:0}.double-contour.bottom-left>div{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0}.double-contour.bottom-right>div{border-top-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0}.double-contour.middle>div{border-radius:0}`)),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
3
|
+
import { defineComponent as $, reactive as q, useSlots as R, computed as s, watch as U, ref as z, createElementBlock as n, openBlock as l, Fragment as D, createElementVNode as c, createVNode as B, normalizeClass as O, createCommentVNode as p, withModifiers as F, withKeys as H, createBlock as i, normalizeStyle as K, unref as t, toDisplayString as u, withCtx as L, renderSlot as j, createTextVNode as A } from "vue";
|
|
3
4
|
|
|
4
5
|
import { prettyBytes as y } from "@milaboratories/helpers";
|
|
5
6
|
import { getFileNameFromHandle as G, getFilePathFromHandle as J } from "@platforma-sdk/model";
|
|
6
7
|
import { getErrorMessage as Q } from "../../helpers/error.js";
|
|
7
8
|
import W from "../../utils/DoubleContour.vue.js";
|
|
9
|
+
|
|
8
10
|
import { useLabelNotch as X } from "../../utils/useLabelNotch.js";
|
|
9
11
|
import Y from "../PlFileDialog/PlFileDialog.vue.js";
|
|
10
12
|
import f from "../PlIcon24/PlIcon24.vue.js";
|
|
@@ -23,7 +25,7 @@ const le = {
|
|
|
23
25
|
}, se = {
|
|
24
26
|
key: 1,
|
|
25
27
|
class: "pl-file-input__helper"
|
|
26
|
-
},
|
|
28
|
+
}, _e = /* @__PURE__ */ $({
|
|
27
29
|
__name: "PlFileInput",
|
|
28
30
|
props: {
|
|
29
31
|
modelValue: {},
|
|
@@ -41,17 +43,17 @@ const le = {
|
|
|
41
43
|
},
|
|
42
44
|
emits: ["update:modelValue"],
|
|
43
45
|
setup(N, { emit: P }) {
|
|
44
|
-
const a =
|
|
46
|
+
const a = q({
|
|
45
47
|
fileDialogOpen: !1,
|
|
46
48
|
error: void 0
|
|
47
|
-
}), g =
|
|
49
|
+
}), g = R(), v = P, o = N, h = (e, r) => {
|
|
48
50
|
if (e)
|
|
49
51
|
try {
|
|
50
52
|
return r(e);
|
|
51
53
|
} catch (d) {
|
|
52
54
|
return a.error = d instanceof Error ? d.message : String(d), e;
|
|
53
55
|
}
|
|
54
|
-
},
|
|
56
|
+
}, _ = s(() => h(o.modelValue, G)), k = s(() => h(o.modelValue, J)), E = s(() => o.progress && !o.progress.done), T = s(() => o.progress && o.progress.done), V = s(() => Q(a.error, o.error)), m = s(() => typeof V.value == "string"), S = s(() => {
|
|
55
57
|
const { status: e, done: r } = o.progress ?? {};
|
|
56
58
|
return !e || !e.bytesTotal ? "" : e.bytesProcessed && !r ? y(e.bytesProcessed, {}) + " / " + y(e.bytesTotal, {}) : y(e.bytesTotal, {});
|
|
57
59
|
}), w = s(() => {
|
|
@@ -60,12 +62,12 @@ const le = {
|
|
|
60
62
|
return e ? {
|
|
61
63
|
width: e.done ? "100%" : Math.round((((r = e.status) == null ? void 0 : r.progress) ?? 0) * 100) + "%"
|
|
62
64
|
} : {};
|
|
63
|
-
}),
|
|
65
|
+
}), b = () => {
|
|
64
66
|
a.fileDialogOpen = !0;
|
|
65
67
|
}, M = (e) => {
|
|
66
68
|
e.files.length && v("update:modelValue", e.files[0]);
|
|
67
69
|
}, I = () => v("update:modelValue", void 0);
|
|
68
|
-
|
|
70
|
+
U(
|
|
69
71
|
() => o.modelValue,
|
|
70
72
|
() => a.error = void 0,
|
|
71
73
|
{ immediate: !0 }
|
|
@@ -73,15 +75,15 @@ const le = {
|
|
|
73
75
|
const C = z();
|
|
74
76
|
return o.cellStyle || X(C), (e, r) => (l(), n(D, null, [
|
|
75
77
|
c("div", {
|
|
76
|
-
class: O([{ "pl-file-input__cell-style": !!e.cellStyle, "has-file": !!
|
|
78
|
+
class: O([{ "pl-file-input__cell-style": !!e.cellStyle, "has-file": !!_.value }, "pl-file-input__envelope"])
|
|
77
79
|
}, [
|
|
78
80
|
c("div", {
|
|
79
81
|
ref_key: "rootRef",
|
|
80
82
|
ref: C,
|
|
81
83
|
class: O([{ dashed: e.dashed, error: m.value }, "pl-file-input"]),
|
|
82
84
|
tabindex: "0",
|
|
83
|
-
onKeyup: H(
|
|
84
|
-
onClick: F(
|
|
85
|
+
onKeyup: H(b, ["enter"]),
|
|
86
|
+
onClick: F(b, ["stop"])
|
|
85
87
|
}, [
|
|
86
88
|
c("div", {
|
|
87
89
|
style: K(w.value),
|
|
@@ -91,21 +93,21 @@ const le = {
|
|
|
91
93
|
e.required ? (l(), i(t(ee), {
|
|
92
94
|
key: 0,
|
|
93
95
|
uri: t(x)
|
|
94
|
-
}, null, 8, ["uri"])) :
|
|
95
|
-
c("span", null,
|
|
96
|
-
t(g).tooltip ||
|
|
96
|
+
}, null, 8, ["uri"])) : p("", !0),
|
|
97
|
+
c("span", null, u(e.label), 1),
|
|
98
|
+
t(g).tooltip || k.value ? (l(), i(t(Z), {
|
|
97
99
|
key: 1,
|
|
98
100
|
class: "info",
|
|
99
101
|
position: "top"
|
|
100
102
|
}, {
|
|
101
103
|
tooltip: L(() => [
|
|
102
104
|
t(g).tooltip ? j(e.$slots, "tooltip", { key: 0 }) : (l(), n(D, { key: 1 }, [
|
|
103
|
-
A(
|
|
105
|
+
A(u(k.value), 1)
|
|
104
106
|
], 64))
|
|
105
107
|
]),
|
|
106
108
|
_: 3
|
|
107
|
-
})) :
|
|
108
|
-
], 512)) :
|
|
109
|
+
})) : p("", !0)
|
|
110
|
+
], 512)) : p("", !0),
|
|
109
111
|
m.value ? (l(), i(t(f), {
|
|
110
112
|
key: 1,
|
|
111
113
|
name: "restart"
|
|
@@ -122,17 +124,17 @@ const le = {
|
|
|
122
124
|
c("div", {
|
|
123
125
|
"data-placeholder": e.placeholder ?? "Choose file",
|
|
124
126
|
class: "pl-file-input__filename"
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
+
}, u(_.value), 9, oe),
|
|
128
|
+
S.value ? (l(), n("div", te, u(S.value), 1)) : p("", !0),
|
|
127
129
|
e.modelValue ? (l(), i(t(f), {
|
|
128
130
|
key: 6,
|
|
129
131
|
class: "pl-file-input__clear",
|
|
130
132
|
name: "close",
|
|
131
133
|
onClick: F(I, ["stop"])
|
|
132
|
-
})) :
|
|
134
|
+
})) : p("", !0),
|
|
133
135
|
B(W, { class: "pl-file-input__contour" })
|
|
134
136
|
], 34),
|
|
135
|
-
m.value ? (l(), n("div", re,
|
|
137
|
+
m.value ? (l(), n("div", re, u(V.value), 1)) : e.helper ? (l(), n("div", se, u(e.helper), 1)) : p("", !0)
|
|
136
138
|
], 2),
|
|
137
139
|
B(t(Y), {
|
|
138
140
|
modelValue: a.fileDialogOpen,
|
|
@@ -146,6 +148,6 @@ const le = {
|
|
|
146
148
|
}
|
|
147
149
|
});
|
|
148
150
|
export {
|
|
149
|
-
|
|
151
|
+
_e as default
|
|
150
152
|
};
|
|
151
153
|
//# sourceMappingURL=PlFileInput.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlFileInput.vue.js","sources":["../../../src/components/PlFileInput/PlFileInput.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport './pl-file-input.scss';\n\nimport { prettyBytes } from '@milaboratories/helpers';\nimport type { ImportFileHandle, ImportProgress } from '@platforma-sdk/model';\nimport { getFileNameFromHandle, getFilePathFromHandle } from '@platforma-sdk/model';\nimport { computed, reactive, ref, useSlots, watch } from 'vue';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport type { ImportedFiles } from '../../types';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { PlFileDialog } from '../PlFileDialog';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { PlTooltip } from '../PlTooltip';\n\nimport SvgRequired from '../../assets/images/required.svg?raw';\nimport { PlSvg } from '../PlSvg';\n\nconst data = reactive({\n fileDialogOpen: false,\n error: undefined as undefined | string,\n});\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: ImportFileHandle | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current import file handle.\n */\n modelValue: ImportFileHandle | undefined;\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the component border is dashed.\n */\n dashed?: boolean;\n /**\n * Allowed file extensions (should start with `.`)\n */\n extensions?: string[];\n /**\n * Placeholder text\n */\n placeholder?: string;\n /**\n * Import/Upload progress\n */\n progress?: ImportProgress;\n /**\n * An error message to display below the input field.\n */\n error?: unknown;\n /**\n * A helper text to display below the input field when there are no errors.\n */\n helper?: string;\n /**\n * Remove rounded border and change styles\n */\n cellStyle?: boolean;\n /**\n * File dialog title\n */\n fileDialogTitle?: string;\n /**\n * If `true`, the file dialog window closes when clicking outside the modal area (default: `true`)\n */\n fileDialogCloseOnOutsideClick?: boolean;\n }>(),\n {\n label: undefined,\n extensions: undefined,\n fileDialogTitle: undefined,\n placeholder: undefined,\n progress: undefined,\n error: undefined,\n helper: undefined,\n cellStyle: false,\n fileDialogCloseOnOutsideClick: true,\n },\n);\n\nconst tryValue = <T extends ImportFileHandle>(v: T | undefined, cb: (v: T) => string | undefined) => {\n if (!v) {\n return undefined;\n }\n\n try {\n return cb(v);\n } catch (err) {\n data.error = err instanceof Error ? err.message : String(err);\n return v;\n }\n};\n\nconst fileName = computed(() => tryValue(props.modelValue, getFileNameFromHandle));\n\nconst filePath = computed(() => tryValue(props.modelValue, getFilePathFromHandle));\n\nconst isUploading = computed(() => props.progress && !props.progress.done);\n\nconst isUploaded = computed(() => props.progress && props.progress.done);\n\nconst computedErrorMessage = computed(() => getErrorMessage(data.error, props.error));\n\nconst hasErrors = computed(() => typeof computedErrorMessage.value === 'string');\n\nconst uploadStats = computed(() => {\n const { status, done } = props.progress ?? {};\n\n if (!status || !status.bytesTotal) {\n return '';\n }\n\n if (status.bytesProcessed && !done) {\n return prettyBytes(status.bytesProcessed, {}) + ' / ' + prettyBytes(status.bytesTotal, {});\n }\n\n return prettyBytes(status.bytesTotal, {});\n});\n\nconst progressStyle = computed(() => {\n const { progress } = props;\n\n if (!progress) {\n return {};\n }\n\n return {\n width: progress.done ? '100%' : Math.round((progress.status?.progress ?? 0) * 100) + '%',\n };\n});\n\nconst openFileDialog = () => {\n data.fileDialogOpen = true;\n};\n\nconst onImport = (v: ImportedFiles) => {\n if (v.files.length) {\n emit('update:modelValue', v.files[0]);\n }\n};\n\nconst clear = () => emit('update:modelValue', undefined);\n\nwatch(\n () => props.modelValue,\n () => (data.error = undefined),\n { immediate: true },\n);\n\nconst rootRef = ref();\n\nif (!props.cellStyle) {\n useLabelNotch(rootRef);\n}\n</script>\n\n<template>\n <div :class=\"{ 'pl-file-input__cell-style': !!cellStyle, 'has-file': !!fileName }\" class=\"pl-file-input__envelope\">\n <div\n ref=\"rootRef\"\n :class=\"{ dashed, error: hasErrors }\"\n class=\"pl-file-input\"\n tabindex=\"0\"\n @keyup.enter=\"openFileDialog\"\n @click.stop=\"openFileDialog\"\n >\n <div :style=\"progressStyle\" class=\"pl-file-input__progress\" />\n <label v-if=\"!cellStyle && label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip || filePath\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot v-if=\"slots.tooltip\" name=\"tooltip\" />\n <template v-else>{{ filePath }}</template>\n </template>\n </PlTooltip>\n </label>\n <PlMaskIcon24 v-if=\"hasErrors\" name=\"restart\" />\n <PlMaskIcon24 v-else-if=\"isUploading\" name=\"cloud-upload\" />\n <PlMaskIcon24 v-else-if=\"isUploaded\" name=\"success\" />\n <PlMaskIcon24 v-else name=\"paper-clip\" />\n <div :data-placeholder=\"placeholder ?? 'Choose file'\" class=\"pl-file-input__filename\">\n {{ fileName }}\n </div>\n <div v-if=\"uploadStats\" class=\"pl-file-input__stats\">{{ uploadStats }}</div>\n <PlMaskIcon24 v-if=\"modelValue\" class=\"pl-file-input__clear\" name=\"close\" @click.stop=\"clear\" />\n <DoubleContour class=\"pl-file-input__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-file-input__error\">\n {{ computedErrorMessage }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-file-input__helper\">{{ helper }}</div>\n </div>\n <PlFileDialog\n v-model=\"data.fileDialogOpen\"\n :close-on-outside-click=\"fileDialogCloseOnOutsideClick\"\n :extensions=\"extensions\"\n :title=\"fileDialogTitle\"\n @import:files=\"onImport\"\n />\n</template>\n"],"names":["data","reactive","slots","useSlots","emit","__emit","props","__props","tryValue","v","cb","err","fileName","computed","getFileNameFromHandle","filePath","getFilePathFromHandle","isUploading","isUploaded","computedErrorMessage","getErrorMessage","hasErrors","uploadStats","status","done","prettyBytes","progressStyle","progress","_a","openFileDialog","onImport","clear","watch","rootRef","ref","useLabelNotch"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlFileInput.vue.js","sources":["../../../src/components/PlFileInput/PlFileInput.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport './pl-file-input.scss';\n\nimport { prettyBytes } from '@milaboratories/helpers';\nimport type { ImportFileHandle, ImportProgress } from '@platforma-sdk/model';\nimport { getFileNameFromHandle, getFilePathFromHandle } from '@platforma-sdk/model';\nimport { computed, reactive, ref, useSlots, watch } from 'vue';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport type { ImportedFiles } from '../../types';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { PlFileDialog } from '../PlFileDialog';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { PlTooltip } from '../PlTooltip';\n\nimport SvgRequired from '../../assets/images/required.svg?raw';\nimport { PlSvg } from '../PlSvg';\n\nconst data = reactive({\n fileDialogOpen: false,\n error: undefined as undefined | string,\n});\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: ImportFileHandle | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current import file handle.\n */\n modelValue: ImportFileHandle | undefined;\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the component border is dashed.\n */\n dashed?: boolean;\n /**\n * Allowed file extensions (should start with `.`)\n */\n extensions?: string[];\n /**\n * Placeholder text\n */\n placeholder?: string;\n /**\n * Import/Upload progress\n */\n progress?: ImportProgress;\n /**\n * An error message to display below the input field.\n */\n error?: unknown;\n /**\n * A helper text to display below the input field when there are no errors.\n */\n helper?: string;\n /**\n * Remove rounded border and change styles\n */\n cellStyle?: boolean;\n /**\n * File dialog title\n */\n fileDialogTitle?: string;\n /**\n * If `true`, the file dialog window closes when clicking outside the modal area (default: `true`)\n */\n fileDialogCloseOnOutsideClick?: boolean;\n }>(),\n {\n label: undefined,\n extensions: undefined,\n fileDialogTitle: undefined,\n placeholder: undefined,\n progress: undefined,\n error: undefined,\n helper: undefined,\n cellStyle: false,\n fileDialogCloseOnOutsideClick: true,\n },\n);\n\nconst tryValue = <T extends ImportFileHandle>(v: T | undefined, cb: (v: T) => string | undefined) => {\n if (!v) {\n return undefined;\n }\n\n try {\n return cb(v);\n } catch (err) {\n data.error = err instanceof Error ? err.message : String(err);\n return v;\n }\n};\n\nconst fileName = computed(() => tryValue(props.modelValue, getFileNameFromHandle));\n\nconst filePath = computed(() => tryValue(props.modelValue, getFilePathFromHandle));\n\nconst isUploading = computed(() => props.progress && !props.progress.done);\n\nconst isUploaded = computed(() => props.progress && props.progress.done);\n\nconst computedErrorMessage = computed(() => getErrorMessage(data.error, props.error));\n\nconst hasErrors = computed(() => typeof computedErrorMessage.value === 'string');\n\nconst uploadStats = computed(() => {\n const { status, done } = props.progress ?? {};\n\n if (!status || !status.bytesTotal) {\n return '';\n }\n\n if (status.bytesProcessed && !done) {\n return prettyBytes(status.bytesProcessed, {}) + ' / ' + prettyBytes(status.bytesTotal, {});\n }\n\n return prettyBytes(status.bytesTotal, {});\n});\n\nconst progressStyle = computed(() => {\n const { progress } = props;\n\n if (!progress) {\n return {};\n }\n\n return {\n width: progress.done ? '100%' : Math.round((progress.status?.progress ?? 0) * 100) + '%',\n };\n});\n\nconst openFileDialog = () => {\n data.fileDialogOpen = true;\n};\n\nconst onImport = (v: ImportedFiles) => {\n if (v.files.length) {\n emit('update:modelValue', v.files[0]);\n }\n};\n\nconst clear = () => emit('update:modelValue', undefined);\n\nwatch(\n () => props.modelValue,\n () => (data.error = undefined),\n { immediate: true },\n);\n\nconst rootRef = ref();\n\nif (!props.cellStyle) {\n useLabelNotch(rootRef);\n}\n</script>\n\n<template>\n <div :class=\"{ 'pl-file-input__cell-style': !!cellStyle, 'has-file': !!fileName }\" class=\"pl-file-input__envelope\">\n <div\n ref=\"rootRef\"\n :class=\"{ dashed, error: hasErrors }\"\n class=\"pl-file-input\"\n tabindex=\"0\"\n @keyup.enter=\"openFileDialog\"\n @click.stop=\"openFileDialog\"\n >\n <div :style=\"progressStyle\" class=\"pl-file-input__progress\" />\n <label v-if=\"!cellStyle && label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip || filePath\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot v-if=\"slots.tooltip\" name=\"tooltip\" />\n <template v-else>{{ filePath }}</template>\n </template>\n </PlTooltip>\n </label>\n <PlMaskIcon24 v-if=\"hasErrors\" name=\"restart\" />\n <PlMaskIcon24 v-else-if=\"isUploading\" name=\"cloud-upload\" />\n <PlMaskIcon24 v-else-if=\"isUploaded\" name=\"success\" />\n <PlMaskIcon24 v-else name=\"paper-clip\" />\n <div :data-placeholder=\"placeholder ?? 'Choose file'\" class=\"pl-file-input__filename\">\n {{ fileName }}\n </div>\n <div v-if=\"uploadStats\" class=\"pl-file-input__stats\">{{ uploadStats }}</div>\n <PlMaskIcon24 v-if=\"modelValue\" class=\"pl-file-input__clear\" name=\"close\" @click.stop=\"clear\" />\n <DoubleContour class=\"pl-file-input__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-file-input__error\">\n {{ computedErrorMessage }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-file-input__helper\">{{ helper }}</div>\n </div>\n <PlFileDialog\n v-model=\"data.fileDialogOpen\"\n :close-on-outside-click=\"fileDialogCloseOnOutsideClick\"\n :extensions=\"extensions\"\n :title=\"fileDialogTitle\"\n @import:files=\"onImport\"\n />\n</template>\n"],"names":["data","reactive","slots","useSlots","emit","__emit","props","__props","tryValue","v","cb","err","fileName","computed","getFileNameFromHandle","filePath","getFilePathFromHandle","isUploading","isUploaded","computedErrorMessage","getErrorMessage","hasErrors","uploadStats","status","done","prettyBytes","progressStyle","progress","_a","openFileDialog","onImport","clear","watch","rootRef","ref","useLabelNotch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,UAAMA,IAAOC,EAAS;AAAA,MACpB,gBAAgB;AAAA,MAChB,OAAO;AAAA,IAAA,CACR,GAEKC,IAAQC,EAAA,GAERC,IAAOC,GAIPC,IAAQC,GAgERC,IAAW,CAA6BC,GAAkBC,MAAqC;AACnG,UAAKD;AAIL,YAAI;AACF,iBAAOC,EAAGD,CAAC;AAAA,QACb,SAASE,GAAK;AACZ,iBAAAX,EAAK,QAAQW,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG,GACrDF;AAAA,QACT;AAAA,IACF,GAEMG,IAAWC,EAAS,MAAML,EAASF,EAAM,YAAYQ,CAAqB,CAAC,GAE3EC,IAAWF,EAAS,MAAML,EAASF,EAAM,YAAYU,CAAqB,CAAC,GAE3EC,IAAcJ,EAAS,MAAMP,EAAM,YAAY,CAACA,EAAM,SAAS,IAAI,GAEnEY,IAAaL,EAAS,MAAMP,EAAM,YAAYA,EAAM,SAAS,IAAI,GAEjEa,IAAuBN,EAAS,MAAMO,EAAgBpB,EAAK,OAAOM,EAAM,KAAK,CAAC,GAE9Ee,IAAYR,EAAS,MAAM,OAAOM,EAAqB,SAAU,QAAQ,GAEzEG,IAAcT,EAAS,MAAM;AACjC,YAAM,EAAE,QAAAU,GAAQ,MAAAC,EAAA,IAASlB,EAAM,YAAY,CAAA;AAE3C,aAAI,CAACiB,KAAU,CAACA,EAAO,aACd,KAGLA,EAAO,kBAAkB,CAACC,IACrBC,EAAYF,EAAO,gBAAgB,CAAA,CAAE,IAAI,QAAQE,EAAYF,EAAO,YAAY,EAAE,IAGpFE,EAAYF,EAAO,YAAY,EAAE;AAAA,IAC1C,CAAC,GAEKG,IAAgBb,EAAS,MAAM;;AACnC,YAAM,EAAE,UAAAc,MAAarB;AAErB,aAAKqB,IAIE;AAAA,QACL,OAAOA,EAAS,OAAO,SAAS,KAAK,SAAOC,IAAAD,EAAS,WAAT,gBAAAC,EAAiB,aAAY,KAAK,GAAG,IAAI;AAAA,MAAA,IAJ9E,CAAA;AAAA,IAMX,CAAC,GAEKC,IAAiB,MAAM;AAC3B,MAAA7B,EAAK,iBAAiB;AAAA,IACxB,GAEM8B,IAAW,CAACrB,MAAqB;AACrC,MAAIA,EAAE,MAAM,UACVL,EAAK,qBAAqBK,EAAE,MAAM,CAAC,CAAC;AAAA,IAExC,GAEMsB,IAAQ,MAAM3B,EAAK,qBAAqB,MAAS;AAEvD,IAAA4B;AAAA,MACE,MAAM1B,EAAM;AAAA,MACZ,MAAON,EAAK,QAAQ;AAAA,MACpB,EAAE,WAAW,GAAA;AAAA,IAAK;AAGpB,UAAMiC,IAAUC,EAAA;AAEhB,WAAK5B,EAAM,aACT6B,EAAcF,CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(
|
|
2
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`.pl-log-view{--log-background: var(--bg-base-light);--contour-color: var(--txt-01);--contour-border-width: 1px;--label-offset-left-x: 8px;--label-offset-right-x: 8px;--border-color-log-view: var(--border-color-div-grey);height:100%;max-height:calc(100% - var(--contour-offset));max-width:calc(100% - var(--contour-offset));border-radius:6px;background:var(--log-background);display:flex;position:relative;min-height:44px;padding-right:40px}.pl-log-view__contour{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:var(--border-radius-control);border-width:var(--contour-border-width);border-color:var(--border-color-log-view);border-style:solid;box-shadow:none;z-index:0;pointer-events:none}.pl-log-view label{display:flex;align-items:center;gap:4px;position:absolute;top:0;transform:translateY(-60%);left:var(--label-offset-left-x);padding:0 4px;max-width:calc(100% - 16px);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit;color:var(--label-color);font-size:12px;font-weight:500;border-bottom-right-radius:4px;border-bottom-left-radius:4px;background:var(--bg-elevated-01)}.pl-log-view label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-log-view.has-error{--log-background: linear-gradient(90deg, #FFEBEB 0%, #FFFFFF 100%);--border-color-log-view: var(--border-color-error)}.pl-log-view__copy{position:absolute;top:12px;right:12px;cursor:pointer;--icon-color: var(--ic-02)}.pl-log-view__copy>*:hover{--icon-color: var(--txt-01)}.pl-log-view__content{margin:12px;max-height:100%;max-width:100%;flex:1;color:var(--txt-01);font-feature-settings:"ss11" on,"ss15" on,"ss17" on;font-family:var(--font-family-monospace);white-space:pre;font-size:14px;font-weight:400;line-height:20px;--thumb-color: var(--ic-02);overflow-y:auto;overflow-x:auto}.pl-log-view__content::-webkit-scrollbar{width:var(--scrollbar-width, 6px);height:5px;background-color:transparent;display:block}.pl-log-view__content::-webkit-scrollbar-thumb{background:var(--thumb-color);border-radius:5px}.pl-log-view__content::-webkit-scrollbar-thumb:hover{--thumb-color: var(--border-color-focus)}.pl-log-view__error{margin:12px;max-height:100%;max-width:100%;flex:1;color:var(--txt-01);font-feature-settings:"ss11" on,"ss15" on,"ss17" on;font-family:var(--font-family-monospace);white-space:pre;font-size:14px;font-weight:400;line-height:20px;--thumb-color: var(--ic-02);overflow-y:auto;overflow-x:auto}.pl-log-view__error::-webkit-scrollbar{width:var(--scrollbar-width, 6px);height:5px;background-color:transparent;display:block}.pl-log-view__error::-webkit-scrollbar-thumb{background:var(--thumb-color);border-radius:5px}.pl-log-view__error::-webkit-scrollbar-thumb:hover{--thumb-color: var(--border-color-focus)}
|
|
2
|
+
.double-contour.top>div{border-bottom-right-radius:0;border-bottom-left-radius:0}.double-contour.bottom>div{border-top-right-radius:0;border-top-left-radius:0}.double-contour.left>div{border-top-right-radius:0;border-bottom-right-radius:0}.double-contour.right>div{border-top-left-radius:0;border-bottom-left-radius:0}.double-contour.top-left>div{border-top-right-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.double-contour.top-right>div{border-bottom-right-radius:0;border-top-left-radius:0;border-top-right-radius:0}.double-contour.bottom-left>div{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0}.double-contour.bottom-right>div{border-top-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0}.double-contour.middle>div{border-radius:0}`)),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
3
|
+
import { defineComponent as F, useSlots as L, ref as s, computed as c, watch as P, createElementBlock as p, openBlock as l, normalizeClass as x, createCommentVNode as f, createVNode as u, createElementVNode as C, createBlock as b, toDisplayString as d, unref as r, withCtx as a, renderSlot as R, createTextVNode as S } from "vue";
|
|
3
4
|
import T from "../PlIcon24/PlIcon24.vue.js";
|
|
4
5
|
|
|
5
|
-
import { okOptional as
|
|
6
|
-
import { useLogHandle as
|
|
6
|
+
import { okOptional as $, tapIf as I } from "@milaboratories/helpers";
|
|
7
|
+
import { useLogHandle as O } from "./useLogHandle.js";
|
|
7
8
|
import { useLabelNotch as j } from "../../utils/useLabelNotch.js";
|
|
8
9
|
import q from "../../utils/DoubleContour.vue.js";
|
|
10
|
+
|
|
9
11
|
import v from "../PlTooltip/PlTooltip.vue.js";
|
|
10
12
|
import { downloadContent as z } from "../../helpers/downloadContent.js";
|
|
11
13
|
const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
@@ -13,7 +15,7 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
13
15
|
class: "pl-log-view__error"
|
|
14
16
|
}, K = {
|
|
15
17
|
name: "PlLogView"
|
|
16
|
-
},
|
|
18
|
+
}, ro = /* @__PURE__ */ F({
|
|
17
19
|
...K,
|
|
18
20
|
props: {
|
|
19
21
|
value: {},
|
|
@@ -33,12 +35,12 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
33
35
|
if (o && o.ok === !1)
|
|
34
36
|
return o.errors.join(`
|
|
35
37
|
`);
|
|
36
|
-
}, N = L(), t = h, y =
|
|
38
|
+
}, N = L(), t = h, y = O(t), _ = s(!0), g = s(), k = s(), m = c(() => {
|
|
37
39
|
var o;
|
|
38
40
|
return ((o = y.value) == null ? void 0 : o.error) ?? t.error ?? V(t.output);
|
|
39
41
|
}), n = c(() => {
|
|
40
42
|
var o;
|
|
41
|
-
return ((o = y.value) == null ? void 0 : o.lines) ?? t.value ??
|
|
43
|
+
return ((o = y.value) == null ? void 0 : o.lines) ?? t.value ?? $(t.output);
|
|
42
44
|
}), w = c(() => {
|
|
43
45
|
if (t.valueToCopy)
|
|
44
46
|
return t.valueToCopy;
|
|
@@ -46,17 +48,17 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
46
48
|
return n.value;
|
|
47
49
|
}), i = s(!1);
|
|
48
50
|
j(k);
|
|
49
|
-
const A = c(() => i.value ? "clipboard-copied" : "clipboard"),
|
|
51
|
+
const A = c(() => i.value ? "clipboard-copied" : "clipboard"), H = () => {
|
|
50
52
|
i.value = !0, setTimeout(() => {
|
|
51
53
|
i.value = !1;
|
|
52
54
|
}, 1200);
|
|
53
55
|
const o = w.value;
|
|
54
56
|
o !== void 0 && navigator.clipboard.writeText(o);
|
|
55
|
-
},
|
|
57
|
+
}, B = (o) => {
|
|
56
58
|
const e = w.value;
|
|
57
59
|
e !== void 0 && z([e, "text/plain"], o);
|
|
58
|
-
},
|
|
59
|
-
t.disableAutoScroll ||
|
|
60
|
+
}, D = () => {
|
|
61
|
+
t.disableAutoScroll || I(g.value, (o) => {
|
|
60
62
|
_.value && o.scrollTo(o.scrollLeft, o.scrollHeight);
|
|
61
63
|
});
|
|
62
64
|
};
|
|
@@ -64,7 +66,7 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
64
66
|
n,
|
|
65
67
|
() => {
|
|
66
68
|
requestAnimationFrame(() => {
|
|
67
|
-
|
|
69
|
+
D();
|
|
68
70
|
});
|
|
69
71
|
},
|
|
70
72
|
{ immediate: !0 }
|
|
@@ -73,12 +75,12 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
73
75
|
const e = o.target;
|
|
74
76
|
_.value = e.scrollTop + 20 >= e.scrollHeight - e.offsetHeight;
|
|
75
77
|
};
|
|
76
|
-
return (o, e) => (l(),
|
|
78
|
+
return (o, e) => (l(), p("div", {
|
|
77
79
|
ref_key: "root",
|
|
78
80
|
ref: k,
|
|
79
81
|
class: x(["pl-log-view", { "has-error": m.value }])
|
|
80
82
|
}, [
|
|
81
|
-
o.label ? (l(),
|
|
83
|
+
o.label ? (l(), p("label", M, [
|
|
82
84
|
C("span", null, d(o.label), 1),
|
|
83
85
|
r(N).tooltip ? (l(), b(r(v), {
|
|
84
86
|
key: 0,
|
|
@@ -91,9 +93,9 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
91
93
|
_: 3
|
|
92
94
|
})) : f("", !0)
|
|
93
95
|
])) : f("", !0),
|
|
94
|
-
|
|
96
|
+
u(q, { class: "pl-log-view__contour" }),
|
|
95
97
|
C("div", G, [
|
|
96
|
-
|
|
98
|
+
u(r(v), {
|
|
97
99
|
"close-delay": 800,
|
|
98
100
|
position: "top"
|
|
99
101
|
}, {
|
|
@@ -101,10 +103,10 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
101
103
|
S(d(i.value ? "copied" : "copy"), 1)
|
|
102
104
|
]),
|
|
103
105
|
default: a(() => [
|
|
104
|
-
|
|
106
|
+
u(r(T), {
|
|
105
107
|
title: "Copy content",
|
|
106
108
|
name: A.value,
|
|
107
|
-
onClick:
|
|
109
|
+
onClick: H
|
|
108
110
|
}, null, 8, ["name"])
|
|
109
111
|
]),
|
|
110
112
|
_: 1
|
|
@@ -118,15 +120,15 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
118
120
|
S("download")
|
|
119
121
|
])),
|
|
120
122
|
default: a(() => [
|
|
121
|
-
|
|
123
|
+
u(r(T), {
|
|
122
124
|
name: "download",
|
|
123
|
-
onClick: e[0] || (e[0] = () =>
|
|
125
|
+
onClick: e[0] || (e[0] = () => B(o.downloadFilename))
|
|
124
126
|
})
|
|
125
127
|
]),
|
|
126
128
|
_: 1
|
|
127
129
|
})) : f("", !0)
|
|
128
130
|
]),
|
|
129
|
-
m.value ? (l(),
|
|
131
|
+
m.value ? (l(), p("div", J, d(m.value), 1)) : (l(), p("div", {
|
|
130
132
|
key: 2,
|
|
131
133
|
ref_key: "contentRef",
|
|
132
134
|
ref: g,
|
|
@@ -137,6 +139,6 @@ const M = { key: 0 }, G = { class: "pl-log-view__copy" }, J = {
|
|
|
137
139
|
}
|
|
138
140
|
});
|
|
139
141
|
export {
|
|
140
|
-
|
|
142
|
+
ro as default
|
|
141
143
|
};
|
|
142
144
|
//# sourceMappingURL=PlLogView.vue.js.map
|