mobigrid-module 1.1.31 → 1.1.35
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 +49 -32
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/examples/transportors/src/App.d.ts +0 -2
- package/dist/examples/transportors/src/App.test.d.ts +0 -1
- package/dist/examples/transportors/src/components/ui/dialog.d.ts +0 -19
- package/dist/examples/transportors/src/index.d.ts +0 -1
- package/dist/examples/transportors/src/reportWebVitals.d.ts +0 -3
- package/dist/examples/transportors/src/setupTests.d.ts +0 -1
package/README.md
CHANGED
|
@@ -17,16 +17,17 @@ import MobigridModule from 'mobigrid-module';
|
|
|
17
17
|
import 'mobigrid-module/dist/index.css'; // Import styles if necessary
|
|
18
18
|
|
|
19
19
|
function App() {
|
|
20
|
-
const
|
|
21
|
-
console.log('
|
|
20
|
+
const handlePrint = (row) => {
|
|
21
|
+
console.log('Print ticket:', row.ticket_numbers);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
console.log('
|
|
24
|
+
const handleRefund = (row) => {
|
|
25
|
+
console.log('Refund transaction:', row.request_id);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Callback to determine if print button should be shown
|
|
29
|
+
const canPrintTicket = (row) => {
|
|
30
|
+
return row.status === 'PAID' && row.canPrint === true;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
return (
|
|
@@ -34,11 +35,11 @@ function App() {
|
|
|
34
35
|
configUrl="https://api.example.com/config"
|
|
35
36
|
// OR provide configJson directly
|
|
36
37
|
// configJson={myConfigObject}
|
|
37
|
-
dataUrl="https://api.example.com/
|
|
38
|
+
dataUrl="https://api.example.com/transactions"
|
|
38
39
|
callbacks={{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
onPrint: handlePrint,
|
|
41
|
+
onRefund: handleRefund,
|
|
42
|
+
checkPrint: canPrintTicket
|
|
42
43
|
}}
|
|
43
44
|
customHeaders={{
|
|
44
45
|
'Authorization': 'Bearer token123'
|
|
@@ -69,22 +70,27 @@ The `MobigridModule` accepts the following props:
|
|
|
69
70
|
|
|
70
71
|
The configuration object defines the structure of the table, filters, and columns. You can provide this via the `configUrl` endpoint or directly via the `configJson` prop.
|
|
71
72
|
|
|
73
|
+
### Example Configuration (Payment History)
|
|
74
|
+
|
|
72
75
|
```json
|
|
73
76
|
{
|
|
74
|
-
"title": "
|
|
75
|
-
"data_url": "https://api.example.com/
|
|
77
|
+
"title": "Payment History",
|
|
78
|
+
"data_url": "https://api.example.com/payments",
|
|
76
79
|
"Filters": [
|
|
77
80
|
[
|
|
78
81
|
{
|
|
79
82
|
"type": "Text",
|
|
80
|
-
"name": "
|
|
81
|
-
"label": "
|
|
83
|
+
"name": "request_id",
|
|
84
|
+
"label": "Request ID"
|
|
82
85
|
},
|
|
83
86
|
{
|
|
84
87
|
"type": "Select",
|
|
85
|
-
"name": "
|
|
86
|
-
"label": "
|
|
87
|
-
"
|
|
88
|
+
"name": "status",
|
|
89
|
+
"label": "Status",
|
|
90
|
+
"options": [
|
|
91
|
+
{ "label": "Paid", "value": "PAID" },
|
|
92
|
+
{ "label": "Failed", "value": "FAILED" }
|
|
93
|
+
]
|
|
88
94
|
}
|
|
89
95
|
],
|
|
90
96
|
[
|
|
@@ -100,32 +106,43 @@ The configuration object defines the structure of the table, filters, and column
|
|
|
100
106
|
}
|
|
101
107
|
]
|
|
102
108
|
],
|
|
103
|
-
"colomns": [
|
|
109
|
+
"colomns": [
|
|
110
|
+
{
|
|
111
|
+
"title": "Request ID",
|
|
112
|
+
"key": "request_id",
|
|
113
|
+
"type": "text"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"title": "Date",
|
|
117
|
+
"key": "created_date",
|
|
118
|
+
"type": "date",
|
|
119
|
+
"pattern": "dd/MM/yyyy HH:mm"
|
|
120
|
+
},
|
|
104
121
|
{
|
|
105
|
-
"title": "
|
|
106
|
-
"key": "
|
|
122
|
+
"title": "POS Code",
|
|
123
|
+
"key": "pos_code",
|
|
107
124
|
"type": "text"
|
|
108
125
|
},
|
|
126
|
+
{
|
|
127
|
+
"title": "Amount",
|
|
128
|
+
"key": "amount",
|
|
129
|
+
"type": "money",
|
|
130
|
+
"currency": "MAD"
|
|
131
|
+
},
|
|
109
132
|
{
|
|
110
133
|
"title": "Status",
|
|
111
134
|
"key": "status",
|
|
112
135
|
"type": "status"
|
|
113
136
|
},
|
|
114
|
-
{
|
|
115
|
-
"title": "Created At",
|
|
116
|
-
"key": "createdAt",
|
|
117
|
-
"type": "date",
|
|
118
|
-
"pattern": "dd/MM/yyyy"
|
|
119
|
-
},
|
|
120
137
|
{
|
|
121
138
|
"title": "Actions",
|
|
122
139
|
"key": "ACTIONS_BUTTONS",
|
|
123
140
|
"actions": [
|
|
124
141
|
{
|
|
125
|
-
"label": "
|
|
126
|
-
"icon": "icon-
|
|
127
|
-
"action": "
|
|
128
|
-
"condition": "
|
|
142
|
+
"label": "Print",
|
|
143
|
+
"icon": "icon-printer",
|
|
144
|
+
"action": "onPrint",
|
|
145
|
+
"condition": "checkPrint"
|
|
129
146
|
}
|
|
130
147
|
]
|
|
131
148
|
}
|
|
@@ -151,11 +168,11 @@ Filters are defined as an array of arrays (rows of filters).
|
|
|
151
168
|
Defines the table columns.
|
|
152
169
|
|
|
153
170
|
- **`title`**: Header text for the column.
|
|
154
|
-
- **`key`**: The key in the data object to display.
|
|
171
|
+
- **`key`**: The key in the data object to display (e.g., `request_id`, `amount`).
|
|
155
172
|
- **`type`**: formatting type.
|
|
156
173
|
- `"text"`: Default display.
|
|
157
174
|
- `"date"`: Formats date using `pattern` (default: `dd-MM-yyyy`).
|
|
158
|
-
- `"money"`: Formats as currency. Usage: `currency` prop required.
|
|
175
|
+
- `"money"`: Formats as currency. Usage: `currency` prop required (e.g., "MAD").
|
|
159
176
|
- `"status"`: Displays a colored badge based on status value (PENDING, PAID, CANCELLED, etc.).
|
|
160
177
|
- `"ACTIONS_BUTTONS"`: Special column for action buttons.
|
|
161
178
|
- **`scroll`**: If true, limits height and adds scrollbar for long content.
|