@platforma-sdk/ui-vue 1.63.12 → 1.65.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 +38 -32
- 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 +24 -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.vue.d.ts +3 -8
- package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js +164 -151
- 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 +8 -7
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.css +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts +24 -8
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js +176 -110
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/types.d.ts +2 -0
- package/dist/components/PlAdvancedFilter/types.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.style.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js +116 -109
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js +3 -3
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.d.ts +6 -5
- package/dist/components/PlAgDataTable/sources/table-source-v2.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.js +122 -88
- package/dist/components/PlAgDataTable/sources/table-source-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-state-v2.d.ts +6 -3
- package/dist/components/PlAgDataTable/sources/table-state-v2.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-state-v2.js +182 -97
- package/dist/components/PlAgDataTable/sources/table-state-v2.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.style.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue.d.ts.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js +37 -42
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/useFilteredItems.d.ts +5 -5
- package/dist/components/PlAgGridColumnManager/useFilteredItems.d.ts.map +1 -1
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js +2 -2
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/useGridColumns.js +14 -0
- package/dist/components/PlAgGridColumnManager/useGridColumns.js.map +1 -0
- 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.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +7 -4
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js +5 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.css +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts +7 -9
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js +72 -47
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/util/helpers/dist/functions.js.map +1 -1
- package/dist/lib/util/helpers/dist/objects.js +4 -1
- package/dist/lib/util/helpers/dist/objects.js.map +1 -1
- package/package.json +8 -7
- package/src/components/PlAdvancedFilter/FilterEditor.vue +99 -55
- package/src/components/PlAdvancedFilter/PlAdvancedFilter.vue +163 -95
- package/src/components/PlAdvancedFilter/types.ts +6 -1
- package/src/components/PlAgDataTable/PlAgDataTableV2.vue +26 -7
- package/src/components/PlAgDataTable/compositions/useFilterableColumns.ts +4 -4
- package/src/components/PlAgDataTable/sources/table-source-v2.ts +231 -131
- package/src/components/PlAgDataTable/sources/table-state-v2.ts +249 -70
- package/src/components/PlAgGridColumnManager/PlAgGridColumnManager.vue +17 -35
- package/src/components/PlAgGridColumnManager/useFilteredItems.ts +9 -11
- package/src/components/PlAgGridColumnManager/useGridColumns.ts +26 -0
- package/src/components/PlAnnotations/components/FilterSidebar.vue +3 -2
- package/src/components/PlTableFilters/PlTableFiltersV2.vue +76 -26
- package/src/index.ts +4 -0
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
Domain,
|
|
13
13
|
readAnnotation,
|
|
14
14
|
readDomain,
|
|
15
|
-
getAxisId,
|
|
16
15
|
getUniqueSourceValuesWithLabels,
|
|
17
16
|
parseJson,
|
|
17
|
+
getPTableColumnId,
|
|
18
18
|
} from "@platforma-sdk/model";
|
|
19
|
-
import { computed,
|
|
19
|
+
import { computed, ref } from "vue";
|
|
20
20
|
import { PlBtnGhost, PlSlideModal, usePlBlockPageTitleTeleportTarget } from "@milaboratories/uikit";
|
|
21
21
|
import {
|
|
22
22
|
PlAdvancedFilter,
|
|
@@ -26,36 +26,47 @@ import {
|
|
|
26
26
|
} from "../PlAdvancedFilter";
|
|
27
27
|
import type { PlAdvancedFilterColumnId } from "../PlAdvancedFilter/types";
|
|
28
28
|
import type { Nil } from "@milaboratories/helpers";
|
|
29
|
-
import { isNil } from "es-toolkit";
|
|
29
|
+
import { isFunction, isNil } from "es-toolkit";
|
|
30
30
|
|
|
31
|
-
const model = defineModel<PlDataTableFiltersWithMeta>({ required: true });
|
|
32
31
|
const props = defineProps<{
|
|
33
|
-
pframeHandle: Nil | PFrameHandle;
|
|
34
32
|
columns: PTableColumnSpec[];
|
|
33
|
+
pframeHandle: Nil | PFrameHandle;
|
|
34
|
+
filters: PlDataTableFiltersWithMeta;
|
|
35
|
+
defaultFilters: Nil | PlDataTableFiltersWithMeta;
|
|
36
|
+
onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;
|
|
37
|
+
onResetDefaultFilters?: () => void;
|
|
38
|
+
onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;
|
|
35
39
|
}>();
|
|
36
40
|
|
|
37
|
-
// Teleport for "Filters" button
|
|
38
|
-
const mounted = ref(false);
|
|
39
|
-
onMounted(() => {
|
|
40
|
-
mounted.value = true;
|
|
41
|
-
});
|
|
42
41
|
const teleportTarget = usePlBlockPageTitleTeleportTarget("PlTableFiltersV2");
|
|
43
42
|
const showManager = ref(false);
|
|
43
|
+
const hasFilters = computed(() => props.filters.filters.length > 0);
|
|
44
|
+
const hasDefaultFilters = computed(
|
|
45
|
+
() => !isNil(props.defaultFilters) && props.defaultFilters.filters.length > 0,
|
|
46
|
+
);
|
|
47
|
+
const filters = computed<PlDataTableFiltersWithMeta>(() => {
|
|
48
|
+
if (isNil(props.defaultFilters) || props.defaultFilters?.filters.length === 0) {
|
|
49
|
+
return props.filters;
|
|
50
|
+
}
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
return {
|
|
53
|
+
...props.filters,
|
|
54
|
+
filters: [...(props.defaultFilters?.filters ?? []), ...props.filters.filters],
|
|
55
|
+
};
|
|
48
56
|
});
|
|
57
|
+
const onUpdateFilters = (_value: PlAdvancedFilter) => {
|
|
58
|
+
const value = _value as PlDataTableFiltersWithMeta;
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
? { type: "axis", id: getAxisId(spec.spec) }
|
|
54
|
-
: { type: "column", id: spec.id };
|
|
55
|
-
return canonicalizeJson<PTableColumnId>(id);
|
|
56
|
-
}
|
|
60
|
+
if (isNil(props.defaultFilters)) {
|
|
61
|
+
return props.onUpdateFilters(value);
|
|
62
|
+
}
|
|
57
63
|
|
|
58
|
-
const
|
|
64
|
+
const [defaults, ...rest] = value.filters;
|
|
65
|
+
props.onUpdateFilters({ ...value, filters: rest });
|
|
66
|
+
props.onUpdateDefaultFilters?.({ ...props.defaultFilters, filters: [defaults] });
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const options = computed<PlAdvancedFilterItem[]>(() => {
|
|
59
70
|
return props.columns.map((col, idx) => {
|
|
60
71
|
const id = makeFilterColumnId(col);
|
|
61
72
|
const label =
|
|
@@ -116,11 +127,18 @@ function handleSuggestOptions(params: {
|
|
|
116
127
|
searchQueryValue: params.searchType === "value" ? params.searchStr : undefined,
|
|
117
128
|
}).then((v) => v.values);
|
|
118
129
|
}
|
|
130
|
+
|
|
131
|
+
function makeFilterColumnId(spec: PTableColumnSpec): CanonicalizedJson<PTableColumnId> {
|
|
132
|
+
return canonicalizeJson<PTableColumnId>(getPTableColumnId(spec));
|
|
133
|
+
}
|
|
119
134
|
</script>
|
|
120
135
|
|
|
121
136
|
<template>
|
|
122
|
-
<Teleport v-if="
|
|
123
|
-
<PlBtnGhost
|
|
137
|
+
<Teleport v-if="teleportTarget" :to="teleportTarget">
|
|
138
|
+
<PlBtnGhost
|
|
139
|
+
:icon="hasFilters || hasDefaultFilters ? 'filter-on' : 'filter'"
|
|
140
|
+
@click.stop="showManager = true"
|
|
141
|
+
>
|
|
124
142
|
Filters
|
|
125
143
|
</PlBtnGhost>
|
|
126
144
|
</Teleport>
|
|
@@ -130,13 +148,31 @@ function handleSuggestOptions(params: {
|
|
|
130
148
|
|
|
131
149
|
<div :class="$style.root">
|
|
132
150
|
<PlAdvancedFilterComponent
|
|
133
|
-
|
|
134
|
-
:
|
|
151
|
+
:filters="filters as PlAdvancedFilter"
|
|
152
|
+
:options="options"
|
|
135
153
|
:supported-filters="supportedFilters"
|
|
136
154
|
:get-suggest-options="handleSuggestOptions"
|
|
155
|
+
:is-pinned="(_, index) => hasDefaultFilters && index === 0"
|
|
156
|
+
:is-removable="(_, index) => (hasDefaultFilters ? index > 0 : true)"
|
|
157
|
+
:is-draggable="(_, index) => (hasDefaultFilters ? index > 0 : true)"
|
|
137
158
|
:enable-dnd="false"
|
|
159
|
+
:enable-toggling="true"
|
|
138
160
|
:enable-add-group-button="true"
|
|
139
|
-
|
|
161
|
+
@update-filters="onUpdateFilters"
|
|
162
|
+
>
|
|
163
|
+
<template #group-title="{ index }">
|
|
164
|
+
<div v-if="hasDefaultFilters && index === 0" :class="$style.defaultGroupTitle">
|
|
165
|
+
Default Group
|
|
166
|
+
<PlBtnGhost
|
|
167
|
+
v-if="isFunction(props.onResetDefaultFilters)"
|
|
168
|
+
icon="restart"
|
|
169
|
+
:class="$style.restartBtn"
|
|
170
|
+
@click.stop="props.onResetDefaultFilters()"
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
<div v-else>Custom Group</div>
|
|
174
|
+
</template>
|
|
175
|
+
</PlAdvancedFilterComponent>
|
|
140
176
|
</div>
|
|
141
177
|
</PlSlideModal>
|
|
142
178
|
</template>
|
|
@@ -147,4 +183,18 @@ function handleSuggestOptions(params: {
|
|
|
147
183
|
flex-direction: column;
|
|
148
184
|
gap: 12px;
|
|
149
185
|
}
|
|
186
|
+
.defaultGroupTitle {
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: 4px;
|
|
190
|
+
}
|
|
191
|
+
.restartBtn {
|
|
192
|
+
width: 24px;
|
|
193
|
+
height: 24px;
|
|
194
|
+
padding: 4px;
|
|
195
|
+
--button-width: 24px;
|
|
196
|
+
--btn-min-width: 24px;
|
|
197
|
+
--button-height: 24px;
|
|
198
|
+
--btn-min-height: 24x;
|
|
199
|
+
}
|
|
150
200
|
</style>
|