@tanglemedia/directus-core-settings 0.0.2 → 0.0.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.
- package/dist/index.js +24 -7
- package/migrations/helpers/fields.mjs +139 -0
- package/migrations/helpers/page.mjs +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export function getBasicCollectionFields(collectionName) {
|
|
2
|
+
return [
|
|
3
|
+
{
|
|
4
|
+
collection: collectionName,
|
|
5
|
+
field: "id",
|
|
6
|
+
hidden: true,
|
|
7
|
+
interface: "input",
|
|
8
|
+
readonly: true,
|
|
9
|
+
required: false,
|
|
10
|
+
sort: 1,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
collection: collectionName,
|
|
14
|
+
field: "sort",
|
|
15
|
+
interface: "input",
|
|
16
|
+
readonly: false,
|
|
17
|
+
hidden: true,
|
|
18
|
+
sort: 2,
|
|
19
|
+
width: "full",
|
|
20
|
+
required: false,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
collection: collectionName,
|
|
24
|
+
display: "labels",
|
|
25
|
+
display_options: JSON.stringify({
|
|
26
|
+
choices: [
|
|
27
|
+
{
|
|
28
|
+
text: "$t:published",
|
|
29
|
+
color: "var(--theme--primary)",
|
|
30
|
+
value: "published",
|
|
31
|
+
background: "var(--theme--primary-background)",
|
|
32
|
+
foreground: "var(--theme--primary)",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
text: "$t:draft",
|
|
36
|
+
color: "var(--theme--foreground)",
|
|
37
|
+
value: "draft",
|
|
38
|
+
background: "var(--theme--background-normal)",
|
|
39
|
+
foreground: "var(--theme--foreground)",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
text: "$t:archived",
|
|
43
|
+
color: "var(--theme--warning)",
|
|
44
|
+
value: "archived",
|
|
45
|
+
background: "var(--theme--warning-background)",
|
|
46
|
+
foreground: "var(--theme--warning)",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
showAsDot: true,
|
|
50
|
+
}),
|
|
51
|
+
field: "status",
|
|
52
|
+
hidden: false,
|
|
53
|
+
interface: "select-dropdown",
|
|
54
|
+
options: JSON.stringify({
|
|
55
|
+
choices: [
|
|
56
|
+
{
|
|
57
|
+
text: "$t:published",
|
|
58
|
+
color: "var(--theme--primary)",
|
|
59
|
+
value: "published",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
text: "$t:draft",
|
|
63
|
+
color: "var(--theme--foreground)",
|
|
64
|
+
value: "draft",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
text: "$t:archived",
|
|
68
|
+
color: "var(--theme--warning)",
|
|
69
|
+
value: "archived",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
}),
|
|
73
|
+
readonly: false,
|
|
74
|
+
required: false,
|
|
75
|
+
sort: 3,
|
|
76
|
+
width: "full",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
collection: collectionName,
|
|
80
|
+
display: "user",
|
|
81
|
+
field: "user_created",
|
|
82
|
+
hidden: true,
|
|
83
|
+
interface: "select-dropdown-m2o",
|
|
84
|
+
options: JSON.stringify({
|
|
85
|
+
template: "{{avatar.$thumbnail}} {{first_name}} {{last_name}}",
|
|
86
|
+
}),
|
|
87
|
+
readonly: true,
|
|
88
|
+
required: false,
|
|
89
|
+
sort: 4,
|
|
90
|
+
special: "user-created",
|
|
91
|
+
width: "half",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
collection: collectionName,
|
|
95
|
+
display: "user",
|
|
96
|
+
field: "user_updated",
|
|
97
|
+
hidden: true,
|
|
98
|
+
interface: "select-dropdown-m2o",
|
|
99
|
+
options: JSON.stringify({
|
|
100
|
+
template: "{{avatar.$thumbnail}} {{first_name}} {{last_name}}",
|
|
101
|
+
}),
|
|
102
|
+
readonly: true,
|
|
103
|
+
required: false,
|
|
104
|
+
sort: 5,
|
|
105
|
+
special: "user-updated",
|
|
106
|
+
width: "half",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
collection: collectionName,
|
|
110
|
+
display: "datetime",
|
|
111
|
+
display_options: JSON.stringify({
|
|
112
|
+
relative: true,
|
|
113
|
+
}),
|
|
114
|
+
field: "date_created",
|
|
115
|
+
hidden: true,
|
|
116
|
+
interface: "datetime",
|
|
117
|
+
readonly: true,
|
|
118
|
+
required: false,
|
|
119
|
+
sort: 6,
|
|
120
|
+
special: "date-created",
|
|
121
|
+
width: "half",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
collection: collectionName,
|
|
125
|
+
display: "datetime",
|
|
126
|
+
display_options: JSON.stringify({
|
|
127
|
+
relative: true,
|
|
128
|
+
}),
|
|
129
|
+
field: "date_updated",
|
|
130
|
+
hidden: true,
|
|
131
|
+
interface: "datetime",
|
|
132
|
+
readonly: true,
|
|
133
|
+
required: false,
|
|
134
|
+
sort: 7,
|
|
135
|
+
special: "date-updated",
|
|
136
|
+
width: "half",
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
}
|