@cxtms/cx-schema 1.0.0
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/README.md +384 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1523 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +111 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/schemaLoader.d.ts +17 -0
- package/dist/utils/schemaLoader.d.ts.map +1 -0
- package/dist/utils/schemaLoader.js +134 -0
- package/dist/utils/schemaLoader.js.map +1 -0
- package/dist/validator.d.ts +64 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +380 -0
- package/dist/validator.js.map +1 -0
- package/dist/workflowValidator.d.ts +64 -0
- package/dist/workflowValidator.d.ts.map +1 -0
- package/dist/workflowValidator.js +410 -0
- package/dist/workflowValidator.js.map +1 -0
- package/package.json +50 -0
- package/schemas/actions/all.json +26 -0
- package/schemas/actions/confirm.json +21 -0
- package/schemas/actions/consoleLog.json +16 -0
- package/schemas/actions/dialog.json +25 -0
- package/schemas/actions/fileDownload.json +16 -0
- package/schemas/actions/forEach.json +31 -0
- package/schemas/actions/if.json +12 -0
- package/schemas/actions/mutation.json +25 -0
- package/schemas/actions/navigate.json +18 -0
- package/schemas/actions/navigateBack.json +22 -0
- package/schemas/actions/navigateBackOrClose.json +21 -0
- package/schemas/actions/notification.json +19 -0
- package/schemas/actions/openBarcodeScanner.json +104 -0
- package/schemas/actions/query.json +32 -0
- package/schemas/actions/refresh.json +13 -0
- package/schemas/actions/resetDirtyState.json +22 -0
- package/schemas/actions/setFields.json +21 -0
- package/schemas/actions/setStore.json +13 -0
- package/schemas/actions/validateForm.json +15 -0
- package/schemas/actions/workflow.json +24 -0
- package/schemas/components/README.md +147 -0
- package/schemas/components/appComponent.json +50 -0
- package/schemas/components/barcodeScanner.json +69 -0
- package/schemas/components/button.json +123 -0
- package/schemas/components/calendar.json +489 -0
- package/schemas/components/card.json +176 -0
- package/schemas/components/collection.json +54 -0
- package/schemas/components/dataGrid.json +119 -0
- package/schemas/components/datasource.json +151 -0
- package/schemas/components/dropdown.json +57 -0
- package/schemas/components/field-collection.json +618 -0
- package/schemas/components/field.json +265 -0
- package/schemas/components/form.json +234 -0
- package/schemas/components/index.json +68 -0
- package/schemas/components/layout.json +69 -0
- package/schemas/components/module.json +138 -0
- package/schemas/components/navDropdown.json +36 -0
- package/schemas/components/navbar.json +78 -0
- package/schemas/components/navbarItem.json +28 -0
- package/schemas/components/navbarLink.json +36 -0
- package/schemas/components/row.json +31 -0
- package/schemas/components/tab.json +34 -0
- package/schemas/components/tabs.json +35 -0
- package/schemas/components/timeline.json +172 -0
- package/schemas/components/timelineGrid.json +324 -0
- package/schemas/fields/README.md +66 -0
- package/schemas/fields/attachment.json +156 -0
- package/schemas/fields/autocomplete-googleplaces.json +130 -0
- package/schemas/fields/checkbox.json +82 -0
- package/schemas/fields/date.json +88 -0
- package/schemas/fields/datetime.json +75 -0
- package/schemas/fields/email.json +75 -0
- package/schemas/fields/index.json +53 -0
- package/schemas/fields/number.json +91 -0
- package/schemas/fields/password.json +70 -0
- package/schemas/fields/radio.json +94 -0
- package/schemas/fields/rangedatetime.json +56 -0
- package/schemas/fields/select-async.json +334 -0
- package/schemas/fields/select.json +115 -0
- package/schemas/fields/tel.json +79 -0
- package/schemas/fields/text.json +86 -0
- package/schemas/fields/textarea.json +95 -0
- package/schemas/fields/time.json +91 -0
- package/schemas/fields/url.json +74 -0
- package/schemas/schema.graphql +10492 -0
- package/schemas/schemas.json +598 -0
- package/schemas/workflows/activity.json +111 -0
- package/schemas/workflows/common/condition.json +48 -0
- package/schemas/workflows/common/expression.json +76 -0
- package/schemas/workflows/common/mapping.json +134 -0
- package/schemas/workflows/input.json +76 -0
- package/schemas/workflows/output.json +41 -0
- package/schemas/workflows/schedule.json +26 -0
- package/schemas/workflows/tasks/accounting-transaction.json +95 -0
- package/schemas/workflows/tasks/all.json +34 -0
- package/schemas/workflows/tasks/attachment.json +94 -0
- package/schemas/workflows/tasks/charge.json +90 -0
- package/schemas/workflows/tasks/commodity.json +89 -0
- package/schemas/workflows/tasks/contact.json +82 -0
- package/schemas/workflows/tasks/csv.json +79 -0
- package/schemas/workflows/tasks/document-render.json +105 -0
- package/schemas/workflows/tasks/document-send.json +84 -0
- package/schemas/workflows/tasks/email-send.json +110 -0
- package/schemas/workflows/tasks/error.json +72 -0
- package/schemas/workflows/tasks/export.json +90 -0
- package/schemas/workflows/tasks/foreach.json +69 -0
- package/schemas/workflows/tasks/generic.json +47 -0
- package/schemas/workflows/tasks/graphql.json +78 -0
- package/schemas/workflows/tasks/httpRequest.json +119 -0
- package/schemas/workflows/tasks/job.json +88 -0
- package/schemas/workflows/tasks/log.json +73 -0
- package/schemas/workflows/tasks/map.json +58 -0
- package/schemas/workflows/tasks/order.json +87 -0
- package/schemas/workflows/tasks/payment.json +85 -0
- package/schemas/workflows/tasks/setVariable.json +76 -0
- package/schemas/workflows/tasks/switch.json +75 -0
- package/schemas/workflows/tasks/template.json +73 -0
- package/schemas/workflows/tasks/validation.json +90 -0
- package/schemas/workflows/tasks/while.json +53 -0
- package/schemas/workflows/tasks/workflow-execute.json +82 -0
- package/schemas/workflows/trigger.json +86 -0
- package/schemas/workflows/variable.json +46 -0
- package/schemas/workflows/workflow.json +172 -0
- package/scripts/postinstall.js +161 -0
- package/scripts/setup-vscode.js +80 -0
- package/templates/module.yaml +83 -0
- package/templates/workflow.yaml +100 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Timeline Grid Component",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"component": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "timeline-grid"
|
|
9
|
+
},
|
|
10
|
+
"name": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Component instance name for referencing in actions/variables"
|
|
13
|
+
},
|
|
14
|
+
"inputs": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"description": "Input parameters for the timeline grid"
|
|
17
|
+
},
|
|
18
|
+
"props": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"view": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": ["hour", "day", "week", "month"],
|
|
24
|
+
"default": "day",
|
|
25
|
+
"description": "Zoom level preset. Works with timescale."
|
|
26
|
+
},
|
|
27
|
+
"startDate": {
|
|
28
|
+
"$ref": "../schemas.json#/definitions/templateExpression",
|
|
29
|
+
"description": "Initial lower bound for visible window (ISO or expression)",
|
|
30
|
+
"x-example": "{{ today() }}"
|
|
31
|
+
},
|
|
32
|
+
"endDate": {
|
|
33
|
+
"$ref": "../schemas.json#/definitions/templateExpression",
|
|
34
|
+
"description": "Initial upper bound for visible window",
|
|
35
|
+
"x-example": "{{ addDays today 7 }}"
|
|
36
|
+
},
|
|
37
|
+
"defaultDate": {
|
|
38
|
+
"$ref": "../schemas.json#/definitions/templateExpression",
|
|
39
|
+
"description": "Initial focal date when range not provided",
|
|
40
|
+
"x-example": "{{ today() }}"
|
|
41
|
+
},
|
|
42
|
+
"options": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "Visual/behavioral options",
|
|
45
|
+
"properties": {
|
|
46
|
+
"height": {
|
|
47
|
+
"oneOf": [
|
|
48
|
+
{ "type": "number", "description": "Height in pixels" },
|
|
49
|
+
{ "type": "string", "description": "CSS size (e.g., '600px', '50vh')" }
|
|
50
|
+
],
|
|
51
|
+
"default": "600px",
|
|
52
|
+
"description": "Grid height"
|
|
53
|
+
},
|
|
54
|
+
"rowHeight": {
|
|
55
|
+
"type": "number",
|
|
56
|
+
"default": 44,
|
|
57
|
+
"description": "Row height in pixels"
|
|
58
|
+
},
|
|
59
|
+
"timescale": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"enum": ["hour", "day", "week", "month"],
|
|
62
|
+
"default": "hour",
|
|
63
|
+
"description": "Time unit on X-axis"
|
|
64
|
+
},
|
|
65
|
+
"timeStepMinutes": {
|
|
66
|
+
"type": "number",
|
|
67
|
+
"default": 30,
|
|
68
|
+
"description": "Cell width resolution when timescale=hour"
|
|
69
|
+
},
|
|
70
|
+
"snapToMinutes": {
|
|
71
|
+
"type": "number",
|
|
72
|
+
"default": 15,
|
|
73
|
+
"description": "Drag/resize snap step"
|
|
74
|
+
},
|
|
75
|
+
"showNowMarker": {
|
|
76
|
+
"type": "boolean",
|
|
77
|
+
"default": true,
|
|
78
|
+
"description": "Displays current time marker line"
|
|
79
|
+
},
|
|
80
|
+
"showNonWorking": {
|
|
81
|
+
"type": "boolean",
|
|
82
|
+
"default": true,
|
|
83
|
+
"description": "Shades non-working periods"
|
|
84
|
+
},
|
|
85
|
+
"workingHours": {
|
|
86
|
+
"type": "array",
|
|
87
|
+
"description": "Daily working window [startHH:mm, endHH:mm]",
|
|
88
|
+
"items": { "type": "string" },
|
|
89
|
+
"minItems": 2,
|
|
90
|
+
"maxItems": 2,
|
|
91
|
+
"x-example": ["06:00", "22:00"]
|
|
92
|
+
},
|
|
93
|
+
"weekendDays": {
|
|
94
|
+
"type": "array",
|
|
95
|
+
"description": "Weekend day numbers (1=Mon..7=Sun)",
|
|
96
|
+
"items": { "type": "number", "minimum": 1, "maximum": 7 },
|
|
97
|
+
"x-example": [6, 7]
|
|
98
|
+
},
|
|
99
|
+
"allowOverlap": {
|
|
100
|
+
"type": "boolean",
|
|
101
|
+
"default": false,
|
|
102
|
+
"description": "Allow overlaps within the same row"
|
|
103
|
+
},
|
|
104
|
+
"editable": {
|
|
105
|
+
"type": "object",
|
|
106
|
+
"properties": {
|
|
107
|
+
"move": { "type": "boolean", "default": true },
|
|
108
|
+
"resize": { "type": "boolean", "default": true },
|
|
109
|
+
"reassign": { "type": "boolean", "default": true }
|
|
110
|
+
},
|
|
111
|
+
"description": "Enable editing interactions"
|
|
112
|
+
},
|
|
113
|
+
"virtualization": {
|
|
114
|
+
"type": "boolean",
|
|
115
|
+
"default": true,
|
|
116
|
+
"description": "Virtualize rows for performance"
|
|
117
|
+
},
|
|
118
|
+
"stickyHeaders": {
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"default": true,
|
|
121
|
+
"description": "Keep time header and row headers sticky"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"rowTemplate": {
|
|
126
|
+
"$ref": "../schemas.json#/definitions/component",
|
|
127
|
+
"description": "Custom render for row header cell; receives 'row' context"
|
|
128
|
+
},
|
|
129
|
+
"itemTemplate": {
|
|
130
|
+
"$ref": "../schemas.json#/definitions/component",
|
|
131
|
+
"description": "Template for items; receives 'item' context"
|
|
132
|
+
},
|
|
133
|
+
"isHidden": {
|
|
134
|
+
"$ref": "../schemas.json#/definitions/templateExpression",
|
|
135
|
+
"description": "Boolean expression for conditional rendering"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": ["options"]
|
|
139
|
+
},
|
|
140
|
+
"rowSources": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"description": "Data providers for resources (rows)",
|
|
143
|
+
"items": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"properties": {
|
|
146
|
+
"query": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"description": "GraphQL query configuration",
|
|
149
|
+
"properties": {
|
|
150
|
+
"command": { "type": "string", "description": "GraphQL document string" },
|
|
151
|
+
"variables": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"description": "Variables for the query (template expressions supported)",
|
|
154
|
+
"additionalProperties": true
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"required": ["command"]
|
|
158
|
+
},
|
|
159
|
+
"path": { "type": "string", "description": "Dot path to array of rows in response" },
|
|
160
|
+
"mapping": {
|
|
161
|
+
"description": "Mapping from source item to row fields",
|
|
162
|
+
"oneOf": [
|
|
163
|
+
{
|
|
164
|
+
"type": "object",
|
|
165
|
+
"properties": {
|
|
166
|
+
"rows": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"description": "Template expression resolving to an array of rows objects"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"required": ["rows"],
|
|
172
|
+
"additionalProperties": true,
|
|
173
|
+
"x-example": {
|
|
174
|
+
"rows": "{{ eval item.lanes.map(l=>({ rowId:l.id, label:l.name, group:item.name })) }}"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "object",
|
|
179
|
+
"properties": {
|
|
180
|
+
"rowId": {
|
|
181
|
+
"oneOf": [{ "type": "string" }, { "type": "number" }],
|
|
182
|
+
"description": "Unique row identifier"
|
|
183
|
+
},
|
|
184
|
+
"label": { "type": "string", "description": "Row display label" },
|
|
185
|
+
"group": { "type": "string", "description": "Group name for collapsible grouping" },
|
|
186
|
+
"status": { "type": "string" },
|
|
187
|
+
"type": { "type": "string" },
|
|
188
|
+
"color": { "type": "string" }
|
|
189
|
+
},
|
|
190
|
+
"required": ["rowId", "label"],
|
|
191
|
+
"additionalProperties": true
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"required": ["query", "path", "mapping"]
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"itemSources": {
|
|
200
|
+
"type": "array",
|
|
201
|
+
"description": "Data providers for time spans (items) for the visible window",
|
|
202
|
+
"items": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"properties": {
|
|
205
|
+
"query": {
|
|
206
|
+
"type": "object",
|
|
207
|
+
"description": "GraphQL query configuration",
|
|
208
|
+
"properties": {
|
|
209
|
+
"command": { "type": "string", "description": "GraphQL document string" },
|
|
210
|
+
"variables": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"description": "Variables for the query; should include start and end",
|
|
213
|
+
"additionalProperties": true
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"required": ["command"]
|
|
217
|
+
},
|
|
218
|
+
"path": { "type": "string", "description": "Dot path to array of items in response" },
|
|
219
|
+
"mapping": {
|
|
220
|
+
"type": "object",
|
|
221
|
+
"description": "Mapping from source item to grid item fields",
|
|
222
|
+
"properties": {
|
|
223
|
+
"id": { "oneOf": [{ "type": "string" }, { "type": "number" }], "description": "Unique item identifier" },
|
|
224
|
+
"rowId": { "oneOf": [{ "type": "string" }, { "type": "number" }], "description": "Row association" },
|
|
225
|
+
"start": { "type": "string", "description": "Start datetime (ISO)" },
|
|
226
|
+
"end": { "type": "string", "description": "End datetime (ISO)" },
|
|
227
|
+
"title": { "type": "string", "description": "Display title" },
|
|
228
|
+
"description": { "type": "string" },
|
|
229
|
+
"status": { "type": "string" },
|
|
230
|
+
"priority": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
|
|
231
|
+
"color": { "type": "string" },
|
|
232
|
+
"textColor": { "type": "string" },
|
|
233
|
+
"className": { "type": "string" }
|
|
234
|
+
},
|
|
235
|
+
"required": ["id", "rowId", "start", "end", "title"],
|
|
236
|
+
"additionalProperties": true
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"required": ["query", "path", "mapping"]
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"events": {
|
|
243
|
+
"type": "object",
|
|
244
|
+
"description": "Interaction handlers",
|
|
245
|
+
"properties": {
|
|
246
|
+
"onItemClick": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
247
|
+
"onItemMove": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
248
|
+
"onItemResize": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
249
|
+
"onItemReassign": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
250
|
+
"onRangeChange": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
251
|
+
"onEmptySlotClick": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
252
|
+
"onLoading": { "$ref": "../schemas.json#/definitions/actionsList" }
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"children": {
|
|
256
|
+
"$ref": "../schemas.json#/definitions/componentChildren"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"required": ["component", "props", "rowSources", "itemSources"],
|
|
260
|
+
"x-examples": [
|
|
261
|
+
{
|
|
262
|
+
"component": "timelineGrid",
|
|
263
|
+
"name": "vehicleScheduler",
|
|
264
|
+
"props": {
|
|
265
|
+
"view": "day",
|
|
266
|
+
"options": {
|
|
267
|
+
"height": "600px",
|
|
268
|
+
"timescale": "hour",
|
|
269
|
+
"timeStepMinutes": 30,
|
|
270
|
+
"snapToMinutes": 15,
|
|
271
|
+
"showNowMarker": true,
|
|
272
|
+
"editable": { "move": true, "resize": true, "reassign": true }
|
|
273
|
+
},
|
|
274
|
+
"itemTemplate": {
|
|
275
|
+
"component": "card",
|
|
276
|
+
"props": {
|
|
277
|
+
"title": "{{ item.title }}",
|
|
278
|
+
"description": "{{ item.description }}",
|
|
279
|
+
"backgroundColor": "{{ item.color || '#3788d8' }}",
|
|
280
|
+
"textColor": "white"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"rowSources": [
|
|
285
|
+
{
|
|
286
|
+
"query": {
|
|
287
|
+
"command": "query GetVehicles($organizationId: Int!) { vehicles(organizationId: $organizationId) { id code status type } }",
|
|
288
|
+
"variables": { "organizationId": "{{ number organizationId }}" }
|
|
289
|
+
},
|
|
290
|
+
"path": "vehicles",
|
|
291
|
+
"mapping": {
|
|
292
|
+
"rowId": "{{ item.id }}",
|
|
293
|
+
"label": "{{ item.code }}",
|
|
294
|
+
"status": "{{ item.status }}",
|
|
295
|
+
"type": "{{ item.type }}"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"itemSources": [
|
|
300
|
+
{
|
|
301
|
+
"query": {
|
|
302
|
+
"command": "query VehicleAssignments($organizationId: Int!, $start: String!, $end: String!) { vehicleAssignments(organizationId: $organizationId, start: $start, end: $end) { id vehicleId start end shipmentId status priority } }",
|
|
303
|
+
"variables": {
|
|
304
|
+
"organizationId": "{{ number organizationId }}",
|
|
305
|
+
"start": "{{ startDate }}",
|
|
306
|
+
"end": "{{ endDate }}"
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"path": "vehicleAssignments",
|
|
310
|
+
"mapping": {
|
|
311
|
+
"id": "{{ item.id }}",
|
|
312
|
+
"rowId": "{{ item.vehicleId }}",
|
|
313
|
+
"start": "{{ item.start }}",
|
|
314
|
+
"end": "{{ item.end }}",
|
|
315
|
+
"title": "Shipment {{ item.shipmentId }}",
|
|
316
|
+
"status": "{{ item.status }}",
|
|
317
|
+
"priority": "{{ item.priority }}",
|
|
318
|
+
"color": "{{ eval item.status === 'delayed' ? '#e53e3e' : (item.priority === 'high' ? '#ffa726' : '#4ecdc4') }}"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Field Type Schemas
|
|
2
|
+
|
|
3
|
+
This directory contains separate JSON schema files for each field type supported by the CargoXplorer TMS system.
|
|
4
|
+
|
|
5
|
+
## Available Field Types
|
|
6
|
+
|
|
7
|
+
### Basic Input Fields
|
|
8
|
+
|
|
9
|
+
- **text.json** - Basic text input field
|
|
10
|
+
- **number.json** - Numeric input field with validation and formatting
|
|
11
|
+
- **email.json** - Email input field with validation
|
|
12
|
+
- **password.json** - Password input field with security features
|
|
13
|
+
- **tel.json** - Telephone number input field with formatting
|
|
14
|
+
- **url.json** - URL input field with validation
|
|
15
|
+
|
|
16
|
+
### Date/Time Fields
|
|
17
|
+
|
|
18
|
+
- **date.json** - Date picker field
|
|
19
|
+
- **datetime.json** - Date/time picker field (timezone-aware options)
|
|
20
|
+
- **rangedatetime.json** - Date/time range picker field
|
|
21
|
+
- **time.json** - Time picker field
|
|
22
|
+
|
|
23
|
+
### Selection Fields
|
|
24
|
+
|
|
25
|
+
- **select.json** - Dropdown select field with static options
|
|
26
|
+
- **select-async.json** - Async dropdown select field with GraphQL queries
|
|
27
|
+
- **autocomplete-googleplaces.json** - Google Places autocomplete field for addresses
|
|
28
|
+
- **checkbox.json** - Checkbox input field
|
|
29
|
+
- **radio.json** - Radio button group field
|
|
30
|
+
|
|
31
|
+
### Text Area
|
|
32
|
+
|
|
33
|
+
- **textarea.json** - Multi-line text input field
|
|
34
|
+
|
|
35
|
+
## Schema Structure
|
|
36
|
+
|
|
37
|
+
Each field type schema includes:
|
|
38
|
+
|
|
39
|
+
- Field-specific properties and validation
|
|
40
|
+
- Event handlers (onChange, onBlur, onFocus, onSelectValue)
|
|
41
|
+
- Transformation configurations
|
|
42
|
+
- Real-world examples from the CargoXplorer modules
|
|
43
|
+
- Complete type safety and validation rules
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
These schemas are referenced by the main `schemas.json` file using conditional validation based on the field `type` property. This modular approach makes it easier to:
|
|
48
|
+
|
|
49
|
+
1. **Maintain** - Each field type is self-contained
|
|
50
|
+
2. **Extend** - Add new field types without modifying the main schema
|
|
51
|
+
3. **Validate** - Specific validation rules for each field type
|
|
52
|
+
4. **Document** - Clear examples and descriptions for each type
|
|
53
|
+
|
|
54
|
+
## Integration
|
|
55
|
+
|
|
56
|
+
The field schemas integrate with:
|
|
57
|
+
|
|
58
|
+
- **GraphQL queries** - For select-async and autocomplete fields
|
|
59
|
+
- **Actions system** - For event handlers and value selection
|
|
60
|
+
- **Template expressions** - For dynamic values and transformations
|
|
61
|
+
- **Localization** - For multi-language support
|
|
62
|
+
- **Permissions** - For role-based field access
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
Each schema includes comprehensive examples derived from real usage patterns in the CargoXplorer TMS modules, ensuring practical applicability and correct implementation.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Attachment Field Type",
|
|
4
|
+
"description": "Schema for attachment field type supporting images and files",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"type": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"const": "attachment"
|
|
10
|
+
},
|
|
11
|
+
"label": {
|
|
12
|
+
"oneOf": [{ "type": "string" }, { "$ref": "../schemas.json#/definitions/localized" }],
|
|
13
|
+
"description": "Field label",
|
|
14
|
+
"x-example": { "en-US": "File Attachment" }
|
|
15
|
+
},
|
|
16
|
+
"placeholder": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Field placeholder text",
|
|
19
|
+
"x-example": "Add Attachment / Take Photo"
|
|
20
|
+
},
|
|
21
|
+
"required": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Whether field is required",
|
|
24
|
+
"x-example": false
|
|
25
|
+
},
|
|
26
|
+
"disabled": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"description": "Whether field is disabled",
|
|
29
|
+
"x-example": false
|
|
30
|
+
},
|
|
31
|
+
"options": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"description": "Attachment field options",
|
|
34
|
+
"properties": {
|
|
35
|
+
"allowMultiple": {
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"description": "Allow selecting or uploading multiple attachments"
|
|
38
|
+
},
|
|
39
|
+
"allowClear": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "Allow clearing the current selection"
|
|
42
|
+
},
|
|
43
|
+
"allowCamera": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"description": "Show camera capture button",
|
|
46
|
+
"default": true
|
|
47
|
+
},
|
|
48
|
+
"cameraQuality": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": ["low", "medium", "high", "maximum"],
|
|
51
|
+
"description": "Camera capture quality setting",
|
|
52
|
+
"default": "high"
|
|
53
|
+
},
|
|
54
|
+
"captureFormat": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"enum": ["jpeg", "png"],
|
|
57
|
+
"description": "Camera capture image format",
|
|
58
|
+
"default": "jpeg"
|
|
59
|
+
},
|
|
60
|
+
"instantCamera": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"description": "Instant capture mode - auto-upload after capture"
|
|
63
|
+
},
|
|
64
|
+
"displayAs": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"enum": ["image", "file"],
|
|
67
|
+
"description": "Preferred display mode for attachments"
|
|
68
|
+
},
|
|
69
|
+
"previewWidth": {
|
|
70
|
+
"oneOf": [{ "type": "integer" }, { "type": "string" }],
|
|
71
|
+
"description": "Preview thumbnail width (pixels or CSS value)"
|
|
72
|
+
},
|
|
73
|
+
"previewHeight": {
|
|
74
|
+
"oneOf": [{ "type": "integer" }, { "type": "string" }],
|
|
75
|
+
"description": "Preview thumbnail height (pixels or CSS value)"
|
|
76
|
+
},
|
|
77
|
+
"maxSize": {
|
|
78
|
+
"type": "integer",
|
|
79
|
+
"description": "Maximum file size in bytes"
|
|
80
|
+
},
|
|
81
|
+
"allowedExtensions": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"description": "Allowed MIME types or extensions",
|
|
84
|
+
"items": { "type": "string" }
|
|
85
|
+
},
|
|
86
|
+
"parentId": {
|
|
87
|
+
"oneOf": [{ "type": "string" }, { "type": "integer" }, { "$ref": "../schemas.json#/definitions/templateExpression" }],
|
|
88
|
+
"description": "Parent entity ID for linking attachment"
|
|
89
|
+
},
|
|
90
|
+
"parentType": {
|
|
91
|
+
"oneOf": [{ "type": "string" }, { "$ref": "../schemas.json#/definitions/templateExpression" }],
|
|
92
|
+
"description": "Logical parent type/entity for the attachment (e.g., Order, Contact)"
|
|
93
|
+
},
|
|
94
|
+
"onUploaded": {
|
|
95
|
+
"oneOf": [{ "type": "string" }, { "$ref": "../schemas.json#/definitions/actions" }],
|
|
96
|
+
"description": "Actions to execute after successful upload"
|
|
97
|
+
},
|
|
98
|
+
"clearAfterUpload": {
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"description": "Clear field after upload, showing success message briefly. Use for drop zone mode."
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"required": ["type"],
|
|
106
|
+
"x-examples": [
|
|
107
|
+
{
|
|
108
|
+
"type": "attachment",
|
|
109
|
+
"label": "File Attachment",
|
|
110
|
+
"options": {
|
|
111
|
+
"allowMultiple": true,
|
|
112
|
+
"allowClear": true,
|
|
113
|
+
"displayAs": "image",
|
|
114
|
+
"previewWidth": 100,
|
|
115
|
+
"previewHeight": 100,
|
|
116
|
+
"maxSize": 10485760,
|
|
117
|
+
"allowedExtensions": ["image/*", "application/pdf"]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"type": "attachment",
|
|
122
|
+
"label": { "en-US": "Logo" },
|
|
123
|
+
"options": {
|
|
124
|
+
"allowMultiple": false,
|
|
125
|
+
"allowClear": true,
|
|
126
|
+
"displayAs": "image",
|
|
127
|
+
"previewWidth": 100,
|
|
128
|
+
"previewHeight": 100,
|
|
129
|
+
"maxSize": 1048576,
|
|
130
|
+
"allowedExtensions": ["image/*"]
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "attachment",
|
|
135
|
+
"label": { "en-US": "Upload Document" },
|
|
136
|
+
"options": {
|
|
137
|
+
"allowMultiple": false,
|
|
138
|
+
"allowClear": true,
|
|
139
|
+
"displayAs": "file",
|
|
140
|
+
"maxSize": 10485760,
|
|
141
|
+
"parentType": "Order"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"type": "attachment",
|
|
146
|
+
"label": { "en-US": "Upload to Order" },
|
|
147
|
+
"options": {
|
|
148
|
+
"allowMultiple": true,
|
|
149
|
+
"allowCamera": true,
|
|
150
|
+
"clearAfterUpload": true,
|
|
151
|
+
"parentId": "{{ orderId }}",
|
|
152
|
+
"parentType": "Order"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Autocomplete Google Places Field Type",
|
|
4
|
+
"description": "Schema for autocomplete-googleplaces field type with Google Places API integration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"type": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"const": "autocomplete-googleplaces"
|
|
10
|
+
},
|
|
11
|
+
"label": {
|
|
12
|
+
"oneOf": [
|
|
13
|
+
{ "type": "string" },
|
|
14
|
+
{ "$ref": "../schemas.json#/definitions/localized" }
|
|
15
|
+
],
|
|
16
|
+
"description": "Field label",
|
|
17
|
+
"x-example": {
|
|
18
|
+
"en-US": "Address"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"placeholder": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Field placeholder text",
|
|
24
|
+
"x-example": "Enter address"
|
|
25
|
+
},
|
|
26
|
+
"required": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"description": "Whether field is required",
|
|
29
|
+
"x-example": false
|
|
30
|
+
},
|
|
31
|
+
"disabled": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "Whether field is disabled",
|
|
34
|
+
"x-example": false
|
|
35
|
+
},
|
|
36
|
+
"options": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"description": "Google Places specific options",
|
|
39
|
+
"properties": {
|
|
40
|
+
"itemLabelTemplate": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Template expression for displaying items",
|
|
43
|
+
"x-example": "{{ description }}"
|
|
44
|
+
},
|
|
45
|
+
"searchQuery": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"description": "Google Places search parameters",
|
|
48
|
+
"properties": {
|
|
49
|
+
"params": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"input": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "Search input template",
|
|
55
|
+
"x-example": "{{ string search }}"
|
|
56
|
+
},
|
|
57
|
+
"types": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "type": "string" },
|
|
60
|
+
"description": "Place types to search for",
|
|
61
|
+
"x-example": ["address"]
|
|
62
|
+
},
|
|
63
|
+
"language": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"description": "Language code for results",
|
|
66
|
+
"x-example": "en"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": ["input"]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"required": ["params"]
|
|
73
|
+
},
|
|
74
|
+
"valueQuery": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"description": "Parameters for place details query",
|
|
77
|
+
"properties": {
|
|
78
|
+
"params": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"properties": {
|
|
81
|
+
"fields": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"items": { "type": "string" },
|
|
84
|
+
"description": "Fields to retrieve from place details",
|
|
85
|
+
"x-example": ["name", "address_components", "formatted_address", "geometry", "business_status"]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"required": ["fields"]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"required": ["params"]
|
|
92
|
+
},
|
|
93
|
+
"prefix": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"description": "Field name prefix for form fields",
|
|
96
|
+
"x-example": "orderEntityPickups[{{shipperIndex}}]."
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"required": ["searchQuery", "valueQuery"]
|
|
100
|
+
},
|
|
101
|
+
"onSelectValue": {
|
|
102
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
103
|
+
"description": "Actions to execute when a place is selected",
|
|
104
|
+
"x-example": [
|
|
105
|
+
{
|
|
106
|
+
"setFields": {
|
|
107
|
+
"{{prefix}}countryCode": "{{ selectedItem.countryCode }}",
|
|
108
|
+
"{{prefix}}stateCode": "{{ selectedItem.stateCode }}",
|
|
109
|
+
"{{prefix}}cityName": "{{ selectedItem.city }}",
|
|
110
|
+
"{{prefix}}postalCode": "{{ selectedItem.postalCode }}",
|
|
111
|
+
"{{prefix}}customValues.address": "{{eval [selectedItem.name, selectedItem.addressLine].filter(Boolean).join(\", \") }}"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"onChange": {
|
|
117
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
118
|
+
"description": "Actions to execute when field value changes"
|
|
119
|
+
},
|
|
120
|
+
"onBlur": {
|
|
121
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
122
|
+
"description": "Actions to execute when field loses focus"
|
|
123
|
+
},
|
|
124
|
+
"onFocus": {
|
|
125
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
126
|
+
"description": "Actions to execute when field gains focus"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": ["type", "options"]
|
|
130
|
+
}
|