@onehat/ui 0.4.75 → 0.4.76
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
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
UPLOAD_DOWNLOAD,
|
|
11
11
|
DOWNLOAD,
|
|
12
12
|
} from '../../Constants/Commands.js';
|
|
13
|
+
import Inflector from 'inflector-js';
|
|
13
14
|
import Clipboard from '../Icons/Clipboard.js';
|
|
14
15
|
import Duplicate from '../Icons/Duplicate.js';
|
|
15
16
|
import Edit from '../Icons/Edit.js';
|
|
@@ -78,7 +79,10 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
78
79
|
disableDuplicate = !isEditor,
|
|
79
80
|
disablePrint = !isGrid,
|
|
80
81
|
protectedValues, // records with these values cannot be edited or deleted
|
|
81
|
-
|
|
82
|
+
addDisplayMsg,
|
|
83
|
+
editDisplayMsg,
|
|
84
|
+
deleteDisplayMsg,
|
|
85
|
+
|
|
82
86
|
// withAlert
|
|
83
87
|
showInfo,
|
|
84
88
|
|
|
@@ -90,6 +94,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
90
94
|
self,
|
|
91
95
|
|
|
92
96
|
// withData
|
|
97
|
+
model,
|
|
93
98
|
Repository,
|
|
94
99
|
|
|
95
100
|
// withPermissions
|
|
@@ -219,7 +224,16 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
219
224
|
switch(type) {
|
|
220
225
|
case ADD:
|
|
221
226
|
key = 'addBtn';
|
|
222
|
-
|
|
227
|
+
if (addDisplayMsg) {
|
|
228
|
+
text = addDisplayMsg;
|
|
229
|
+
} else {
|
|
230
|
+
text = 'Add';
|
|
231
|
+
if (model) {
|
|
232
|
+
let inflected = Inflector.singularize(model); // can only add one at a time
|
|
233
|
+
inflected = Inflector.camel2words(Inflector.humanize(Inflector.underscore(inflected))); // Separate with spaces, capitalize each word
|
|
234
|
+
text += ' ' + inflected;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
223
237
|
handler = (parent, e) => {
|
|
224
238
|
onAdd();
|
|
225
239
|
};
|
|
@@ -232,7 +246,21 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
232
246
|
break;
|
|
233
247
|
case EDIT:
|
|
234
248
|
key = 'editBtn';
|
|
235
|
-
|
|
249
|
+
if (editDisplayMsg) {
|
|
250
|
+
text = editDisplayMsg;
|
|
251
|
+
} else {
|
|
252
|
+
text = 'Edit';
|
|
253
|
+
if (model) {
|
|
254
|
+
let inflected = model;
|
|
255
|
+
if (selection.length <= 1) {
|
|
256
|
+
inflected = Inflector.singularize(inflected);
|
|
257
|
+
} else {
|
|
258
|
+
inflected = Inflector.pluralize(inflected);
|
|
259
|
+
}
|
|
260
|
+
inflected = Inflector.camel2words(Inflector.humanize(Inflector.underscore(inflected))); // Separate with spaces, capitalize each word
|
|
261
|
+
text += ' ' + inflected;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
236
264
|
handler = (parent, e) => {
|
|
237
265
|
onEdit();
|
|
238
266
|
};
|
|
@@ -248,7 +276,21 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
248
276
|
break;
|
|
249
277
|
case DELETE:
|
|
250
278
|
key = 'deleteBtn';
|
|
251
|
-
|
|
279
|
+
if (deleteDisplayMsg) {
|
|
280
|
+
text = deleteDisplayMsg;
|
|
281
|
+
} else {
|
|
282
|
+
text = 'Delete';
|
|
283
|
+
if (model) {
|
|
284
|
+
let inflected = model;
|
|
285
|
+
if (selection.length <= 1) {
|
|
286
|
+
inflected = Inflector.singularize(inflected);
|
|
287
|
+
} else {
|
|
288
|
+
inflected = Inflector.pluralize(inflected);
|
|
289
|
+
}
|
|
290
|
+
inflected = Inflector.camel2words(Inflector.humanize(Inflector.underscore(inflected))); // Separate with spaces, capitalize each word
|
|
291
|
+
text += ' ' + inflected;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
252
294
|
handler = onDelete;
|
|
253
295
|
handler = (parent, e) => {
|
|
254
296
|
onDelete();
|