@tunghtml/strapi-plugin-composite-field 1.1.6 → 1.1.7

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.
@@ -466,6 +466,15 @@ const CompositeInput = (props) => {
466
466
  onChange({ target: { name, value: newValue, type: "text" } });
467
467
  }
468
468
  };
469
+ const formatTimeValue = (value2) => {
470
+ if (!value2) return value2;
471
+ const timeRegex = /^(\d{2}):(\d{2}):(\d{2})(\.\d{3})?$/;
472
+ const match = value2.match(timeRegex);
473
+ if (match) {
474
+ return `${match[1]}:${match[2]}`;
475
+ }
476
+ return value2;
477
+ };
469
478
  const handleGenerate = React__namespace.default.useCallback(() => {
470
479
  const parts = [];
471
480
  fields.forEach((fieldPath) => {
@@ -504,6 +513,7 @@ const CompositeInput = (props) => {
504
513
  }
505
514
  }
506
515
  if (fieldValue) {
516
+ fieldValue = formatTimeValue(fieldValue);
507
517
  parts.push(fieldValue);
508
518
  }
509
519
  });
@@ -447,6 +447,15 @@ const CompositeInput = (props) => {
447
447
  onChange({ target: { name, value: newValue, type: "text" } });
448
448
  }
449
449
  };
450
+ const formatTimeValue = (value2) => {
451
+ if (!value2) return value2;
452
+ const timeRegex = /^(\d{2}):(\d{2}):(\d{2})(\.\d{3})?$/;
453
+ const match = value2.match(timeRegex);
454
+ if (match) {
455
+ return `${match[1]}:${match[2]}`;
456
+ }
457
+ return value2;
458
+ };
450
459
  const handleGenerate = React__default.useCallback(() => {
451
460
  const parts = [];
452
461
  fields.forEach((fieldPath) => {
@@ -485,6 +494,7 @@ const CompositeInput = (props) => {
485
494
  }
486
495
  }
487
496
  if (fieldValue) {
497
+ fieldValue = formatTimeValue(fieldValue);
488
498
  parts.push(fieldValue);
489
499
  }
490
500
  });
@@ -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-BhDBr5rx.js"))
40
+ Input: async () => Promise.resolve().then(() => require("../_chunks/CompositeInput-Bjv6XSUB.js"))
41
41
  },
42
42
  options: {
43
43
  base: [
@@ -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-DLjmxeUG.mjs")
37
+ Input: async () => import("../_chunks/CompositeInput-ef71gPFZ.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.6",
3
+ "version": "1.1.7",
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",