@tunghtml/strapi-plugin-composite-field 1.2.0 → 1.2.1
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/package.json +5 -34
- package/strapi-admin.js +125 -0
- package/strapi-server.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tunghtml/strapi-plugin-composite-field",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
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",
|
|
@@ -19,43 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"author": "Tung Le <tunghtml@gmail.com>",
|
|
22
|
-
"type": "commonjs",
|
|
23
|
-
"exports": {
|
|
24
|
-
"./package.json": "./package.json",
|
|
25
|
-
"./strapi-admin": {
|
|
26
|
-
"source": "./admin/src/index.js",
|
|
27
|
-
"import": "./dist/admin/index.mjs",
|
|
28
|
-
"require": "./dist/admin/index.js",
|
|
29
|
-
"default": "./dist/admin/index.js"
|
|
30
|
-
},
|
|
31
|
-
"./strapi-server": {
|
|
32
|
-
"source": "./server/src/index.js",
|
|
33
|
-
"import": "./dist/server/index.mjs",
|
|
34
|
-
"require": "./dist/server/index.js",
|
|
35
|
-
"default": "./dist/server/index.js"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"files": [
|
|
39
|
-
"dist",
|
|
40
|
-
"README.md"
|
|
41
|
-
],
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "strapi-plugin build",
|
|
44
|
-
"watch": "strapi-plugin watch",
|
|
45
|
-
"verify": "strapi-plugin verify"
|
|
46
|
-
},
|
|
47
22
|
"dependencies": {
|
|
48
23
|
"@strapi/design-system": "^2.0.0-rc.11",
|
|
49
24
|
"@strapi/icons": "^2.0.0-rc.11"
|
|
50
25
|
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@strapi/sdk-plugin": "^5.2.6",
|
|
53
|
-
"@strapi/strapi": "^5.33.2",
|
|
54
|
-
"react": "^18.3.1",
|
|
55
|
-
"react-dom": "^18.3.1",
|
|
56
|
-
"react-router-dom": "^6.26.2",
|
|
57
|
-
"styled-components": "^6.1.13"
|
|
58
|
-
},
|
|
59
26
|
"peerDependencies": {
|
|
60
27
|
"@strapi/strapi": "^5.33.2",
|
|
61
28
|
"react": "^18.3.1",
|
|
@@ -68,5 +35,9 @@
|
|
|
68
35
|
"name": "composite-field",
|
|
69
36
|
"displayName": "Composite Field",
|
|
70
37
|
"description": "Create composite display fields by combining multiple text fields"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0 <=22.x.x",
|
|
41
|
+
"npm": ">=6.0.0"
|
|
71
42
|
}
|
|
72
43
|
}
|
package/strapi-admin.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const CompositeIcon = () =>
|
|
4
|
+
React.createElement(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
style: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
width: "32px",
|
|
12
|
+
height: "24px",
|
|
13
|
+
borderRadius: "4px",
|
|
14
|
+
border: "1px solid #b8e1ff",
|
|
15
|
+
background: "#eafbff",
|
|
16
|
+
fontSize: "14px",
|
|
17
|
+
fontWeight: "600",
|
|
18
|
+
color: "#0c75af",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
"Aa"
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
register(app) {
|
|
26
|
+
app.customFields.register({
|
|
27
|
+
name: "composite",
|
|
28
|
+
pluginId: "composite-field",
|
|
29
|
+
type: "string",
|
|
30
|
+
icon: CompositeIcon,
|
|
31
|
+
intlLabel: {
|
|
32
|
+
id: "composite-field.label",
|
|
33
|
+
defaultMessage: "Composite",
|
|
34
|
+
},
|
|
35
|
+
intlDescription: {
|
|
36
|
+
id: "composite-field.description",
|
|
37
|
+
defaultMessage: "Combine multiple fields into one display value",
|
|
38
|
+
},
|
|
39
|
+
components: {
|
|
40
|
+
Input: async () => import("./components/CompositeInput"),
|
|
41
|
+
},
|
|
42
|
+
options: {
|
|
43
|
+
base: [
|
|
44
|
+
{
|
|
45
|
+
sectionTitle: {
|
|
46
|
+
id: "composite-field.section.title",
|
|
47
|
+
defaultMessage: "Settings",
|
|
48
|
+
},
|
|
49
|
+
items: [
|
|
50
|
+
{
|
|
51
|
+
name: "options.fields",
|
|
52
|
+
type: "textarea",
|
|
53
|
+
intlLabel: {
|
|
54
|
+
id: "composite-field.fields.label",
|
|
55
|
+
defaultMessage: "Fields to combine",
|
|
56
|
+
},
|
|
57
|
+
description: {
|
|
58
|
+
id: "composite-field.fields.description",
|
|
59
|
+
defaultMessage:
|
|
60
|
+
"Enter field names (one per line). Only text/string fields are supported.",
|
|
61
|
+
},
|
|
62
|
+
placeholder: {
|
|
63
|
+
id: "composite-field.fields.placeholder",
|
|
64
|
+
defaultMessage: "salutation\nfirstName\nlastName\nemail",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "options.separator",
|
|
69
|
+
type: "text",
|
|
70
|
+
intlLabel: {
|
|
71
|
+
id: "composite-field.separator.label",
|
|
72
|
+
defaultMessage: "Separator",
|
|
73
|
+
},
|
|
74
|
+
description: {
|
|
75
|
+
id: "composite-field.separator.description",
|
|
76
|
+
defaultMessage: 'Separator between fields (default: " - ")',
|
|
77
|
+
},
|
|
78
|
+
placeholder: {
|
|
79
|
+
id: "composite-field.separator.placeholder",
|
|
80
|
+
defaultMessage: " - ",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
advanced: [
|
|
87
|
+
{
|
|
88
|
+
sectionTitle: {
|
|
89
|
+
id: "composite-field.advanced.title",
|
|
90
|
+
defaultMessage: "Settings",
|
|
91
|
+
},
|
|
92
|
+
items: [
|
|
93
|
+
{
|
|
94
|
+
name: "options.editable",
|
|
95
|
+
type: "checkbox",
|
|
96
|
+
intlLabel: {
|
|
97
|
+
id: "composite-field.editable.label",
|
|
98
|
+
defaultMessage: "Editable",
|
|
99
|
+
},
|
|
100
|
+
description: {
|
|
101
|
+
id: "composite-field.editable.description",
|
|
102
|
+
defaultMessage:
|
|
103
|
+
"Allow manual editing of the composite field value",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "options.autoGenerate",
|
|
108
|
+
type: "checkbox",
|
|
109
|
+
intlLabel: {
|
|
110
|
+
id: "composite-field.autoGenerate.label",
|
|
111
|
+
defaultMessage: "Auto-generate",
|
|
112
|
+
},
|
|
113
|
+
description: {
|
|
114
|
+
id: "composite-field.autoGenerate.description",
|
|
115
|
+
defaultMessage:
|
|
116
|
+
"Automatically generate value when source fields change",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
};
|
package/strapi-server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./server/src/index");
|