@caido-utils/components 0.1.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/dist/ButtonGroup/Container.d.vue.ts +34 -0
- package/dist/ButtonGroup/Container.vue +36 -0
- package/dist/ButtonGroup/Container.vue.d.ts +34 -0
- package/dist/Card/Container.d.vue.ts +12 -0
- package/dist/Card/Container.vue +21 -0
- package/dist/Card/Container.vue.d.ts +12 -0
- package/dist/ContextMenu/Container.d.vue.ts +9 -0
- package/dist/ContextMenu/Container.vue +38 -0
- package/dist/ContextMenu/Container.vue.d.ts +9 -0
- package/dist/DataTable/Container.d.vue.ts +68 -0
- package/dist/DataTable/Container.vue +295 -0
- package/dist/DataTable/Container.vue.d.ts +68 -0
- package/dist/Dialog/Container.d.vue.ts +64 -0
- package/dist/Dialog/Container.vue +89 -0
- package/dist/Dialog/Container.vue.d.ts +64 -0
- package/dist/HttpqlInput/Container.d.vue.ts +33 -0
- package/dist/HttpqlInput/Container.vue +225 -0
- package/dist/HttpqlInput/Container.vue.d.ts +33 -0
- package/dist/HttpqlInput/suggestions.d.ts +24 -0
- package/dist/HttpqlInput/suggestions.js +325 -0
- package/dist/Menu/Container.d.vue.ts +11 -0
- package/dist/Menu/Container.vue +40 -0
- package/dist/Menu/Container.vue.d.ts +11 -0
- package/dist/MenuButton/Container.d.vue.ts +43 -0
- package/dist/MenuButton/Container.vue +42 -0
- package/dist/MenuButton/Container.vue.d.ts +43 -0
- package/dist/MultiSelect/Container.d.vue.ts +54 -0
- package/dist/MultiSelect/Container.vue +57 -0
- package/dist/MultiSelect/Container.vue.d.ts +54 -0
- package/dist/RequestEditor/Container.d.vue.ts +30 -0
- package/dist/RequestEditor/Container.vue +67 -0
- package/dist/RequestEditor/Container.vue.d.ts +30 -0
- package/dist/ResponseEditor/Container.d.vue.ts +30 -0
- package/dist/ResponseEditor/Container.vue +67 -0
- package/dist/ResponseEditor/Container.vue.d.ts +30 -0
- package/dist/Table/Container.d.vue.ts +36 -0
- package/dist/Table/Container.vue +512 -0
- package/dist/Table/Container.vue.d.ts +36 -0
- package/dist/env.d.ts +5 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/package.json +32 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
const NAMESPACES = [
|
|
2
|
+
{ value: "req", description: "Request" },
|
|
3
|
+
{ value: "resp", description: "Response" },
|
|
4
|
+
{ value: "row", description: "Row identifier" },
|
|
5
|
+
{ value: "filter", description: "Custom filter" }
|
|
6
|
+
];
|
|
7
|
+
const REQ_FIELDS = [
|
|
8
|
+
{ value: "created_at", description: "Created at" },
|
|
9
|
+
{ value: "ext", description: "File extension" },
|
|
10
|
+
{ value: "host", description: "Host" },
|
|
11
|
+
{ value: "len", description: "Length" },
|
|
12
|
+
{ value: "method", description: "Method" },
|
|
13
|
+
{ value: "path", description: "Path" },
|
|
14
|
+
{ value: "port", description: "Port" },
|
|
15
|
+
{ value: "query", description: "Query" },
|
|
16
|
+
{ value: "raw", description: "Entire content" },
|
|
17
|
+
{ value: "tls", description: "Is TLS" }
|
|
18
|
+
];
|
|
19
|
+
const RESP_FIELDS = [
|
|
20
|
+
{ value: "code", description: "Status code" },
|
|
21
|
+
{ value: "len", description: "Length" },
|
|
22
|
+
{ value: "raw", description: "Entire content" },
|
|
23
|
+
{ value: "roundtrip", description: "Round trip time" }
|
|
24
|
+
];
|
|
25
|
+
const ROW_FIELDS = [{ value: "id", description: "Row ID" }];
|
|
26
|
+
const FILTER_VALUES = [
|
|
27
|
+
{ value: "inscope", description: "In-scope requests" },
|
|
28
|
+
{ value: "recent", description: "Recent requests" },
|
|
29
|
+
{ value: "1hr", description: "Last hour" },
|
|
30
|
+
{ value: "6hr", description: "Last 6 hours" },
|
|
31
|
+
{ value: "12hr", description: "Last 12 hours" },
|
|
32
|
+
{ value: "24hr", description: "Last 24 hours" }
|
|
33
|
+
];
|
|
34
|
+
const FIELD_TYPES = {
|
|
35
|
+
// req
|
|
36
|
+
"req.created_at": "datetime",
|
|
37
|
+
"req.ext": "string",
|
|
38
|
+
"req.host": "string",
|
|
39
|
+
"req.len": "integer",
|
|
40
|
+
"req.method": "string",
|
|
41
|
+
"req.path": "string",
|
|
42
|
+
"req.port": "integer",
|
|
43
|
+
"req.query": "string",
|
|
44
|
+
"req.raw": "string",
|
|
45
|
+
"req.tls": "boolean",
|
|
46
|
+
// resp
|
|
47
|
+
"resp.code": "integer",
|
|
48
|
+
"resp.len": "integer",
|
|
49
|
+
"resp.raw": "string",
|
|
50
|
+
"resp.roundtrip": "integer",
|
|
51
|
+
// row
|
|
52
|
+
"row.id": "integer"
|
|
53
|
+
};
|
|
54
|
+
const STRING_OPERATORS = [
|
|
55
|
+
{ value: "eq", description: "Equals" },
|
|
56
|
+
{ value: "ne", description: "Not equals" },
|
|
57
|
+
{ value: "cont", description: "Contains" },
|
|
58
|
+
{ value: "ncont", description: "Not contains" },
|
|
59
|
+
{ value: "like", description: "Like" },
|
|
60
|
+
{ value: "nlike", description: "Not like" },
|
|
61
|
+
{ value: "regex", description: "Regex" },
|
|
62
|
+
{ value: "nregex", description: "Not regex" }
|
|
63
|
+
];
|
|
64
|
+
const INTEGER_OPERATORS = [
|
|
65
|
+
{ value: "eq", description: "Equals" },
|
|
66
|
+
{ value: "ne", description: "Not equals" },
|
|
67
|
+
{ value: "gt", description: "Greater than" },
|
|
68
|
+
{ value: "gte", description: "Greater or equal" },
|
|
69
|
+
{ value: "lt", description: "Less than" },
|
|
70
|
+
{ value: "lte", description: "Less or equal" }
|
|
71
|
+
];
|
|
72
|
+
const DATETIME_OPERATORS = [
|
|
73
|
+
{ value: "gt", description: "After" },
|
|
74
|
+
{ value: "lt", description: "Before" }
|
|
75
|
+
];
|
|
76
|
+
const BOOLEAN_OPERATORS = [
|
|
77
|
+
{ value: "eq", description: "Equals" },
|
|
78
|
+
{ value: "ne", description: "Not equals" }
|
|
79
|
+
];
|
|
80
|
+
const LOGICAL_OPERATORS = [
|
|
81
|
+
{ value: "AND", description: "Both match" },
|
|
82
|
+
{ value: "OR", description: "Either matches" }
|
|
83
|
+
];
|
|
84
|
+
function getOperatorsForType(type) {
|
|
85
|
+
switch (type) {
|
|
86
|
+
case "string":
|
|
87
|
+
return STRING_OPERATORS;
|
|
88
|
+
case "integer":
|
|
89
|
+
return INTEGER_OPERATORS;
|
|
90
|
+
case "datetime":
|
|
91
|
+
return DATETIME_OPERATORS;
|
|
92
|
+
case "boolean":
|
|
93
|
+
return BOOLEAN_OPERATORS;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export function getSuggestions(query, cursorPos) {
|
|
97
|
+
const before = query.slice(0, cursorPos).trimStart();
|
|
98
|
+
const empty = {
|
|
99
|
+
category: "",
|
|
100
|
+
items: [],
|
|
101
|
+
partial: "",
|
|
102
|
+
suffix: ""
|
|
103
|
+
};
|
|
104
|
+
if (!before.trim()) {
|
|
105
|
+
return {
|
|
106
|
+
category: "Namespaces",
|
|
107
|
+
items: [...NAMESPACES],
|
|
108
|
+
partial: "",
|
|
109
|
+
suffix: "."
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const lastBoundary = Math.max(
|
|
113
|
+
before.lastIndexOf(" "),
|
|
114
|
+
before.lastIndexOf(" "),
|
|
115
|
+
before.lastIndexOf("(")
|
|
116
|
+
);
|
|
117
|
+
const currentToken = before.slice(lastBoundary + 1);
|
|
118
|
+
const preceding = before.slice(0, lastBoundary + 1).trimEnd();
|
|
119
|
+
if (currentToken.includes('"') || currentToken.includes("'")) {
|
|
120
|
+
return empty;
|
|
121
|
+
}
|
|
122
|
+
const beforeTrimmed = before.trimEnd();
|
|
123
|
+
if (beforeTrimmed.endsWith('"') || beforeTrimmed.endsWith("'") || beforeTrimmed.endsWith(")")) {
|
|
124
|
+
return {
|
|
125
|
+
category: "Logical",
|
|
126
|
+
items: [...LOGICAL_OPERATORS],
|
|
127
|
+
partial: currentToken,
|
|
128
|
+
suffix: " "
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function handleNamespaceToken(ns, fields, nsLen) {
|
|
132
|
+
if (!currentToken.startsWith(ns + ".")) return null;
|
|
133
|
+
const rest = currentToken.slice(nsLen + 1);
|
|
134
|
+
const dotIdx = rest.indexOf(".");
|
|
135
|
+
if (dotIdx !== -1) {
|
|
136
|
+
const fieldName = rest.slice(0, dotIdx);
|
|
137
|
+
const fullField = ns + "." + fieldName;
|
|
138
|
+
if (fullField in FIELD_TYPES) {
|
|
139
|
+
const afterDot = rest.slice(dotIdx + 1);
|
|
140
|
+
if (afterDot.includes(":")) return empty;
|
|
141
|
+
const fieldType = FIELD_TYPES[fullField];
|
|
142
|
+
const operators = getOperatorsForType(fieldType);
|
|
143
|
+
return {
|
|
144
|
+
category: "Operators",
|
|
145
|
+
items: operators.filter(
|
|
146
|
+
(op) => op.value.startsWith(afterDot.toLowerCase())
|
|
147
|
+
),
|
|
148
|
+
partial: afterDot,
|
|
149
|
+
suffix: ":"
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
category: "Fields",
|
|
155
|
+
items: fields.filter((f) => f.value.startsWith(rest)),
|
|
156
|
+
partial: rest,
|
|
157
|
+
suffix: "."
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const nsResult = handleNamespaceToken("req", REQ_FIELDS, 3) ?? handleNamespaceToken("resp", RESP_FIELDS, 4) ?? handleNamespaceToken("row", ROW_FIELDS, 3);
|
|
161
|
+
if (nsResult) return nsResult;
|
|
162
|
+
if (currentToken.startsWith("filter:")) {
|
|
163
|
+
const rest = currentToken.slice(7);
|
|
164
|
+
const items = FILTER_VALUES.filter(
|
|
165
|
+
(f) => f.value.startsWith(rest.toLowerCase()) && f.value !== rest.toLowerCase()
|
|
166
|
+
);
|
|
167
|
+
if (items.length === 0) return empty;
|
|
168
|
+
return {
|
|
169
|
+
category: "Filters",
|
|
170
|
+
items,
|
|
171
|
+
partial: rest,
|
|
172
|
+
suffix: " "
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (currentToken === "filter") {
|
|
176
|
+
return { category: "", items: [{ value: ":" }], partial: "", suffix: "" };
|
|
177
|
+
}
|
|
178
|
+
const upperPreceding = preceding.toUpperCase();
|
|
179
|
+
if (!preceding || upperPreceding.endsWith("AND") || upperPreceding.endsWith("OR") || preceding.endsWith("(")) {
|
|
180
|
+
const filtered2 = NAMESPACES.filter(
|
|
181
|
+
(ns) => ns.value.startsWith(currentToken.toLowerCase())
|
|
182
|
+
);
|
|
183
|
+
if (filtered2.length > 0) {
|
|
184
|
+
return {
|
|
185
|
+
category: "Namespaces",
|
|
186
|
+
items: filtered2,
|
|
187
|
+
partial: currentToken,
|
|
188
|
+
suffix: "."
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const lastPrecedingSpace = preceding.trimEnd().lastIndexOf(" ");
|
|
193
|
+
const precedingToken = preceding.trimEnd().slice(lastPrecedingSpace + 1).toLowerCase();
|
|
194
|
+
if (precedingToken in FIELD_TYPES) {
|
|
195
|
+
const fieldType = FIELD_TYPES[precedingToken];
|
|
196
|
+
const operators = getOperatorsForType(fieldType);
|
|
197
|
+
const filtered2 = operators.filter(
|
|
198
|
+
(op) => op.value.startsWith(currentToken.toLowerCase())
|
|
199
|
+
);
|
|
200
|
+
return {
|
|
201
|
+
category: "Operators",
|
|
202
|
+
items: filtered2,
|
|
203
|
+
partial: currentToken,
|
|
204
|
+
suffix: " "
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const allOperators = [
|
|
208
|
+
...STRING_OPERATORS,
|
|
209
|
+
...INTEGER_OPERATORS,
|
|
210
|
+
...DATETIME_OPERATORS,
|
|
211
|
+
...BOOLEAN_OPERATORS
|
|
212
|
+
];
|
|
213
|
+
if (allOperators.some((op) => op.value === precedingToken)) {
|
|
214
|
+
return empty;
|
|
215
|
+
}
|
|
216
|
+
const filtered = LOGICAL_OPERATORS.filter(
|
|
217
|
+
(op) => op.value.toUpperCase().startsWith(currentToken.toUpperCase())
|
|
218
|
+
);
|
|
219
|
+
if (filtered.length > 0 && currentToken.length > 0) {
|
|
220
|
+
return {
|
|
221
|
+
category: "Logical",
|
|
222
|
+
items: filtered,
|
|
223
|
+
partial: currentToken,
|
|
224
|
+
suffix: " "
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
return empty;
|
|
228
|
+
}
|
|
229
|
+
const ALL_OPERATORS = /* @__PURE__ */ new Set([
|
|
230
|
+
"eq",
|
|
231
|
+
"ne",
|
|
232
|
+
"cont",
|
|
233
|
+
"ncont",
|
|
234
|
+
"like",
|
|
235
|
+
"nlike",
|
|
236
|
+
"regex",
|
|
237
|
+
"nregex",
|
|
238
|
+
"gt",
|
|
239
|
+
"gte",
|
|
240
|
+
"lt",
|
|
241
|
+
"lte"
|
|
242
|
+
]);
|
|
243
|
+
const LOGICAL_SET = /* @__PURE__ */ new Set(["AND", "OR"]);
|
|
244
|
+
const NAMESPACE_PREFIXES = ["req", "resp", "row", "filter"];
|
|
245
|
+
const FIELD_PATTERN = /^(req|resp|row)(\..*)?$/;
|
|
246
|
+
const FILTER_PATTERN = /^filter(:.*)?\s*$/;
|
|
247
|
+
export function tokenize(query) {
|
|
248
|
+
const tokens = [];
|
|
249
|
+
let i = 0;
|
|
250
|
+
while (i < query.length) {
|
|
251
|
+
if (query[i] === " " || query[i] === " ") {
|
|
252
|
+
let start2 = i;
|
|
253
|
+
while (i < query.length && (query[i] === " " || query[i] === " ")) i++;
|
|
254
|
+
tokens.push({ type: "text", text: query.slice(start2, i) });
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (query[i] === "(" || query[i] === ")") {
|
|
258
|
+
tokens.push({ type: "paren", text: query[i] });
|
|
259
|
+
i++;
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (query[i] === '"' || query[i] === "'") {
|
|
263
|
+
const quote = query[i];
|
|
264
|
+
let start2 = i;
|
|
265
|
+
i++;
|
|
266
|
+
while (i < query.length && query[i] !== quote) {
|
|
267
|
+
if (query[i] === "\\") i++;
|
|
268
|
+
i++;
|
|
269
|
+
}
|
|
270
|
+
if (i < query.length) i++;
|
|
271
|
+
tokens.push({ type: "value", text: query.slice(start2, i) });
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
let start = i;
|
|
275
|
+
while (i < query.length && query[i] !== " " && query[i] !== " " && query[i] !== "(" && query[i] !== ")") {
|
|
276
|
+
if ((query[i] === '"' || query[i] === "'") && i > start && query[i - 1] === ":") {
|
|
277
|
+
const quote = query[i];
|
|
278
|
+
i++;
|
|
279
|
+
while (i < query.length && query[i] !== quote) {
|
|
280
|
+
if (query[i] === "\\") i++;
|
|
281
|
+
i++;
|
|
282
|
+
}
|
|
283
|
+
if (i < query.length) i++;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
i++;
|
|
287
|
+
}
|
|
288
|
+
const word = query.slice(start, i);
|
|
289
|
+
if (LOGICAL_SET.has(word) || LOGICAL_SET.has(word.toUpperCase())) {
|
|
290
|
+
tokens.push({ type: "logical", text: word });
|
|
291
|
+
} else if (ALL_OPERATORS.has(word.toLowerCase())) {
|
|
292
|
+
tokens.push({ type: "operator", text: word });
|
|
293
|
+
} else if (FIELD_PATTERN.test(word) || FILTER_PATTERN.test(word) || word === "filter") {
|
|
294
|
+
const inlineMatch = word.match(
|
|
295
|
+
/^((?:req|resp|row)\.[^.]+)\.(\w+)(?::([\s\S]*))?$/
|
|
296
|
+
);
|
|
297
|
+
if (inlineMatch) {
|
|
298
|
+
const [, field, op, val] = inlineMatch;
|
|
299
|
+
tokens.push({ type: "field", text: field });
|
|
300
|
+
tokens.push({ type: "text", text: "." });
|
|
301
|
+
if (val !== void 0) {
|
|
302
|
+
tokens.push({ type: "operator", text: op });
|
|
303
|
+
tokens.push({ type: "text", text: ":" });
|
|
304
|
+
tokens.push({ type: "value", text: val });
|
|
305
|
+
} else {
|
|
306
|
+
tokens.push({ type: "operator", text: op });
|
|
307
|
+
}
|
|
308
|
+
} else if (FILTER_PATTERN.test(word) && word.includes(":")) {
|
|
309
|
+
const colonIdx = word.indexOf(":");
|
|
310
|
+
tokens.push({ type: "field", text: word.slice(0, colonIdx) });
|
|
311
|
+
tokens.push({ type: "text", text: ":" });
|
|
312
|
+
tokens.push({ type: "value", text: word.slice(colonIdx + 1) });
|
|
313
|
+
} else {
|
|
314
|
+
tokens.push({ type: "field", text: word });
|
|
315
|
+
}
|
|
316
|
+
} else if (/^\d+$/.test(word)) {
|
|
317
|
+
tokens.push({ type: "value", text: word });
|
|
318
|
+
} else if (NAMESPACE_PREFIXES.some((ns) => ns.startsWith(word.toLowerCase()))) {
|
|
319
|
+
tokens.push({ type: "field", text: word });
|
|
320
|
+
} else {
|
|
321
|
+
tokens.push({ type: "text", text: word });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return tokens;
|
|
325
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function show(event: Event | {
|
|
2
|
+
currentTarget: HTMLElement | undefined;
|
|
3
|
+
}): void;
|
|
4
|
+
declare function hide(): void;
|
|
5
|
+
declare function toggle(event: Event): void;
|
|
6
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
7
|
+
show: typeof show;
|
|
8
|
+
hide: typeof hide;
|
|
9
|
+
toggle: typeof toggle;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import TieredMenu from "primevue/tieredmenu";
|
|
3
|
+
import type { MenuItem } from "primevue/menuitem";
|
|
4
|
+
import { ref } from "vue";
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
items: MenuItem[];
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const menuRef = ref<InstanceType<typeof TieredMenu>>();
|
|
11
|
+
|
|
12
|
+
function show(event: Event | { currentTarget: HTMLElement | undefined }) {
|
|
13
|
+
menuRef.value?.show(event);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function hide() {
|
|
17
|
+
menuRef.value?.hide();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function toggle(event: Event) {
|
|
21
|
+
menuRef.value?.toggle(event);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
defineExpose({ show, hide, toggle });
|
|
25
|
+
|
|
26
|
+
const menuPt = {
|
|
27
|
+
itemContent: { class: "!bg-transparent hover:!bg-surface-700" },
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<TieredMenu
|
|
33
|
+
ref="menuRef"
|
|
34
|
+
:model="items"
|
|
35
|
+
popup
|
|
36
|
+
appendTo="body"
|
|
37
|
+
class="border border-surface-600 shadow-lg text-sm"
|
|
38
|
+
:pt="menuPt"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function show(event: Event | {
|
|
2
|
+
currentTarget: HTMLElement | undefined;
|
|
3
|
+
}): void;
|
|
4
|
+
declare function hide(): void;
|
|
5
|
+
declare function toggle(event: Event): void;
|
|
6
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
7
|
+
show: typeof show;
|
|
8
|
+
hide: typeof hide;
|
|
9
|
+
toggle: typeof toggle;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MenuItem } from "primevue/menuitem";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
items: MenuItem[];
|
|
4
|
+
label?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
severity?: string;
|
|
7
|
+
size?: "small" | "large" | undefined;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare function toggle(event: Event): void;
|
|
11
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
12
|
+
severity: string;
|
|
13
|
+
size: string;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
}>, {
|
|
16
|
+
toggle: typeof toggle;
|
|
17
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
18
|
+
severity: string;
|
|
19
|
+
size: string;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
}>>>, {
|
|
22
|
+
size: "small" | "large";
|
|
23
|
+
severity: string;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
}, {}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithDefaults<P, D> = {
|
|
28
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
29
|
+
default: D[K];
|
|
30
|
+
}> : P[K];
|
|
31
|
+
};
|
|
32
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
33
|
+
type __VLS_TypePropsToOption<T> = {
|
|
34
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
35
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
36
|
+
} : {
|
|
37
|
+
type: import('vue').PropType<T[K]>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
type __VLS_PrettifyLocal<T> = {
|
|
42
|
+
[K in keyof T]: T[K];
|
|
43
|
+
} & {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Button from "primevue/button";
|
|
3
|
+
import type { MenuItem } from "primevue/menuitem";
|
|
4
|
+
import { ref } from "vue";
|
|
5
|
+
import Menu from "../Menu/Container.vue";
|
|
6
|
+
|
|
7
|
+
withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
items: MenuItem[];
|
|
10
|
+
label?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
severity?: string;
|
|
13
|
+
size?: "small" | "large" | undefined;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
severity: "contrast",
|
|
18
|
+
size: "small",
|
|
19
|
+
disabled: false,
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const menuRef = ref<InstanceType<typeof Menu>>();
|
|
24
|
+
|
|
25
|
+
function toggle(event: Event) {
|
|
26
|
+
menuRef.value?.toggle(event);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
defineExpose({ toggle });
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<Button
|
|
34
|
+
:label="label"
|
|
35
|
+
:icon="icon"
|
|
36
|
+
:severity="severity"
|
|
37
|
+
:size="size"
|
|
38
|
+
:disabled="disabled"
|
|
39
|
+
@click="toggle"
|
|
40
|
+
/>
|
|
41
|
+
<Menu ref="menuRef" :items="items" />
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MenuItem } from "primevue/menuitem";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
items: MenuItem[];
|
|
4
|
+
label?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
severity?: string;
|
|
7
|
+
size?: "small" | "large" | undefined;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare function toggle(event: Event): void;
|
|
11
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
12
|
+
severity: string;
|
|
13
|
+
size: string;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
}>, {
|
|
16
|
+
toggle: typeof toggle;
|
|
17
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
18
|
+
severity: string;
|
|
19
|
+
size: string;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
}>>>, {
|
|
22
|
+
size: "small" | "large";
|
|
23
|
+
severity: string;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
}, {}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithDefaults<P, D> = {
|
|
28
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
29
|
+
default: D[K];
|
|
30
|
+
}> : P[K];
|
|
31
|
+
};
|
|
32
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
33
|
+
type __VLS_TypePropsToOption<T> = {
|
|
34
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
35
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
36
|
+
} : {
|
|
37
|
+
type: import('vue').PropType<T[K]>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
type __VLS_PrettifyLocal<T> = {
|
|
42
|
+
[K in keyof T]: T[K];
|
|
43
|
+
} & {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue: unknown[];
|
|
3
|
+
options: unknown[];
|
|
4
|
+
optionLabel?: string;
|
|
5
|
+
optionValue?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
display?: "comma" | "chip";
|
|
8
|
+
filter?: boolean;
|
|
9
|
+
showToggleAll?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
13
|
+
optionLabel: string;
|
|
14
|
+
optionValue: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
display: string;
|
|
17
|
+
filter: boolean;
|
|
18
|
+
showToggleAll: boolean;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
21
|
+
optionLabel: string;
|
|
22
|
+
optionValue: string;
|
|
23
|
+
placeholder: string;
|
|
24
|
+
display: string;
|
|
25
|
+
filter: boolean;
|
|
26
|
+
showToggleAll: boolean;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
}>>>, {
|
|
29
|
+
filter: boolean;
|
|
30
|
+
placeholder: string;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
optionLabel: string;
|
|
33
|
+
optionValue: string;
|
|
34
|
+
display: "comma" | "chip";
|
|
35
|
+
showToggleAll: boolean;
|
|
36
|
+
}, {}>;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithDefaults<P, D> = {
|
|
39
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
40
|
+
default: D[K];
|
|
41
|
+
}> : P[K];
|
|
42
|
+
};
|
|
43
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
44
|
+
type __VLS_TypePropsToOption<T> = {
|
|
45
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
46
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
47
|
+
} : {
|
|
48
|
+
type: import('vue').PropType<T[K]>;
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
type __VLS_PrettifyLocal<T> = {
|
|
53
|
+
[K in keyof T]: T[K];
|
|
54
|
+
} & {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import PrimeMultiSelect from "primevue/multiselect";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<{
|
|
7
|
+
modelValue: unknown[];
|
|
8
|
+
options: unknown[];
|
|
9
|
+
optionLabel?: string;
|
|
10
|
+
optionValue?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
display?: "comma" | "chip";
|
|
13
|
+
filter?: boolean;
|
|
14
|
+
showToggleAll?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
optionLabel: "label",
|
|
19
|
+
optionValue: "value",
|
|
20
|
+
placeholder: "Select...",
|
|
21
|
+
display: "chip",
|
|
22
|
+
filter: false,
|
|
23
|
+
showToggleAll: false,
|
|
24
|
+
disabled: false,
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits<{
|
|
29
|
+
"update:modelValue": [value: unknown[]];
|
|
30
|
+
}>();
|
|
31
|
+
|
|
32
|
+
const pt = computed(() => ({
|
|
33
|
+
label: { style: "padding: 0.25rem 0.5rem; font-size: 0.75rem;" },
|
|
34
|
+
chipItem: { style: "padding: 0; font-size: 0.75rem;" },
|
|
35
|
+
pcChip: {
|
|
36
|
+
root: { style: "padding: 0.1rem 0.4rem; font-size: 0.7rem;" },
|
|
37
|
+
},
|
|
38
|
+
}));
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<PrimeMultiSelect
|
|
43
|
+
:model-value="modelValue"
|
|
44
|
+
:options="options"
|
|
45
|
+
:option-label="optionLabel"
|
|
46
|
+
:option-value="optionValue"
|
|
47
|
+
:placeholder="placeholder"
|
|
48
|
+
:display="display"
|
|
49
|
+
:filter="filter"
|
|
50
|
+
:show-toggle-all="showToggleAll"
|
|
51
|
+
:disabled="disabled"
|
|
52
|
+
:pt="pt"
|
|
53
|
+
size="small"
|
|
54
|
+
v-bind="$attrs"
|
|
55
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
56
|
+
/>
|
|
57
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue: unknown[];
|
|
3
|
+
options: unknown[];
|
|
4
|
+
optionLabel?: string;
|
|
5
|
+
optionValue?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
display?: "comma" | "chip";
|
|
8
|
+
filter?: boolean;
|
|
9
|
+
showToggleAll?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
13
|
+
optionLabel: string;
|
|
14
|
+
optionValue: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
display: string;
|
|
17
|
+
filter: boolean;
|
|
18
|
+
showToggleAll: boolean;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
21
|
+
optionLabel: string;
|
|
22
|
+
optionValue: string;
|
|
23
|
+
placeholder: string;
|
|
24
|
+
display: string;
|
|
25
|
+
filter: boolean;
|
|
26
|
+
showToggleAll: boolean;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
}>>>, {
|
|
29
|
+
filter: boolean;
|
|
30
|
+
placeholder: string;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
optionLabel: string;
|
|
33
|
+
optionValue: string;
|
|
34
|
+
display: "comma" | "chip";
|
|
35
|
+
showToggleAll: boolean;
|
|
36
|
+
}, {}>;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithDefaults<P, D> = {
|
|
39
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
40
|
+
default: D[K];
|
|
41
|
+
}> : P[K];
|
|
42
|
+
};
|
|
43
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
44
|
+
type __VLS_TypePropsToOption<T> = {
|
|
45
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
46
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
47
|
+
} : {
|
|
48
|
+
type: import('vue').PropType<T[K]>;
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
type __VLS_PrettifyLocal<T> = {
|
|
53
|
+
[K in keyof T]: T[K];
|
|
54
|
+
} & {};
|