@vidispine/vdt-materialui 25.4.0 → 25.4.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 y=require("react/jsx-runtime"),T=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("react/jsx-runtime"),T=require("react"),S=require("clsx"),e=require("prop-types"),j=require("@material-ui/lab"),f=require("@vidispine/proptypes"),v=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 l=n.operation,i=({operation:r,value:u,range:t}={})=>r?"operator":u||t?"field":"group";return{...l?{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 d;const m=(d=t.value)==null?void 0:d.map(({value:p})=>({value:p.includes(" ")&&!p.includes("*")?`"${p}"`:`${p}`}));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:l,field:i,group:r,entry:u}={})=>({...s?{operation:s}:{name:n},entry:[...i||[],...(l||[]).map(t=>a(t)),...(r||[]).map(t=>a(t)),...u||[]].map(t=>({uuid:v.uuidv4(),...t}))});return o&&o.operator&&{operator:a(o.operator)}};function h({classes:o,className:a,query:s,fields:n,groups:l,defaultField:i,defaultGroup:r,onChange:u,QueryEntryComponent:t,QueryEntryProps:m}){const d=T.useMemo(()=>N(s),[s]),p=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:S(a,o.root,"VdtQueryBuilder-root"),children:d?y.jsx(C.QueryBuilderContextProvider,{query:d,onChange:p,children:y.jsx(j.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:l,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,8 +1,8 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
2
|
+
import { useMemo as x, useCallback as C, useState as Q } from "react";
|
|
3
|
+
import S from "clsx";
|
|
4
4
|
import e from "prop-types";
|
|
5
|
-
import { TreeView as
|
|
5
|
+
import { TreeView as v } from "@material-ui/lab";
|
|
6
6
|
import f from "@vidispine/proptypes";
|
|
7
7
|
import { uuidv4 as N } from "../../../utils.js";
|
|
8
8
|
import { QueryBuilderContextProvider as P } from "../QueryBuilderContext.js";
|
|
@@ -18,49 +18,49 @@ const $ = (o) => ({
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}), j = (o) => {
|
|
21
|
-
function
|
|
22
|
-
const
|
|
21
|
+
function a({ uuid: i, ...n }) {
|
|
22
|
+
const d = n.operation, u = ({ operation: r, value: p, range: t } = {}) => r ? "operator" : p || t ? "field" : "group";
|
|
23
23
|
return {
|
|
24
|
-
...
|
|
25
|
-
operation:
|
|
26
|
-
operator:
|
|
27
|
-
} : { name:
|
|
28
|
-
field:
|
|
29
|
-
var
|
|
30
|
-
const y = (
|
|
31
|
-
value:
|
|
24
|
+
...d ? {
|
|
25
|
+
operation: n.operation,
|
|
26
|
+
operator: n.entry.filter((r) => r.operation).map((r) => a(r))
|
|
27
|
+
} : { name: n.name },
|
|
28
|
+
field: n.entry.filter((r) => u(r) === "field").map(({ uuid: r, predicate: p, ...t }) => {
|
|
29
|
+
var l;
|
|
30
|
+
const y = (l = t.value) == null ? void 0 : l.map(({ value: s }) => ({
|
|
31
|
+
value: s.includes(" ") && !s.includes("*") ? `"${s}"` : `${s}`
|
|
32
32
|
}));
|
|
33
33
|
return { ...t, value: y };
|
|
34
34
|
}),
|
|
35
|
-
group:
|
|
35
|
+
group: n.entry.filter((r) => u(r) === "group").map((r) => a(r))
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
return o && o.operator && { operator:
|
|
38
|
+
return o && o.operator && { operator: a(o.operator) };
|
|
39
39
|
}, k = (o) => {
|
|
40
|
-
const
|
|
41
|
-
...i ? { operation: i } : { name:
|
|
40
|
+
const a = ({ operation: i, name: n, operator: d, field: u, group: r, entry: p } = {}) => ({
|
|
41
|
+
...i ? { operation: i } : { name: n },
|
|
42
42
|
entry: [
|
|
43
43
|
...u || [],
|
|
44
|
-
...(
|
|
45
|
-
...(r || []).map((t) =>
|
|
44
|
+
...(d || []).map((t) => a(t)),
|
|
45
|
+
...(r || []).map((t) => a(t)),
|
|
46
46
|
...p || []
|
|
47
47
|
].map((t) => ({ uuid: N(), ...t }))
|
|
48
48
|
});
|
|
49
|
-
return o && o.operator && { operator:
|
|
49
|
+
return o && o.operator && { operator: a(o.operator) };
|
|
50
50
|
};
|
|
51
51
|
function O({
|
|
52
52
|
classes: o,
|
|
53
|
-
className:
|
|
53
|
+
className: a,
|
|
54
54
|
query: i,
|
|
55
|
-
fields:
|
|
56
|
-
groups:
|
|
55
|
+
fields: n,
|
|
56
|
+
groups: d,
|
|
57
57
|
defaultField: u,
|
|
58
58
|
defaultGroup: r,
|
|
59
59
|
onChange: p,
|
|
60
60
|
QueryEntryComponent: t,
|
|
61
61
|
QueryEntryProps: y
|
|
62
62
|
}) {
|
|
63
|
-
const
|
|
63
|
+
const l = x(() => k(i), [i]), s = C(
|
|
64
64
|
(c) => {
|
|
65
65
|
p({
|
|
66
66
|
...c,
|
|
@@ -70,13 +70,13 @@ function O({
|
|
|
70
70
|
});
|
|
71
71
|
},
|
|
72
72
|
[p]
|
|
73
|
-
), [T, h] =
|
|
73
|
+
), [T, h] = Q(["operator"]), b = (c, g) => {
|
|
74
74
|
h(g);
|
|
75
75
|
}, E = (c) => {
|
|
76
76
|
T.includes(c) || h((g) => [...g, c]);
|
|
77
77
|
};
|
|
78
|
-
return /* @__PURE__ */ m("div", { className:
|
|
79
|
-
|
|
78
|
+
return /* @__PURE__ */ m("div", { className: S(a, o.root, "VdtQueryBuilder-root"), children: l ? /* @__PURE__ */ m(P, { query: l, onChange: s, children: /* @__PURE__ */ m(
|
|
79
|
+
v,
|
|
80
80
|
{
|
|
81
81
|
classes: { root: o.treeRoot },
|
|
82
82
|
disableSelection: !0,
|
|
@@ -89,8 +89,8 @@ function O({
|
|
|
89
89
|
path: "operator",
|
|
90
90
|
defaultField: u,
|
|
91
91
|
defaultGroup: r,
|
|
92
|
-
fields:
|
|
93
|
-
groups:
|
|
92
|
+
fields: n,
|
|
93
|
+
groups: d,
|
|
94
94
|
canExpand: !1,
|
|
95
95
|
...y
|
|
96
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidispine/vdt-materialui",
|
|
3
|
-
"version": "25.4.
|
|
3
|
+
"version": "25.4.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": "25.4.
|
|
40
|
-
"@vidispine/vdt-api": "25.4.
|
|
41
|
-
"@vidispine/vdt-js": "25.4.
|
|
42
|
-
"@vidispine/vdt-react": "25.4.
|
|
43
|
-
"@vidispine/vdt-videojs-react": "25.4.
|
|
39
|
+
"@vidispine/proptypes": "25.4.2",
|
|
40
|
+
"@vidispine/vdt-api": "25.4.2",
|
|
41
|
+
"@vidispine/vdt-js": "25.4.2",
|
|
42
|
+
"@vidispine/vdt-react": "25.4.2",
|
|
43
|
+
"@vidispine/vdt-videojs-react": "25.4.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": "25.4.
|
|
78
|
-
"@vidispine/eslint-config-react": "25.4.
|
|
79
|
-
"@vidispine/eslint-config-storybook": "25.4.
|
|
80
|
-
"@vidispine/prettier-config": "25.4.
|
|
81
|
-
"@vidispine/proptypes": "25.4.
|
|
77
|
+
"@vidispine/eslint-config-mdx": "25.4.2",
|
|
78
|
+
"@vidispine/eslint-config-react": "25.4.2",
|
|
79
|
+
"@vidispine/eslint-config-storybook": "25.4.2",
|
|
80
|
+
"@vidispine/prettier-config": "25.4.2",
|
|
81
|
+
"@vidispine/proptypes": "25.4.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",
|