@uniformdev/mesh-sdk-react 19.166.1 → 19.167.2-alpha.3

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/index.esm.js CHANGED
@@ -5136,7 +5136,7 @@ function ParameterOrSingleVariable(props) {
5136
5136
  editorRef ? /* @__PURE__ */ jsx42(EditorRefPlugin, { editorRef }) : null,
5137
5137
  /* @__PURE__ */ jsx42(ControlledValuePlugin, { enabled: true, value }),
5138
5138
  /* @__PURE__ */ jsxs25(HorizontalRhythm6, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5139
- /* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
5139
+ /* @__PURE__ */ jsx42("div", { css: { flex: 1, minWidth: "0" }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
5140
5140
  VariablesComposerInput,
5141
5141
  {
5142
5142
  "data-text-value": value,
@@ -8998,6 +8998,23 @@ var FilterItem = ({
8998
8998
  ] })
8999
8999
  ] });
9000
9000
  };
9001
+ var singleValuedOperators = /* @__PURE__ */ new Set([
9002
+ "eq",
9003
+ "neq",
9004
+ "lt",
9005
+ "gt",
9006
+ "is",
9007
+ "!is",
9008
+ "has",
9009
+ "!has",
9010
+ "startswith",
9011
+ "!startswith",
9012
+ "endswith",
9013
+ "!endswith"
9014
+ ]);
9015
+ var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
9016
+ var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
9017
+ var noValueOperators = /* @__PURE__ */ new Set(["empty", "!empty"]);
9001
9018
  var FilterItems = ({
9002
9019
  addButtonText = "add condition",
9003
9020
  additionalFiltersContainer,
@@ -9011,14 +9028,25 @@ var FilterItems = ({
9011
9028
  const next = [...filters];
9012
9029
  next[index] = { ...next[index], [prop]: value };
9013
9030
  if (prop === "operator") {
9014
- if (!Array.isArray(value) && ["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
9031
+ const newOperator = value;
9032
+ const currentValue = next[index].value;
9033
+ if (Array.isArray(newOperator)) {
9034
+ throw new Error("Operator value must be a single string");
9035
+ }
9036
+ if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
9015
9037
  next[index].value = next[index].value[0];
9016
9038
  }
9017
- if (filters[index].operator === "ndef" || filters[index].operator === "def") {
9039
+ if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
9040
+ next[index].value = currentValue ? [currentValue] : [];
9041
+ }
9042
+ if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
9043
+ next[index].value = "";
9044
+ }
9045
+ if (noValueOperators.has(newOperator)) {
9018
9046
  next[index].value = "";
9019
9047
  }
9020
- if (!Array.isArray(value) && ["between"].includes(value) && Array.isArray(next[index].value) === false) {
9021
- next[index].value = [next[index].value, ""];
9048
+ if (newOperator === "between" && Array.isArray(currentValue) === false) {
9049
+ next[index].value = [currentValue, ""];
9022
9050
  }
9023
9051
  if (value === "def" || value === "true") {
9024
9052
  next[index].value = "true";
package/dist/index.js CHANGED
@@ -5334,7 +5334,7 @@ function ParameterOrSingleVariable(props) {
5334
5334
  editorRef ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EditorRefPlugin, { editorRef }) : null,
5335
5335
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ControlledValuePlugin, { enabled: true, value }),
5336
5336
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system23.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5337
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5337
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { css: { flex: 1, minWidth: "0" }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5338
5338
  VariablesComposerInput,
5339
5339
  {
5340
5340
  "data-text-value": value,
@@ -9133,6 +9133,23 @@ var FilterItem = ({
9133
9133
  ] })
9134
9134
  ] });
9135
9135
  };
9136
+ var singleValuedOperators = /* @__PURE__ */ new Set([
9137
+ "eq",
9138
+ "neq",
9139
+ "lt",
9140
+ "gt",
9141
+ "is",
9142
+ "!is",
9143
+ "has",
9144
+ "!has",
9145
+ "startswith",
9146
+ "!startswith",
9147
+ "endswith",
9148
+ "!endswith"
9149
+ ]);
9150
+ var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
9151
+ var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
9152
+ var noValueOperators = /* @__PURE__ */ new Set(["empty", "!empty"]);
9136
9153
  var FilterItems = ({
9137
9154
  addButtonText = "add condition",
9138
9155
  additionalFiltersContainer,
@@ -9146,14 +9163,25 @@ var FilterItems = ({
9146
9163
  const next = [...filters];
9147
9164
  next[index] = { ...next[index], [prop]: value };
9148
9165
  if (prop === "operator") {
9149
- if (!Array.isArray(value) && ["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
9166
+ const newOperator = value;
9167
+ const currentValue = next[index].value;
9168
+ if (Array.isArray(newOperator)) {
9169
+ throw new Error("Operator value must be a single string");
9170
+ }
9171
+ if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
9150
9172
  next[index].value = next[index].value[0];
9151
9173
  }
9152
- if (filters[index].operator === "ndef" || filters[index].operator === "def") {
9174
+ if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
9175
+ next[index].value = currentValue ? [currentValue] : [];
9176
+ }
9177
+ if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
9178
+ next[index].value = "";
9179
+ }
9180
+ if (noValueOperators.has(newOperator)) {
9153
9181
  next[index].value = "";
9154
9182
  }
9155
- if (!Array.isArray(value) && ["between"].includes(value) && Array.isArray(next[index].value) === false) {
9156
- next[index].value = [next[index].value, ""];
9183
+ if (newOperator === "between" && Array.isArray(currentValue) === false) {
9184
+ next[index].value = [currentValue, ""];
9157
9185
  }
9158
9186
  if (value === "def" || value === "true") {
9159
9187
  next[index].value = "true";
package/dist/index.mjs CHANGED
@@ -5136,7 +5136,7 @@ function ParameterOrSingleVariable(props) {
5136
5136
  editorRef ? /* @__PURE__ */ jsx42(EditorRefPlugin, { editorRef }) : null,
5137
5137
  /* @__PURE__ */ jsx42(ControlledValuePlugin, { enabled: true, value }),
5138
5138
  /* @__PURE__ */ jsxs25(HorizontalRhythm6, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5139
- /* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
5139
+ /* @__PURE__ */ jsx42("div", { css: { flex: 1, minWidth: "0" }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
5140
5140
  VariablesComposerInput,
5141
5141
  {
5142
5142
  "data-text-value": value,
@@ -8998,6 +8998,23 @@ var FilterItem = ({
8998
8998
  ] })
8999
8999
  ] });
9000
9000
  };
9001
+ var singleValuedOperators = /* @__PURE__ */ new Set([
9002
+ "eq",
9003
+ "neq",
9004
+ "lt",
9005
+ "gt",
9006
+ "is",
9007
+ "!is",
9008
+ "has",
9009
+ "!has",
9010
+ "startswith",
9011
+ "!startswith",
9012
+ "endswith",
9013
+ "!endswith"
9014
+ ]);
9015
+ var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
9016
+ var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
9017
+ var noValueOperators = /* @__PURE__ */ new Set(["empty", "!empty"]);
9001
9018
  var FilterItems = ({
9002
9019
  addButtonText = "add condition",
9003
9020
  additionalFiltersContainer,
@@ -9011,14 +9028,25 @@ var FilterItems = ({
9011
9028
  const next = [...filters];
9012
9029
  next[index] = { ...next[index], [prop]: value };
9013
9030
  if (prop === "operator") {
9014
- if (!Array.isArray(value) && ["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
9031
+ const newOperator = value;
9032
+ const currentValue = next[index].value;
9033
+ if (Array.isArray(newOperator)) {
9034
+ throw new Error("Operator value must be a single string");
9035
+ }
9036
+ if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
9015
9037
  next[index].value = next[index].value[0];
9016
9038
  }
9017
- if (filters[index].operator === "ndef" || filters[index].operator === "def") {
9039
+ if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
9040
+ next[index].value = currentValue ? [currentValue] : [];
9041
+ }
9042
+ if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
9043
+ next[index].value = "";
9044
+ }
9045
+ if (noValueOperators.has(newOperator)) {
9018
9046
  next[index].value = "";
9019
9047
  }
9020
- if (!Array.isArray(value) && ["between"].includes(value) && Array.isArray(next[index].value) === false) {
9021
- next[index].value = [next[index].value, ""];
9048
+ if (newOperator === "between" && Array.isArray(currentValue) === false) {
9049
+ next[index].value = [currentValue, ""];
9022
9050
  }
9023
9051
  if (value === "def" || value === "true") {
9024
9052
  next[index].value = "true";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk-react",
3
- "version": "19.166.1",
3
+ "version": "19.167.2-alpha.3+d42f32a982",
4
4
  "description": "Uniform Mesh Framework SDK for React",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -50,9 +50,9 @@
50
50
  "@lexical/selection": "^0.12.0",
51
51
  "@lexical/utils": "^0.12.0",
52
52
  "@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.2.1/react-icons-all-files-5.2.1.tgz",
53
- "@uniformdev/canvas": "19.166.1",
54
- "@uniformdev/design-system": "19.166.1",
55
- "@uniformdev/mesh-sdk": "19.166.1",
53
+ "@uniformdev/canvas": "19.167.2-alpha.3+d42f32a982",
54
+ "@uniformdev/design-system": "19.167.2-alpha.3+d42f32a982",
55
+ "@uniformdev/mesh-sdk": "19.167.2-alpha.3+d42f32a982",
56
56
  "dequal": "^2.0.3",
57
57
  "lexical": "^0.12.0",
58
58
  "mitt": "^3.0.0",
@@ -61,7 +61,7 @@
61
61
  "react-use": "17.5.0",
62
62
  "timeago.js": "4.0.2",
63
63
  "uuid": "9.0.1",
64
- "zod": "3.22.4"
64
+ "zod": "3.23.8"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@emotion/react": ">=11.8.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "d6a92d76bb91fa41a51cf27a69d81e0cc985f80f"
89
+ "gitHead": "d42f32a98294c96f55a29c10c7c461c5327f56f3"
90
90
  }