@code0-tech/pictor 0.0.0-mvp.41 → 0.0.0-mvp.42
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/assets/components/data-table/DataTable.style.css +1 -0
- package/dist/assets/components/menu/Menu.style.css +1 -1
- package/dist/components/d-flow-input/DFlowInputDataTypeEditDialog.js +1 -1
- package/dist/components/d-project/DNamespaceProject.service.d.ts +2 -1
- package/dist/components/data-table/DataTable.d.ts +23 -0
- package/dist/components/data-table/DataTable.js +41 -0
- package/dist/components/data-table/DataTableColumn.d.ts +6 -0
- package/dist/components/data-table/DataTableColumn.js +22 -0
- package/dist/components/data-table/DataTableFilterInput.d.ts +18 -0
- package/dist/components/data-table/DataTableFilterInput.js +210 -0
- package/dist/components/data-table/DataTableFilterSuggestionMenu.d.ts +7 -0
- package/dist/components/data-table/DataTableFilterSuggestionMenu.js +53 -0
- package/dist/components/data-table/index.d.ts +4 -0
- package/dist/components/data-table/index.js +11 -0
- package/dist/components/editor/Editor.d.ts +9 -3
- package/dist/components/editor/Editor.js +249 -174
- package/dist/components/menu/Menu.d.ts +5 -1
- package/dist/components/menu/Menu.js +73 -57
- package/dist/index.d.ts +1 -0
- package/dist/index.js +182 -171
- package/dist/node_modules/@lezer/highlight/dist/index.js +132 -169
- package/package.json +12 -2
- package/dist/node_modules/@codemirror/language/dist/index.js +0 -429
- package/dist/node_modules/@codemirror/lint/dist/index.js +0 -515
- package/dist/node_modules/@codemirror/state/dist/index.js +0 -2614
- package/dist/node_modules/@codemirror/view/dist/index.js +0 -6227
- package/dist/node_modules/@lezer/common/dist/index.js +0 -1357
- package/dist/node_modules/@marijn/find-cluster-break/src/index.js +0 -69
- package/dist/node_modules/crelt/index.js +0 -27
- package/dist/node_modules/style-mod/src/style-mod.js +0 -109
- package/dist/node_modules/w3c-keyname/index.js +0 -88
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.data-table{width:100%;-webkit-border-horizontal-spacing:0;-webkit-border-vertical-spacing:0;border-spacing:0}.data-table__row td{border-bottom:.5px solid rgba(191,191,191,.1);border-top:.5px solid rgba(191,191,191,.1);padding:.7rem .35rem}.data-table__row:hover{background:#191825;cursor:pointer}.data-table__row td:last-child{width:1px;white-space:nowrap}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.menu__content,.menu__sub-content{padding:.35rem;position:relative;box-sizing:border-box;z-index:999}.menu__content,.menu__sub-content{border-radius:1rem}.menu__label{text-transform:uppercase;font-size:.7rem;display:flex;gap:.35rem;align-items:center;padding:.35rem .7rem;color:#ffffff80}.menu__label{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px}.menu__item,.menu__sub-trigger{border-radius:.65rem;padding:.35rem .7rem;gap:.7rem;cursor:pointer;width:100%;display:flex;align-items:center;font-size:.8rem}.menu__item,.menu__sub-trigger{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__item:focus,.menu__sub-trigger:focus{outline:none}.menu__item,.menu__sub-trigger{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px}.menu__item:disabled,.menu__item[data-disabled],.menu__item[aria-disabled=true],.menu__item--disabled,.menu__sub-trigger:disabled,.menu__sub-trigger[data-disabled],.menu__sub-trigger[aria-disabled=true],.menu__sub-trigger--disabled{cursor:not-allowed;opacity:25%;pointer-events:unset}.menu__item,.menu__sub-trigger{box-shadow:none}.menu__item:focus,.menu__item[data-focus=true],.menu__sub-trigger:focus,.menu__sub-trigger[data-focus=true]{background:#201e2c;box-shadow:inset 0 1px 1px #ffffff1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:none;width:100%}.menu__separator{border:none;margin:.35rem 0;color:#ffffff1a;height:1px;background-color:#ffffff1a}.menu__content--primary,.menu__sub-content--primary{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--secondary,.menu__sub-content--secondary{background:#191825;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--tertiary,.menu__sub-content--tertiary{background:#201e2c;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--success,.menu__sub-content--success{background:#0a1814;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--warning,.menu__sub-content--warning{background:#201813;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--error,.menu__sub-content--error{background:#1c0516;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--info,.menu__sub-content--info{background:#121e24;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}
|
|
1
|
+
.menu__content,.menu__sub-content{padding:.35rem;position:relative;box-sizing:border-box;z-index:999}.menu__content,.menu__sub-content{border-radius:1rem}.menu__label{text-transform:uppercase;font-size:.7rem;display:flex;gap:.35rem;align-items:center;padding:.35rem .7rem;color:#ffffff80}.menu__label{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px}.menu__item,.menu__sub-trigger,.menu__checkbox-item{border-radius:.65rem;padding:.35rem .7rem;gap:.7rem;cursor:pointer;width:100%;display:flex;align-items:center;font-size:.8rem}.menu__item,.menu__sub-trigger,.menu__checkbox-item{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__item:focus,.menu__sub-trigger:focus,.menu__checkbox-item:focus{outline:none}.menu__item,.menu__sub-trigger,.menu__checkbox-item{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px}.menu__item:disabled,.menu__item[data-disabled],.menu__item[aria-disabled=true],.menu__item--disabled,.menu__sub-trigger:disabled,.menu__sub-trigger[data-disabled],.menu__sub-trigger[aria-disabled=true],.menu__sub-trigger--disabled,.menu__checkbox-item:disabled,.menu__checkbox-item[data-disabled],.menu__checkbox-item[aria-disabled=true],.menu__checkbox-item--disabled{cursor:not-allowed;opacity:25%;pointer-events:unset}.menu__item,.menu__sub-trigger,.menu__checkbox-item{box-shadow:none}.menu__item:focus,.menu__item[data-focus=true],.menu__sub-trigger:focus,.menu__sub-trigger[data-focus=true],.menu__checkbox-item:focus,.menu__checkbox-item[data-focus=true]{background:#201e2c;box-shadow:inset 0 1px 1px #ffffff1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:none;width:100%}.menu__separator{border:none;margin:.35rem 0;color:#ffffff1a;height:1px;background-color:#ffffff1a}.menu__content--primary,.menu__sub-content--primary{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--secondary,.menu__sub-content--secondary{background:#191825;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--tertiary,.menu__sub-content--tertiary{background:#201e2c;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--success,.menu__sub-content--success{background:#0a1814;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--warning,.menu__sub-content--warning{background:#201813;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--error,.menu__sub-content--error{background:#1c0516;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.menu__content--info,.menu__sub-content--info{background:#121e24;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}
|
|
@@ -14,7 +14,7 @@ import { hashToColor as s } from "../d-flow/DFlow.util.js";
|
|
|
14
14
|
import { ScrollArea as U, ScrollAreaViewport as X, ScrollAreaScrollbar as f, ScrollAreaThumb as h } from "../scroll-area/ScrollArea.js";
|
|
15
15
|
import { Spacing as g } from "../spacing/Spacing.js";
|
|
16
16
|
import { Badge as c } from "../badge/Badge.js";
|
|
17
|
-
import { syntaxTree as T } from "
|
|
17
|
+
import { syntaxTree as T } from "@codemirror/language";
|
|
18
18
|
import { Button as q } from "../button/Button.js";
|
|
19
19
|
import { IconX as J } from "@tabler/icons-react";
|
|
20
20
|
const ue = (i) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Namespace, NamespaceProject, NamespacesProjectsAssignRuntimesInput, NamespacesProjectsAssignRuntimesPayload, NamespacesProjectsCreateInput, NamespacesProjectsCreatePayload, NamespacesProjectsDeleteInput, NamespacesProjectsDeletePayload } from '@code0-tech/sagittarius-graphql-types';
|
|
1
|
+
import { Namespace, NamespaceProject, NamespacesProjectsAssignRuntimesInput, NamespacesProjectsAssignRuntimesPayload, NamespacesProjectsCreateInput, NamespacesProjectsCreatePayload, NamespacesProjectsDeleteInput, NamespacesProjectsDeletePayload, NamespacesProjectsUpdateInput, NamespacesProjectsUpdatePayload } from '@code0-tech/sagittarius-graphql-types';
|
|
2
2
|
import { DNamespaceProjectView } from './DNamespaceProject.view';
|
|
3
3
|
import { ReactiveArrayService } from '../../utils';
|
|
4
4
|
export type DProjectDependencies = {
|
|
@@ -7,6 +7,7 @@ export type DProjectDependencies = {
|
|
|
7
7
|
export declare abstract class DNamespaceProjectReactiveService extends ReactiveArrayService<DNamespaceProjectView, DProjectDependencies> {
|
|
8
8
|
getById(id: NamespaceProject['id'], dependencies?: DProjectDependencies): DNamespaceProjectView | undefined;
|
|
9
9
|
abstract projectAssignRuntimes(payload: NamespacesProjectsAssignRuntimesInput): Promise<NamespacesProjectsAssignRuntimesPayload | undefined>;
|
|
10
|
+
abstract projectUpdate(payload: NamespacesProjectsUpdateInput): Promise<NamespacesProjectsUpdatePayload | undefined>;
|
|
10
11
|
abstract projectCreate(payload: NamespacesProjectsCreateInput): Promise<NamespacesProjectsCreatePayload | undefined>;
|
|
11
12
|
abstract projectDelete(payload: NamespacesProjectsDeleteInput): Promise<NamespacesProjectsDeletePayload | undefined>;
|
|
12
13
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Code0Component } from '../../utils';
|
|
3
|
+
export type DataTableFilterOperator = "isOneOf" | "isNotOneOf";
|
|
4
|
+
export interface DataTableFilterProps {
|
|
5
|
+
[key: string]: {
|
|
6
|
+
operator: DataTableFilterOperator;
|
|
7
|
+
value: string | string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface DataTableSortProps {
|
|
11
|
+
[key: string]: 'asc' | 'desc' | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface DataTableProps<T> extends Omit<Code0Component<HTMLTableElement>, 'data' | 'children' | 'onSelect'> {
|
|
14
|
+
data: Array<T>;
|
|
15
|
+
sort?: DataTableSortProps;
|
|
16
|
+
filter?: DataTableFilterProps;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
loadingComponent?: React.ReactNode;
|
|
19
|
+
emptyComponent?: React.ReactNode;
|
|
20
|
+
onSelect?: (item: T | undefined) => void;
|
|
21
|
+
children?: (item: T, index: number) => React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare const DataTable: <T>(props: DataTableProps<T>) => React.JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as g, jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import h from "react";
|
|
3
|
+
import '../../assets/components/data-table/DataTable.style.css';/* empty css */
|
|
4
|
+
import "../../utils/contextStore.js";
|
|
5
|
+
import { mergeCode0Props as C } from "../../utils/utils.js";
|
|
6
|
+
const d = (l, y) => y.split(".").reduce((t, f) => {
|
|
7
|
+
if (t != null)
|
|
8
|
+
return Array.isArray(t) ? t.map((a) => a?.[f]).filter((a) => a !== void 0) : t[f];
|
|
9
|
+
}, l), N = (l) => {
|
|
10
|
+
const {
|
|
11
|
+
data: y,
|
|
12
|
+
sort: t,
|
|
13
|
+
filter: f,
|
|
14
|
+
loading: a,
|
|
15
|
+
loadingComponent: j,
|
|
16
|
+
emptyComponent: A,
|
|
17
|
+
onSelect: u,
|
|
18
|
+
children: p,
|
|
19
|
+
...b
|
|
20
|
+
} = l, m = y.filter((i) => Object.entries(f || {}).every(([o, {
|
|
21
|
+
operator: n,
|
|
22
|
+
value: r
|
|
23
|
+
}]) => {
|
|
24
|
+
const e = d(i, o);
|
|
25
|
+
return n === "isOneOf" && !Array.isArray(r) && !Array.isArray(e) ? e === r : n === "isOneOf" && !Array.isArray(r) && Array.isArray(e) ? Array.from(e).includes(r) : n === "isOneOf" && Array.isArray(r) && !Array.isArray(e) ? Array.from(r).some((s) => s === e) : n === "isOneOf" && Array.isArray(r) && Array.isArray(e) ? Array.from(r).some((s) => Array.from(e).includes(s)) : !1;
|
|
26
|
+
})), c = h.useMemo(() => t ? [...m].sort((i, o) => {
|
|
27
|
+
for (const [n, r] of Object.entries(t)) {
|
|
28
|
+
const e = d(i, n), s = d(o, n);
|
|
29
|
+
if (e < s) return r === "asc" ? -1 : 1;
|
|
30
|
+
if (e > s) return r === "asc" ? 1 : -1;
|
|
31
|
+
}
|
|
32
|
+
return 0;
|
|
33
|
+
}) : m, [m, t]);
|
|
34
|
+
return /* @__PURE__ */ g("table", { ...C("data-table", b), children: [
|
|
35
|
+
c.map((i, o) => /* @__PURE__ */ O("tr", { className: "data-table__row", onClick: () => u?.(i), children: p?.(i, o) })),
|
|
36
|
+
c.length === 0 && !a && A ? /* @__PURE__ */ O("tr", { className: "data-table__row", onClick: () => u?.(void 0), children: A }) : null
|
|
37
|
+
] });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
N as DataTable
|
|
41
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Code0Component } from '../../utils';
|
|
3
|
+
export interface DataTableColumnProps extends Code0Component<HTMLTableCellElement> {
|
|
4
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
5
|
+
}
|
|
6
|
+
export declare const DataTableColumn: React.FC<DataTableColumnProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as n } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import "../../utils/contextStore.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { mergeCode0Props as s } from "../../utils/utils.js";
|
|
6
|
+
const x = (m) => {
|
|
7
|
+
const t = n.c(6);
|
|
8
|
+
let e, r;
|
|
9
|
+
if (t[0] !== m) {
|
|
10
|
+
const {
|
|
11
|
+
children: i,
|
|
12
|
+
...l
|
|
13
|
+
} = m;
|
|
14
|
+
e = i, r = s("", l), t[0] = m, t[1] = e, t[2] = r;
|
|
15
|
+
} else
|
|
16
|
+
e = t[1], r = t[2];
|
|
17
|
+
let o;
|
|
18
|
+
return t[3] !== e || t[4] !== r ? (o = /* @__PURE__ */ c("td", { ...r, children: e }), t[3] = e, t[4] = r, t[5] = o) : o = t[5], o;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
x as DataTableColumn
|
|
22
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { StreamLanguage } from '@codemirror/language';
|
|
3
|
+
import { CompletionContext } from '@codemirror/autocomplete';
|
|
4
|
+
import { DataTableFilterOperator, DataTableFilterProps } from './DataTable';
|
|
5
|
+
export interface DataTableFilterTokens {
|
|
6
|
+
token: string;
|
|
7
|
+
key: string;
|
|
8
|
+
operators: DataTableFilterOperator[];
|
|
9
|
+
suggestion?: (context: CompletionContext, operator: DataTableFilterOperator, currentValue: string, applySuggestion: (value: string, silently?: boolean) => void) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface DataTableFilterInputProps {
|
|
12
|
+
filterTokens?: DataTableFilterTokens[];
|
|
13
|
+
onChange?: (filter: DataTableFilterProps) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const createFilterQueryLanguage: (validTokens: string[]) => StreamLanguage<{
|
|
16
|
+
tokens: string[];
|
|
17
|
+
}>;
|
|
18
|
+
export declare const DataTableFilterInput: React.FC<DataTableFilterInputProps>;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { c as Q } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { Editor as z } from "../editor/Editor.js";
|
|
4
|
+
import { StreamLanguage as U, syntaxTree as J } from "@codemirror/language";
|
|
5
|
+
import { EditorState as K } from "@uiw/react-codemirror";
|
|
6
|
+
import { Badge as b } from "../badge/Badge.js";
|
|
7
|
+
import { hashToColor as X } from "../d-flow/DFlow.util.js";
|
|
8
|
+
import { DataTableFilterSuggestionMenu as j } from "./DataTableFilterSuggestionMenu.js";
|
|
9
|
+
import { MenuItem as G } from "../menu/Menu.js";
|
|
10
|
+
const $ = {
|
|
11
|
+
"=": "isOneOf",
|
|
12
|
+
"!=": "isNotOneOf"
|
|
13
|
+
}, H = {
|
|
14
|
+
isOneOf: "is one of",
|
|
15
|
+
isNotOneOf: "is not one of"
|
|
16
|
+
}, Y = {
|
|
17
|
+
isOneOf: "=",
|
|
18
|
+
isNotOneOf: "!="
|
|
19
|
+
}, y = (r) => r.replace(/^\\|\\$/g, ""), Z = (r) => U.define({
|
|
20
|
+
startState: () => ({
|
|
21
|
+
tokens: []
|
|
22
|
+
}),
|
|
23
|
+
token(e, n) {
|
|
24
|
+
if (e.eatSpace()) return null;
|
|
25
|
+
if (e.match("!=") || e.match("=") && e.peek() !== "=")
|
|
26
|
+
return n.tokens.push("operator"), "operator";
|
|
27
|
+
if (e.peek() === "\\") {
|
|
28
|
+
e.next();
|
|
29
|
+
const k = [];
|
|
30
|
+
for (; !e.eol() && e.peek() !== "\\"; ) k.push(e.next());
|
|
31
|
+
if (e.peek() === "\\") {
|
|
32
|
+
e.next();
|
|
33
|
+
const S = k.join("");
|
|
34
|
+
if (r.includes(S) && n.tokens[n.tokens.length - 1] !== "propertyName")
|
|
35
|
+
return n.tokens.push("propertyName"), "propertyName";
|
|
36
|
+
if (n.tokens[n.tokens.length - 1] !== "literal")
|
|
37
|
+
return n.tokens.push("literal"), "literal";
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return e.next(), null;
|
|
42
|
+
}
|
|
43
|
+
}), he = (r) => {
|
|
44
|
+
const e = Q.c(17), {
|
|
45
|
+
filterTokens: n,
|
|
46
|
+
onChange: k
|
|
47
|
+
} = r;
|
|
48
|
+
let S;
|
|
49
|
+
e[0] !== n ? (S = Z(n?.map(q) || []), e[0] = n, e[1] = S) : S = e[1];
|
|
50
|
+
const A = S;
|
|
51
|
+
let v;
|
|
52
|
+
e[2] !== n ? (v = (o) => {
|
|
53
|
+
if (!o.trim())
|
|
54
|
+
return {};
|
|
55
|
+
const d = {}, l = o.split(/\\/).filter(Boolean);
|
|
56
|
+
for (let i = 0; i + 2 < l.length; i = i + 3, i) {
|
|
57
|
+
const p = l[i], a = l[i + 1], _ = l[i + 2];
|
|
58
|
+
if (!p || !a || !_)
|
|
59
|
+
continue;
|
|
60
|
+
const L = n?.find((t) => t.token === p);
|
|
61
|
+
if (!L)
|
|
62
|
+
continue;
|
|
63
|
+
const h = $[a];
|
|
64
|
+
if (!h)
|
|
65
|
+
continue;
|
|
66
|
+
const O = _.split(",").map(x).filter(Boolean);
|
|
67
|
+
O.length > 0 && (d[L.key] = {
|
|
68
|
+
operator: h,
|
|
69
|
+
value: O
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return d;
|
|
73
|
+
}, e[2] = n, e[3] = v) : v = e[3];
|
|
74
|
+
const B = v;
|
|
75
|
+
let w;
|
|
76
|
+
e[4] !== k || e[5] !== B ? (w = (o) => {
|
|
77
|
+
const d = B(o);
|
|
78
|
+
k?.(d);
|
|
79
|
+
}, e[4] = k, e[5] = B, e[6] = w) : w = e[6];
|
|
80
|
+
const F = w;
|
|
81
|
+
let C;
|
|
82
|
+
e[7] !== n ? (C = (o) => {
|
|
83
|
+
const d = J(o.state), l = d.resolveInner(o.pos, -1), i = d.resolveInner(o.pos, 1), {
|
|
84
|
+
propertyNode: p,
|
|
85
|
+
operatorNode: a
|
|
86
|
+
} = (() => {
|
|
87
|
+
const t = {
|
|
88
|
+
propertyNode: null,
|
|
89
|
+
operatorNode: null
|
|
90
|
+
};
|
|
91
|
+
for (let s = l; s; s = s.prevSibling)
|
|
92
|
+
s.name === "propertyName" && !t.propertyNode && (t.propertyNode = s), s.name === "operator" && !t.operatorNode && (t.operatorNode = s);
|
|
93
|
+
return t;
|
|
94
|
+
})(), _ = p ? o.pos < p.to ? "propertyName" : o.pos === p.to ? "operator" : a ? o.pos < a.to ? "operator" : o.pos === a.to ? "literal" : l.name === "literal" ? "propertyName" : l.name === "invalid" && o.state.sliceDoc(l.from, l.to).startsWith("\\") ? "literal" : (() => {
|
|
95
|
+
const t = o.state.sliceDoc(a.to, o.pos);
|
|
96
|
+
return t.trim() ? t.includes(" ") ? "propertyName" : "literal" : t.length > 0 ? "propertyName" : "literal";
|
|
97
|
+
})() : (i.name === "operator", "operator") : "propertyName", L = p ? y(o.state.sliceDoc(p.from, p.to)) : "", h = n?.find((t) => t.token === L), O = (t, s, c, g) => {
|
|
98
|
+
g ? o.view?.dispatch({
|
|
99
|
+
changes: {
|
|
100
|
+
from: t,
|
|
101
|
+
to: s,
|
|
102
|
+
insert: c
|
|
103
|
+
},
|
|
104
|
+
selection: {
|
|
105
|
+
anchor: o.pos
|
|
106
|
+
},
|
|
107
|
+
scrollIntoView: !1
|
|
108
|
+
}) : (o.view?.dispatch({
|
|
109
|
+
changes: {
|
|
110
|
+
from: t,
|
|
111
|
+
to: s,
|
|
112
|
+
insert: c
|
|
113
|
+
},
|
|
114
|
+
selection: {
|
|
115
|
+
anchor: t + c.length
|
|
116
|
+
},
|
|
117
|
+
scrollIntoView: !0
|
|
118
|
+
}), o.view?.focus());
|
|
119
|
+
};
|
|
120
|
+
if (_ === "propertyName") {
|
|
121
|
+
const t = /* @__PURE__ */ new Set(), s = o.matchBefore(/\\?[\w-]*/), c = s ? s.from : o.pos, g = p && o.pos <= p.to, N = i.name === "propertyName" ? i.to : g ? p.to : o.pos, m = g && p.from < c ? p.from : c, W = y(o.state.sliceDoc(m, o.pos)), R = n?.filter((f) => f.token.startsWith(W) && !t.has(f.token)) || [];
|
|
122
|
+
if (d.iterate({
|
|
123
|
+
enter: (f) => {
|
|
124
|
+
f.name === "propertyName" && t.add(y(o.state.sliceDoc(f.from, f.to)));
|
|
125
|
+
}
|
|
126
|
+
}), R.length)
|
|
127
|
+
return /* @__PURE__ */ u(j, { context: o, children: R.map((f) => /* @__PURE__ */ u(G, { onSelect: () => {
|
|
128
|
+
let M = `\\${f.token}\\`;
|
|
129
|
+
l.name === "literal" && o.state.sliceDoc(N, N + 1) !== "\\" && (M = "\\" + M), O(m, N, M);
|
|
130
|
+
}, children: f.token }, f.token)) });
|
|
131
|
+
}
|
|
132
|
+
if (_ === "operator" && h) {
|
|
133
|
+
const t = o.matchBefore(/[!=]+/), s = t ? t.from : o.pos, c = a && o.pos <= a.to, g = i.name === "operator" ? i.to : c ? a.to : o.pos, N = c && a.from < s ? a.from : s;
|
|
134
|
+
return /* @__PURE__ */ u(j, { context: o, children: h.operators.map((m) => /* @__PURE__ */ u(G, { onSelect: () => O(N, g, Y[m]), children: H[m] }, m)) });
|
|
135
|
+
}
|
|
136
|
+
if (_ === "literal" && h?.suggestion) {
|
|
137
|
+
const t = a ? o.state.sliceDoc(a.from, a.to) : "", s = $[t];
|
|
138
|
+
if (s && h.operators.includes(s)) {
|
|
139
|
+
const c = i.name === "literal" ? o.state.sliceDoc(i.from, i.to) : "";
|
|
140
|
+
return h.suggestion(o, s, y(c), (g, N) => {
|
|
141
|
+
const m = l.name === "literal" || l.name === "invalid" && o.state.sliceDoc(l.from, l.to).startsWith("\\"), W = m ? l.from : o.pos, R = m ? l.to : i.name === "literal" ? i.to : o.pos;
|
|
142
|
+
O(W, R, `\\${g}\\`, N);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}, e[7] = n, e[8] = C) : C = e[8];
|
|
148
|
+
const V = C;
|
|
149
|
+
let D, I;
|
|
150
|
+
e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = {
|
|
151
|
+
backgroundColor: "rgba(255,255,255,.1)",
|
|
152
|
+
padding: "0.35rem",
|
|
153
|
+
boxSizing: "border-box",
|
|
154
|
+
borderRadius: "1rem",
|
|
155
|
+
boxShadow: "inset 0 1px 1px 0 rgba(255,255,255,.2)"
|
|
156
|
+
}, I = {
|
|
157
|
+
literal: oe,
|
|
158
|
+
operator: te,
|
|
159
|
+
propertyName: re
|
|
160
|
+
}, e[9] = D, e[10] = I) : (D = e[9], I = e[10]);
|
|
161
|
+
let T, E;
|
|
162
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = [K.transactionFilter.of(ne)], E = {
|
|
163
|
+
lineNumbers: !1,
|
|
164
|
+
foldGutter: !1,
|
|
165
|
+
highlightActiveLine: !1,
|
|
166
|
+
highlightActiveLineGutter: !1,
|
|
167
|
+
dropCursor: !1,
|
|
168
|
+
indentOnInput: !1
|
|
169
|
+
}, e[11] = T, e[12] = E) : (T = e[11], E = e[12]);
|
|
170
|
+
let P;
|
|
171
|
+
return e[13] !== V || e[14] !== F || e[15] !== A ? (P = /* @__PURE__ */ u(z, { w: "100%", initialValue: "", onChange: F, style: D, tokenHighlights: I, showTooltips: !1, showValidation: !1, customSuggestionComponent: !0, suggestions: V, extensions: T, basicSetup: E, language: A }), e[13] = V, e[14] = F, e[15] = A, e[16] = P) : P = e[16], P;
|
|
172
|
+
};
|
|
173
|
+
function q(r) {
|
|
174
|
+
return r.token;
|
|
175
|
+
}
|
|
176
|
+
function x(r) {
|
|
177
|
+
return r.trim();
|
|
178
|
+
}
|
|
179
|
+
function ee(r) {
|
|
180
|
+
return /* @__PURE__ */ u(b, { style: {
|
|
181
|
+
boxShadow: "none"
|
|
182
|
+
}, color: "secondary", children: r }, r);
|
|
183
|
+
}
|
|
184
|
+
function oe(r) {
|
|
185
|
+
const {
|
|
186
|
+
content: e
|
|
187
|
+
} = r, n = y(e).split(",");
|
|
188
|
+
return n.length > 1 ? /* @__PURE__ */ u(b, { p: 0.175, mx: 0.175, children: n.map(ee) }) : /* @__PURE__ */ u(b, { mx: 0.175, children: y(e) });
|
|
189
|
+
}
|
|
190
|
+
function te(r) {
|
|
191
|
+
const {
|
|
192
|
+
content: e
|
|
193
|
+
} = r;
|
|
194
|
+
return /* @__PURE__ */ u(b, { color: "tertiary", style: {
|
|
195
|
+
boxShadow: "none"
|
|
196
|
+
}, children: H[$[e]] || e });
|
|
197
|
+
}
|
|
198
|
+
function re(r) {
|
|
199
|
+
const {
|
|
200
|
+
content: e
|
|
201
|
+
} = r;
|
|
202
|
+
return /* @__PURE__ */ u(b, { mx: 0.175, color: X(y(e)), children: y(e) });
|
|
203
|
+
}
|
|
204
|
+
function ne(r) {
|
|
205
|
+
return r.docChanged && r.newDoc.lines > 1 ? [] : r;
|
|
206
|
+
}
|
|
207
|
+
export {
|
|
208
|
+
he as DataTableFilterInput,
|
|
209
|
+
Z as createFilterQueryLanguage
|
|
210
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CompletionContext } from '@codemirror/autocomplete';
|
|
3
|
+
export interface DataTableFilterSuggestionMenuProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
context?: CompletionContext;
|
|
6
|
+
}
|
|
7
|
+
export declare const DataTableFilterSuggestionMenu: React.FC<DataTableFilterSuggestionMenuProps>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as f, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { c as v } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import w from "react";
|
|
4
|
+
import { MenuTrigger as y, MenuContent as _, Menu as g } from "../menu/Menu.js";
|
|
5
|
+
const T = (t) => {
|
|
6
|
+
const e = v.c(11), {
|
|
7
|
+
children: l,
|
|
8
|
+
context: u
|
|
9
|
+
} = t, [m, p] = w.useState(!0), h = _;
|
|
10
|
+
let r;
|
|
11
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = (a) => p(a), e[0] = r) : r = e[0];
|
|
12
|
+
let i;
|
|
13
|
+
e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ f(y, { asChild: !0, children: /* @__PURE__ */ f("div", { style: {
|
|
14
|
+
position: "absolute",
|
|
15
|
+
top: 0,
|
|
16
|
+
left: 0,
|
|
17
|
+
width: 0,
|
|
18
|
+
height: 0
|
|
19
|
+
} }) }), e[1] = i) : i = e[1];
|
|
20
|
+
let n;
|
|
21
|
+
e[2] !== u?.view ? (n = (a) => {
|
|
22
|
+
["Escape", "ArrowUp", "ArrowDown"].includes(a.key) || u?.view?.focus();
|
|
23
|
+
}, e[2] = u?.view, e[3] = n) : n = e[3];
|
|
24
|
+
let s;
|
|
25
|
+
e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {
|
|
26
|
+
position: "fixed",
|
|
27
|
+
top: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
pointerEvents: "auto"
|
|
30
|
+
}, e[4] = s) : s = e[4];
|
|
31
|
+
let o;
|
|
32
|
+
e[5] !== l || e[6] !== n ? (o = /* @__PURE__ */ f(h, { w: "200px", onInteractOutside: b, onOpenAutoFocus: D, onKeyDown: n, style: s, children: l }), e[5] = l, e[6] = n, e[7] = o) : o = e[7];
|
|
33
|
+
let c;
|
|
34
|
+
return e[8] !== m || e[9] !== o ? (c = /* @__PURE__ */ d(g, { open: m, onOpenChange: r, modal: !1, children: [
|
|
35
|
+
i,
|
|
36
|
+
o
|
|
37
|
+
] }), e[8] = m, e[9] = o, e[10] = c) : c = e[10], c;
|
|
38
|
+
};
|
|
39
|
+
function x(t) {
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
42
|
+
function S(t) {
|
|
43
|
+
return t.startsWith("cm-");
|
|
44
|
+
}
|
|
45
|
+
function b(t) {
|
|
46
|
+
Array.from(t.currentTarget.classList).map(x).some(S) && t.preventDefault();
|
|
47
|
+
}
|
|
48
|
+
function D(t) {
|
|
49
|
+
t.preventDefault(), t.currentTarget.querySelector('[role="menuitem"]')?.focus();
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
T as DataTableFilterSuggestionMenu
|
|
53
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataTable as t } from "./DataTable.js";
|
|
2
|
+
import { DataTableColumn as o } from "./DataTableColumn.js";
|
|
3
|
+
import { DataTableFilterInput as u, createFilterQueryLanguage as m } from "./DataTableFilterInput.js";
|
|
4
|
+
import { DataTableFilterSuggestionMenu as p } from "./DataTableFilterSuggestionMenu.js";
|
|
5
|
+
export {
|
|
6
|
+
t as DataTable,
|
|
7
|
+
o as DataTableColumn,
|
|
8
|
+
u as DataTableFilterInput,
|
|
9
|
+
p as DataTableFilterSuggestionMenu,
|
|
10
|
+
m as createFilterQueryLanguage
|
|
11
|
+
};
|
|
@@ -2,7 +2,9 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { Code0Component } from '../../utils';
|
|
3
3
|
import { ValidationProps } from '../form';
|
|
4
4
|
import { Extension } from '@uiw/react-codemirror';
|
|
5
|
+
import { StreamLanguage } from '@codemirror/language';
|
|
5
6
|
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
7
|
+
import { BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
6
8
|
export type EditorTokenizer = (content: string) => string | null;
|
|
7
9
|
export interface EditorRendererProps {
|
|
8
10
|
content: string;
|
|
@@ -10,14 +12,18 @@ export interface EditorRendererProps {
|
|
|
10
12
|
export interface EditorTokenHighlights {
|
|
11
13
|
[tokenName: string]: (props: EditorRendererProps) => React.ReactNode;
|
|
12
14
|
}
|
|
13
|
-
export interface EditorInputProps extends Omit<Code0Component<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value'>, ValidationProps<
|
|
14
|
-
language?: 'json'
|
|
15
|
+
export interface EditorInputProps extends Omit<Code0Component<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value'>, ValidationProps<any> {
|
|
16
|
+
language?: 'json' | StreamLanguage<unknown>;
|
|
15
17
|
tokenizer?: EditorTokenizer;
|
|
16
18
|
tokenHighlights?: EditorTokenHighlights;
|
|
17
|
-
suggestions?: (context: CompletionContext) => CompletionResult | null;
|
|
19
|
+
suggestions?: (context: CompletionContext) => CompletionResult | React.ReactNode | null;
|
|
20
|
+
customSuggestionComponent?: boolean;
|
|
18
21
|
onChange?: (value: any) => void;
|
|
19
22
|
extensions?: Extension[];
|
|
20
23
|
disabled?: boolean;
|
|
21
24
|
readonly?: boolean;
|
|
25
|
+
showTooltips?: boolean;
|
|
26
|
+
showValidation?: boolean;
|
|
27
|
+
basicSetup?: BasicSetupOptions;
|
|
22
28
|
}
|
|
23
29
|
export declare const Editor: React.FC<EditorInputProps>;
|