@tunghtml/strapi-plugin-composite-field 1.1.3 → 1.1.4
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,17 +464,20 @@ const CompositeInput = (props) => {
|
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
if (!fieldValue) {
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
467
|
+
const allComboboxes = document.querySelectorAll(
|
|
468
|
+
'button[role="combobox"]'
|
|
469
|
+
);
|
|
470
|
+
for (const combobox of allComboboxes) {
|
|
471
|
+
const fieldContainer = combobox.closest("[data-strapi-field]") || combobox.closest('div[class*="Field"]');
|
|
472
|
+
if (fieldContainer) {
|
|
473
|
+
const label2 = fieldContainer.querySelector("label");
|
|
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) {
|
|
478
481
|
const selectedText = combobox.textContent?.trim();
|
|
479
482
|
if (selectedText && selectedText !== "Select..." && selectedText !== "") {
|
|
480
483
|
fieldValue = selectedText;
|
|
@@ -485,6 +488,16 @@ const CompositeInput = (props) => {
|
|
|
485
488
|
}
|
|
486
489
|
}
|
|
487
490
|
}
|
|
491
|
+
if (!fieldValue) {
|
|
492
|
+
const fieldById = document.getElementById(fieldPath);
|
|
493
|
+
if (fieldById) {
|
|
494
|
+
if (fieldById.tagName === "SELECT") {
|
|
495
|
+
fieldValue = fieldById.value;
|
|
496
|
+
} else if (fieldById.value) {
|
|
497
|
+
fieldValue = fieldById.value;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
488
501
|
if (fieldValue) {
|
|
489
502
|
parts.push(fieldValue);
|
|
490
503
|
}
|
|
@@ -483,17 +483,20 @@ const CompositeInput = (props) => {
|
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
if (!fieldValue) {
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
486
|
+
const allComboboxes = document.querySelectorAll(
|
|
487
|
+
'button[role="combobox"]'
|
|
488
|
+
);
|
|
489
|
+
for (const combobox of allComboboxes) {
|
|
490
|
+
const fieldContainer = combobox.closest("[data-strapi-field]") || combobox.closest('div[class*="Field"]');
|
|
491
|
+
if (fieldContainer) {
|
|
492
|
+
const label2 = fieldContainer.querySelector("label");
|
|
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) {
|
|
497
500
|
const selectedText = combobox.textContent?.trim();
|
|
498
501
|
if (selectedText && selectedText !== "Select..." && selectedText !== "") {
|
|
499
502
|
fieldValue = selectedText;
|
|
@@ -504,6 +507,16 @@ const CompositeInput = (props) => {
|
|
|
504
507
|
}
|
|
505
508
|
}
|
|
506
509
|
}
|
|
510
|
+
if (!fieldValue) {
|
|
511
|
+
const fieldById = document.getElementById(fieldPath);
|
|
512
|
+
if (fieldById) {
|
|
513
|
+
if (fieldById.tagName === "SELECT") {
|
|
514
|
+
fieldValue = fieldById.value;
|
|
515
|
+
} else if (fieldById.value) {
|
|
516
|
+
fieldValue = fieldById.value;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
507
520
|
if (fieldValue) {
|
|
508
521
|
parts.push(fieldValue);
|
|
509
522
|
}
|
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-DJdUl_gs.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-BWK_SH2_.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.4",
|
|
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",
|