@platforma-sdk/ui-vue 1.65.9 → 1.66.0
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 +21 -21
- package/.turbo/turbo-formatter$colon$check.log +2 -2
- package/.turbo/turbo-linter$colon$check.log +2 -2
- package/.turbo/turbo-types$colon$check.log +1 -1
- package/CHANGELOG.md +17 -0
- package/dist/components/PlAdvancedFilter/FilterEditor.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.test.d.ts +2 -0
- package/dist/components/PlAdvancedFilter/FilterEditor.test.d.ts.map +1 -0
- package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js +142 -145
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/types.d.ts +5 -6
- package/dist/components/PlAdvancedFilter/types.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/utils.d.ts +1 -0
- package/dist/components/PlAdvancedFilter/utils.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/utils.js +10 -1
- package/dist/components/PlAdvancedFilter/utils.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue.d.ts +7 -10
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue.d.ts.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js +71 -50
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue.d.ts +5 -7
- package/dist/components/PlAnnotations/components/FilterSidebar.vue.d.ts.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +81 -67
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue.d.ts +4 -14
- package/dist/components/PlAnnotations/components/PlAnnotations.vue.d.ts.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js +43 -38
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue.d.ts +5 -13
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue.d.ts.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js +37 -40
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js.map +1 -1
- package/package.json +7 -7
- package/src/components/PlAdvancedFilter/FilterEditor.test.ts +315 -0
- package/src/components/PlAdvancedFilter/FilterEditor.vue +12 -18
- package/src/components/PlAdvancedFilter/PlAdvancedFilter.vue +1 -6
- package/src/components/PlAdvancedFilter/types.ts +6 -8
- package/src/components/PlAdvancedFilter/utils.ts +20 -0
- package/src/components/PlAnnotations/components/AnnotationsSidebar.vue +59 -30
- package/src/components/PlAnnotations/components/FilterSidebar.vue +65 -40
- package/src/components/PlAnnotations/components/PlAnnotations.vue +35 -19
- package/src/components/PlAnnotations/components/PlAnnotationsModal.vue +18 -21
|
@@ -2,73 +2,94 @@ import { randomInt as e } from "../../../lib/util/helpers/dist/random.js";
|
|
|
2
2
|
import "../../../lib/util/helpers/dist/index.js";
|
|
3
3
|
import t from "./style.module.js";
|
|
4
4
|
import { validateTitle as n } from "../utils.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { produce as r } from "immer";
|
|
6
|
+
import { createBlock as i, createElementVNode as a, createSlots as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, openBlock as d, toDisplayString as f, unref as p, withCtx as m, withModifiers as h } from "vue";
|
|
7
|
+
import { PlBtnGhost as g, PlBtnSecondary as _, PlEditableTitle as v, PlElementList as y, PlSidebarItem as b, PlTextField as x } from "@milaboratories/uikit";
|
|
8
|
+
import { isEmpty as S } from "es-toolkit/compat";
|
|
8
9
|
//#region src/components/PlAnnotations/components/AnnotationsSidebar.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var
|
|
10
|
+
var C = /* @__PURE__ */ l({
|
|
10
11
|
__name: "AnnotationsSidebar",
|
|
11
12
|
props: {
|
|
12
|
-
annotation: {
|
|
13
|
-
annotationModifiers: {},
|
|
13
|
+
annotation: {},
|
|
14
14
|
selectedStepId: {},
|
|
15
|
-
|
|
15
|
+
onUpdateAnnotation: { type: Function },
|
|
16
|
+
onUpdateSelectedStepId: { type: Function }
|
|
16
17
|
},
|
|
17
|
-
emits:
|
|
18
|
-
setup(
|
|
19
|
-
let w =
|
|
20
|
-
function
|
|
18
|
+
emits: ["delete-schema"],
|
|
19
|
+
setup(l, { emit: C }) {
|
|
20
|
+
let w = l, T = C;
|
|
21
|
+
function E(e) {
|
|
22
|
+
w.onUpdateAnnotation(r(w.annotation, e));
|
|
23
|
+
}
|
|
24
|
+
function D(e) {
|
|
25
|
+
E((t) => {
|
|
26
|
+
t.title = e;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function O(e) {
|
|
30
|
+
E((t) => {
|
|
31
|
+
t.steps = e;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function k(e) {
|
|
35
|
+
E((t) => {
|
|
36
|
+
t.defaultValue = e === "" ? void 0 : e;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function A() {
|
|
21
40
|
let t = e();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
E((n) => {
|
|
42
|
+
n.steps.push({
|
|
43
|
+
id: t,
|
|
44
|
+
label: "",
|
|
45
|
+
filter: {
|
|
46
|
+
id: e(),
|
|
47
|
+
type: "and",
|
|
48
|
+
filters: []
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}), w.onUpdateSelectedStepId(t);
|
|
31
52
|
}
|
|
32
|
-
return (e,
|
|
33
|
-
"header-content":
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class: u({ [p(t).flashing]: w.value.title.length === 0 }),
|
|
53
|
+
return (e, r) => (d(), i(p(b), null, o({
|
|
54
|
+
"header-content": m(() => [c(p(v), {
|
|
55
|
+
"model-value": w.annotation.title,
|
|
56
|
+
class: u({ [p(t).flashing]: w.annotation.title.length === 0 }),
|
|
37
57
|
"max-length": 40,
|
|
38
58
|
"max-width": "600px",
|
|
39
59
|
placeholder: "Annotation Title",
|
|
40
|
-
autofocus: w.
|
|
41
|
-
validate: p(n)
|
|
60
|
+
autofocus: w.annotation.title.length === 0,
|
|
61
|
+
validate: p(n),
|
|
62
|
+
"onUpdate:modelValue": D
|
|
42
63
|
}, null, 8, [
|
|
43
|
-
"
|
|
64
|
+
"model-value",
|
|
44
65
|
"class",
|
|
45
66
|
"autofocus",
|
|
46
67
|
"validate"
|
|
47
68
|
])]),
|
|
48
|
-
"footer-content":
|
|
69
|
+
"footer-content": m(() => [c(p(g), {
|
|
49
70
|
icon: "delete-bin",
|
|
50
71
|
reverse: "",
|
|
51
|
-
disabled: w.
|
|
52
|
-
onClick:
|
|
72
|
+
disabled: w.annotation.steps.length === 0,
|
|
73
|
+
onClick: r[2] ||= h((e) => T("delete-schema"), ["stop"])
|
|
53
74
|
}, {
|
|
54
|
-
default:
|
|
75
|
+
default: m(() => [...r[4] ||= [s(" Delete Schema ", -1)]]),
|
|
55
76
|
_: 1
|
|
56
77
|
}, 8, ["disabled"])]),
|
|
57
78
|
_: 2
|
|
58
|
-
}, [w.
|
|
79
|
+
}, [w.annotation ? {
|
|
59
80
|
name: "body-content",
|
|
60
|
-
fn:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
items: w.
|
|
64
|
-
"onUpdate:items": c[1] ||= (e) => w.value.steps = e,
|
|
81
|
+
fn: m(() => [a("div", { class: u([e.$style.root, { [p(t).disabled]: w.annotation.title.length === 0 }]) }, [
|
|
82
|
+
a("span", { class: u(e.$style.tip) }, " Above annotations override the ones below. Rearrange them by dragging. ", 2),
|
|
83
|
+
c(p(y), {
|
|
84
|
+
items: w.annotation.steps,
|
|
65
85
|
"get-item-key": (e) => e.id,
|
|
66
|
-
"is-active": (e) => e.id ===
|
|
86
|
+
"is-active": (e) => e.id === w.selectedStepId,
|
|
67
87
|
"item-class": e.$style.stepItem,
|
|
68
88
|
class: u(e.$style.steps),
|
|
69
|
-
|
|
89
|
+
"onUpdate:items": O,
|
|
90
|
+
onItemClick: r[0] ||= (e) => w.onUpdateSelectedStepId(e.id)
|
|
70
91
|
}, {
|
|
71
|
-
"item-title":
|
|
92
|
+
"item-title": m(({ item: e }) => [s(f(e.label), 1)]),
|
|
72
93
|
_: 1
|
|
73
94
|
}, 8, [
|
|
74
95
|
"items",
|
|
@@ -77,22 +98,22 @@ var w = /* @__PURE__ */ c({
|
|
|
77
98
|
"item-class",
|
|
78
99
|
"class"
|
|
79
100
|
]),
|
|
80
|
-
|
|
101
|
+
c(p(_), {
|
|
81
102
|
icon: "add",
|
|
82
|
-
onClick:
|
|
103
|
+
onClick: A
|
|
83
104
|
}, {
|
|
84
|
-
default:
|
|
105
|
+
default: m(() => [...r[3] ||= [s(" Add label ", -1)]]),
|
|
85
106
|
_: 1
|
|
86
107
|
}),
|
|
87
|
-
|
|
88
|
-
class: u([e.$style.defaultValue, { [e.$style.emptyDefaultValue]: p(
|
|
89
|
-
"model-value": w.
|
|
108
|
+
c(p(x), {
|
|
109
|
+
class: u([e.$style.defaultValue, { [e.$style.emptyDefaultValue]: p(S)(w.annotation.defaultValue) }]),
|
|
110
|
+
"model-value": w.annotation.defaultValue ?? "",
|
|
90
111
|
label: "Label remaining with",
|
|
91
112
|
placeholder: "No label",
|
|
92
113
|
clearable: "",
|
|
93
114
|
helper: "This label will be applied to the remaining rows, after all other filters are applied.",
|
|
94
|
-
onClick:
|
|
95
|
-
"onUpdate:modelValue":
|
|
115
|
+
onClick: r[1] ||= h(() => {}, ["stop"]),
|
|
116
|
+
"onUpdate:modelValue": k
|
|
96
117
|
}, null, 8, ["class", "model-value"])
|
|
97
118
|
], 2)]),
|
|
98
119
|
key: "0"
|
|
@@ -100,6 +121,6 @@ var w = /* @__PURE__ */ c({
|
|
|
100
121
|
}
|
|
101
122
|
});
|
|
102
123
|
//#endregion
|
|
103
|
-
export {
|
|
124
|
+
export { C as default };
|
|
104
125
|
|
|
105
126
|
//# sourceMappingURL=AnnotationsSidebar.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotationsSidebar.vue_vue_type_script_setup_true_lang.js","names":["$style"],"sources":["../../../../src/components/PlAnnotations/components/AnnotationsSidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport $commonStyle from \"./style.module.css\";\n\nimport { randomInt } from \"@milaboratories/helpers\";\nimport {\n PlBtnGhost,\n PlBtnSecondary,\n PlEditableTitle,\n PlElementList,\n PlSidebarItem,\n PlTextField,\n} from \"@milaboratories/uikit\";\nimport type { Annotation } from \"../types\";\nimport { validateTitle } from \"../utils\";\nimport { isEmpty } from \"es-toolkit/compat\";\n\
|
|
1
|
+
{"version":3,"file":"AnnotationsSidebar.vue_vue_type_script_setup_true_lang.js","names":["$style"],"sources":["../../../../src/components/PlAnnotations/components/AnnotationsSidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport $commonStyle from \"./style.module.css\";\n\nimport { produce } from \"immer\";\nimport { randomInt } from \"@milaboratories/helpers\";\nimport {\n PlBtnGhost,\n PlBtnSecondary,\n PlEditableTitle,\n PlElementList,\n PlSidebarItem,\n PlTextField,\n} from \"@milaboratories/uikit\";\nimport type { Annotation } from \"../types\";\nimport { validateTitle } from \"../utils\";\nimport { isEmpty } from \"es-toolkit/compat\";\n\nconst props = defineProps<{\n annotation: Annotation;\n selectedStepId: undefined | number;\n onUpdateAnnotation: (annotation: Annotation) => void;\n onUpdateSelectedStepId: (id: undefined | number) => void;\n}>();\n\nconst emits = defineEmits<{\n (e: \"delete-schema\"): void;\n}>();\n\nfunction produceAnnotationUpdate(updater: (draft: Annotation) => void) {\n props.onUpdateAnnotation(produce(props.annotation, updater));\n}\n\nfunction updateTitle(title: string) {\n produceAnnotationUpdate((draft) => {\n draft.title = title;\n });\n}\n\nfunction updateSteps(steps: Annotation[\"steps\"]) {\n produceAnnotationUpdate((draft) => {\n draft.steps = steps;\n });\n}\n\nfunction updateDefaultValue(value: string) {\n produceAnnotationUpdate((draft) => {\n draft.defaultValue = value === \"\" ? undefined : value;\n });\n}\n\nfunction handleAddStep() {\n const id = randomInt();\n produceAnnotationUpdate((draft) => {\n draft.steps.push({\n id,\n label: \"\",\n filter: {\n id: randomInt(),\n type: \"and\",\n filters: [],\n },\n });\n });\n props.onUpdateSelectedStepId(id);\n}\n</script>\n\n<template>\n <PlSidebarItem>\n <template #header-content>\n <PlEditableTitle\n :model-value=\"props.annotation.title\"\n :class=\"{ [$commonStyle.flashing]: props.annotation.title.length === 0 }\"\n :max-length=\"40\"\n max-width=\"600px\"\n placeholder=\"Annotation Title\"\n :autofocus=\"props.annotation.title.length === 0\"\n :validate=\"validateTitle\"\n @update:model-value=\"updateTitle\"\n />\n </template>\n <template v-if=\"props.annotation\" #body-content>\n <div :class=\"[$style.root, { [$commonStyle.disabled]: props.annotation.title.length === 0 }]\">\n <span :class=\"$style.tip\">\n Above annotations override the ones below. Rearrange them by dragging.\n </span>\n <PlElementList\n :items=\"props.annotation.steps\"\n :get-item-key=\"(item) => item.id\"\n :is-active=\"(item) => item.id === props.selectedStepId\"\n :item-class=\"$style.stepItem\"\n :class=\"$style.steps\"\n @update:items=\"updateSteps\"\n @item-click=\"(item) => props.onUpdateSelectedStepId(item.id)\"\n >\n <template #item-title=\"{ item }\">\n {{ item.label }}\n </template>\n </PlElementList>\n\n <PlBtnSecondary icon=\"add\" @click=\"handleAddStep\"> Add label </PlBtnSecondary>\n\n <PlTextField\n :class=\"[\n $style.defaultValue,\n { [$style.emptyDefaultValue]: isEmpty(props.annotation.defaultValue) },\n ]\"\n :model-value=\"props.annotation.defaultValue ?? ''\"\n label=\"Label remaining with\"\n placeholder=\"No label\"\n clearable\n helper=\"This label will be applied to the remaining rows, after all other filters are applied.\"\n @click.stop\n @update:model-value=\"updateDefaultValue\"\n />\n </div>\n </template>\n <template #footer-content>\n <PlBtnGhost\n icon=\"delete-bin\"\n reverse\n :disabled=\"props.annotation.steps.length === 0\"\n @click.stop=\"emits('delete-schema')\"\n >\n Delete Schema\n </PlBtnGhost>\n </template>\n </PlSidebarItem>\n</template>\n\n<style lang=\"scss\" module>\n@use \"@milaboratories/uikit/styles/variables\" as *;\n\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.tip {\n color: var(--txt-03);\n}\n\n.steps {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.stepItem {\n cursor: pointer;\n}\n\n.defaultValue {\n margin-top: 8px;\n}\n.emptyDefaultValue {\n opacity: 0.5;\n transition: opacity 0.2s ease-in-out;\n\n &:hover {\n opacity: 1;\n }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3B,CAjCN,EAiCM,OAAA,EAjCA,OAAK,EAAA,CAAGA,EAAAA,OAAO,MAAI,GAAK,EAAA,EAAY,CAAC,WAAW,EAAM,WAAW,MAAM,WAAM,GAAA,CAAA,CAAA,EAAA,EAAA;IACjF,EAEO,QAAA,EAFA,OAAK,EAAEA,EAAAA,OAAO,IAAG,EAAA,EAAE,4EAE1B,EAAA;IACA,EAYgB,EAAA,EAAA,EAAA;KAXb,OAAO,EAAM,WAAW;KACxB,iBAAe,MAAS,EAAK;KAC7B,cAAY,MAAS,EAAK,OAAO,EAAM;KACvC,cAAYA,EAAAA,OAAO;KACnB,OAAK,EAAEA,EAAAA,OAAO,MAAK;KACnB,kBAAc;KACd,aAAU,AAAA,EAAA,QAAG,MAAS,EAAM,uBAAuB,EAAK,GAAE;;KAEhD,cAAU,GACH,EADO,cAAI,CAAA,EAAA,EACxB,EAAK,MAAK,EAAA,EAAA,CAAA,CAAA;;;;;;;;;IAIjB,EAA8E,EAAA,EAAA,EAAA;KAA9D,MAAK;KAAO,SAAO;;sBAA0B,CAAA,GAAA,AAAA,EAAA,OAAA,CAAA,EAAX,eAAW,GAAA,CAAA,CAAA,CAAA;;;IAE7D,EAYE,EAAA,EAAA,EAAA;KAXC,OAAK,EAAA,CAAgBA,EAAAA,OAAO,cAAA,GAA6BA,EAAAA,OAAO,oBAAoB,EAAA,EAAO,CAAC,EAAM,WAAW,aAAY,EAAA,CAAA,CAAA;KAIzH,eAAa,EAAM,WAAW,gBAAY;KAC3C,OAAM;KACN,aAAY;KACZ,WAAA;KACA,QAAO;KACN,SAAK,AAAA,EAAA,OAAA,QAAN,IAAW,CAAA,OAAA,CAAA;KACV,uBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSidebar.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type Props = {\n columns: PlAdvancedFilterItem[];\n\n getSuggestOptions: (params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n }) => ListOptionBase<string | number>[] | Promise<ListOptionBase<string | number>[]>;\n\n hasSelectedColumns?: boolean;\n getValuesForSelectedColumns?: () => Promise<\n undefined | { columnId: PObjectId; values: string[] }\n >;\n};\n</script>\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { randomInt } from \"@milaboratories/helpers\";\nimport { PlBtnSecondary, PlEditableTitle, PlSidebarItem } from \"@milaboratories/uikit\";\nimport type { ListOptionBase, PObjectId, SUniversalPColumnId } from \"@platforma-sdk/model\";\n\nimport { PlAdvancedFilterComponent } from \"../../PlAdvancedFilter\";\nimport type {\n PlAdvancedFilterItem,\n PlAdvancedFilterColumnId,\n PlAdvancedFilterSupportedFilters,\n PlAdvancedFilter,\n} from \"../../PlAdvancedFilter\";\nimport type { Filter } from \"../types\";\n\nimport $commonStyle from \"./style.module.css\";\
|
|
1
|
+
{"version":3,"file":"FilterSidebar.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type Props = {\n columns: PlAdvancedFilterItem[];\n\n getSuggestOptions: (params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n }) => ListOptionBase<string | number>[] | Promise<ListOptionBase<string | number>[]>;\n\n hasSelectedColumns?: boolean;\n getValuesForSelectedColumns?: () => Promise<\n undefined | { columnId: PObjectId; values: string[] }\n >;\n};\n</script>\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { produce } from \"immer\";\nimport { randomInt } from \"@milaboratories/helpers\";\nimport { PlBtnSecondary, PlEditableTitle, PlSidebarItem } from \"@milaboratories/uikit\";\nimport type { ListOptionBase, PObjectId, SUniversalPColumnId } from \"@platforma-sdk/model\";\n\nimport { PlAdvancedFilterComponent } from \"../../PlAdvancedFilter\";\nimport type {\n PlAdvancedFilterItem,\n PlAdvancedFilterColumnId,\n PlAdvancedFilterSupportedFilters,\n PlAdvancedFilter,\n} from \"../../PlAdvancedFilter\";\nimport type { Filter } from \"../types\";\nimport { validateTitle } from \"../utils\";\n\nimport $commonStyle from \"./style.module.css\";\n\nconst props = defineProps<\n Props & {\n step: Filter;\n onUpdateStep: (step: Filter) => void;\n }\n>();\n\nconst withSelection = computed(() => {\n return props.hasSelectedColumns !== undefined && props.getValuesForSelectedColumns !== undefined;\n});\n\nfunction produceStepUpdate(updater: (draft: Filter) => void) {\n props.onUpdateStep(produce(props.step, updater));\n}\n\nfunction updateLabel(label: string) {\n produceStepUpdate((draft) => {\n draft.label = label;\n });\n}\n\nfunction updateFilter(filter: PlAdvancedFilter) {\n produceStepUpdate((draft) => {\n draft.filter = filter as typeof draft.filter;\n });\n}\n\nfunction addFilterPlaceholder() {\n if (props.columns.length === 0) return;\n produceStepUpdate((draft) => {\n draft.filter.filters.push({\n id: randomInt(),\n isExpanded: true,\n type: \"or\",\n filters: [\n {\n id: randomInt(),\n type: \"isNA\",\n column: props.columns[0].id as SUniversalPColumnId,\n },\n ],\n });\n });\n}\n\nasync function addFilterFromSelected() {\n if (props.hasSelectedColumns === undefined || props.getValuesForSelectedColumns === undefined)\n return;\n\n const data = await props.getValuesForSelectedColumns();\n if (!data || data.values.length === 0) return;\n\n const { columnId, values } = data;\n const shortReminder =\n values.slice(0, 3).join(\", \") + (values.length > 3 ? ` and ${values.length - 3} more` : \"\");\n\n produceStepUpdate((draft) => {\n draft.filter.filters.push({\n id: randomInt(),\n name: `Selected list (${shortReminder})`,\n isExpanded: false,\n type: \"or\",\n filters: values.map((value, i) => ({\n id: i,\n type: \"patternEquals\",\n column: columnId as SUniversalPColumnId,\n value,\n })),\n });\n });\n}\n\nconst supportedFilters = [\n \"isNA\",\n \"isNotNA\",\n \"greaterThan\",\n \"greaterThanOrEqual\",\n \"lessThan\",\n \"lessThanOrEqual\",\n \"patternEquals\",\n \"patternNotEquals\",\n \"patternContainSubsequence\",\n \"patternNotContainSubsequence\",\n \"equal\",\n \"notEqual\",\n \"topN\",\n \"bottomN\",\n] as (typeof PlAdvancedFilterSupportedFilters)[number][];\n</script>\n\n<template>\n <PlSidebarItem v-if=\"props.step\">\n <template #header-content>\n <PlEditableTitle\n :key=\"props.step.id\"\n :model-value=\"props.step.label\"\n :class=\"{ [$commonStyle.flashing]: props.step.label.length === 0 }\"\n :max-length=\"40\"\n max-width=\"600px\"\n placeholder=\"Label\"\n :autofocus=\"props.step.label.length === 0\"\n :validate=\"validateTitle\"\n @update:model-value=\"updateLabel\"\n />\n </template>\n <template #body-content>\n <PlAdvancedFilterComponent\n :class=\"[$style.root, { [$commonStyle.disabled]: props.step.label.length === 0 }]\"\n :options=\"props.columns\"\n :filters=\"props.step.filter as PlAdvancedFilter\"\n :on-update-filters=\"updateFilter\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"props.getSuggestOptions\"\n :enable-dnd=\"false\"\n :enable-add-group-button=\"true\"\n >\n <template #add-group-buttons>\n <div :class=\"$style.actions\">\n <PlBtnSecondary icon=\"add\" @click=\"addFilterPlaceholder\"> Add Filter </PlBtnSecondary>\n <PlBtnSecondary\n v-if=\"withSelection\"\n icon=\"add\"\n :disabled=\"props.hasSelectedColumns !== true\"\n @click=\"addFilterFromSelected\"\n >\n From selection\n </PlBtnSecondary>\n </div>\n </template>\n </PlAdvancedFilterComponent>\n </template>\n </PlSidebarItem>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.actions {\n display: flex;\n flex-direction: row;\n gap: 12px;\n}\n</style>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSidebar.vue_vue_type_style_index_0_lang.module.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type Props = {\n columns: PlAdvancedFilterItem[];\n\n getSuggestOptions: (params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n }) => ListOptionBase<string | number>[] | Promise<ListOptionBase<string | number>[]>;\n\n hasSelectedColumns?: boolean;\n getValuesForSelectedColumns?: () => Promise<\n undefined | { columnId: PObjectId; values: string[] }\n >;\n};\n</script>\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { randomInt } from \"@milaboratories/helpers\";\nimport { PlBtnSecondary, PlEditableTitle, PlSidebarItem } from \"@milaboratories/uikit\";\nimport type { ListOptionBase, PObjectId, SUniversalPColumnId } from \"@platforma-sdk/model\";\n\nimport { PlAdvancedFilterComponent } from \"../../PlAdvancedFilter\";\nimport type {\n PlAdvancedFilterItem,\n PlAdvancedFilterColumnId,\n PlAdvancedFilterSupportedFilters,\n PlAdvancedFilter,\n} from \"../../PlAdvancedFilter\";\nimport type { Filter } from \"../types\";\n\nimport $commonStyle from \"./style.module.css\";\
|
|
1
|
+
{"version":3,"file":"FilterSidebar.vue_vue_type_style_index_0_lang.module.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type Props = {\n columns: PlAdvancedFilterItem[];\n\n getSuggestOptions: (params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n }) => ListOptionBase<string | number>[] | Promise<ListOptionBase<string | number>[]>;\n\n hasSelectedColumns?: boolean;\n getValuesForSelectedColumns?: () => Promise<\n undefined | { columnId: PObjectId; values: string[] }\n >;\n};\n</script>\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { produce } from \"immer\";\nimport { randomInt } from \"@milaboratories/helpers\";\nimport { PlBtnSecondary, PlEditableTitle, PlSidebarItem } from \"@milaboratories/uikit\";\nimport type { ListOptionBase, PObjectId, SUniversalPColumnId } from \"@platforma-sdk/model\";\n\nimport { PlAdvancedFilterComponent } from \"../../PlAdvancedFilter\";\nimport type {\n PlAdvancedFilterItem,\n PlAdvancedFilterColumnId,\n PlAdvancedFilterSupportedFilters,\n PlAdvancedFilter,\n} from \"../../PlAdvancedFilter\";\nimport type { Filter } from \"../types\";\nimport { validateTitle } from \"../utils\";\n\nimport $commonStyle from \"./style.module.css\";\n\nconst props = defineProps<\n Props & {\n step: Filter;\n onUpdateStep: (step: Filter) => void;\n }\n>();\n\nconst withSelection = computed(() => {\n return props.hasSelectedColumns !== undefined && props.getValuesForSelectedColumns !== undefined;\n});\n\nfunction produceStepUpdate(updater: (draft: Filter) => void) {\n props.onUpdateStep(produce(props.step, updater));\n}\n\nfunction updateLabel(label: string) {\n produceStepUpdate((draft) => {\n draft.label = label;\n });\n}\n\nfunction updateFilter(filter: PlAdvancedFilter) {\n produceStepUpdate((draft) => {\n draft.filter = filter as typeof draft.filter;\n });\n}\n\nfunction addFilterPlaceholder() {\n if (props.columns.length === 0) return;\n produceStepUpdate((draft) => {\n draft.filter.filters.push({\n id: randomInt(),\n isExpanded: true,\n type: \"or\",\n filters: [\n {\n id: randomInt(),\n type: \"isNA\",\n column: props.columns[0].id as SUniversalPColumnId,\n },\n ],\n });\n });\n}\n\nasync function addFilterFromSelected() {\n if (props.hasSelectedColumns === undefined || props.getValuesForSelectedColumns === undefined)\n return;\n\n const data = await props.getValuesForSelectedColumns();\n if (!data || data.values.length === 0) return;\n\n const { columnId, values } = data;\n const shortReminder =\n values.slice(0, 3).join(\", \") + (values.length > 3 ? ` and ${values.length - 3} more` : \"\");\n\n produceStepUpdate((draft) => {\n draft.filter.filters.push({\n id: randomInt(),\n name: `Selected list (${shortReminder})`,\n isExpanded: false,\n type: \"or\",\n filters: values.map((value, i) => ({\n id: i,\n type: \"patternEquals\",\n column: columnId as SUniversalPColumnId,\n value,\n })),\n });\n });\n}\n\nconst supportedFilters = [\n \"isNA\",\n \"isNotNA\",\n \"greaterThan\",\n \"greaterThanOrEqual\",\n \"lessThan\",\n \"lessThanOrEqual\",\n \"patternEquals\",\n \"patternNotEquals\",\n \"patternContainSubsequence\",\n \"patternNotContainSubsequence\",\n \"equal\",\n \"notEqual\",\n \"topN\",\n \"bottomN\",\n] as (typeof PlAdvancedFilterSupportedFilters)[number][];\n</script>\n\n<template>\n <PlSidebarItem v-if=\"props.step\">\n <template #header-content>\n <PlEditableTitle\n :key=\"props.step.id\"\n :model-value=\"props.step.label\"\n :class=\"{ [$commonStyle.flashing]: props.step.label.length === 0 }\"\n :max-length=\"40\"\n max-width=\"600px\"\n placeholder=\"Label\"\n :autofocus=\"props.step.label.length === 0\"\n :validate=\"validateTitle\"\n @update:model-value=\"updateLabel\"\n />\n </template>\n <template #body-content>\n <PlAdvancedFilterComponent\n :class=\"[$style.root, { [$commonStyle.disabled]: props.step.label.length === 0 }]\"\n :options=\"props.columns\"\n :filters=\"props.step.filter as PlAdvancedFilter\"\n :on-update-filters=\"updateFilter\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"props.getSuggestOptions\"\n :enable-dnd=\"false\"\n :enable-add-group-button=\"true\"\n >\n <template #add-group-buttons>\n <div :class=\"$style.actions\">\n <PlBtnSecondary icon=\"add\" @click=\"addFilterPlaceholder\"> Add Filter </PlBtnSecondary>\n <PlBtnSecondary\n v-if=\"withSelection\"\n icon=\"add\"\n :disabled=\"props.hasSelectedColumns !== true\"\n @click=\"addFilterFromSelected\"\n >\n From selection\n </PlBtnSecondary>\n </div>\n </template>\n </PlAdvancedFilterComponent>\n </template>\n </PlSidebarItem>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.actions {\n display: flex;\n flex-direction: row;\n gap: 12px;\n}\n</style>\n"],"mappings":""}
|
|
@@ -15,14 +15,12 @@ export type Props = {
|
|
|
15
15
|
values: string[];
|
|
16
16
|
}>;
|
|
17
17
|
};
|
|
18
|
-
declare const _default: import('vue').DefineComponent<{
|
|
18
|
+
declare const _default: import('vue').DefineComponent<Props & {
|
|
19
19
|
step: Filter;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, string, import('vue').PublicProps, Readonly<{
|
|
20
|
+
onUpdateStep: (step: Filter) => void;
|
|
21
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props & {
|
|
23
22
|
step: Filter;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
onUpdateStep: (step: Filter) => void;
|
|
24
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
27
25
|
export default _default;
|
|
28
26
|
//# sourceMappingURL=FilterSidebar.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"names":[],"mappings":"AA6LA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAuB,MAAM,sBAAsB,CAAC;AAG3F,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EAGzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMvC,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAEhC,iBAAiB,EAAE,CAAC,MAAM,EAAE;QAC1B,QAAQ,EAAE,wBAAwB,CAAC;QACnC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC;KAC/B,KAAK,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IAErF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2BAA2B,CAAC,EAAE,MAAM,OAAO,CACzC,SAAS,GAAG;QAAE,QAAQ,EAAE,SAAS,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CACtD,CAAC;CACH,CAAC;;UAIQ,MAAM;kBACE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;;UAD9B,MAAM;kBACE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;;AAHxC,wBA+QK"}
|
|
@@ -4,53 +4,70 @@ import t from "../../PlAdvancedFilter/PlAdvancedFilter.js";
|
|
|
4
4
|
import "../../PlAdvancedFilter/index.js";
|
|
5
5
|
import n from "./style.module.js";
|
|
6
6
|
import { validateTitle as r } from "../utils.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { produce as i } from "immer";
|
|
8
|
+
import { computed as a, createBlock as o, createCommentVNode as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, unref as m, withCtx as h } from "vue";
|
|
9
|
+
import { PlBtnSecondary as g, PlEditableTitle as _, PlSidebarItem as v } from "@milaboratories/uikit";
|
|
9
10
|
//#region src/components/PlAnnotations/components/FilterSidebar.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var
|
|
11
|
+
var y = /* @__PURE__ */ d({
|
|
11
12
|
__name: "FilterSidebar",
|
|
12
|
-
props:
|
|
13
|
+
props: {
|
|
13
14
|
columns: {},
|
|
14
15
|
getSuggestOptions: { type: Function },
|
|
15
16
|
hasSelectedColumns: { type: Boolean },
|
|
16
|
-
getValuesForSelectedColumns: { type: Function }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
getValuesForSelectedColumns: { type: Function },
|
|
18
|
+
step: {},
|
|
19
|
+
onUpdateStep: { type: Function }
|
|
20
|
+
},
|
|
21
|
+
setup(d) {
|
|
22
|
+
let y = d, b = a(() => y.hasSelectedColumns !== void 0 && y.getValuesForSelectedColumns !== void 0);
|
|
23
|
+
function x(e) {
|
|
24
|
+
y.onUpdateStep(i(y.step, e));
|
|
25
|
+
}
|
|
26
|
+
function S(e) {
|
|
27
|
+
x((t) => {
|
|
28
|
+
t.label = e;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function C(e) {
|
|
32
|
+
x((t) => {
|
|
33
|
+
t.filter = e;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function w() {
|
|
37
|
+
y.columns.length !== 0 && x((t) => {
|
|
38
|
+
t.filter.filters.push({
|
|
29
39
|
id: e(),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
isExpanded: !0,
|
|
41
|
+
type: "or",
|
|
42
|
+
filters: [{
|
|
43
|
+
id: e(),
|
|
44
|
+
type: "isNA",
|
|
45
|
+
column: y.columns[0].id
|
|
46
|
+
}]
|
|
47
|
+
});
|
|
33
48
|
});
|
|
34
|
-
}
|
|
35
|
-
async function
|
|
36
|
-
if (
|
|
37
|
-
let t = await
|
|
49
|
+
}
|
|
50
|
+
async function T() {
|
|
51
|
+
if (y.hasSelectedColumns === void 0 || y.getValuesForSelectedColumns === void 0) return;
|
|
52
|
+
let t = await y.getValuesForSelectedColumns();
|
|
38
53
|
if (!t || t.values.length === 0) return;
|
|
39
54
|
let { columnId: n, values: r } = t, i = r.slice(0, 3).join(", ") + (r.length > 3 ? ` and ${r.length - 3} more` : "");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
x((t) => {
|
|
56
|
+
t.filter.filters.push({
|
|
57
|
+
id: e(),
|
|
58
|
+
name: `Selected list (${i})`,
|
|
59
|
+
isExpanded: !1,
|
|
60
|
+
type: "or",
|
|
61
|
+
filters: r.map((e, t) => ({
|
|
62
|
+
id: t,
|
|
63
|
+
type: "patternEquals",
|
|
64
|
+
column: n,
|
|
65
|
+
value: e
|
|
66
|
+
}))
|
|
67
|
+
});
|
|
51
68
|
});
|
|
52
69
|
}
|
|
53
|
-
let
|
|
70
|
+
let E = [
|
|
54
71
|
"isNA",
|
|
55
72
|
"isNotNA",
|
|
56
73
|
"greaterThan",
|
|
@@ -66,63 +83,60 @@ var b = /* @__PURE__ */ u({
|
|
|
66
83
|
"topN",
|
|
67
84
|
"bottomN"
|
|
68
85
|
];
|
|
69
|
-
return (e, i) =>
|
|
70
|
-
"header-content":
|
|
71
|
-
key:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class: f({ [m(n).flashing]: d.value.label.length === 0 }),
|
|
86
|
+
return (e, i) => y.step ? (p(), o(m(v), { key: 0 }, {
|
|
87
|
+
"header-content": h(() => [(p(), o(m(_), {
|
|
88
|
+
key: y.step.id,
|
|
89
|
+
"model-value": y.step.label,
|
|
90
|
+
class: f({ [m(n).flashing]: y.step.label.length === 0 }),
|
|
75
91
|
"max-length": 40,
|
|
76
92
|
"max-width": "600px",
|
|
77
93
|
placeholder: "Label",
|
|
78
|
-
autofocus:
|
|
79
|
-
validate: m(r)
|
|
94
|
+
autofocus: y.step.label.length === 0,
|
|
95
|
+
validate: m(r),
|
|
96
|
+
"onUpdate:modelValue": S
|
|
80
97
|
}, null, 8, [
|
|
81
|
-
"
|
|
98
|
+
"model-value",
|
|
82
99
|
"class",
|
|
83
100
|
"autofocus",
|
|
84
101
|
"validate"
|
|
85
102
|
]))]),
|
|
86
|
-
"body-content":
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
"
|
|
103
|
+
"body-content": h(() => [u(m(t), {
|
|
104
|
+
class: f([e.$style.root, { [m(n).disabled]: y.step.label.length === 0 }]),
|
|
105
|
+
options: y.columns,
|
|
106
|
+
filters: y.step.filter,
|
|
107
|
+
"on-update-filters": C,
|
|
108
|
+
"supported-filters": E,
|
|
109
|
+
"get-suggest-options": y.getSuggestOptions,
|
|
92
110
|
"enable-dnd": !1,
|
|
93
|
-
"enable-add-group-button": !0
|
|
94
|
-
onUpdateFilters: i[1] ||= (e) => d.value = {
|
|
95
|
-
...d.value,
|
|
96
|
-
filter: e
|
|
97
|
-
}
|
|
111
|
+
"enable-add-group-button": !0
|
|
98
112
|
}, {
|
|
99
|
-
"add-group-buttons":
|
|
113
|
+
"add-group-buttons": h(() => [c("div", { class: f(e.$style.actions) }, [u(m(g), {
|
|
100
114
|
icon: "add",
|
|
101
|
-
onClick:
|
|
115
|
+
onClick: w
|
|
102
116
|
}, {
|
|
103
|
-
default:
|
|
117
|
+
default: h(() => [...i[0] ||= [l(" Add Filter ", -1)]]),
|
|
104
118
|
_: 1
|
|
105
|
-
}),
|
|
119
|
+
}), b.value ? (p(), o(m(g), {
|
|
106
120
|
key: 0,
|
|
107
121
|
icon: "add",
|
|
108
|
-
disabled:
|
|
109
|
-
onClick:
|
|
122
|
+
disabled: y.hasSelectedColumns !== !0,
|
|
123
|
+
onClick: T
|
|
110
124
|
}, {
|
|
111
|
-
default:
|
|
125
|
+
default: h(() => [...i[1] ||= [l(" From selection ", -1)]]),
|
|
112
126
|
_: 1
|
|
113
|
-
}, 8, ["disabled"])) :
|
|
127
|
+
}, 8, ["disabled"])) : s("", !0)], 2)]),
|
|
114
128
|
_: 1
|
|
115
129
|
}, 8, [
|
|
116
|
-
"filters",
|
|
117
130
|
"class",
|
|
118
131
|
"options",
|
|
132
|
+
"filters",
|
|
119
133
|
"get-suggest-options"
|
|
120
134
|
])]),
|
|
121
135
|
_: 1
|
|
122
|
-
})) :
|
|
136
|
+
})) : s("", !0);
|
|
123
137
|
}
|
|
124
138
|
});
|
|
125
139
|
//#endregion
|
|
126
|
-
export {
|
|
140
|
+
export { y as default };
|
|
127
141
|
|
|
128
142
|
//# sourceMappingURL=FilterSidebar.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSidebar.vue_vue_type_script_setup_true_lang.js","names":["$style"],"sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type Props = {\n columns: PlAdvancedFilterItem[];\n\n getSuggestOptions: (params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n }) => ListOptionBase<string | number>[] | Promise<ListOptionBase<string | number>[]>;\n\n hasSelectedColumns?: boolean;\n getValuesForSelectedColumns?: () => Promise<\n undefined | { columnId: PObjectId; values: string[] }\n >;\n};\n</script>\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { randomInt } from \"@milaboratories/helpers\";\nimport { PlBtnSecondary, PlEditableTitle, PlSidebarItem } from \"@milaboratories/uikit\";\nimport type { ListOptionBase, PObjectId, SUniversalPColumnId } from \"@platforma-sdk/model\";\n\nimport { PlAdvancedFilterComponent } from \"../../PlAdvancedFilter\";\nimport type {\n PlAdvancedFilterItem,\n PlAdvancedFilterColumnId,\n PlAdvancedFilterSupportedFilters,\n PlAdvancedFilter,\n} from \"../../PlAdvancedFilter\";\nimport type { Filter } from \"../types\";\n\nimport $commonStyle from \"./style.module.css\";\
|
|
1
|
+
{"version":3,"file":"FilterSidebar.vue_vue_type_script_setup_true_lang.js","names":["$style"],"sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type Props = {\n columns: PlAdvancedFilterItem[];\n\n getSuggestOptions: (params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n }) => ListOptionBase<string | number>[] | Promise<ListOptionBase<string | number>[]>;\n\n hasSelectedColumns?: boolean;\n getValuesForSelectedColumns?: () => Promise<\n undefined | { columnId: PObjectId; values: string[] }\n >;\n};\n</script>\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { produce } from \"immer\";\nimport { randomInt } from \"@milaboratories/helpers\";\nimport { PlBtnSecondary, PlEditableTitle, PlSidebarItem } from \"@milaboratories/uikit\";\nimport type { ListOptionBase, PObjectId, SUniversalPColumnId } from \"@platforma-sdk/model\";\n\nimport { PlAdvancedFilterComponent } from \"../../PlAdvancedFilter\";\nimport type {\n PlAdvancedFilterItem,\n PlAdvancedFilterColumnId,\n PlAdvancedFilterSupportedFilters,\n PlAdvancedFilter,\n} from \"../../PlAdvancedFilter\";\nimport type { Filter } from \"../types\";\nimport { validateTitle } from \"../utils\";\n\nimport $commonStyle from \"./style.module.css\";\n\nconst props = defineProps<\n Props & {\n step: Filter;\n onUpdateStep: (step: Filter) => void;\n }\n>();\n\nconst withSelection = computed(() => {\n return props.hasSelectedColumns !== undefined && props.getValuesForSelectedColumns !== undefined;\n});\n\nfunction produceStepUpdate(updater: (draft: Filter) => void) {\n props.onUpdateStep(produce(props.step, updater));\n}\n\nfunction updateLabel(label: string) {\n produceStepUpdate((draft) => {\n draft.label = label;\n });\n}\n\nfunction updateFilter(filter: PlAdvancedFilter) {\n produceStepUpdate((draft) => {\n draft.filter = filter as typeof draft.filter;\n });\n}\n\nfunction addFilterPlaceholder() {\n if (props.columns.length === 0) return;\n produceStepUpdate((draft) => {\n draft.filter.filters.push({\n id: randomInt(),\n isExpanded: true,\n type: \"or\",\n filters: [\n {\n id: randomInt(),\n type: \"isNA\",\n column: props.columns[0].id as SUniversalPColumnId,\n },\n ],\n });\n });\n}\n\nasync function addFilterFromSelected() {\n if (props.hasSelectedColumns === undefined || props.getValuesForSelectedColumns === undefined)\n return;\n\n const data = await props.getValuesForSelectedColumns();\n if (!data || data.values.length === 0) return;\n\n const { columnId, values } = data;\n const shortReminder =\n values.slice(0, 3).join(\", \") + (values.length > 3 ? ` and ${values.length - 3} more` : \"\");\n\n produceStepUpdate((draft) => {\n draft.filter.filters.push({\n id: randomInt(),\n name: `Selected list (${shortReminder})`,\n isExpanded: false,\n type: \"or\",\n filters: values.map((value, i) => ({\n id: i,\n type: \"patternEquals\",\n column: columnId as SUniversalPColumnId,\n value,\n })),\n });\n });\n}\n\nconst supportedFilters = [\n \"isNA\",\n \"isNotNA\",\n \"greaterThan\",\n \"greaterThanOrEqual\",\n \"lessThan\",\n \"lessThanOrEqual\",\n \"patternEquals\",\n \"patternNotEquals\",\n \"patternContainSubsequence\",\n \"patternNotContainSubsequence\",\n \"equal\",\n \"notEqual\",\n \"topN\",\n \"bottomN\",\n] as (typeof PlAdvancedFilterSupportedFilters)[number][];\n</script>\n\n<template>\n <PlSidebarItem v-if=\"props.step\">\n <template #header-content>\n <PlEditableTitle\n :key=\"props.step.id\"\n :model-value=\"props.step.label\"\n :class=\"{ [$commonStyle.flashing]: props.step.label.length === 0 }\"\n :max-length=\"40\"\n max-width=\"600px\"\n placeholder=\"Label\"\n :autofocus=\"props.step.label.length === 0\"\n :validate=\"validateTitle\"\n @update:model-value=\"updateLabel\"\n />\n </template>\n <template #body-content>\n <PlAdvancedFilterComponent\n :class=\"[$style.root, { [$commonStyle.disabled]: props.step.label.length === 0 }]\"\n :options=\"props.columns\"\n :filters=\"props.step.filter as PlAdvancedFilter\"\n :on-update-filters=\"updateFilter\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"props.getSuggestOptions\"\n :enable-dnd=\"false\"\n :enable-add-group-button=\"true\"\n >\n <template #add-group-buttons>\n <div :class=\"$style.actions\">\n <PlBtnSecondary icon=\"add\" @click=\"addFilterPlaceholder\"> Add Filter </PlBtnSecondary>\n <PlBtnSecondary\n v-if=\"withSelection\"\n icon=\"add\"\n :disabled=\"props.hasSelectedColumns !== true\"\n @click=\"addFilterFromSelected\"\n >\n From selection\n </PlBtnSecondary>\n </div>\n </template>\n </PlAdvancedFilterComponent>\n </template>\n </PlSidebarItem>\n</template>\n\n<style module>\n.root {\n display: flex;\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ations.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/PlAnnotations.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Props as BaseProps } from \"./FilterSidebar.vue\";\nexport type Props = BaseProps & {\n onDeleteSchema?: () => void;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, effect, shallowRef } from \"vue\";\n\nimport { isNil } from \"@milaboratories/helpers\";\nimport { PlSidebarGroup, useConfirm } from \"@milaboratories/uikit\";\n\nimport type { Annotation } from \"../types\";\nimport AnnotationsSidebar from \"./AnnotationsSidebar.vue\";\nimport FilterSidebar from \"./FilterSidebar.vue\";\n\
|
|
1
|
+
{"version":3,"file":"PlAnnotations.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/PlAnnotations.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Props as BaseProps } from \"./FilterSidebar.vue\";\nexport type Props = Omit<BaseProps, \"step\" | \"onUpdateStep\"> & {\n annotation: Annotation;\n onUpdateAnnotation: (annotation: Annotation) => void;\n onDeleteSchema?: () => void;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, effect, shallowRef } from \"vue\";\n\nimport { isNil } from \"@milaboratories/helpers\";\nimport { produce } from \"immer\";\nimport { PlSidebarGroup, useConfirm } from \"@milaboratories/uikit\";\n\nimport type { Annotation, Filter } from \"../types\";\nimport AnnotationsSidebar from \"./AnnotationsSidebar.vue\";\nimport FilterSidebar from \"./FilterSidebar.vue\";\n\nconst props = defineProps<Props>();\n\nconst selectedStepId = shallowRef<undefined | number>(undefined);\n\nconst selectedStep = computed(() => {\n return isNil(selectedStepId.value) || isNil(props.annotation)\n ? undefined\n : props.annotation.steps.find((step) => step.id === selectedStepId.value);\n});\n\neffect(function setDefaultStepId() {\n if (selectedStepId.value === undefined && props.annotation.steps.length > 0) {\n selectedStepId.value = props.annotation.steps[0].id;\n }\n});\n\nconst confirmResetSchema = useConfirm({\n title: \"Reset Schema\",\n message: \"Are you sure you want to reset the schema? This action cannot be undone.\",\n confirmLabel: \"Yes, reset\",\n cancelLabel: \"No, cancel\",\n});\n\nasync function handleDeleteSchema() {\n if (await confirmResetSchema()) {\n selectedStepId.value = undefined;\n props.onDeleteSchema?.();\n }\n}\n\nfunction updateSelectedStepId(id: undefined | number) {\n selectedStepId.value = id;\n}\n\nfunction updateSelectedStep(step: Filter) {\n props.onUpdateAnnotation(\n produce(props.annotation, (draft) => {\n const idx = draft.steps.findIndex((s) => s.id === step.id);\n if (idx !== -1) {\n draft.steps[idx] = step;\n }\n }),\n );\n}\n</script>\n\n<template>\n <PlSidebarGroup>\n <template #item-0>\n <AnnotationsSidebar\n :annotation=\"props.annotation\"\n :selected-step-id=\"selectedStepId\"\n :on-update-annotation=\"props.onUpdateAnnotation\"\n :on-update-selected-step-id=\"updateSelectedStepId\"\n :class=\"$style.sidebarItem\"\n @delete-schema=\"handleDeleteSchema\"\n />\n </template>\n <template #item-1>\n <FilterSidebar\n v-if=\"selectedStep\"\n :step=\"selectedStep\"\n :on-update-step=\"updateSelectedStep\"\n :class=\"$style.sidebarItem\"\n :columns=\"props.columns\"\n :get-suggest-options=\"props.getSuggestOptions\"\n :hasSelectedColumns=\"props.hasSelectedColumns\"\n :getValuesForSelectedColumns=\"props.getValuesForSelectedColumns\"\n />\n </template>\n </PlSidebarGroup>\n</template>\n\n<style module>\n.sidebarItem {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlAnnotations.vue_vue_type_style_index_0_lang.module.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/PlAnnotations.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Props as BaseProps } from \"./FilterSidebar.vue\";\nexport type Props = BaseProps & {\n onDeleteSchema?: () => void;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, effect, shallowRef } from \"vue\";\n\nimport { isNil } from \"@milaboratories/helpers\";\nimport { PlSidebarGroup, useConfirm } from \"@milaboratories/uikit\";\n\nimport type { Annotation } from \"../types\";\nimport AnnotationsSidebar from \"./AnnotationsSidebar.vue\";\nimport FilterSidebar from \"./FilterSidebar.vue\";\n\
|
|
1
|
+
{"version":3,"file":"PlAnnotations.vue_vue_type_style_index_0_lang.module.js","names":[],"sources":["../../../../src/components/PlAnnotations/components/PlAnnotations.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Props as BaseProps } from \"./FilterSidebar.vue\";\nexport type Props = Omit<BaseProps, \"step\" | \"onUpdateStep\"> & {\n annotation: Annotation;\n onUpdateAnnotation: (annotation: Annotation) => void;\n onDeleteSchema?: () => void;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, effect, shallowRef } from \"vue\";\n\nimport { isNil } from \"@milaboratories/helpers\";\nimport { produce } from \"immer\";\nimport { PlSidebarGroup, useConfirm } from \"@milaboratories/uikit\";\n\nimport type { Annotation, Filter } from \"../types\";\nimport AnnotationsSidebar from \"./AnnotationsSidebar.vue\";\nimport FilterSidebar from \"./FilterSidebar.vue\";\n\nconst props = defineProps<Props>();\n\nconst selectedStepId = shallowRef<undefined | number>(undefined);\n\nconst selectedStep = computed(() => {\n return isNil(selectedStepId.value) || isNil(props.annotation)\n ? undefined\n : props.annotation.steps.find((step) => step.id === selectedStepId.value);\n});\n\neffect(function setDefaultStepId() {\n if (selectedStepId.value === undefined && props.annotation.steps.length > 0) {\n selectedStepId.value = props.annotation.steps[0].id;\n }\n});\n\nconst confirmResetSchema = useConfirm({\n title: \"Reset Schema\",\n message: \"Are you sure you want to reset the schema? This action cannot be undone.\",\n confirmLabel: \"Yes, reset\",\n cancelLabel: \"No, cancel\",\n});\n\nasync function handleDeleteSchema() {\n if (await confirmResetSchema()) {\n selectedStepId.value = undefined;\n props.onDeleteSchema?.();\n }\n}\n\nfunction updateSelectedStepId(id: undefined | number) {\n selectedStepId.value = id;\n}\n\nfunction updateSelectedStep(step: Filter) {\n props.onUpdateAnnotation(\n produce(props.annotation, (draft) => {\n const idx = draft.steps.findIndex((s) => s.id === step.id);\n if (idx !== -1) {\n draft.steps[idx] = step;\n }\n }),\n );\n}\n</script>\n\n<template>\n <PlSidebarGroup>\n <template #item-0>\n <AnnotationsSidebar\n :annotation=\"props.annotation\"\n :selected-step-id=\"selectedStepId\"\n :on-update-annotation=\"props.onUpdateAnnotation\"\n :on-update-selected-step-id=\"updateSelectedStepId\"\n :class=\"$style.sidebarItem\"\n @delete-schema=\"handleDeleteSchema\"\n />\n </template>\n <template #item-1>\n <FilterSidebar\n v-if=\"selectedStep\"\n :step=\"selectedStep\"\n :on-update-step=\"updateSelectedStep\"\n :class=\"$style.sidebarItem\"\n :columns=\"props.columns\"\n :get-suggest-options=\"props.getSuggestOptions\"\n :hasSelectedColumns=\"props.hasSelectedColumns\"\n :getValuesForSelectedColumns=\"props.getValuesForSelectedColumns\"\n />\n </template>\n </PlSidebarGroup>\n</template>\n\n<style module>\n.sidebarItem {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"mappings":""}
|