@vidispine/vdt-materialui 24.4.0-pre.2 → 25.3.0-pre.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("react/jsx-runtime"),T=require("react"),v=require("clsx"),e=require("prop-types"),S=require("@material-ui/lab"),f=require("@vidispine/proptypes"),j=require("../../../utils.js"),C=require("../QueryBuilderContext.js"),E=require("../QueryEntry/index.js"),Q=o=>({root:{},treeRoot:{backgroundColor:o.palette.background.paper,"& > .MuiTreeItem-root:first-child":{backgroundColor:"transparent",margin:"0",border:"none"}}}),R=o=>{function a({uuid:s,...n}){const p=n.operation,i=({operation:r,value:u,range:t}={})=>r?"operator":u||t?"field":"group";return{...p?{operation:n.operation,operator:n.entry.filter(r=>r.operation).map(r=>a(r))}:{name:n.name},field:n.entry.filter(r=>i(r)==="field").map(({uuid:r,predicate:u,...t})=>{var l;const m=(l=t.value)==null?void 0:l.map(({value:d})=>({value:d.includes(" ")?`"${d}"`:`${d}`}));return{...t,value:m}}),group:n.entry.filter(r=>i(r)==="group").map(r=>a(r))}}return o&&o.operator&&{operator:a(o.operator)}},N=o=>{const a=({operation:s,name:n,operator:p,field:i,group:r,entry:u}={})=>({...s?{operation:s}:{name:n},entry:[...i||[],...(p||[]).map(t=>a(t)),...(r||[]).map(t=>a(t)),...u||[]].map(t=>({uuid:j.uuidv4(),...t}))});return o&&o.operator&&{operator:a(o.operator)}};function h({classes:o,className:a,query:s,fields:n,groups:p,defaultField:i,defaultGroup:r,onChange:u,QueryEntryComponent:t,QueryEntryProps:m}){const l=T.useMemo(()=>N(s),[s]),d=T.useCallback(c=>{u({...c,toItemSearchDocument(){return R(this)}})},[u]),[O,x]=T.useState(["operator"]),b=(c,g)=>{x(g)},q=c=>{O.includes(c)||x(g=>[...g,c])};return y.jsx("div",{className:v(a,o.root,"VdtQueryBuilder-root"),children:l?y.jsx(C.QueryBuilderContextProvider,{query:l,onChange:d,children:y.jsx(S.TreeView,{classes:{root:o.treeRoot},disableSelection:!0,expanded:O,onNodeToggle:b,children:y.jsx(t,{expandNode:q,path:"operator",defaultField:i,defaultGroup:r,fields:n,groups:p,canExpand:!1,...m})})}):null})}h.propTypes={classes:e.objectOf(e.string),className:e.string,query:e.oneOfType([e.shape({operation:e.oneOf(["AND","OR","NOT"]).isRequired,entry:e.arrayOf(e.oneOfType([f.SearchOperatorType,f.SearchFieldType,f.SearchGroupType]))}),f.ItemSearchType]).isRequired,groups:e.arrayOf(e.any),fields:e.arrayOf(e.any),defaultField:e.oneOfType([e.string,e.objectOf(e.any)]),defaultGroup:e.string,onChange:e.func.isRequired,QueryEntryComponent:e.elementType,QueryEntryProps:e.objectOf(e.any)};h.defaultProps={className:void 0,classes:{},fields:[],groups:[],defaultField:void 0,defaultGroup:void 0,QueryEntryComponent:E.default,QueryEntryProps:{}};exports.default=h;exports.styles=Q;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as v, useCallback as x, useState as C } from "react";
|
|
3
|
+
import Q from "clsx";
|
|
4
4
|
import e from "prop-types";
|
|
5
|
-
import { TreeView as
|
|
6
|
-
import
|
|
5
|
+
import { TreeView as S } from "@material-ui/lab";
|
|
6
|
+
import f from "@vidispine/proptypes";
|
|
7
7
|
import { uuidv4 as N } from "../../../utils.js";
|
|
8
8
|
import { QueryBuilderContextProvider as P } from "../QueryBuilderContext.js";
|
|
9
9
|
import R from "../QueryEntry/index.js";
|
|
10
|
-
const
|
|
10
|
+
const $ = (o) => ({
|
|
11
11
|
root: {},
|
|
12
12
|
treeRoot: {
|
|
13
13
|
backgroundColor: o.palette.background.paper,
|
|
@@ -25,7 +25,13 @@ const w = (o) => ({
|
|
|
25
25
|
operation: a.operation,
|
|
26
26
|
operator: a.entry.filter((r) => r.operation).map((r) => n(r))
|
|
27
27
|
} : { name: a.name },
|
|
28
|
-
field: a.entry.filter((r) => u(r) === "field").map(({ uuid: r, predicate: p, ...t }) =>
|
|
28
|
+
field: a.entry.filter((r) => u(r) === "field").map(({ uuid: r, predicate: p, ...t }) => {
|
|
29
|
+
var d;
|
|
30
|
+
const y = (d = t.value) == null ? void 0 : d.map(({ value: l }) => ({
|
|
31
|
+
value: l.includes(" ") ? `"${l}"` : `${l}`
|
|
32
|
+
}));
|
|
33
|
+
return { ...t, value: y };
|
|
34
|
+
}),
|
|
29
35
|
group: a.entry.filter((r) => u(r) === "group").map((r) => n(r))
|
|
30
36
|
};
|
|
31
37
|
}
|
|
@@ -42,7 +48,7 @@ const w = (o) => ({
|
|
|
42
48
|
});
|
|
43
49
|
return o && o.operator && { operator: n(o.operator) };
|
|
44
50
|
};
|
|
45
|
-
function
|
|
51
|
+
function O({
|
|
46
52
|
classes: o,
|
|
47
53
|
className: n,
|
|
48
54
|
query: i,
|
|
@@ -52,31 +58,31 @@ function T({
|
|
|
52
58
|
defaultGroup: r,
|
|
53
59
|
onChange: p,
|
|
54
60
|
QueryEntryComponent: t,
|
|
55
|
-
QueryEntryProps:
|
|
61
|
+
QueryEntryProps: y
|
|
56
62
|
}) {
|
|
57
|
-
const
|
|
58
|
-
(
|
|
63
|
+
const d = v(() => k(i), [i]), l = x(
|
|
64
|
+
(c) => {
|
|
59
65
|
p({
|
|
60
|
-
...
|
|
66
|
+
...c,
|
|
61
67
|
toItemSearchDocument() {
|
|
62
68
|
return j(this);
|
|
63
69
|
}
|
|
64
70
|
});
|
|
65
71
|
},
|
|
66
72
|
[p]
|
|
67
|
-
), [
|
|
68
|
-
g
|
|
69
|
-
}, E = (
|
|
70
|
-
|
|
73
|
+
), [T, h] = C(["operator"]), b = (c, g) => {
|
|
74
|
+
h(g);
|
|
75
|
+
}, E = (c) => {
|
|
76
|
+
T.includes(c) || h((g) => [...g, c]);
|
|
71
77
|
};
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
|
|
78
|
+
return /* @__PURE__ */ m("div", { className: Q(n, o.root, "VdtQueryBuilder-root"), children: d ? /* @__PURE__ */ m(P, { query: d, onChange: l, children: /* @__PURE__ */ m(
|
|
79
|
+
S,
|
|
74
80
|
{
|
|
75
81
|
classes: { root: o.treeRoot },
|
|
76
82
|
disableSelection: !0,
|
|
77
|
-
expanded:
|
|
83
|
+
expanded: T,
|
|
78
84
|
onNodeToggle: b,
|
|
79
|
-
children: /* @__PURE__ */
|
|
85
|
+
children: /* @__PURE__ */ m(
|
|
80
86
|
t,
|
|
81
87
|
{
|
|
82
88
|
expandNode: E,
|
|
@@ -86,13 +92,13 @@ function T({
|
|
|
86
92
|
fields: a,
|
|
87
93
|
groups: s,
|
|
88
94
|
canExpand: !1,
|
|
89
|
-
...
|
|
95
|
+
...y
|
|
90
96
|
}
|
|
91
97
|
)
|
|
92
98
|
}
|
|
93
99
|
) }) : null });
|
|
94
100
|
}
|
|
95
|
-
|
|
101
|
+
O.propTypes = {
|
|
96
102
|
/**
|
|
97
103
|
* Override or extend the styles applied to the component.
|
|
98
104
|
*/
|
|
@@ -106,13 +112,13 @@ T.propTypes = {
|
|
|
106
112
|
operation: e.oneOf(["AND", "OR", "NOT"]).isRequired,
|
|
107
113
|
entry: e.arrayOf(
|
|
108
114
|
e.oneOfType([
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
f.SearchOperatorType,
|
|
116
|
+
f.SearchFieldType,
|
|
117
|
+
f.SearchGroupType
|
|
112
118
|
])
|
|
113
119
|
)
|
|
114
120
|
}),
|
|
115
|
-
|
|
121
|
+
f.ItemSearchType
|
|
116
122
|
]).isRequired,
|
|
117
123
|
groups: e.arrayOf(e.any),
|
|
118
124
|
fields: e.arrayOf(e.any),
|
|
@@ -122,7 +128,7 @@ T.propTypes = {
|
|
|
122
128
|
QueryEntryComponent: e.elementType,
|
|
123
129
|
QueryEntryProps: e.objectOf(e.any)
|
|
124
130
|
};
|
|
125
|
-
|
|
131
|
+
O.defaultProps = {
|
|
126
132
|
className: void 0,
|
|
127
133
|
classes: {},
|
|
128
134
|
fields: [],
|
|
@@ -133,6 +139,6 @@ T.defaultProps = {
|
|
|
133
139
|
QueryEntryProps: {}
|
|
134
140
|
};
|
|
135
141
|
export {
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
O as default,
|
|
143
|
+
$ as styles
|
|
138
144
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidispine/vdt-materialui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.3.0-pre.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/runtime": "^7.23.6",
|
|
39
|
-
"@vidispine/proptypes": "
|
|
40
|
-
"@vidispine/vdt-api": "
|
|
41
|
-
"@vidispine/vdt-js": "
|
|
42
|
-
"@vidispine/vdt-react": "
|
|
43
|
-
"@vidispine/vdt-videojs-react": "
|
|
39
|
+
"@vidispine/proptypes": "25.3.0-pre.2",
|
|
40
|
+
"@vidispine/vdt-api": "25.3.0-pre.2",
|
|
41
|
+
"@vidispine/vdt-js": "25.3.0-pre.2",
|
|
42
|
+
"@vidispine/vdt-react": "25.3.0-pre.2",
|
|
43
|
+
"@vidispine/vdt-videojs-react": "25.3.0-pre.2",
|
|
44
44
|
"clsx": "^1.2.1",
|
|
45
45
|
"filesize": "^10.1.0",
|
|
46
46
|
"final-form": "^4.20.10",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
"@material-ui/icons": "4.11.3",
|
|
75
75
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
76
76
|
"@types/jest": "29.5.11",
|
|
77
|
-
"@vidispine/eslint-config-mdx": "
|
|
78
|
-
"@vidispine/eslint-config-react": "
|
|
79
|
-
"@vidispine/eslint-config-storybook": "
|
|
80
|
-
"@vidispine/prettier-config": "
|
|
81
|
-
"@vidispine/proptypes": "
|
|
77
|
+
"@vidispine/eslint-config-mdx": "25.3.0-pre.2",
|
|
78
|
+
"@vidispine/eslint-config-react": "25.3.0-pre.2",
|
|
79
|
+
"@vidispine/eslint-config-storybook": "25.3.0-pre.2",
|
|
80
|
+
"@vidispine/prettier-config": "25.3.0-pre.2",
|
|
81
|
+
"@vidispine/proptypes": "25.3.0-pre.2",
|
|
82
82
|
"@vitejs/plugin-react": "4.2.1",
|
|
83
83
|
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
|
|
84
84
|
"axios": "1.7.7",
|