@tunghtml/strapi-plugin-composite-field 1.1.4 → 1.1.5
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.
|
@@ -464,27 +464,13 @@ const CompositeInput = (props) => {
|
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
if (!fieldValue) {
|
|
467
|
-
const
|
|
468
|
-
|
|
467
|
+
const combobox = document.querySelector(
|
|
468
|
+
`div[role="combobox"][name="${fieldPath}"]`
|
|
469
469
|
);
|
|
470
|
-
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
473
|
-
|
|
474
|
-
const hiddenInput = fieldContainer.querySelector(
|
|
475
|
-
`input[name="${fieldPath}"]`
|
|
476
|
-
);
|
|
477
|
-
if (label2 || hiddenInput) {
|
|
478
|
-
const labelText = label2?.textContent?.trim().toLowerCase() || "";
|
|
479
|
-
const fieldName = fieldPath.toLowerCase();
|
|
480
|
-
if (labelText === fieldName || labelText.replace(/\s+/g, "").includes(fieldName.replace(/\s+/g, "")) || hiddenInput) {
|
|
481
|
-
const selectedText = combobox.textContent?.trim();
|
|
482
|
-
if (selectedText && selectedText !== "Select..." && selectedText !== "") {
|
|
483
|
-
fieldValue = selectedText;
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
470
|
+
if (combobox) {
|
|
471
|
+
const selectedText = combobox.textContent?.trim();
|
|
472
|
+
if (selectedText && selectedText !== "Select..." && selectedText !== "") {
|
|
473
|
+
fieldValue = selectedText;
|
|
488
474
|
}
|
|
489
475
|
}
|
|
490
476
|
}
|
|
@@ -519,7 +505,7 @@ const CompositeInput = (props) => {
|
|
|
519
505
|
const listeners = [];
|
|
520
506
|
fields.forEach((fieldPath) => {
|
|
521
507
|
const elements = document.querySelectorAll(
|
|
522
|
-
`input[name="${fieldPath}"], textarea[name="${fieldPath}"], select[name="${fieldPath}"],
|
|
508
|
+
`input[name="${fieldPath}"], textarea[name="${fieldPath}"], select[name="${fieldPath}"], div[role="combobox"][name="${fieldPath}"]`
|
|
523
509
|
);
|
|
524
510
|
elements.forEach((element) => {
|
|
525
511
|
element.addEventListener("change", handleFieldChange);
|
|
@@ -483,27 +483,13 @@ const CompositeInput = (props) => {
|
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
if (!fieldValue) {
|
|
486
|
-
const
|
|
487
|
-
|
|
486
|
+
const combobox = document.querySelector(
|
|
487
|
+
`div[role="combobox"][name="${fieldPath}"]`
|
|
488
488
|
);
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
492
|
-
|
|
493
|
-
const hiddenInput = fieldContainer.querySelector(
|
|
494
|
-
`input[name="${fieldPath}"]`
|
|
495
|
-
);
|
|
496
|
-
if (label2 || hiddenInput) {
|
|
497
|
-
const labelText = label2?.textContent?.trim().toLowerCase() || "";
|
|
498
|
-
const fieldName = fieldPath.toLowerCase();
|
|
499
|
-
if (labelText === fieldName || labelText.replace(/\s+/g, "").includes(fieldName.replace(/\s+/g, "")) || hiddenInput) {
|
|
500
|
-
const selectedText = combobox.textContent?.trim();
|
|
501
|
-
if (selectedText && selectedText !== "Select..." && selectedText !== "") {
|
|
502
|
-
fieldValue = selectedText;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
489
|
+
if (combobox) {
|
|
490
|
+
const selectedText = combobox.textContent?.trim();
|
|
491
|
+
if (selectedText && selectedText !== "Select..." && selectedText !== "") {
|
|
492
|
+
fieldValue = selectedText;
|
|
507
493
|
}
|
|
508
494
|
}
|
|
509
495
|
}
|
|
@@ -538,7 +524,7 @@ const CompositeInput = (props) => {
|
|
|
538
524
|
const listeners = [];
|
|
539
525
|
fields.forEach((fieldPath) => {
|
|
540
526
|
const elements = document.querySelectorAll(
|
|
541
|
-
`input[name="${fieldPath}"], textarea[name="${fieldPath}"], select[name="${fieldPath}"],
|
|
527
|
+
`input[name="${fieldPath}"], textarea[name="${fieldPath}"], select[name="${fieldPath}"], div[role="combobox"][name="${fieldPath}"]`
|
|
542
528
|
);
|
|
543
529
|
elements.forEach((element) => {
|
|
544
530
|
element.addEventListener("change", handleFieldChange);
|
package/dist/admin/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const index = {
|
|
|
37
37
|
defaultMessage: "Combine multiple fields into one display value"
|
|
38
38
|
},
|
|
39
39
|
components: {
|
|
40
|
-
Input: async () => Promise.resolve().then(() => require("../_chunks/CompositeInput-
|
|
40
|
+
Input: async () => Promise.resolve().then(() => require("../_chunks/CompositeInput-C_wtVXHq.js"))
|
|
41
41
|
},
|
|
42
42
|
options: {
|
|
43
43
|
base: [
|
package/dist/admin/index.mjs
CHANGED
|
@@ -34,7 +34,7 @@ const index = {
|
|
|
34
34
|
defaultMessage: "Combine multiple fields into one display value"
|
|
35
35
|
},
|
|
36
36
|
components: {
|
|
37
|
-
Input: async () => import("../_chunks/CompositeInput-
|
|
37
|
+
Input: async () => import("../_chunks/CompositeInput-CF-LA05U.mjs")
|
|
38
38
|
},
|
|
39
39
|
options: {
|
|
40
40
|
base: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tunghtml/strapi-plugin-composite-field",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "A Strapi v5 plugin to create composite display fields by combining multiple text, string, and enum fields with auto-generate support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|