@platforma-sdk/ui-vue 1.44.14 → 1.45.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 +27 -16
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +24 -0
- package/dist/AgGridVue/useAgGridOptions.js +3 -2
- package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.js +8 -7
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js +10 -9
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js.map +1 -1
- package/dist/components/PlAgRowNumHeader.vue.js +3 -2
- package/dist/components/PlAgRowNumHeader.vue.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue.d.ts +4 -4
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/DynamicForm.vue.d.ts +5 -4
- package/dist/components/PlAnnotations/components/DynamicForm.vue2.js +64 -61
- package/dist/components/PlAnnotations/components/DynamicForm.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue.d.ts +13 -12
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +49 -48
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue.d.ts +19 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue.js +10 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue.js.map +1 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js +66 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue3.js +13 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue3.js.map +1 -0
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue.d.ts +6 -13
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js +35 -78
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/index.d.ts +1 -0
- package/dist/components/PlAnnotations/types.d.ts +12 -6
- package/dist/components/PlAnnotations/utils.d.ts +4 -4
- package/dist/components/PlAnnotations/utils.js +2 -11
- package/dist/components/PlAnnotations/utils.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Item.vue.d.ts +6 -0
- package/dist/components/PlBtnExportArchive/Item.vue.js +10 -0
- package/dist/components/PlBtnExportArchive/Item.vue.js.map +1 -0
- package/dist/components/PlBtnExportArchive/Item.vue2.js +43 -0
- package/dist/components/PlBtnExportArchive/Item.vue2.js.map +1 -0
- package/dist/components/PlBtnExportArchive/Item.vue3.js +15 -0
- package/dist/components/PlBtnExportArchive/Item.vue3.js.map +1 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue.d.ts +34 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue.js +10 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue.js.map +1 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js +154 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js.map +1 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue3.js +13 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue3.js.map +1 -0
- package/dist/components/PlBtnExportArchive/Summary.vue.d.ts +10 -0
- package/dist/components/PlBtnExportArchive/Summary.vue.js +10 -0
- package/dist/components/PlBtnExportArchive/Summary.vue.js.map +1 -0
- package/dist/components/PlBtnExportArchive/Summary.vue2.js +42 -0
- package/dist/components/PlBtnExportArchive/Summary.vue2.js.map +1 -0
- package/dist/components/PlBtnExportArchive/Summary.vue3.js +13 -0
- package/dist/components/PlBtnExportArchive/Summary.vue3.js.map +1 -0
- package/dist/components/PlBtnExportArchive/index.d.ts +2 -0
- package/dist/components/PlBtnExportArchive/types.d.ts +14 -0
- package/dist/index.js +44 -40
- package/dist/index.js.map +1 -1
- package/dist/lib/util/helpers/dist/prettyBytes.js +68 -0
- package/dist/lib/util/helpers/dist/prettyBytes.js.map +1 -0
- package/dist/lib.d.ts +1 -0
- package/package.json +8 -6
- package/src/components/PlAnnotations/components/AnnotationsSidebar.vue +2 -2
- package/src/components/PlAnnotations/components/DynamicForm.vue +16 -9
- package/src/components/PlAnnotations/components/FilterSidebar.vue +23 -13
- package/src/components/PlAnnotations/components/PlAnnotations.vue +92 -0
- package/src/components/PlAnnotations/components/PlAnnotationsModal.vue +19 -77
- package/src/components/PlAnnotations/index.ts +1 -0
- package/src/components/PlAnnotations/types.ts +7 -6
- package/src/components/PlAnnotations/utils.ts +5 -13
- package/src/components/PlBtnExportArchive/Item.vue +66 -0
- package/src/components/PlBtnExportArchive/PlBtnExportArchive.vue +235 -0
- package/src/components/PlBtnExportArchive/Summary.vue +56 -0
- package/src/components/PlBtnExportArchive/index.ts +2 -0
- package/src/components/PlBtnExportArchive/types.ts +17 -0
- package/src/lib.ts +2 -0
- package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue.d.ts +0 -18
- package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue.js +0 -73
- package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue.js.map +0 -1
- package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue2.js +0 -5
- package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue2.js.map +0 -1
- package/src/components/PlAnnotations/components/PlAnnotationCreateDialog.vue +0 -64
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isNil as
|
|
3
|
-
import { PlDropdown as
|
|
4
|
-
|
|
5
|
-
const I = { key: 7 }, G = /* @__PURE__ */ g({
|
|
1
|
+
import { defineComponent as D, mergeModels as O, useModel as _, computed as c, watch as h, resolveComponent as P, createElementBlock as v, createCommentVNode as V, openBlock as u, normalizeClass as B, Fragment as i, renderList as S, createBlock as p, unref as s, withCtx as j, createTextVNode as w, toDisplayString as U } from "vue";
|
|
2
|
+
import { isNil as x } from "../../../lib/util/helpers/dist/utils.js";
|
|
3
|
+
import { getFilterUiMetadata as R, getFilterUiTypeOptions as z, PlDropdown as T, PlTextField as E, PlNumberField as k, PlCheckbox as I } from "@milaboratories/uikit";
|
|
4
|
+
const L = { key: 7 }, G = /* @__PURE__ */ D({
|
|
6
5
|
__name: "DynamicForm",
|
|
7
|
-
props: /* @__PURE__ */
|
|
6
|
+
props: /* @__PURE__ */ O({
|
|
8
7
|
columns: {},
|
|
9
8
|
formMetadata: {}
|
|
10
9
|
}, {
|
|
@@ -13,88 +12,92 @@ const I = { key: 7 }, G = /* @__PURE__ */ g({
|
|
|
13
12
|
}),
|
|
14
13
|
emits: ["update:modelValue"],
|
|
15
14
|
setup(y) {
|
|
16
|
-
const t =
|
|
15
|
+
const t = _(y, "modelValue"), d = y, b = c(() => {
|
|
17
16
|
var n;
|
|
18
|
-
const
|
|
19
|
-
if ("column" in
|
|
20
|
-
return (n = d.columns.find((r) => r.id ===
|
|
17
|
+
const e = t.value;
|
|
18
|
+
if ("column" in e)
|
|
19
|
+
return (n = d.columns.find((r) => r.id === e.column)) == null ? void 0 : n.obj;
|
|
21
20
|
}), F = c(() => {
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
25
|
-
}), M = c(() =>
|
|
26
|
-
const
|
|
27
|
-
return
|
|
21
|
+
const e = t.value;
|
|
22
|
+
if (e.type && typeof e.type == "string")
|
|
23
|
+
return R(e.type);
|
|
24
|
+
}), M = c(() => z(b.value)), f = c(() => d.columns.map((e) => ({ label: e.label, value: e.id }))), C = c(() => {
|
|
25
|
+
const e = F.value, n = b.value;
|
|
26
|
+
return e && n ? d.columns.filter((r) => e.supportedFor(n, r.obj)).map((r) => ({
|
|
28
27
|
label: r.label,
|
|
29
28
|
value: r.id
|
|
30
29
|
})) : [];
|
|
31
|
-
}), m = (
|
|
32
|
-
t.value[
|
|
30
|
+
}), m = (e, n) => {
|
|
31
|
+
t.value[e] = n;
|
|
33
32
|
};
|
|
34
|
-
|
|
33
|
+
h(
|
|
35
34
|
() => d.formMetadata,
|
|
36
|
-
(
|
|
37
|
-
for (const [n, r] of Object.entries(
|
|
35
|
+
(e) => {
|
|
36
|
+
for (const [n, r] of Object.entries(e))
|
|
38
37
|
if (t.value[n] === void 0) {
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
const o = r.defaultValue();
|
|
39
|
+
x(o) || (t.value[n] = o);
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
42
|
{ immediate: !0, deep: !0 }
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
return
|
|
43
|
+
);
|
|
44
|
+
function g(e) {
|
|
45
|
+
return e === "FilterType" || e === "FilterUiType";
|
|
46
|
+
}
|
|
47
|
+
return (e, n) => {
|
|
48
|
+
const r = P("DynamicForm", !0);
|
|
49
|
+
return e.formMetadata ? (u(), v("div", {
|
|
47
50
|
key: 0,
|
|
48
|
-
class:
|
|
51
|
+
class: B(e.$style.form)
|
|
49
52
|
}, [
|
|
50
|
-
(u(!0), v(i, null,
|
|
51
|
-
|
|
52
|
-
"form" in
|
|
53
|
+
(u(!0), v(i, null, S(e.formMetadata, (o, l) => (u(), v(i, { key: l }, [
|
|
54
|
+
o.fieldType === "form" ? (u(), v(i, { key: 0 }, [
|
|
55
|
+
"form" in o ? (u(), p(r, {
|
|
53
56
|
key: 0,
|
|
54
|
-
"model-value": t.value[
|
|
55
|
-
"form-metadata":
|
|
57
|
+
"model-value": t.value[l],
|
|
58
|
+
"form-metadata": o.form,
|
|
56
59
|
columns: d.columns,
|
|
57
|
-
"onUpdate:modelValue": (a) => m(
|
|
60
|
+
"onUpdate:modelValue": (a) => m(l, a)
|
|
58
61
|
}, null, 8, ["model-value", "form-metadata", "columns", "onUpdate:modelValue"])) : V("", !0)
|
|
59
|
-
], 64)) :
|
|
62
|
+
], 64)) : g(o.fieldType) ? (u(), p(s(T), {
|
|
60
63
|
key: 1,
|
|
61
|
-
"model-value": t.value[
|
|
62
|
-
label:
|
|
64
|
+
"model-value": t.value[l],
|
|
65
|
+
label: o.label ?? l,
|
|
63
66
|
options: M.value,
|
|
64
|
-
"onUpdate:modelValue": (a) => m(
|
|
65
|
-
}, null, 8, ["model-value", "label", "options", "onUpdate:modelValue"])) :
|
|
67
|
+
"onUpdate:modelValue": (a) => m(l, a)
|
|
68
|
+
}, null, 8, ["model-value", "label", "options", "onUpdate:modelValue"])) : o.fieldType === "string" ? (u(), p(s(E), {
|
|
66
69
|
key: 2,
|
|
67
|
-
"model-value": t.value[
|
|
68
|
-
label:
|
|
69
|
-
"onUpdate:modelValue": (a) => m(
|
|
70
|
-
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) :
|
|
70
|
+
"model-value": t.value[l],
|
|
71
|
+
label: o.label ?? l,
|
|
72
|
+
"onUpdate:modelValue": (a) => m(l, a)
|
|
73
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) : o.fieldType === "SUniversalPColumnId" ? (u(), p(s(T), {
|
|
71
74
|
key: 3,
|
|
72
|
-
"model-value": t.value[
|
|
73
|
-
label:
|
|
74
|
-
options:
|
|
75
|
-
"onUpdate:modelValue": (a) => m(
|
|
76
|
-
}, null, 8, ["model-value", "label", "options", "onUpdate:modelValue"])) :
|
|
75
|
+
"model-value": t.value[l],
|
|
76
|
+
label: o.label ?? l,
|
|
77
|
+
options: l === "column" ? f.value : C.value,
|
|
78
|
+
"onUpdate:modelValue": (a) => m(l, a)
|
|
79
|
+
}, null, 8, ["model-value", "label", "options", "onUpdate:modelValue"])) : o.fieldType === "number" ? (u(), p(s(k), {
|
|
77
80
|
key: 4,
|
|
78
|
-
"model-value": t.value[
|
|
79
|
-
label:
|
|
80
|
-
"onUpdate:modelValue": (a) => m(
|
|
81
|
-
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) :
|
|
81
|
+
"model-value": t.value[l],
|
|
82
|
+
label: o.label ?? l,
|
|
83
|
+
"onUpdate:modelValue": (a) => m(l, a)
|
|
84
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) : o.fieldType === "number?" ? (u(), p(s(k), {
|
|
82
85
|
key: 5,
|
|
83
|
-
"model-value": t.value[
|
|
84
|
-
label:
|
|
86
|
+
"model-value": t.value[l],
|
|
87
|
+
label: o.label ?? l,
|
|
85
88
|
clearable: !0,
|
|
86
|
-
"onUpdate:modelValue": (a) => m(
|
|
87
|
-
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) :
|
|
89
|
+
"onUpdate:modelValue": (a) => m(l, a)
|
|
90
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) : o.fieldType === "boolean" || o.fieldType === "boolean?" ? (u(), p(s(I), {
|
|
88
91
|
key: 6,
|
|
89
|
-
"model-value": !!t.value[
|
|
90
|
-
label:
|
|
91
|
-
"onUpdate:modelValue": (a) => m(
|
|
92
|
+
"model-value": !!t.value[l],
|
|
93
|
+
label: o.label ?? l,
|
|
94
|
+
"onUpdate:modelValue": (a) => m(l, a)
|
|
92
95
|
}, {
|
|
93
|
-
default:
|
|
94
|
-
|
|
96
|
+
default: j(() => [
|
|
97
|
+
w(U(o.label ?? l), 1)
|
|
95
98
|
]),
|
|
96
99
|
_: 2
|
|
97
|
-
}, 1032, ["model-value", "label", "onUpdate:modelValue"])) : (u(), v("pre",
|
|
100
|
+
}, 1032, ["model-value", "label", "onUpdate:modelValue"])) : (u(), v("pre", L, "TODO:" + U(o.fieldType), 1))
|
|
98
101
|
], 64))), 128))
|
|
99
102
|
], 2)) : V("", !0);
|
|
100
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicForm.vue2.js","sources":["../../../../src/components/PlAnnotations/components/DynamicForm.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T extends
|
|
1
|
+
{"version":3,"file":"DynamicForm.vue2.js","sources":["../../../../src/components/PlAnnotations/components/DynamicForm.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T extends FilterSpec = FilterSpec\">\nimport { computed, watch } from 'vue';\n\nimport { isNil } from '@milaboratories/helpers';\nimport type { FilterSpecTypeFieldRecord } from '@milaboratories/uikit';\nimport { getFilterUiMetadata, getFilterUiTypeOptions, PlCheckbox, PlDropdown, PlNumberField, PlTextField } from '@milaboratories/uikit';\nimport type { SimplifiedUniversalPColumnEntry, SUniversalPColumnId } from '@platforma-sdk/model';\n\nimport type { FilterSpec, FilterSpecType } from '../types';\n\ntype ObjectEntries<T, K extends keyof T = keyof T> = [K, T[K]][];\n\nconst formData = defineModel<T>({ default: () => ({}) });\n\nconst props = defineProps<{\n columns: SimplifiedUniversalPColumnEntry[];\n formMetadata: FilterSpecTypeFieldRecord<T>;\n}>();\n\nconst columnSpecRef = computed(() => {\n const value = formData.value;\n if ('column' in value) {\n return props.columns.find((c) => c.id === value.column)?.obj;\n }\n return undefined;\n});\n\nconst typeMetadataRef = computed(() => {\n const value = formData.value;\n if (value.type && typeof value.type === 'string') {\n return getFilterUiMetadata(value.type);\n }\n return undefined;\n});\n\nconst filterUiTypeOptions = computed(() => {\n return getFilterUiTypeOptions(columnSpecRef.value);\n});\n\nconst firstColumnsOptions = computed(() => props.columns.map((c) => ({ label: c.label, value: c.id })));\nconst secondColumnOptions = computed(() => {\n const typeMetadata = typeMetadataRef.value;\n const columnSpec = columnSpecRef.value;\n if (typeMetadata && columnSpec) {\n return props.columns.filter((c) => typeMetadata.supportedFor(columnSpec, c.obj)).map((c) => ({\n label: c.label,\n value: c.id,\n }));\n }\n return [];\n});\n\nconst setFieldValue = <K extends keyof T>(fieldName: K, value: T[K]) => {\n formData.value[fieldName] = value;\n};\n\nwatch(() => props.formMetadata, (newForm) => {\n for (const [fieldName, field] of Object.entries(newForm) as ObjectEntries<typeof newForm>) {\n if (formData.value[fieldName] === undefined) {\n const value = field.defaultValue();\n if (!isNil(value)) {\n formData.value[fieldName] = value;\n }\n }\n }\n},\n{ immediate: true, deep: true },\n);\n\nfunction isFilterType(type: string | undefined): boolean {\n return type === 'FilterType'\n // @deprecated version\n || type === 'FilterUiType';\n}\n\n</script>\n\n<template>\n <div v-if=\"formMetadata\" :class=\"$style.form\">\n <template v-for=\"(field, fieldName) in formMetadata\" :key=\"fieldName\">\n <template v-if=\"field.fieldType === 'form'\">\n <!-- TODO: Nested Form not described in FilterUi, we need to define it later. Even more in type it don't possible situations -->\n <DynamicForm\n v-if=\"'form' in field\"\n :model-value=\"formData[fieldName] as any\"\n :form-metadata=\"field.form as any\"\n :columns=\"props.columns\"\n @update:model-value=\"setFieldValue(fieldName, $event as T[keyof T])\"\n />\n </template>\n <template v-else-if=\"isFilterType(field.fieldType)\">\n <PlDropdown\n :model-value=\"formData[fieldName] as FilterSpecType\"\n :label=\"field.label ?? fieldName\"\n :options=\"filterUiTypeOptions\"\n @update:model-value=\"setFieldValue(fieldName, $event as T[keyof T])\"\n />\n </template>\n <template v-else-if=\"field.fieldType === 'string'\">\n <PlTextField\n :model-value=\"formData[fieldName] as string\"\n :label=\"field.label ?? fieldName\"\n @update:model-value=\"setFieldValue(fieldName, $event as T[keyof T])\"\n />\n </template>\n <template v-else-if=\"field.fieldType === 'SUniversalPColumnId'\">\n <PlDropdown\n :model-value=\"formData[fieldName] as SUniversalPColumnId\"\n :label=\"field.label ?? fieldName\"\n :options=\"fieldName === 'column' ? firstColumnsOptions : secondColumnOptions\"\n @update:model-value=\"setFieldValue(fieldName, $event as T[keyof T])\"\n />\n </template>\n <template v-else-if=\"field.fieldType === 'number'\">\n <PlNumberField\n :model-value=\"formData[fieldName] as number\"\n :label=\"field.label ?? fieldName\"\n @update:model-value=\"setFieldValue(fieldName, $event as T[keyof T])\"\n />\n </template>\n <template v-else-if=\"field.fieldType === 'number?'\">\n <PlNumberField\n :model-value=\"formData[fieldName] as (undefined | number)\"\n :label=\"field.label ?? fieldName\"\n :clearable=\"true\"\n @update:model-value=\"setFieldValue(fieldName, $event as T[keyof T])\"\n />\n </template>\n <template v-else-if=\"field.fieldType === 'boolean' || field.fieldType === 'boolean?'\">\n <PlCheckbox\n :model-value=\"Boolean(formData[fieldName])\"\n :label=\"field.label ?? fieldName\"\n @update:model-value=\"setFieldValue(fieldName, $event as T[keyof T])\"\n >\n {{ field.label ?? fieldName }}\n </PlCheckbox>\n </template>\n <template v-else>\n <pre>TODO:{{ field.fieldType }}</pre>\n </template>\n </template>\n </div>\n</template>\n\n<style module>\n.form {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n</style>\n"],"names":["formData","_useModel","__props","props","columnSpecRef","computed","value","_a","c","typeMetadataRef","getFilterUiMetadata","filterUiTypeOptions","getFilterUiTypeOptions","firstColumnsOptions","secondColumnOptions","typeMetadata","columnSpec","setFieldValue","fieldName","watch","newForm","field","isNil","isFilterType","type"],"mappings":";;;;;;;;;;;;;;AAYA,UAAMA,IAAWC,EAAcC,GAAA,YAAwB,GAEjDC,IAAQD,GAKRE,IAAgBC,EAAS,MAAM;;AACnC,YAAMC,IAAQN,EAAS;AACvB,UAAI,YAAYM;AACd,gBAAOC,IAAAJ,EAAM,QAAQ,KAAK,CAACK,MAAMA,EAAE,OAAOF,EAAM,MAAM,MAA/C,gBAAAC,EAAkD;AAAA,IAG7D,CAAC,GAEKE,IAAkBJ,EAAS,MAAM;AACrC,YAAMC,IAAQN,EAAS;AACvB,UAAIM,EAAM,QAAQ,OAAOA,EAAM,QAAS;AACtC,eAAOI,EAAoBJ,EAAM,IAAI;AAAA,IAGzC,CAAC,GAEKK,IAAsBN,EAAS,MAC5BO,EAAuBR,EAAc,KAAK,CAClD,GAEKS,IAAsBR,EAAS,MAAMF,EAAM,QAAQ,IAAI,CAACK,OAAO,EAAE,OAAOA,EAAE,OAAO,OAAOA,EAAE,GAAA,EAAK,CAAC,GAChGM,IAAsBT,EAAS,MAAM;AACzC,YAAMU,IAAeN,EAAgB,OAC/BO,IAAaZ,EAAc;AACjC,aAAIW,KAAgBC,IACXb,EAAM,QAAQ,OAAO,CAACK,MAAMO,EAAa,aAAaC,GAAYR,EAAE,GAAG,CAAC,EAAE,IAAI,CAACA,OAAO;AAAA,QAC3F,OAAOA,EAAE;AAAA,QACT,OAAOA,EAAE;AAAA,MAAA,EACT,IAEG,CAAA;AAAA,IACT,CAAC,GAEKS,IAAgB,CAAoBC,GAAcZ,MAAgB;AACtE,MAAAN,EAAS,MAAMkB,CAAS,IAAIZ;AAAA,IAC9B;AAEA,IAAAa;AAAA,MAAM,MAAMhB,EAAM;AAAA,MAAc,CAACiB,MAAY;AAC3C,mBAAW,CAACF,GAAWG,CAAK,KAAK,OAAO,QAAQD,CAAO;AACrD,cAAIpB,EAAS,MAAMkB,CAAS,MAAM,QAAW;AAC3C,kBAAMZ,IAAQe,EAAM,aAAA;AACpB,YAAKC,EAAMhB,CAAK,MACdN,EAAS,MAAMkB,CAAS,IAAIZ;AAAA,UAEhC;AAAA,MAEJ;AAAA,MACA,EAAE,WAAW,IAAM,MAAM,GAAA;AAAA,IAAK;AAG9B,aAASiB,EAAaC,GAAmC;AACvD,aAAOA,MAAS,gBAEXA,MAAS;AAAA,IAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
1
|
+
import { PObjectId, SimplifiedUniversalPColumnEntry } from '@platforma-sdk/model';
|
|
2
|
+
import { Filter } from '../types';
|
|
3
|
+
export type Props = {
|
|
4
4
|
columns: SimplifiedUniversalPColumnEntry[];
|
|
5
|
-
hasSelectedColumns
|
|
6
|
-
getValuesForSelectedColumns
|
|
5
|
+
hasSelectedColumns?: boolean;
|
|
6
|
+
getValuesForSelectedColumns?: () => Promise<undefined | {
|
|
7
7
|
columnId: PObjectId;
|
|
8
8
|
values: string[];
|
|
9
9
|
}>;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} &
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
declare const _default: import('vue').DefineComponent<{
|
|
12
|
+
step: Filter;
|
|
13
|
+
} & Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
"update:step": (value: Filter) => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
16
|
+
step: Filter;
|
|
17
|
+
} & Props> & Readonly<{
|
|
18
|
+
"onUpdate:step"?: ((value: Filter) => any) | undefined;
|
|
18
19
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
20
|
export default _default;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isNil as
|
|
3
|
-
import { randomInt as
|
|
4
|
-
import { PlSidebarItem as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const j = { key: 1 }, H = /* @__PURE__ */ E({
|
|
1
|
+
import { defineComponent as B, mergeModels as w, useModel as M, computed as N, createBlock as r, createCommentVNode as f, openBlock as d, unref as s, withCtx as n, createElementVNode as y, normalizeClass as v, createVNode as g, createTextVNode as p, createElementBlock as P, toDisplayString as F } from "vue";
|
|
2
|
+
import { isNil as u } from "../../../lib/util/helpers/dist/utils.js";
|
|
3
|
+
import { randomInt as V } from "../../../lib/util/helpers/dist/random.js";
|
|
4
|
+
import { PlSidebarItem as U, PlBtnSecondary as C, PlElementList as $, PlEditableTitle as D, getFilterUiMetadata as I } from "@milaboratories/uikit";
|
|
5
|
+
import { createDefaultFilterMetadata as j } from "../utils.js";
|
|
6
|
+
import q from "./DynamicForm.vue.js";
|
|
7
|
+
const L = { key: 1 }, J = /* @__PURE__ */ B({
|
|
9
8
|
__name: "FilterSidebar",
|
|
10
|
-
props: /* @__PURE__ */
|
|
9
|
+
props: /* @__PURE__ */ w({
|
|
11
10
|
columns: {},
|
|
12
11
|
hasSelectedColumns: { type: Boolean },
|
|
13
12
|
getValuesForSelectedColumns: { type: Function }
|
|
@@ -16,37 +15,38 @@ const j = { key: 1 }, H = /* @__PURE__ */ E({
|
|
|
16
15
|
stepModifiers: {}
|
|
17
16
|
}),
|
|
18
17
|
emits: ["update:step"],
|
|
19
|
-
setup(
|
|
20
|
-
const o =
|
|
18
|
+
setup(c) {
|
|
19
|
+
const o = M(c, "step"), a = c, S = N(() => a.hasSelectedColumns !== void 0 && a.getValuesForSelectedColumns !== void 0), h = () => {
|
|
21
20
|
o.value.filter.filters.push({
|
|
22
|
-
id:
|
|
21
|
+
id: V(),
|
|
23
22
|
isExpanded: !0,
|
|
24
23
|
type: void 0
|
|
25
24
|
});
|
|
26
25
|
};
|
|
27
|
-
async function
|
|
28
|
-
|
|
26
|
+
async function x() {
|
|
27
|
+
if (a.hasSelectedColumns === void 0 || a.getValuesForSelectedColumns === void 0) return;
|
|
28
|
+
const t = await a.getValuesForSelectedColumns();
|
|
29
29
|
if (!t || t.values.length === 0) return;
|
|
30
|
-
const { columnId: l, values: e } = t,
|
|
30
|
+
const { columnId: l, values: e } = t, i = e.slice(0, 3).join(", ") + (e.length > 3 ? ` and ${e.length - 3} more` : "");
|
|
31
31
|
o.value.filter.filters.push({
|
|
32
|
-
id:
|
|
33
|
-
name: `Selected list (${
|
|
32
|
+
id: V(),
|
|
33
|
+
name: `Selected list (${i})`,
|
|
34
34
|
isExpanded: !1,
|
|
35
35
|
type: "or",
|
|
36
|
-
filters: e.map((
|
|
36
|
+
filters: e.map((m) => ({
|
|
37
37
|
type: "patternEquals",
|
|
38
38
|
column: l,
|
|
39
|
-
value:
|
|
39
|
+
value: m
|
|
40
40
|
}))
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const k = (t) => {
|
|
44
44
|
var l;
|
|
45
|
-
return
|
|
46
|
-
},
|
|
47
|
-
return (t, l) => o.value ? (
|
|
48
|
-
"header-content":
|
|
49
|
-
(
|
|
45
|
+
return u(t.name) ? ((l = a.columns.find((e) => "column" in t ? e.id === t.column : !1)) == null ? void 0 : l.label) ?? t.type : t.name;
|
|
46
|
+
}, b = (t) => u(t.type) ? j() : I(t.type).form, E = (t) => t.type === "or" || t.type === "and" ? t.filters.map((l) => "value" in l && !u(l.value) ? l.value : null).filter((l) => !u(l)).join(", ") : null;
|
|
47
|
+
return (t, l) => o.value ? (d(), r(s(U), { key: 0 }, {
|
|
48
|
+
"header-content": n(() => [
|
|
49
|
+
(d(), r(s(D), {
|
|
50
50
|
key: o.value.id,
|
|
51
51
|
modelValue: o.value.label,
|
|
52
52
|
"onUpdate:modelValue": l[0] || (l[0] = (e) => o.value.label = e),
|
|
@@ -56,63 +56,64 @@ const j = { key: 1 }, H = /* @__PURE__ */ E({
|
|
|
56
56
|
autofocus: o.value.label.length === 0
|
|
57
57
|
}, null, 8, ["modelValue", "autofocus"]))
|
|
58
58
|
]),
|
|
59
|
-
"body-content":
|
|
59
|
+
"body-content": n(() => [
|
|
60
60
|
y("div", {
|
|
61
61
|
class: v(t.$style.root)
|
|
62
62
|
}, [
|
|
63
63
|
y("div", {
|
|
64
64
|
class: v(t.$style.actions)
|
|
65
65
|
}, [
|
|
66
|
-
|
|
66
|
+
g(s(C), {
|
|
67
67
|
style: { width: "100%" },
|
|
68
68
|
icon: "add",
|
|
69
|
-
onClick:
|
|
69
|
+
onClick: h
|
|
70
70
|
}, {
|
|
71
|
-
default:
|
|
72
|
-
|
|
71
|
+
default: n(() => l[2] || (l[2] = [
|
|
72
|
+
p(" Filter ")
|
|
73
73
|
])),
|
|
74
74
|
_: 1
|
|
75
75
|
}),
|
|
76
|
-
|
|
76
|
+
S.value ? (d(), r(s(C), {
|
|
77
|
+
key: 0,
|
|
77
78
|
style: { width: "100%" },
|
|
78
79
|
icon: "add",
|
|
79
|
-
disabled: !
|
|
80
|
-
onClick:
|
|
80
|
+
disabled: !a.hasSelectedColumns,
|
|
81
|
+
onClick: x
|
|
81
82
|
}, {
|
|
82
|
-
default:
|
|
83
|
-
|
|
83
|
+
default: n(() => l[3] || (l[3] = [
|
|
84
|
+
p(" From selection ")
|
|
84
85
|
])),
|
|
85
86
|
_: 1
|
|
86
|
-
}, 8, ["disabled"])
|
|
87
|
+
}, 8, ["disabled"])) : f("", !0)
|
|
87
88
|
], 2),
|
|
88
|
-
|
|
89
|
+
g(s($), {
|
|
89
90
|
items: o.value.filter.filters,
|
|
90
91
|
"onUpdate:items": l[1] || (l[1] = (e) => o.value.filter.filters = e),
|
|
91
92
|
"get-item-key": (e) => e.id,
|
|
92
93
|
"is-expanded": (e) => !!e.isExpanded,
|
|
93
94
|
"on-expand": (e) => e.isExpanded = !e.isExpanded
|
|
94
95
|
}, {
|
|
95
|
-
"item-title":
|
|
96
|
-
|
|
96
|
+
"item-title": n(({ item: e }) => [
|
|
97
|
+
p(F(k(e)), 1)
|
|
97
98
|
]),
|
|
98
|
-
"item-content":
|
|
99
|
-
e.type !== "or" && e.type !== "and" ? (
|
|
99
|
+
"item-content": n(({ item: e, index: i }) => [
|
|
100
|
+
e.type !== "or" && e.type !== "and" ? (d(), r(q, {
|
|
100
101
|
key: 0,
|
|
101
|
-
modelValue: o.value.filter.filters[
|
|
102
|
-
"onUpdate:modelValue": (
|
|
103
|
-
"form-metadata":
|
|
104
|
-
columns:
|
|
105
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "form-metadata", "columns"])) : (
|
|
102
|
+
modelValue: o.value.filter.filters[i],
|
|
103
|
+
"onUpdate:modelValue": (m) => o.value.filter.filters[i] = m,
|
|
104
|
+
"form-metadata": b(e),
|
|
105
|
+
columns: a.columns
|
|
106
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "form-metadata", "columns"])) : (d(), P("div", L, F(E(e)), 1))
|
|
106
107
|
]),
|
|
107
108
|
_: 1
|
|
108
109
|
}, 8, ["items", "get-item-key", "is-expanded", "on-expand"])
|
|
109
110
|
], 2)
|
|
110
111
|
]),
|
|
111
112
|
_: 1
|
|
112
|
-
})) :
|
|
113
|
+
})) : f("", !0);
|
|
113
114
|
}
|
|
114
115
|
});
|
|
115
116
|
export {
|
|
116
|
-
|
|
117
|
+
J as default
|
|
117
118
|
};
|
|
118
119
|
//# sourceMappingURL=FilterSidebar.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSidebar.vue2.js","sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { isNil, randomInt } from '@milaboratories/helpers';\nimport {\n PlBtnSecondary,\n PlEditableTitle,\n PlElementList,\n PlSidebarItem,\n} from '@milaboratories/uikit';\nimport type {
|
|
1
|
+
{"version":3,"file":"FilterSidebar.vue2.js","sources":["../../../../src/components/PlAnnotations/components/FilterSidebar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type Props = {\n columns: SimplifiedUniversalPColumnEntry[];\n hasSelectedColumns?: boolean;\n getValuesForSelectedColumns?: () => Promise<undefined | { columnId: PObjectId; values: string[] }>;\n};\n</script>\n<script setup lang=\"ts\">\nimport { isNil, randomInt } from '@milaboratories/helpers';\nimport {\n getFilterUiMetadata,\n PlBtnSecondary,\n PlEditableTitle,\n PlElementList,\n PlSidebarItem,\n} from '@milaboratories/uikit';\nimport type { PObjectId, SimplifiedUniversalPColumnEntry, SUniversalPColumnId } from '@platforma-sdk/model';\nimport { computed } from 'vue';\nimport type { Filter, FilterSpec } from '../types';\nimport { createDefaultFilterMetadata } from '../utils';\nimport DynamicForm from './DynamicForm.vue';\n\n// Models\nconst step = defineModel<Filter>('step', { required: true });\n// Props\nconst props = defineProps<Props>();\n// State\nconst withSelection = computed(() => {\n return props.hasSelectedColumns !== undefined && props.getValuesForSelectedColumns !== undefined;\n});\n// Actions\nconst addFilterPlaceholder = () => {\n step.value.filter.filters.push({\n id: randomInt(),\n isExpanded: true,\n type: undefined,\n });\n};\n\nasync function addFilterFromSelected() {\n if (props.hasSelectedColumns === undefined || props.getValuesForSelectedColumns === undefined) 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 = values.slice(0, 3).join(', ') + (values.length > 3 ? ` and ${values.length - 3} more` : '');\n\n step.value.filter.filters.push({\n id: randomInt(),\n name: `Selected list (${shortReminder})`,\n isExpanded: false,\n type: 'or',\n filters: values.map((value) => ({\n type: 'patternEquals',\n column: columnId as SUniversalPColumnId,\n value,\n })),\n });\n}\n\n// Getters\nconst getColumnLabel = (filter: FilterSpec) => {\n if (!isNil(filter.name)) return filter.name;\n return props.columns\n .find((c) => 'column' in filter ? c.id === filter.column : false)?.label\n ?? filter.type;\n};\n\nconst getFormMetadata = (filter: FilterSpec) => {\n return !isNil(filter.type) ? getFilterUiMetadata(filter.type).form : createDefaultFilterMetadata();\n};\n\nconst getFilterValues = (filter: FilterSpec) => {\n if (filter.type === 'or' || filter.type === 'and') {\n return filter.filters.map((f) => 'value' in f && !isNil(f.value) ? f.value : null).filter((v) => !isNil(v)).join (', ');\n }\n return null;\n};\n</script>\n\n<template>\n <PlSidebarItem v-if=\"step\">\n <template #header-content>\n <PlEditableTitle\n :key=\"step.id\"\n v-model=\"step.label\"\n :max-length=\"40\"\n max-width=\"600px\"\n placeholder=\"Annotation Name\"\n :autofocus=\"step.label.length === 0\"\n />\n </template>\n <template #body-content>\n <div :class=\"$style.root\">\n <div :class=\"$style.actions\">\n <PlBtnSecondary style=\"width: 100%;\" icon=\"add\" @click=\"addFilterPlaceholder\">\n Filter\n </PlBtnSecondary>\n <PlBtnSecondary v-if=\"withSelection\" style=\"width: 100%;\" icon=\"add\" :disabled=\"!props.hasSelectedColumns\" @click=\"addFilterFromSelected\">\n From selection\n </PlBtnSecondary>\n </div>\n\n <PlElementList\n v-model:items=\"step.filter.filters\"\n :get-item-key=\"(item) => item.id!\"\n :is-expanded=\"(item) => Boolean(item.isExpanded)\"\n :on-expand=\"(item) => item.isExpanded = !Boolean(item.isExpanded)\"\n >\n <template #item-title=\"{ item }\">\n {{ getColumnLabel(item) }}\n </template>\n <template #item-content=\"{ item, index }\">\n <template v-if=\"item.type !== 'or' && item.type !== 'and'\">\n <DynamicForm\n v-model=\"step.filter.filters[index]\"\n :form-metadata=\"getFormMetadata(item)\"\n :columns=\"props.columns\"\n />\n </template>\n <template v-else>\n <div>{{ getFilterValues(item) }}</div>\n </template>\n </template>\n </PlElementList>\n </div>\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.actions {\n display: flex;\n flex-direction: row;\n gap: 12px;\n}\n</style>\n"],"names":["step","_useModel","__props","props","withSelection","computed","addFilterPlaceholder","randomInt","addFilterFromSelected","data","columnId","values","shortReminder","value","getColumnLabel","filter","isNil","_a","c","getFormMetadata","createDefaultFilterMetadata","getFilterUiMetadata","getFilterValues","f","v"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,UAAMA,IAAOC,EAAmBC,GAAC,MAA0B,GAErDC,IAAQD,GAERE,IAAgBC,EAAS,MACtBF,EAAM,uBAAuB,UAAaA,EAAM,gCAAgC,MACxF,GAEKG,IAAuB,MAAM;AACjC,MAAAN,EAAK,MAAM,OAAO,QAAQ,KAAK;AAAA,QAC7B,IAAIO,EAAA;AAAA,QACJ,YAAY;AAAA,QACZ,MAAM;AAAA,MAAA,CACP;AAAA,IACH;AAEA,mBAAeC,IAAwB;AACrC,UAAIL,EAAM,uBAAuB,UAAaA,EAAM,gCAAgC,OAAW;AAE/F,YAAMM,IAAO,MAAMN,EAAM,4BAAA;AACzB,UAAI,CAACM,KAAQA,EAAK,OAAO,WAAW,EAAG;AAEvC,YAAM,EAAE,UAAAC,GAAU,QAAAC,EAAA,IAAWF,GACvBG,IAAgBD,EAAO,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,KAAKA,EAAO,SAAS,IAAI,QAAQA,EAAO,SAAS,CAAC,UAAU;AAE9G,MAAAX,EAAK,MAAM,OAAO,QAAQ,KAAK;AAAA,QAC7B,IAAIO,EAAA;AAAA,QACJ,MAAM,kBAAkBK,CAAa;AAAA,QACrC,YAAY;AAAA,QACZ,MAAM;AAAA,QACN,SAASD,EAAO,IAAI,CAACE,OAAW;AAAA,UAC9B,MAAM;AAAA,UACN,QAAQH;AAAA,UACR,OAAAG;AAAA,QAAA,EACA;AAAA,MAAA,CACH;AAAA,IACH;AAGA,UAAMC,IAAiB,CAACC,MAAuB;;AAC7C,aAAKC,EAAMD,EAAO,IAAI,MACfE,IAAAd,EAAM,QACV,KAAK,CAACe,MAAM,YAAYH,IAASG,EAAE,OAAOH,EAAO,SAAS,EAAK,MAD3D,gBAAAE,EAC8D,UAChEF,EAAO,OAHoBA,EAAO;AAAA,IAIzC,GAEMI,IAAkB,CAACJ,MACfC,EAAMD,EAAO,IAAI,IAA4CK,EAAA,IAAxCC,EAAoBN,EAAO,IAAI,EAAE,MAG1DO,IAAkB,CAACP,MACnBA,EAAO,SAAS,QAAQA,EAAO,SAAS,QACnCA,EAAO,QAAQ,IAAI,CAACQ,MAAM,WAAWA,KAAK,CAACP,EAAMO,EAAE,KAAK,IAAIA,EAAE,QAAQ,IAAI,EAAE,OAAO,CAACC,MAAM,CAACR,EAAMQ,CAAC,CAAC,EAAE,KAAM,IAAI,IAEjH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Annotation } from '../types';
|
|
2
|
+
import { Props as BaseProps } from './FilterSidebar.vue';
|
|
3
|
+
export type Props = BaseProps & {
|
|
4
|
+
onDeleteSchema?: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import('vue').DefineComponent<{
|
|
7
|
+
annotation: Annotation;
|
|
8
|
+
} & BaseProps & {
|
|
9
|
+
onDeleteSchema?: () => void;
|
|
10
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
|
+
"update:annotation": (value: Annotation) => any;
|
|
12
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
13
|
+
annotation: Annotation;
|
|
14
|
+
} & BaseProps & {
|
|
15
|
+
onDeleteSchema?: () => void;
|
|
16
|
+
}> & Readonly<{
|
|
17
|
+
"onUpdate:annotation"?: ((value: Annotation) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import o from "./PlAnnotations.vue2.js";
|
|
2
|
+
import s from "./PlAnnotations.vue3.js";
|
|
3
|
+
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const r = {
|
|
5
|
+
$style: s
|
|
6
|
+
}, f = /* @__PURE__ */ t(o, [["__cssModules", r]]);
|
|
7
|
+
export {
|
|
8
|
+
f as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=PlAnnotations.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlAnnotations.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineComponent as f, mergeModels as v, useModel as C, shallowRef as h, computed as y, effect as b, createBlock as c, openBlock as d, unref as I, normalizeClass as u, withCtx as m, createCommentVNode as g, createVNode as F } from "vue";
|
|
2
|
+
import { isNil as r } from "../../../lib/util/helpers/dist/utils.js";
|
|
3
|
+
import { useConfirm as V, PlSidebarGroup as D } from "@milaboratories/uikit";
|
|
4
|
+
import w from "./AnnotationsSidebar.vue.js";
|
|
5
|
+
import N from "./FilterSidebar.vue.js";
|
|
6
|
+
const U = /* @__PURE__ */ f({
|
|
7
|
+
__name: "PlAnnotations",
|
|
8
|
+
props: /* @__PURE__ */ v({
|
|
9
|
+
columns: {},
|
|
10
|
+
hasSelectedColumns: { type: Boolean },
|
|
11
|
+
getValuesForSelectedColumns: { type: Function },
|
|
12
|
+
onDeleteSchema: { type: Function }
|
|
13
|
+
}, {
|
|
14
|
+
annotation: { required: !0 },
|
|
15
|
+
annotationModifiers: {}
|
|
16
|
+
}),
|
|
17
|
+
emits: ["update:annotation"],
|
|
18
|
+
setup(i) {
|
|
19
|
+
const n = C(i, "annotation"), o = i, t = h(void 0), a = y(() => r(t.value) || r(n.value) ? void 0 : n.value.steps.find((e) => e.id === t.value));
|
|
20
|
+
b(function() {
|
|
21
|
+
t.value === void 0 && n.value.steps.length > 0 && (t.value = n.value.steps[0].id);
|
|
22
|
+
});
|
|
23
|
+
const p = V({
|
|
24
|
+
title: "Reset Schema",
|
|
25
|
+
message: "Are you sure you want to reset the schema? This action cannot be undone.",
|
|
26
|
+
confirmLabel: "Yes, reset",
|
|
27
|
+
cancelLabel: "No, cancel"
|
|
28
|
+
});
|
|
29
|
+
async function S() {
|
|
30
|
+
var e;
|
|
31
|
+
await p() && (t.value = void 0, (e = o.onDeleteSchema) == null || e.call(o));
|
|
32
|
+
}
|
|
33
|
+
return (e, l) => (d(), c(I(D), {
|
|
34
|
+
class: u(e.$style.sidebarGroup)
|
|
35
|
+
}, {
|
|
36
|
+
"item-0": m(() => [
|
|
37
|
+
F(w, {
|
|
38
|
+
annotation: n.value,
|
|
39
|
+
"onUpdate:annotation": l[0] || (l[0] = (s) => n.value = s),
|
|
40
|
+
selectedStepId: t.value,
|
|
41
|
+
"onUpdate:selectedStepId": l[1] || (l[1] = (s) => t.value = s),
|
|
42
|
+
class: u(e.$style.sidebarItem),
|
|
43
|
+
columns: o.columns,
|
|
44
|
+
onDeleteSchema: S
|
|
45
|
+
}, null, 8, ["annotation", "selectedStepId", "class", "columns"])
|
|
46
|
+
]),
|
|
47
|
+
"item-1": m(() => [
|
|
48
|
+
a.value ? (d(), c(N, {
|
|
49
|
+
key: 0,
|
|
50
|
+
step: a.value,
|
|
51
|
+
"onUpdate:step": l[2] || (l[2] = (s) => a.value = s),
|
|
52
|
+
class: u(e.$style.sidebarItem),
|
|
53
|
+
columns: o.columns,
|
|
54
|
+
selectedStepId: t.value,
|
|
55
|
+
hasSelectedColumns: o.hasSelectedColumns,
|
|
56
|
+
getValuesForSelectedColumns: o.getValuesForSelectedColumns
|
|
57
|
+
}, null, 8, ["step", "class", "columns", "selectedStepId", "hasSelectedColumns", "getValuesForSelectedColumns"])) : g("", !0)
|
|
58
|
+
]),
|
|
59
|
+
_: 1
|
|
60
|
+
}, 8, ["class"]));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
U as default
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=PlAnnotations.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlAnnotations.vue2.js","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\n// Models\nconst annotation = defineModel<Annotation>('annotation', { required: true });\n// Props\nconst props = defineProps<Props>();\n// State\nconst selectedStepId = shallowRef<number | undefined>(undefined);\nconst selectedStep = computed(() => {\n return isNil(selectedStepId.value) || isNil(annotation.value)\n ? undefined\n : annotation.value.steps.find((step) => step.id === selectedStepId.value);\n});\n\n// Watchers\neffect(function setDefaultStepId() {\n if (selectedStepId.value === undefined && annotation.value.steps.length > 0) {\n selectedStepId.value = annotation.value.steps[0].id;\n }\n});\n// Hooks\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// Actions\nasync function handleDeleteSchema() {\n if (await confirmResetSchema()) {\n selectedStepId.value = undefined;\n props.onDeleteSchema?.();\n }\n}\n\n</script>\n\n<template>\n <PlSidebarGroup :class=\"$style.sidebarGroup\">\n <template #item-0>\n <AnnotationsSidebar\n v-model:annotation=\"annotation\"\n v-model:selectedStepId=\"selectedStepId\"\n :class=\"$style.sidebarItem\"\n :columns=\"props.columns\"\n @delete-schema=\"handleDeleteSchema\"\n />\n </template>\n <template #item-1>\n <FilterSidebar\n v-if=\"selectedStep\"\n v-model:step=\"selectedStep\"\n :class=\"$style.sidebarItem\"\n :columns=\"props.columns\"\n :selectedStepId=\"selectedStepId\"\n :hasSelectedColumns=\"props.hasSelectedColumns\"\n :getValuesForSelectedColumns=\"props.getValuesForSelectedColumns\"\n />\n </template>\n </PlSidebarGroup>\n</template>\n\n<style lang=\"scss\" module>\n.modal {\n display: flex;\n}\n\n.sidebarGroup {\n width: 100%;\n height: 100%;\n}\n\n.sidebarItem {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["annotation","_useModel","props","__props","selectedStepId","shallowRef","selectedStep","computed","isNil","step","effect","confirmResetSchema","useConfirm","handleDeleteSchema","_a"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,UAAMA,IAAaC,KAAwB,YAAgC,GAErEC,IAAQC,GAERC,IAAiBC,EAA+B,MAAS,GACzDC,IAAeC,EAAS,MACrBC,EAAMJ,EAAe,KAAK,KAAKI,EAAMR,EAAW,KAAK,IACxD,SACAA,EAAW,MAAM,MAAM,KAAK,CAACS,MAASA,EAAK,OAAOL,EAAe,KAAK,CAC3E;AAGD,IAAAM,EAAO,WAA4B;AACjC,MAAIN,EAAe,UAAU,UAAaJ,EAAW,MAAM,MAAM,SAAS,MACxEI,EAAe,QAAQJ,EAAW,MAAM,MAAM,CAAC,EAAE;AAAA,IAErD,CAAC;AAED,UAAMW,IAAqBC,EAAW;AAAA,MACpC,OAAO;AAAA,MACP,SAAS;AAAA,MACT,cAAc;AAAA,MACd,aAAa;AAAA,IAAA,CACd;AAED,mBAAeC,IAAqB;;AAClC,MAAI,MAAMF,QACRP,EAAe,QAAQ,SACvBU,IAAAZ,EAAM,mBAAN,QAAAY,EAAA,KAAAZ;AAAA,IAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._modal_1634u_1{display:flex}._sidebarGroup_1634u_5,._sidebarItem_1634u_10{width:100%;height:100%}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
|
|
2
|
+
const e = "_modal_1634u_1", s = "_sidebarGroup_1634u_5", a = "_sidebarItem_1634u_10", o = {
|
|
3
|
+
modal: e,
|
|
4
|
+
sidebarGroup: s,
|
|
5
|
+
sidebarItem: a
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
o as default,
|
|
9
|
+
e as modal,
|
|
10
|
+
s as sidebarGroup,
|
|
11
|
+
a as sidebarItem
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=PlAnnotations.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlAnnotations.vue3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type __VLS_Props =
|
|
4
|
-
columns: SimplifiedUniversalPColumnEntry[];
|
|
5
|
-
hasSelectedColumns: boolean;
|
|
6
|
-
getValuesForSelectedColumns: () => Promise<undefined | {
|
|
7
|
-
columnId: PObjectId;
|
|
8
|
-
values: string[];
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
1
|
+
import { Annotation } from '../types';
|
|
2
|
+
import { Props } from './PlAnnotations.vue';
|
|
3
|
+
type __VLS_Props = Props;
|
|
11
4
|
type __VLS_PublicProps = {
|
|
12
|
-
'annotation':
|
|
5
|
+
'annotation': Annotation;
|
|
13
6
|
'opened': boolean;
|
|
14
7
|
} & __VLS_Props;
|
|
15
8
|
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
16
|
-
"update:annotation": (value:
|
|
9
|
+
"update:annotation": (value: Annotation) => any;
|
|
17
10
|
"update:opened": (value: boolean) => any;
|
|
18
11
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
-
"onUpdate:annotation"?: ((value:
|
|
12
|
+
"onUpdate:annotation"?: ((value: Annotation) => any) | undefined;
|
|
20
13
|
"onUpdate:opened"?: ((value: boolean) => any) | undefined;
|
|
21
14
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
22
15
|
export default _default;
|