@milaboratories/uikit 2.6.2 → 2.6.4
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 +129 -129
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/base/BtnBase.vue.js +18 -18
- package/dist/base/BtnBase.vue.js.map +1 -1
- package/dist/components/ContextProvider.vue.js.map +1 -1
- package/dist/components/DataTable/BaseCellComponent.vue.js +20 -20
- package/dist/components/DataTable/BaseCellComponent.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnCaret.vue.js +6 -6
- package/dist/components/DataTable/ColumnCaret.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/RowsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/TScroll.vue.js +12 -12
- package/dist/components/DataTable/TScroll.vue.js.map +1 -1
- package/dist/components/DataTable/TableComponent.vue.js +1 -1
- package/dist/components/DataTable/TableComponent.vue.js.map +1 -1
- package/dist/components/DataTable/TdCell.vue.js +36 -36
- package/dist/components/DataTable/TdCell.vue.js.map +1 -1
- package/dist/components/DataTable/ThCell.vue.js +27 -27
- package/dist/components/DataTable/ThCell.vue.js.map +1 -1
- package/dist/components/DataTable/TrBody.vue.js +12 -12
- package/dist/components/DataTable/TrBody.vue.js.map +1 -1
- package/dist/components/DataTable/TrHead.vue.js.map +1 -1
- package/dist/components/DataTable/assets/TableIcon.vue.js +2 -2
- package/dist/components/DataTable/assets/TableIcon.vue.js.map +1 -1
- package/dist/components/DropdownListItem.vue.js +18 -18
- package/dist/components/DropdownListItem.vue.js.map +1 -1
- package/dist/components/HScroll.vue.js.map +1 -1
- package/dist/components/InputRange.vue.js.map +1 -1
- package/dist/components/LongText.vue.js +1 -1
- package/dist/components/LongText.vue.js.map +1 -1
- package/dist/components/LongText.vue3.js +1 -1
- package/dist/components/PlAccordion/{ExpandTransition.vue2.js → ExpandTransition.vue.js} +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +1 -0
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +1 -1
- package/dist/components/PlAccordion/PlAccordion.vue.js.map +1 -1
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +21 -21
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js.map +1 -1
- package/dist/components/PlAlert/PlAlert.vue.js +23 -23
- package/dist/components/PlAlert/PlAlert.vue.js.map +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +86 -86
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +83 -83
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js.map +1 -1
- package/dist/components/PlBtnAccent/PlBtnAccent.vue.js.map +1 -1
- package/dist/components/PlBtnDanger/PlBtnDanger.vue.js.map +1 -1
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js +21 -21
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js.map +1 -1
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js +34 -34
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js.map +1 -1
- package/dist/components/PlBtnLink/PlBtnLink.vue.js +12 -12
- package/dist/components/PlBtnLink/PlBtnLink.vue.js.map +1 -1
- package/dist/components/PlBtnPrimary/PlBtnPrimary.vue.js.map +1 -1
- package/dist/components/PlBtnSecondary/PlBtnSecondary.vue.js.map +1 -1
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js +31 -31
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js.map +1 -1
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js +18 -18
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/Legends.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js +15 -15
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBarCompact.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRow.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRowCompact.vue2.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckbox.vue.js +13 -13
- package/dist/components/PlCheckbox/PlCheckbox.vue.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js +6 -6
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js.map +1 -1
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js +28 -28
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js.map +1 -1
- package/dist/components/PlChip/PlChip.vue.js +20 -20
- package/dist/components/PlChip/PlChip.vue.js.map +1 -1
- package/dist/components/PlClipboard/PlClipboard.vue2.js.map +1 -1
- package/dist/components/PlConfirmDialog.vue.js +14 -14
- package/dist/components/PlConfirmDialog.vue.js.map +1 -1
- package/dist/components/PlDialogModal/PlDialogModal.vue.js +30 -30
- package/dist/components/PlDialogModal/PlDialogModal.vue.js.map +1 -1
- package/dist/components/PlDropdown/OptionList.vue.js +40 -40
- package/dist/components/PlDropdown/OptionList.vue.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.js +89 -89
- package/dist/components/PlDropdown/PlDropdown.vue.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +92 -92
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.d.ts +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js +4 -4
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/ResizableInput.vue.js +12 -12
- package/dist/components/PlDropdownLine/ResizableInput.vue.js.map +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +70 -70
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js.map +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.d.ts +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.js.map +1 -1
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js +11 -11
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js.map +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.d.ts +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js +36 -36
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js.map +1 -1
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue2.js +67 -67
- package/dist/components/PlElementList/PlElementListItem.vue2.js.map +1 -1
- package/dist/components/PlErrorAlert/PlErrorAlert.vue2.js.map +1 -1
- package/dist/components/PlErrorBoundary/PlErrorBoundary.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Local.vue.js +24 -24
- package/dist/components/PlFileDialog/Local.vue.js.map +1 -1
- package/dist/components/PlFileDialog/PlFileDialog.vue.js +38 -38
- package/dist/components/PlFileDialog/PlFileDialog.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Remote.vue.js +2 -2
- package/dist/components/PlFileDialog/Remote.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Shortcuts.vue2.js +4 -4
- package/dist/components/PlFileDialog/Shortcuts.vue2.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.d.ts +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +75 -75
- package/dist/components/PlFileInput/PlFileInput.vue.js.map +1 -1
- package/dist/components/PlIcon16/PlIcon16.vue2.js.map +1 -1
- package/dist/components/PlIcon24/PlIcon24.vue2.js.map +1 -1
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js +11 -11
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js.map +1 -1
- package/dist/components/PlLogView/PlLogView.vue.js +58 -58
- package/dist/components/PlLogView/PlLogView.vue.js.map +1 -1
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js +22 -22
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js.map +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.d.ts +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.js +75 -75
- package/dist/components/PlNumberField/PlNumberField.vue.js.map +1 -1
- package/dist/components/PlProgressBar/PlProgressBar.vue.js +12 -12
- package/dist/components/PlProgressBar/PlProgressBar.vue.js.map +1 -1
- package/dist/components/PlProgressCell/PlProgressCell.vue.js +20 -20
- package/dist/components/PlProgressCell/PlProgressCell.vue.js.map +1 -1
- package/dist/components/PlRadio/PlRadio.vue2.js.map +1 -1
- package/dist/components/PlRadio/PlRadioGroup.vue2.js +8 -8
- package/dist/components/PlRadio/PlRadioGroup.vue2.js.map +1 -1
- package/dist/components/PlSearchField/PlSearchField.vue2.js +19 -19
- package/dist/components/PlSearchField/PlSearchField.vue2.js.map +1 -1
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js +8 -8
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarGroup.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarItem.vue2.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlSlideModal.vue2.js.map +1 -1
- package/dist/components/PlSplash/PlSplash.vue.js +16 -16
- package/dist/components/PlSplash/PlSplash.vue.js.map +1 -1
- package/dist/components/PlStatusTag/PlStatusTag.vue.js +7 -7
- package/dist/components/PlStatusTag/PlStatusTag.vue.js.map +1 -1
- package/dist/components/PlSvg/PlSvg.vue2.js.map +1 -1
- package/dist/components/PlTabs/PlTabs.vue.js +18 -18
- package/dist/components/PlTabs/PlTabs.vue.js.map +1 -1
- package/dist/components/PlTabs/Tab.vue.js +9 -9
- package/dist/components/PlTabs/Tab.vue.js.map +1 -1
- package/dist/components/PlTextArea/PlTextArea.vue.js +51 -51
- package/dist/components/PlTextArea/PlTextArea.vue.js.map +1 -1
- package/dist/components/PlTextField/PlTextField.vue.js +62 -62
- package/dist/components/PlTextField/PlTextField.vue.js.map +1 -1
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js +14 -14
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js.map +1 -1
- package/dist/components/PlTooltip/Beak.vue.js +2 -2
- package/dist/components/PlTooltip/Beak.vue.js.map +1 -1
- package/dist/components/PlTooltip/PlTooltip.vue.js +50 -50
- package/dist/components/PlTooltip/PlTooltip.vue.js.map +1 -1
- package/dist/components/Scrollable.vue.js.map +1 -1
- package/dist/components/Slider.vue.js +35 -35
- package/dist/components/Slider.vue.js.map +1 -1
- package/dist/components/SliderRange.vue.js +47 -47
- package/dist/components/SliderRange.vue.js.map +1 -1
- package/dist/components/SliderRangeTriple.vue.js +47 -47
- package/dist/components/SliderRangeTriple.vue.js.map +1 -1
- package/dist/components/TabItem.vue.js.map +1 -1
- package/dist/components/ThemeSwitcher.vue.js +2 -2
- package/dist/components/ThemeSwitcher.vue.js.map +1 -1
- package/dist/components/TransitionSlidePanel.vue.js.map +1 -1
- package/dist/components/VScroll.vue.js.map +1 -1
- package/dist/components/contextMenu/Menu.vue2.js +12 -12
- package/dist/components/contextMenu/Menu.vue2.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js +27 -27
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js.map +1 -1
- package/dist/layout/PlContainer/PlContainer.vue.js +10 -10
- package/dist/layout/PlContainer/PlContainer.vue.js.map +1 -1
- package/dist/layout/PlGrid/PlGrid.vue.js.map +1 -1
- package/dist/layout/PlRow/PlRow.vue.js +8 -8
- package/dist/layout/PlRow/PlRow.vue.js.map +1 -1
- package/dist/layout/PlSpacer/PlSpacer.vue.js.map +1 -1
- package/dist/utils/DoubleContour.vue.js +9 -9
- package/dist/utils/DoubleContour.vue.js.map +1 -1
- package/dist/utils/DropdownOverlay/DropdownOverlay.vue.js.map +1 -1
- package/dist/utils/PlCloseModalBtn.vue.js +2 -2
- package/dist/utils/PlCloseModalBtn.vue.js.map +1 -1
- package/dist/utils/TextLabel.vue.js.map +1 -1
- package/package.json +5 -5
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +0 -1
- package/dist/utils/DoubleContour.vue2.js +0 -23
- package/dist/utils/DoubleContour.vue2.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(`.ui-text-area{--contour-color: var(--txt-01);--label-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);width:100%;min-height:var(--control-height);position:relative;border-radius:var(--border-radius-control);display:flex;flex-direction:row;align-items:center;outline:none}.ui-text-area__envelope{font-family:var(--font-family-base)}.ui-text-area textarea{min-height:calc(var(--control-height) - 2px);width:100%;padding:10px 12px;border:none;font-size:inherit;background-color:transparent;color:var(--txt-01);caret-color:var(--border-color-focus);cursor:inherit;resize:none;--thumb-color: var(--ic-02);overflow-y:auto}.ui-text-area textarea::-webkit-scrollbar{width:var(--scrollbar-width, 6px);height:5px;background-color:transparent;display:block}.ui-text-area textarea::-webkit-scrollbar-thumb{background:var(--thumb-color);border-radius:5px}.ui-text-area textarea::-webkit-scrollbar-thumb:hover{--thumb-color: var(--border-color-focus)}.ui-text-area textarea:focus{outline:none}.ui-text-area textarea::placeholder{color:var(--color-placeholder)}.ui-text-area 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)}.ui-text-area label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.ui-text-area__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}.ui-text-area__append{display:flex;flex-direction:row;align-items:center;gap:4px}.ui-text-area__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}.ui-text-area__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}.ui-text-area:hover{--contour-color: var(--control-hover-color)}.ui-text-area: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)}.ui-text-area:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.ui-text-area.dashed .ui-text-area__contour{border-style:dashed}.ui-text-area.nonEmpty{--prefix-color: var(--txt-01)}.ui-text-area.error{--contour-color: var(--txt-error)}.ui-text-area.disabled{--contour-color: var(--color-dis-01);cursor:not-allowed;pointer-events:none}.ui-text-area.disabled *{color:var(--contour-color)}
|
|
2
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(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
3
|
-
import { defineComponent as
|
|
3
|
+
import { defineComponent as E, useSlots as S, ref as v, computed as a, onMounted as $, createElementBlock as s, openBlock as o, createElementVNode as n, createCommentVNode as i, normalizeClass as C, withDirectives as N, createVNode as q, createBlock as g, unref as d, toDisplayString as c, withCtx as D, renderSlot as b, vModelText as M } from "vue";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import j from "../PlTooltip/PlTooltip.vue.js";
|
|
6
|
+
import H from "../../utils/DoubleContour.vue.js";
|
|
7
7
|
|
|
8
|
-
import { useLabelNotch as
|
|
9
|
-
import { useValidation as
|
|
10
|
-
import { getErrorMessage as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
const
|
|
8
|
+
import { useLabelNotch as P } from "../../utils/useLabelNotch.js";
|
|
9
|
+
import { useValidation as T } from "../../utils/useValidation.js";
|
|
10
|
+
import { getErrorMessage as z } from "../../helpers/error.js";
|
|
11
|
+
import A from "../PlSvg/PlSvg.vue.js";
|
|
12
|
+
import I from "../../assets/images/required.svg.js";
|
|
13
|
+
const L = { class: "ui-text-area__envelope" }, R = {
|
|
14
14
|
key: 0,
|
|
15
15
|
ref: "label"
|
|
16
|
-
},
|
|
16
|
+
}, U = ["readonly", "rows", "disabled", "placeholder"], F = { class: "ui-text-area__append" }, G = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "ui-text-area__error"
|
|
19
19
|
}, J = {
|
|
@@ -21,7 +21,7 @@ const R = { class: "ui-text-area__envelope" }, U = {
|
|
|
21
21
|
class: "ui-text-area__helper"
|
|
22
22
|
}, K = {
|
|
23
23
|
name: "PlTextArea"
|
|
24
|
-
}, le = /* @__PURE__ */
|
|
24
|
+
}, le = /* @__PURE__ */ E({
|
|
25
25
|
...K,
|
|
26
26
|
props: {
|
|
27
27
|
modelValue: {},
|
|
@@ -38,69 +38,69 @@ const R = { class: "ui-text-area__envelope" }, U = {
|
|
|
38
38
|
rules: {}
|
|
39
39
|
},
|
|
40
40
|
emits: ["update:modelValue"],
|
|
41
|
-
setup(
|
|
42
|
-
const
|
|
41
|
+
setup(t, { emit: k }) {
|
|
42
|
+
const x = S(), _ = k, r = t, m = v(), p = v(), u = a({
|
|
43
43
|
get() {
|
|
44
44
|
return r.modelValue ?? "";
|
|
45
45
|
},
|
|
46
46
|
set(e) {
|
|
47
|
-
|
|
47
|
+
_("update:modelValue", e);
|
|
48
48
|
}
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
const e = [],
|
|
53
|
-
return
|
|
54
|
-
}),
|
|
49
|
+
}), V = a(() => !!r.modelValue), w = T(u, r.rules || []);
|
|
50
|
+
P(m);
|
|
51
|
+
const h = a(() => {
|
|
52
|
+
const e = [], l = z(r.error);
|
|
53
|
+
return l && e.push(l), e.push(...w.value.errors), e;
|
|
54
|
+
}), f = a(() => h.value.length > 0), y = () => {
|
|
55
55
|
if (!r.autogrow)
|
|
56
56
|
return;
|
|
57
|
-
const e =
|
|
57
|
+
const e = p.value;
|
|
58
58
|
e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
|
|
59
59
|
};
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
}), (e,
|
|
63
|
-
|
|
60
|
+
return $(() => {
|
|
61
|
+
y();
|
|
62
|
+
}), (e, l) => (o(), s("div", L, [
|
|
63
|
+
n("div", {
|
|
64
64
|
ref_key: "root",
|
|
65
|
-
ref:
|
|
66
|
-
class:
|
|
65
|
+
ref: m,
|
|
66
|
+
class: C(["ui-text-area", { error: f.value, disabled: t.disabled, dashed: t.dashed, nonEmpty: V.value }])
|
|
67
67
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
t.label ? (o(), s("label", R, [
|
|
69
|
+
t.required ? (o(), g(d(A), {
|
|
70
70
|
key: 0,
|
|
71
|
-
uri:
|
|
72
|
-
}, null, 8, ["uri"])) :
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
uri: d(I)
|
|
72
|
+
}, null, 8, ["uri"])) : i("", !0),
|
|
73
|
+
n("span", null, c(t.label), 1),
|
|
74
|
+
d(x).tooltip ? (o(), g(d(j), {
|
|
75
75
|
key: 1,
|
|
76
76
|
class: "info",
|
|
77
77
|
position: "top"
|
|
78
78
|
}, {
|
|
79
|
-
tooltip:
|
|
80
|
-
|
|
79
|
+
tooltip: D(() => [
|
|
80
|
+
b(e.$slots, "tooltip")
|
|
81
81
|
]),
|
|
82
82
|
_: 3
|
|
83
|
-
})) :
|
|
84
|
-
], 512)) :
|
|
85
|
-
|
|
83
|
+
})) : i("", !0)
|
|
84
|
+
], 512)) : i("", !0),
|
|
85
|
+
N(n("textarea", {
|
|
86
86
|
ref_key: "input",
|
|
87
|
-
ref:
|
|
88
|
-
"onUpdate:modelValue":
|
|
89
|
-
readonly:
|
|
90
|
-
rows:
|
|
91
|
-
disabled:
|
|
92
|
-
placeholder:
|
|
87
|
+
ref: p,
|
|
88
|
+
"onUpdate:modelValue": l[0] || (l[0] = (B) => u.value = B),
|
|
89
|
+
readonly: t.readonly,
|
|
90
|
+
rows: t.rows,
|
|
91
|
+
disabled: t.disabled,
|
|
92
|
+
placeholder: t.placeholder ?? "...",
|
|
93
93
|
spellcheck: "false",
|
|
94
|
-
onInput:
|
|
95
|
-
}, null, 40,
|
|
96
|
-
[
|
|
94
|
+
onInput: y
|
|
95
|
+
}, null, 40, U), [
|
|
96
|
+
[M, u.value]
|
|
97
97
|
]),
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
n("div", F, [
|
|
99
|
+
b(e.$slots, "append")
|
|
100
100
|
]),
|
|
101
|
-
|
|
101
|
+
q(H, { class: "ui-text-area__contour" })
|
|
102
102
|
], 2),
|
|
103
|
-
|
|
103
|
+
f.value ? (o(), s("div", G, c(h.value.join(" ")), 1)) : t.helper ? (o(), s("div", J, c(t.helper), 1)) : i("", !0)
|
|
104
104
|
]));
|
|
105
105
|
}
|
|
106
106
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTextArea.vue.js","sources":["../../../src/components/PlTextArea/PlTextArea.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Component for multi-line string data manipulation */\nexport default {\n name: 'PlTextArea',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-textarea.scss';\nimport { computed, onMounted, ref, useSlots } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport { PlSvg } from '../PlSvg';\nimport SvgRequired from '../../assets/images/required.svg?raw';\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: string): void;\n}>();\n\nconst props = defineProps<{\n /**\n * The current value of the texarea.\n */\n modelValue?: string;\n /**\n * The label to display above the texarea.\n */\n label?: string;\n /**\n * If `true`, the textarea is marked as required.\n */\n required?: boolean;\n /**\n * An error message to display below the textarea.\n */\n error?: unknown;\n /**\n * A helper text to display below the textarea when there are no errors.\n */\n helper?: string;\n /**\n * A placeholder text to display inside the textarea when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the textarea is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the textarea is in a read-only state and cannot be edited, but it can still be focused and text can be selected.\n */\n readonly?: boolean;\n /**\n * If `true`, applies a dashed border style to the textarea, likely used for stylistic purposes or to indicate a certain state.\n */\n dashed?: boolean;\n /**\n * The number of visible text lines for the textarea, which controls the height of the textarea.\n */\n rows?: number;\n /**\n * If `true`, the textarea automatically adjusts its height to fit the content as the user types.\n */\n autogrow?: boolean;\n /**\n * An array of validation rules that are applied to the textarea input. Each rule is a function that receives the input value and returns `true` for valid input or an error message string for invalid input.\n */\n rules?: ((v: string) => boolean | string)[];\n}>();\n\nconst root = ref<HTMLInputElement>();\nconst input = ref<HTMLTextAreaElement>();\n\nconst value = computed({\n get() {\n return props.modelValue ?? '';\n },\n set(v) {\n emit('update:modelValue', v);\n },\n});\n\nconst nonEmpty = computed(() => !!props.modelValue);\nconst validationData = useValidation(value, props.rules || []);\n\nuseLabelNotch(root);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n\n if (propsError) {\n errors.push(propsError);\n }\n\n errors.push(...validationData.value.errors);\n\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst adjustHeight = () => {\n if (!props.autogrow) {\n return;\n }\n const el = input.value;\n if (el) {\n el.style.height = 'auto'; // it works, do not delete it\n el.style.height = `${el.scrollHeight}px`; // Set height based on scrollHeight\n }\n};\n\nonMounted(() => {\n adjustHeight();\n});\n</script>\n\n<template>\n <div class=\"ui-text-area__envelope\">\n <div ref=\"root\" class=\"ui-text-area\" :class=\"{ error: hasErrors, disabled, dashed, nonEmpty }\">\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <textarea\n ref=\"input\"\n v-model=\"value\"\n :readonly=\"readonly\"\n :rows=\"rows\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder ?? '...'\"\n spellcheck=\"false\"\n @input=\"adjustHeight\"\n />\n <div class=\"ui-text-area__append\">\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"ui-text-area__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"ui-text-area__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"ui-text-area__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","emit","__emit","props","__props","root","ref","input","value","computed","v","nonEmpty","validationData","useValidation","useLabelNotch","displayErrors","errors","propsError","getErrorMessage","hasErrors","adjustHeight","el","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;GAEAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;AAcA,UAAMC,IAAQC,EAAA,GAERC,IAAOC,GAOPC,IAAQC,GAmDRC,IAAOC,EAAA,GACPC,IAAQD,EAAA,GAERE,IAAQC,EAAS;AAAA,MACrB,MAAM;AACJ,eAAON,EAAM,cAAc;AAAA,MAC7B;AAAA,MACA,IAAIO,GAAG;AACL,QAAAT,EAAK,qBAAqBS,CAAC;AAAA,MAC7B;AAAA,IAAA,CACD,GAEKC,IAAWF,EAAS,MAAM,CAAC,CAACN,EAAM,UAAU,GAC5CS,IAAiBC,EAAcL,GAAOL,EAAM,SAAS,CAAA,CAAE;AAE7D,IAAAW,EAAcT,CAAI;AAElB,UAAMU,IAAgBN,EAAS,MAAM;AACnC,YAAMO,IAAmB,CAAA,GACnBC,IAAaC,EAAgBf,EAAM,KAAK;AAE9C,aAAIc,KACFD,EAAO,KAAKC,CAAU,GAGxBD,EAAO,KAAK,GAAGJ,EAAe,MAAM,MAAM,GAEnCI;AAAA,IACT,CAAC,GAEKG,IAAYV,EAAS,MAAMM,EAAc,MAAM,SAAS,CAAC,GAEzDK,IAAe,MAAM;AACzB,UAAI,CAACjB,EAAM;AACT;AAEF,YAAMkB,IAAKd,EAAM;AACjB,MAAIc,MACFA,EAAG,MAAM,SAAS,QAClBA,EAAG,MAAM,SAAS,GAAGA,EAAG,YAAY;AAAA,IAExC;AAEA,WAAAC,EAAU,MAAM;AACd,MAAAF,EAAA;AAAA,IACF,CAAC
|
|
1
|
+
{"version":3,"file":"PlTextArea.vue.js","sources":["../../../src/components/PlTextArea/PlTextArea.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Component for multi-line string data manipulation */\nexport default {\n name: 'PlTextArea',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-textarea.scss';\nimport { computed, onMounted, ref, useSlots } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport { PlSvg } from '../PlSvg';\nimport SvgRequired from '../../assets/images/required.svg?raw';\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: string): void;\n}>();\n\nconst props = defineProps<{\n /**\n * The current value of the texarea.\n */\n modelValue?: string;\n /**\n * The label to display above the texarea.\n */\n label?: string;\n /**\n * If `true`, the textarea is marked as required.\n */\n required?: boolean;\n /**\n * An error message to display below the textarea.\n */\n error?: unknown;\n /**\n * A helper text to display below the textarea when there are no errors.\n */\n helper?: string;\n /**\n * A placeholder text to display inside the textarea when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the textarea is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the textarea is in a read-only state and cannot be edited, but it can still be focused and text can be selected.\n */\n readonly?: boolean;\n /**\n * If `true`, applies a dashed border style to the textarea, likely used for stylistic purposes or to indicate a certain state.\n */\n dashed?: boolean;\n /**\n * The number of visible text lines for the textarea, which controls the height of the textarea.\n */\n rows?: number;\n /**\n * If `true`, the textarea automatically adjusts its height to fit the content as the user types.\n */\n autogrow?: boolean;\n /**\n * An array of validation rules that are applied to the textarea input. Each rule is a function that receives the input value and returns `true` for valid input or an error message string for invalid input.\n */\n rules?: ((v: string) => boolean | string)[];\n}>();\n\nconst root = ref<HTMLInputElement>();\nconst input = ref<HTMLTextAreaElement>();\n\nconst value = computed({\n get() {\n return props.modelValue ?? '';\n },\n set(v) {\n emit('update:modelValue', v);\n },\n});\n\nconst nonEmpty = computed(() => !!props.modelValue);\nconst validationData = useValidation(value, props.rules || []);\n\nuseLabelNotch(root);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n\n if (propsError) {\n errors.push(propsError);\n }\n\n errors.push(...validationData.value.errors);\n\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst adjustHeight = () => {\n if (!props.autogrow) {\n return;\n }\n const el = input.value;\n if (el) {\n el.style.height = 'auto'; // it works, do not delete it\n el.style.height = `${el.scrollHeight}px`; // Set height based on scrollHeight\n }\n};\n\nonMounted(() => {\n adjustHeight();\n});\n</script>\n\n<template>\n <div class=\"ui-text-area__envelope\">\n <div ref=\"root\" class=\"ui-text-area\" :class=\"{ error: hasErrors, disabled, dashed, nonEmpty }\">\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <textarea\n ref=\"input\"\n v-model=\"value\"\n :readonly=\"readonly\"\n :rows=\"rows\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder ?? '...'\"\n spellcheck=\"false\"\n @input=\"adjustHeight\"\n />\n <div class=\"ui-text-area__append\">\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"ui-text-area__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"ui-text-area__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"ui-text-area__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","emit","__emit","props","__props","root","ref","input","value","computed","v","nonEmpty","validationData","useValidation","useLabelNotch","displayErrors","errors","propsError","getErrorMessage","hasErrors","adjustHeight","el","onMounted","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_normalizeClass","_hoisted_2","_createBlock","_unref","PlSvg","SvgRequired","PlTooltip","_renderSlot","_ctx","$event","_hoisted_4","_createVNode","DoubleContour","_hoisted_5","_toDisplayString","_hoisted_6"],"mappings":";;;;;;;;;;;;;;;;;;;GAEAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;AAcA,UAAMC,IAAQC,EAAA,GAERC,IAAOC,GAOPC,IAAQC,GAmDRC,IAAOC,EAAA,GACPC,IAAQD,EAAA,GAERE,IAAQC,EAAS;AAAA,MACrB,MAAM;AACJ,eAAON,EAAM,cAAc;AAAA,MAC7B;AAAA,MACA,IAAIO,GAAG;AACL,QAAAT,EAAK,qBAAqBS,CAAC;AAAA,MAC7B;AAAA,IAAA,CACD,GAEKC,IAAWF,EAAS,MAAM,CAAC,CAACN,EAAM,UAAU,GAC5CS,IAAiBC,EAAcL,GAAOL,EAAM,SAAS,CAAA,CAAE;AAE7D,IAAAW,EAAcT,CAAI;AAElB,UAAMU,IAAgBN,EAAS,MAAM;AACnC,YAAMO,IAAmB,CAAA,GACnBC,IAAaC,EAAgBf,EAAM,KAAK;AAE9C,aAAIc,KACFD,EAAO,KAAKC,CAAU,GAGxBD,EAAO,KAAK,GAAGJ,EAAe,MAAM,MAAM,GAEnCI;AAAA,IACT,CAAC,GAEKG,IAAYV,EAAS,MAAMM,EAAc,MAAM,SAAS,CAAC,GAEzDK,IAAe,MAAM;AACzB,UAAI,CAACjB,EAAM;AACT;AAEF,YAAMkB,IAAKd,EAAM;AACjB,MAAIc,MACFA,EAAG,MAAM,SAAS,QAClBA,EAAG,MAAM,SAAS,GAAGA,EAAG,YAAY;AAAA,IAExC;AAEA,WAAAC,EAAU,MAAM;AACd,MAAAF,EAAA;AAAA,IACF,CAAC,cAICG,EAAA,GAAAC,EA8BM,OA9BNC,GA8BM;AAAA,MA7BJC,EAwBM,OAAA;AAAA,iBAxBG;AAAA,QAAJ,KAAIrB;AAAA,QAAO,OAAKsB,EAAA,CAAC,gBAAc,EAAA,OAAkBR,EAAA,iBAAWf,EAAA,UAAQ,QAAEA,EAAA,QAAM,UAAEO,EAAA,OAAQ,CAAA;AAAA,MAAA;QAC5EP,EAAA,SAAbmB,EAAA,GAAAC,EAQQ,SARRI,GAQQ;AAAA,UAPOxB,EAAA,iBAAbyB,EAA4CC,EAAAC,CAAA,GAAA;AAAA;YAApB,KAAKD,EAAAE,CAAA;AAAA,UAAA;UAC7BN,EAAwB,gBAAftB,EAAA,KAAK,GAAA,CAAA;AAAA,UACG0B,EAAA/B,CAAA,EAAM,gBAAvB8B,EAIYC,EAAAG,CAAA,GAAA;AAAA;YAJoB,OAAM;AAAA,YAAO,UAAS;AAAA,UAAA;YACzC,WACT,MAAuB;AAAA,cAAvBC,EAAuBC,EAAA,QAAA,SAAA;AAAA,YAAA;;;;UAI7BT,EASE,YAAA;AAAA,mBARI;AAAA,UAAJ,KAAInB;AAAA,wDACKC,EAAK,QAAA4B;AAAA,UACb,UAAUhC,EAAA;AAAA,UACV,MAAMA,EAAA;AAAA,UACN,UAAUA,EAAA;AAAA,UACV,aAAaA,EAAA,eAAW;AAAA,UACzB,YAAW;AAAA,UACV,SAAOgB;AAAA,QAAA;cANCZ,EAAA,KAAK;AAAA,QAAA;QAQhBkB,EAEM,OAFNW,GAEM;AAAA,UADJH,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;QAExBG,EAA+CC,GAAA,EAAhC,OAAM,yBAAuB;AAAA,MAAA;MAEnCpB,EAAA,SAAXI,KAAAC,EAEM,OAFNgB,GAEMC,EADD1B,EAAA,MAAc,KAAI,GAAA,CAAA,GAAA,CAAA,KAEPX,EAAA,eAAhBoB,EAAuE,OAAvEkB,GAAuED,EAAfrC,EAAA,MAAM,GAAA,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`.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}
|
|
2
2
|
.pl-text-field{--pl-text-field-text-color: var(--txt-01);--contour-color: var(--txt-01);--label-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);--show-clearable: none;width:100%;min-width:160px;min-height:var(--control-height);position:relative;border-radius:var(--border-radius-control);display:flex;flex-direction:row;align-items:center;outline:none}.pl-text-field__envelope{font-family:var(--font-family-base)}.pl-text-field input{font-family:var(--font-family-base);font-weight:500;min-height:calc(var(--control-height) - 2px);line-height:20px;width:100%;padding:0 12px;border:none;font-size:inherit;background-color:transparent;color:var(--pl-text-field-text-color);caret-color:var(--border-color-focus);cursor:inherit}.pl-text-field input:focus{outline:none}.pl-text-field input::placeholder{color:var(--color-placeholder)}.pl-text-field 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-text-field label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-text-field__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-text-field__prefix{padding-left:12px;white-space:nowrap;margin-right:-12px;color:var(--prefix-color)}.pl-text-field__append{padding-right:12px;display:flex;flex-direction:row;align-items:center;gap:4px;cursor:text}.pl-text-field__append .icon-16{cursor:pointer}.pl-text-field__append .mask-16{--icon-color: var(--control-mask-fill);cursor:pointer}.pl-text-field__clearable{display:var(--show-clearable)!important;--icon-color: var(--ic-02) !important}.pl-text-field__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-text-field__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-text-field:hover{--contour-color: var(--control-hover-color);--show-clearable: inline-block}.pl-text-field:focus-within{--show-clearable: inline-block}.pl-text-field: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-text-field:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.pl-text-field.dashed .pl-text-field__contour{border-style:dashed}.pl-text-field.nonEmpty{--prefix-color: var(--txt-01)}.pl-text-field.error{--contour-color: var(--txt-error);--label-color: var(--txt-error)}.pl-text-field.disabled{--contour-color: var(--color-dis-01);--label-color: var(--dis-01);--pl-text-field-text-color: var(--dis-01);--mask-icon-bg-color: var(--dis-01);cursor:not-allowed}`)),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
3
|
-
import { defineComponent as
|
|
3
|
+
import { defineComponent as I, mergeModels as N, useSlots as $, useModel as O, ref as h, reactive as T, computed as i, createElementBlock as d, openBlock as a, createElementVNode as p, createCommentVNode as n, normalizeClass as j, withDirectives as z, createVNode as L, createBlock as f, unref as c, toDisplayString as m, withCtx as U, renderSlot as E, vModelDynamic as A, withModifiers as V } from "vue";
|
|
4
4
|
import G from "../../assets/images/required.svg.js";
|
|
5
5
|
import { getErrorMessage as H } from "../../helpers/error.js";
|
|
6
6
|
import J from "../../utils/DoubleContour.vue.js";
|
|
@@ -12,13 +12,13 @@ import X from "../PlIcon24/PlIcon24.vue.js";
|
|
|
12
12
|
import Y from "../PlSvg/PlSvg.vue.js";
|
|
13
13
|
import Z from "../PlTooltip/PlTooltip.vue.js";
|
|
14
14
|
|
|
15
|
-
const ee = { class: "pl-text-field__envelope" },
|
|
15
|
+
const ee = { class: "pl-text-field__envelope" }, le = {
|
|
16
16
|
key: 0,
|
|
17
17
|
ref: "label"
|
|
18
|
-
},
|
|
18
|
+
}, te = {
|
|
19
19
|
key: 1,
|
|
20
20
|
class: "pl-text-field__prefix"
|
|
21
|
-
},
|
|
21
|
+
}, oe = ["disabled", "placeholder", "type"], re = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "pl-text-field__error"
|
|
24
24
|
}, ae = {
|
|
@@ -26,9 +26,9 @@ const ee = { class: "pl-text-field__envelope" }, oe = {
|
|
|
26
26
|
class: "pl-text-field__helper"
|
|
27
27
|
}, se = {
|
|
28
28
|
name: "PlTextField"
|
|
29
|
-
},
|
|
29
|
+
}, ke = /* @__PURE__ */ I({
|
|
30
30
|
...se,
|
|
31
|
-
props: /* @__PURE__ */
|
|
31
|
+
props: /* @__PURE__ */ N({
|
|
32
32
|
label: {},
|
|
33
33
|
clearable: { type: [Boolean, Function] },
|
|
34
34
|
parse: { type: Function },
|
|
@@ -49,106 +49,106 @@ const ee = { class: "pl-text-field__envelope" }, oe = {
|
|
|
49
49
|
modelModifiers: {}
|
|
50
50
|
}),
|
|
51
51
|
emits: ["update:modelValue"],
|
|
52
|
-
setup(
|
|
53
|
-
const
|
|
52
|
+
setup(l) {
|
|
53
|
+
const _ = $(), o = O(l, "modelValue"), e = l, y = h(void 0), b = h(), u = h(!1), s = T({
|
|
54
54
|
cached: void 0
|
|
55
|
-
}),
|
|
55
|
+
}), v = i({
|
|
56
56
|
get() {
|
|
57
|
-
return
|
|
57
|
+
return s.cached ? s.cached.value : o.value === void 0 || o.value === null ? "" : String(o.value);
|
|
58
58
|
},
|
|
59
|
-
set(
|
|
60
|
-
if (
|
|
59
|
+
set(t) {
|
|
60
|
+
if (s.cached = void 0, e.parse)
|
|
61
61
|
try {
|
|
62
|
-
|
|
62
|
+
o.value = e.parse(t);
|
|
63
63
|
} catch (r) {
|
|
64
|
-
|
|
64
|
+
s.cached = {
|
|
65
65
|
error: r instanceof Error ? r.message : String(r),
|
|
66
|
-
value:
|
|
66
|
+
value: t
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
else
|
|
70
|
-
|
|
70
|
+
o.value = t;
|
|
71
71
|
}
|
|
72
|
-
}),
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
const
|
|
76
|
-
return r &&
|
|
77
|
-
}), w =
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
var
|
|
81
|
-
return (
|
|
72
|
+
}), C = i(() => e.type && e.type === "password" ? u.value ? "text" : e.type : "text"), M = i(() => u.value ? "view-show" : "view-hide"), P = () => {
|
|
73
|
+
e.clearable && (s.cached = void 0, o.value = e.clearable === !0 ? "" : e.clearable());
|
|
74
|
+
}, k = Q(v, e.rules || []), S = i(() => e.clearable ? e.clearable === !0 ? o.value === "" : o.value === e.clearable() : o.value === ""), g = i(() => !S.value), x = i(() => {
|
|
75
|
+
const t = [], r = H(e.error);
|
|
76
|
+
return r && t.push(r), s.cached && t.push(s.cached.error), k.value.isValid || t.push(...k.value.errors), t;
|
|
77
|
+
}), w = i(() => x.value.length > 0), B = i(() => e.clearable && g.value && e.type !== "password" && !e.disabled), F = () => u.value = !u.value, R = () => {
|
|
78
|
+
s.cached = void 0;
|
|
79
|
+
}, q = () => {
|
|
80
|
+
var t;
|
|
81
|
+
return (t = b.value) == null ? void 0 : t.focus();
|
|
82
82
|
};
|
|
83
|
-
return K(y), (
|
|
84
|
-
|
|
83
|
+
return K(y), (t, r) => (a(), d("div", ee, [
|
|
84
|
+
p("div", {
|
|
85
85
|
ref_key: "rootRef",
|
|
86
86
|
ref: y,
|
|
87
87
|
class: j(["pl-text-field", {
|
|
88
88
|
error: w.value,
|
|
89
|
-
disabled:
|
|
90
|
-
dashed:
|
|
91
|
-
nonEmpty:
|
|
89
|
+
disabled: l.disabled,
|
|
90
|
+
dashed: l.dashed,
|
|
91
|
+
nonEmpty: g.value
|
|
92
92
|
}])
|
|
93
93
|
}, [
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
l.label ? (a(), d("label", le, [
|
|
95
|
+
l.required ? (a(), f(c(Y), {
|
|
96
96
|
key: 0,
|
|
97
|
-
uri:
|
|
98
|
-
}, null, 8, ["uri"])) :
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
uri: c(G)
|
|
98
|
+
}, null, 8, ["uri"])) : n("", !0),
|
|
99
|
+
p("span", null, m(l.label), 1),
|
|
100
|
+
c(_).tooltip ? (a(), f(c(Z), {
|
|
101
101
|
key: 1,
|
|
102
102
|
class: "info",
|
|
103
103
|
position: "top"
|
|
104
104
|
}, {
|
|
105
105
|
tooltip: U(() => [
|
|
106
|
-
E(
|
|
106
|
+
E(t.$slots, "tooltip")
|
|
107
107
|
]),
|
|
108
108
|
_: 3
|
|
109
|
-
})) :
|
|
110
|
-
], 512)) :
|
|
111
|
-
|
|
112
|
-
z(
|
|
109
|
+
})) : n("", !0)
|
|
110
|
+
], 512)) : n("", !0),
|
|
111
|
+
l.prefix ? (a(), d("div", te, m(l.prefix), 1)) : n("", !0),
|
|
112
|
+
z(p("input", {
|
|
113
113
|
ref_key: "inputRef",
|
|
114
114
|
ref: b,
|
|
115
|
-
"onUpdate:modelValue": r[0] || (r[0] = (
|
|
116
|
-
disabled:
|
|
117
|
-
placeholder:
|
|
118
|
-
type:
|
|
115
|
+
"onUpdate:modelValue": r[0] || (r[0] = (D) => v.value = D),
|
|
116
|
+
disabled: l.disabled,
|
|
117
|
+
placeholder: l.placeholder || "...",
|
|
118
|
+
type: C.value,
|
|
119
119
|
spellcheck: "false",
|
|
120
|
-
onFocusout:
|
|
121
|
-
}, null, 40,
|
|
122
|
-
[A,
|
|
120
|
+
onFocusout: R
|
|
121
|
+
}, null, 40, oe), [
|
|
122
|
+
[A, v.value]
|
|
123
123
|
]),
|
|
124
|
-
|
|
124
|
+
p("div", {
|
|
125
125
|
class: "pl-text-field__append",
|
|
126
|
-
onClick:
|
|
126
|
+
onClick: q
|
|
127
127
|
}, [
|
|
128
|
-
|
|
128
|
+
B.value ? (a(), f(c(W), {
|
|
129
129
|
key: 0,
|
|
130
130
|
class: "pl-text-field__clearable",
|
|
131
131
|
name: "delete-clear",
|
|
132
|
-
onClick: V(
|
|
133
|
-
})) :
|
|
134
|
-
|
|
132
|
+
onClick: V(P, ["stop"])
|
|
133
|
+
})) : n("", !0),
|
|
134
|
+
l.type === "password" ? (a(), f(c(X), {
|
|
135
135
|
key: 1,
|
|
136
|
-
name:
|
|
136
|
+
name: M.value,
|
|
137
137
|
style: { cursor: "pointer" },
|
|
138
|
-
onClick: V(
|
|
139
|
-
}, null, 8, ["name"])) :
|
|
140
|
-
E(
|
|
138
|
+
onClick: V(F, ["stop"])
|
|
139
|
+
}, null, 8, ["name"])) : n("", !0),
|
|
140
|
+
E(t.$slots, "append")
|
|
141
141
|
]),
|
|
142
142
|
L(J, {
|
|
143
143
|
class: "pl-text-field__contour",
|
|
144
|
-
"group-position":
|
|
144
|
+
"group-position": l.groupPosition
|
|
145
145
|
}, null, 8, ["group-position"])
|
|
146
146
|
], 2),
|
|
147
|
-
w.value ? (
|
|
147
|
+
w.value ? (a(), d("div", re, m(x.value.join(" ")), 1)) : l.helper ? (a(), d("div", ae, m(l.helper), 1)) : n("", !0)
|
|
148
148
|
]));
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
export {
|
|
152
|
-
|
|
152
|
+
ke as default
|
|
153
153
|
};
|
|
154
154
|
//# sourceMappingURL=PlTextField.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTextField.vue.js","sources":["../../../src/components/PlTextField/PlTextField.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for one-line string data manipulation\n */\nexport default {\n name: 'PlTextField',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M, E = string, C = E\">\nimport type { Equal } from '@milaboratories/helpers';\nimport { computed, reactive, ref, useSlots } from 'vue';\nimport SvgRequired from '../../assets/images/required.svg?raw';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlIcon24 } from '../PlIcon24';\nimport { PlSvg } from '../PlSvg';\nimport { PlTooltip } from '../PlTooltip';\nimport './pl-text-field.scss';\n\nconst slots = useSlots();\n\ntype Model = Equal<M, E | C> extends true ? M : never; // basically in === out\n\n/**\n * The current value of the input field.\n */\nconst model = defineModel<Model>({\n required: true,\n});\n\nconst props = defineProps<{\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, a clear icon will appear in the input field to clear the value (set it to empty string).\n * Or you can pass a callback that returns a custom \"empty\" value (null | undefined | string)\n */\n clearable?: boolean | (() => C);\n /**\n * An optional callback to parse and/or cast the value, the return type overrides the model type.\n * The callback must throw an exception if the value is invalid\n */\n parse?: (v: string) => E;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\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 * A placeholder text to display inside the input field when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the input field is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the input field has a dashed border.\n */\n dashed?: boolean;\n /**\n * A prefix text to display inside the input field before the value.\n */\n prefix?: string;\n /**\n * An array of validation rules to apply to the input field. Each rule is a function that takes the current value and returns `true` if valid or an error message if invalid.\n */\n rules?: ((v: string) => boolean | string)[];\n /**\n * The string specifies whether the field should be a password or not, value could be \"password\" or undefined.\n */\n type?: 'password';\n /**\n * Makes some of corners not rounded\n * */\n groupPosition?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle';\n}>();\n\nconst rootRef = ref<HTMLInputElement | undefined>(undefined);\n\nconst inputRef = ref<HTMLInputElement | undefined>();\n\nconst showPassword = ref(false);\n\nconst data = reactive({\n cached: undefined as { error: string; value: string } | undefined,\n});\n\nconst valueRef = computed<string>({\n get() {\n if (data.cached) {\n return data.cached.value;\n }\n return model.value === undefined || model.value === null ? '' : String(model.value);\n },\n set(value) {\n data.cached = undefined;\n\n if (props.parse) {\n try {\n model.value = props.parse(value) as Model;\n } catch (err) {\n data.cached = {\n error: err instanceof Error ? err.message : String(err),\n value,\n };\n }\n } else {\n model.value = value as Model;\n }\n },\n});\n\nconst fieldType = computed(() => {\n if (props.type && props.type === 'password') {\n return showPassword.value ? 'text' : props.type;\n } else {\n return 'text';\n }\n});\n\nconst passwordIcon = computed(() => (showPassword.value ? 'view-show' : 'view-hide'));\n\nconst clear = () => {\n if (props.clearable) {\n data.cached = undefined;\n model.value = props.clearable === true ? ('' as Model) : (props.clearable() as Model);\n }\n};\n\nconst validationData = useValidation(valueRef, props.rules || []);\n\nconst isEmpty = computed(() => {\n if (props.clearable) {\n return props.clearable === true ? model.value === '' : model.value === props.clearable();\n }\n\n return model.value === '';\n});\n\nconst nonEmpty = computed(() => !isEmpty.value);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n if (propsError) {\n errors.push(propsError);\n }\n if (data.cached) {\n errors.push(data.cached.error);\n }\n if (!validationData.value.isValid) {\n errors.push(...validationData.value.errors);\n }\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst canShowClearable = computed(() => props.clearable && nonEmpty.value && props.type !== 'password' && !props.disabled);\n\nconst togglePasswordVisibility = () => (showPassword.value = !showPassword.value);\n\nconst onFocusOut = () => {\n data.cached = undefined;\n};\n\nconst setFocusOnInput = () => inputRef.value?.focus();\n\nuseLabelNotch(rootRef);\n</script>\n\n<template>\n <div class=\"pl-text-field__envelope\">\n <div\n ref=\"rootRef\"\n class=\"pl-text-field\"\n :class=\"{\n error: hasErrors,\n disabled,\n dashed,\n nonEmpty,\n }\"\n >\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div v-if=\"prefix\" class=\"pl-text-field__prefix\">\n {{ prefix }}\n </div>\n <input\n ref=\"inputRef\"\n v-model=\"valueRef\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder || '...'\"\n :type=\"fieldType\"\n spellcheck=\"false\"\n @focusout=\"onFocusOut\"\n />\n <div class=\"pl-text-field__append\" @click=\"setFocusOnInput\">\n <PlIcon16 v-if=\"canShowClearable\" class=\"pl-text-field__clearable\" name=\"delete-clear\" @click.stop=\"clear\" />\n <PlIcon24 v-if=\"type === 'password'\" :name=\"passwordIcon\" style=\"cursor: pointer\" @click.stop=\"togglePasswordVisibility\" />\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"pl-text-field__contour\" :group-position=\"groupPosition\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-text-field__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-text-field__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","model","_useModel","__props","props","rootRef","ref","inputRef","showPassword","data","reactive","valueRef","computed","value","err","fieldType","passwordIcon","clear","validationData","useValidation","isEmpty","nonEmpty","displayErrors","errors","propsError","getErrorMessage","hasErrors","canShowClearable","togglePasswordVisibility","onFocusOut","setFocusOnInput","_a","useLabelNotch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;GAIAA,KAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,UAAMC,IAAQC,EAAA,GAORC,IAAQC,EAAkBC,GAAA,YAE/B,GAEKC,IAAQD,GAyDRE,IAAUC,EAAkC,MAAS,GAErDC,IAAWD,EAAA,GAEXE,IAAeF,EAAI,EAAK,GAExBG,IAAOC,EAAS;AAAA,MACpB,QAAQ;AAAA,IAAA,CACT,GAEKC,IAAWC,EAAiB;AAAA,MAChC,MAAM;AACJ,eAAIH,EAAK,SACAA,EAAK,OAAO,QAEdR,EAAM,UAAU,UAAaA,EAAM,UAAU,OAAO,KAAK,OAAOA,EAAM,KAAK;AAAA,MACpF;AAAA,MACA,IAAIY,GAAO;AAGT,YAFAJ,EAAK,SAAS,QAEVL,EAAM;AACR,cAAI;AACF,YAAAH,EAAM,QAAQG,EAAM,MAAMS,CAAK;AAAA,UACjC,SAASC,GAAK;AACZ,YAAAL,EAAK,SAAS;AAAA,cACZ,OAAOK,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG;AAAA,cACtD,OAAAD;AAAA,YAAA;AAAA,UAEJ;AAAA;AAEA,UAAAZ,EAAM,QAAQY;AAAA,MAElB;AAAA,IAAA,CACD,GAEKE,IAAYH,EAAS,MACrBR,EAAM,QAAQA,EAAM,SAAS,aACxBI,EAAa,QAAQ,SAASJ,EAAM,OAEpC,MAEV,GAEKY,IAAeJ,EAAS,MAAOJ,EAAa,QAAQ,cAAc,WAAY,GAE9ES,IAAQ,MAAM;AAClB,MAAIb,EAAM,cACRK,EAAK,SAAS,QACdR,EAAM,QAAQG,EAAM,cAAc,KAAQ,KAAgBA,EAAM,UAAA;AAAA,IAEpE,GAEMc,IAAiBC,EAAcR,GAAUP,EAAM,SAAS,CAAA,CAAE,GAE1DgB,IAAUR,EAAS,MACnBR,EAAM,YACDA,EAAM,cAAc,KAAOH,EAAM,UAAU,KAAKA,EAAM,UAAUG,EAAM,UAAA,IAGxEH,EAAM,UAAU,EACxB,GAEKoB,IAAWT,EAAS,MAAM,CAACQ,EAAQ,KAAK,GAExCE,IAAgBV,EAAS,MAAM;AACnC,YAAMW,IAAmB,CAAA,GACnBC,IAAaC,EAAgBrB,EAAM,KAAK;AAC9C,aAAIoB,KACFD,EAAO,KAAKC,CAAU,GAEpBf,EAAK,UACPc,EAAO,KAAKd,EAAK,OAAO,KAAK,GAE1BS,EAAe,MAAM,WACxBK,EAAO,KAAK,GAAGL,EAAe,MAAM,MAAM,GAErCK;AAAA,IACT,CAAC,GAEKG,IAAYd,EAAS,MAAMU,EAAc,MAAM,SAAS,CAAC,GAEzDK,IAAmBf,EAAS,MAAMR,EAAM,aAAaiB,EAAS,SAASjB,EAAM,SAAS,cAAc,CAACA,EAAM,QAAQ,GAEnHwB,IAA2B,MAAOpB,EAAa,QAAQ,CAACA,EAAa,OAErEqB,IAAa,MAAM;AACvB,MAAApB,EAAK,SAAS;AAAA,IAChB,GAEMqB,IAAkB,MAAA;;AAAM,cAAAC,IAAAxB,EAAS,UAAT,gBAAAwB,EAAgB;AAAA;AAE9C,WAAAC,EAAc3B,CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"PlTextField.vue.js","sources":["../../../src/components/PlTextField/PlTextField.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for one-line string data manipulation\n */\nexport default {\n name: 'PlTextField',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M, E = string, C = E\">\nimport type { Equal } from '@milaboratories/helpers';\nimport { computed, reactive, ref, useSlots } from 'vue';\nimport SvgRequired from '../../assets/images/required.svg?raw';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { useValidation } from '../../utils/useValidation';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlIcon24 } from '../PlIcon24';\nimport { PlSvg } from '../PlSvg';\nimport { PlTooltip } from '../PlTooltip';\nimport './pl-text-field.scss';\n\nconst slots = useSlots();\n\ntype Model = Equal<M, E | C> extends true ? M : never; // basically in === out\n\n/**\n * The current value of the input field.\n */\nconst model = defineModel<Model>({\n required: true,\n});\n\nconst props = defineProps<{\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, a clear icon will appear in the input field to clear the value (set it to empty string).\n * Or you can pass a callback that returns a custom \"empty\" value (null | undefined | string)\n */\n clearable?: boolean | (() => C);\n /**\n * An optional callback to parse and/or cast the value, the return type overrides the model type.\n * The callback must throw an exception if the value is invalid\n */\n parse?: (v: string) => E;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\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 * A placeholder text to display inside the input field when it is empty.\n */\n placeholder?: string;\n /**\n * If `true`, the input field is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * If `true`, the input field has a dashed border.\n */\n dashed?: boolean;\n /**\n * A prefix text to display inside the input field before the value.\n */\n prefix?: string;\n /**\n * An array of validation rules to apply to the input field. Each rule is a function that takes the current value and returns `true` if valid or an error message if invalid.\n */\n rules?: ((v: string) => boolean | string)[];\n /**\n * The string specifies whether the field should be a password or not, value could be \"password\" or undefined.\n */\n type?: 'password';\n /**\n * Makes some of corners not rounded\n * */\n groupPosition?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle';\n}>();\n\nconst rootRef = ref<HTMLInputElement | undefined>(undefined);\n\nconst inputRef = ref<HTMLInputElement | undefined>();\n\nconst showPassword = ref(false);\n\nconst data = reactive({\n cached: undefined as { error: string; value: string } | undefined,\n});\n\nconst valueRef = computed<string>({\n get() {\n if (data.cached) {\n return data.cached.value;\n }\n return model.value === undefined || model.value === null ? '' : String(model.value);\n },\n set(value) {\n data.cached = undefined;\n\n if (props.parse) {\n try {\n model.value = props.parse(value) as Model;\n } catch (err) {\n data.cached = {\n error: err instanceof Error ? err.message : String(err),\n value,\n };\n }\n } else {\n model.value = value as Model;\n }\n },\n});\n\nconst fieldType = computed(() => {\n if (props.type && props.type === 'password') {\n return showPassword.value ? 'text' : props.type;\n } else {\n return 'text';\n }\n});\n\nconst passwordIcon = computed(() => (showPassword.value ? 'view-show' : 'view-hide'));\n\nconst clear = () => {\n if (props.clearable) {\n data.cached = undefined;\n model.value = props.clearable === true ? ('' as Model) : (props.clearable() as Model);\n }\n};\n\nconst validationData = useValidation(valueRef, props.rules || []);\n\nconst isEmpty = computed(() => {\n if (props.clearable) {\n return props.clearable === true ? model.value === '' : model.value === props.clearable();\n }\n\n return model.value === '';\n});\n\nconst nonEmpty = computed(() => !isEmpty.value);\n\nconst displayErrors = computed(() => {\n const errors: string[] = [];\n const propsError = getErrorMessage(props.error);\n if (propsError) {\n errors.push(propsError);\n }\n if (data.cached) {\n errors.push(data.cached.error);\n }\n if (!validationData.value.isValid) {\n errors.push(...validationData.value.errors);\n }\n return errors;\n});\n\nconst hasErrors = computed(() => displayErrors.value.length > 0);\n\nconst canShowClearable = computed(() => props.clearable && nonEmpty.value && props.type !== 'password' && !props.disabled);\n\nconst togglePasswordVisibility = () => (showPassword.value = !showPassword.value);\n\nconst onFocusOut = () => {\n data.cached = undefined;\n};\n\nconst setFocusOnInput = () => inputRef.value?.focus();\n\nuseLabelNotch(rootRef);\n</script>\n\n<template>\n <div class=\"pl-text-field__envelope\">\n <div\n ref=\"rootRef\"\n class=\"pl-text-field\"\n :class=\"{\n error: hasErrors,\n disabled,\n dashed,\n nonEmpty,\n }\"\n >\n <label v-if=\"label\" ref=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div v-if=\"prefix\" class=\"pl-text-field__prefix\">\n {{ prefix }}\n </div>\n <input\n ref=\"inputRef\"\n v-model=\"valueRef\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder || '...'\"\n :type=\"fieldType\"\n spellcheck=\"false\"\n @focusout=\"onFocusOut\"\n />\n <div class=\"pl-text-field__append\" @click=\"setFocusOnInput\">\n <PlIcon16 v-if=\"canShowClearable\" class=\"pl-text-field__clearable\" name=\"delete-clear\" @click.stop=\"clear\" />\n <PlIcon24 v-if=\"type === 'password'\" :name=\"passwordIcon\" style=\"cursor: pointer\" @click.stop=\"togglePasswordVisibility\" />\n <slot name=\"append\" />\n </div>\n <DoubleContour class=\"pl-text-field__contour\" :group-position=\"groupPosition\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-text-field__error\">\n {{ displayErrors.join(' ') }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-text-field__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","slots","useSlots","model","_useModel","__props","props","rootRef","ref","inputRef","showPassword","data","reactive","valueRef","computed","value","err","fieldType","passwordIcon","clear","validationData","useValidation","isEmpty","nonEmpty","displayErrors","errors","propsError","getErrorMessage","hasErrors","canShowClearable","togglePasswordVisibility","onFocusOut","setFocusOnInput","_a","useLabelNotch","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_createBlock","_unref","PlSvg","SvgRequired","PlTooltip","_renderSlot","_ctx","_hoisted_3","_toDisplayString","$event","PlIcon16","PlIcon24","_createVNode","DoubleContour","_hoisted_5","_hoisted_6"],"mappings":"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"}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(".ui-toggle-switch{--handle-ml: 0;--body-bg: var(--bg-base-light);--body-shadow: var(--btn-group-shape-shadow);display:flex;align-items:center;gap:12px;outline:none}.ui-toggle-switch__body{width:40px;height:24px;display:flex;padding:5px;border-radius:12px;border:1px solid var(--color-ic-01);box-shadow:var(--body-shadow);background:var(--body-bg);cursor:pointer}.ui-toggle-switch__handle{width:12px;height:12px;border-radius:12px;border:1px solid var(--color-ic-01);background:var(--color-ic-00);margin-left:var(--handle-ml)}.ui-toggle-switch.active{--body-bg: var(--btn-switcher-bg);--handle-ml: auto}.ui-toggle-switch:focus-visible{--label-color: var(--txt-focus);--body-shadow: var(--btn-group-shape-shadow), 0 0 0 2px #fff, 0 0 0 4px var(--border-color-focus)}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import { defineComponent as
|
|
2
|
+
import { defineComponent as d, createElementBlock as o, openBlock as a, withKeys as m, normalizeClass as s, createElementVNode as n, createCommentVNode as u, toDisplayString as r } from "vue";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const g = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "label"
|
|
7
|
-
},
|
|
7
|
+
}, V = {
|
|
8
8
|
name: "PlToggleSwitch"
|
|
9
|
-
},
|
|
10
|
-
...
|
|
9
|
+
}, p = /* @__PURE__ */ d({
|
|
10
|
+
...V,
|
|
11
11
|
props: {
|
|
12
12
|
label: {},
|
|
13
13
|
modelValue: { type: Boolean }
|
|
14
14
|
},
|
|
15
15
|
emits: ["update:modelValue"],
|
|
16
|
-
setup(
|
|
17
|
-
return (
|
|
16
|
+
setup(l) {
|
|
17
|
+
return (t, e) => (a(), o("div", {
|
|
18
18
|
tabindex: "0",
|
|
19
|
-
class:
|
|
20
|
-
onClick:
|
|
21
|
-
onKeydown:
|
|
19
|
+
class: s(["ui-toggle-switch", { active: l.modelValue }]),
|
|
20
|
+
onClick: e[0] || (e[0] = (i) => t.$emit("update:modelValue", !l.modelValue)),
|
|
21
|
+
onKeydown: e[1] || (e[1] = m((i) => t.$emit("update:modelValue", !l.modelValue), ["enter"]))
|
|
22
22
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
e[2] || (e[2] = n("div", { class: "ui-toggle-switch__body" }, [
|
|
24
|
+
n("div", { class: "ui-toggle-switch__handle" })
|
|
25
25
|
], -1)),
|
|
26
|
-
|
|
26
|
+
l.label ? (a(), o("span", g, r(l.label), 1)) : u("", !0)
|
|
27
27
|
], 34));
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
p as default
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=PlToggleSwitch.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlToggleSwitch.vue.js","sources":["../../../src/components/PlToggleSwitch/PlToggleSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for manipulating a boolean value\n */\nexport default {\n name: 'PlToggleSwitch',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-toggle-switch.scss';\n\ndefineEmits<{\n /**\n * Emitted when the model value is updated\n *\n * @param value - The new boolean value of the model\n */\n (e: 'update:modelValue', value: boolean): void;\n}>();\n\ndefineProps<{\n /**\n * The label text for the component (optional)\n */\n label?: string;\n /**\n * The current boolean value of the component (represents 'on' | 'off' states generally).\n */\n modelValue?: boolean;\n}>();\n</script>\n\n<template>\n <div\n tabindex=\"0\"\n class=\"ui-toggle-switch\"\n :class=\"{ active: modelValue }\"\n @click=\"$emit('update:modelValue', !modelValue)\"\n @keydown.enter=\"$emit('update:modelValue', !modelValue)\"\n >\n <div class=\"ui-toggle-switch__body\">\n <div class=\"ui-toggle-switch__handle\" />\n </div>\n <span v-if=\"label\" class=\"label\">{{ label }}</span>\n </div>\n</template>\n"],"names":["__default__"],"mappings":";;;;;GAIAA,IAAe;AAAA,EACb,MAAM;AACR
|
|
1
|
+
{"version":3,"file":"PlToggleSwitch.vue.js","sources":["../../../src/components/PlToggleSwitch/PlToggleSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Component for manipulating a boolean value\n */\nexport default {\n name: 'PlToggleSwitch',\n};\n</script>\n\n<script lang=\"ts\" setup>\nimport './pl-toggle-switch.scss';\n\ndefineEmits<{\n /**\n * Emitted when the model value is updated\n *\n * @param value - The new boolean value of the model\n */\n (e: 'update:modelValue', value: boolean): void;\n}>();\n\ndefineProps<{\n /**\n * The label text for the component (optional)\n */\n label?: string;\n /**\n * The current boolean value of the component (represents 'on' | 'off' states generally).\n */\n modelValue?: boolean;\n}>();\n</script>\n\n<template>\n <div\n tabindex=\"0\"\n class=\"ui-toggle-switch\"\n :class=\"{ active: modelValue }\"\n @click=\"$emit('update:modelValue', !modelValue)\"\n @keydown.enter=\"$emit('update:modelValue', !modelValue)\"\n >\n <div class=\"ui-toggle-switch__body\">\n <div class=\"ui-toggle-switch__handle\" />\n </div>\n <span v-if=\"label\" class=\"label\">{{ label }}</span>\n </div>\n</template>\n"],"names":["__default__","_createElementBlock","_normalizeClass","__props","_cache","$event","$emit","_withKeys","_createElementVNode","_hoisted_1","_toDisplayString"],"mappings":";;;;;GAIAA,IAAe;AAAA,EACb,MAAM;AACR;;;;;;;;2BA4BEC,EAWM,OAAA;AAAA,MAVJ,UAAS;AAAA,MACT,OAAKC,EAAA,CAAC,oBAAkB,EAAA,QACNC,EAAA,WAAA,CAAU,CAAA;AAAA,MAC3B,SAAKC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEC,EAAAA,MAAK,qBAAA,CAAuBH,EAAA,UAAU;AAAA,MAC7C,WAAOC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAAG,EAAA,CAAAF,MAAQC,EAAAA,MAAK,qBAAA,CAAuBH,EAAA,UAAU,GAAA,CAAA,OAAA,CAAA;AAAA,IAAA;sBAEtDK,EAEM,OAAA,EAFD,OAAM,4BAAwB;AAAA,QACjCA,EAAwC,OAAA,EAAnC,OAAM,4BAA0B;AAAA,MAAA;MAE3BL,EAAA,cAAZF,EAAmD,QAAnDQ,GAAmDC,EAAfP,EAAA,KAAK,GAAA,CAAA;;;;"}
|
|
@@ -9,12 +9,12 @@ const l = {}, s = {
|
|
|
9
9
|
xmlns: "http://www.w3.org/2000/svg"
|
|
10
10
|
};
|
|
11
11
|
function c(i, e) {
|
|
12
|
-
return o(), t("svg", s, e[0] || (e[0] = [
|
|
12
|
+
return o(), t("svg", s, [...e[0] || (e[0] = [
|
|
13
13
|
n("path", {
|
|
14
14
|
d: "M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z",
|
|
15
15
|
fill: "#24223D"
|
|
16
16
|
}, null, -1)
|
|
17
|
-
]));
|
|
17
|
+
])]);
|
|
18
18
|
}
|
|
19
19
|
const m = /* @__PURE__ */ r(l, [["render", c]]);
|
|
20
20
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Beak.vue.js","sources":["../../../src/components/PlTooltip/Beak.vue"],"sourcesContent":["<template>\n <svg class=\"beak\" width=\"5\" height=\"9\" viewBox=\"0 0 3 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z\" fill=\"#24223D\" />\n </svg>\n</template>\n"],"names":["_hoisted_1","_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode"],"mappings":";;cACOA,IAAY;AAAA,EAAC,OAAM;AAAA,EAAI;EAAW;EAAkB,SAAK;AAAA,EAAO;;;AAArE,SAAAC,EAAAC,GAAAC,GAAA;SACEC,EAAA,GAA0FC,EAAA,OAAAL,GAAAG,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,IAApFG,EAAE,QAAA;AAAA,MAAiE,GAAA;AAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"Beak.vue.js","sources":["../../../src/components/PlTooltip/Beak.vue"],"sourcesContent":["<template>\n <svg class=\"beak\" width=\"5\" height=\"9\" viewBox=\"0 0 3 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z\" fill=\"#24223D\" />\n </svg>\n</template>\n"],"names":["_hoisted_1","_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode"],"mappings":";;cACOA,IAAY;AAAA,EAAC,OAAM;AAAA,EAAI;EAAW;EAAkB,SAAK;AAAA,EAAO;;;AAArE,SAAAC,EAAAC,GAAAC,GAAA;SACEC,EAAA,GAA0FC,EAAA,OAAAL,GAAA,CAAA,GAAAG,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,IAApFG,EAAE,QAAA;AAAA,MAAiE,GAAA;AAAA;;;;;"}
|