@onehat/data 1.12.0 → 1.13.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/package.json
CHANGED
|
@@ -479,9 +479,15 @@ export default class Repository extends EventEmitter {
|
|
|
479
479
|
throw Error('this.getDefaultSorters is no longer valid. Repository has been destroyed.');
|
|
480
480
|
}
|
|
481
481
|
let sorters = [];
|
|
482
|
-
if (this.schema
|
|
482
|
+
if (this.schema?.model) {
|
|
483
483
|
if (_.size(this.schema.model.sorters) > 0) {
|
|
484
484
|
sorters = this.schema.model.sorters
|
|
485
|
+
} else if (!_.isNil(this.schema.model.sortProperty)) {
|
|
486
|
+
sorters = [{
|
|
487
|
+
name: this.schema.model.sortProperty,
|
|
488
|
+
direction: 'ASC',
|
|
489
|
+
fn: 'default',
|
|
490
|
+
}];
|
|
485
491
|
} else if (!_.isNil(this.schema.model.displayProperty)) {
|
|
486
492
|
sorters = [{
|
|
487
493
|
name: this.schema.model.displayProperty,
|
package/src/Schema/Schema.js
CHANGED
|
@@ -58,6 +58,12 @@ export default class Schema extends EventEmitter {
|
|
|
58
58
|
*/
|
|
59
59
|
displayProperty: null,
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @member {string} sortProperty - name of sort Property (e.g. 'users__sort_order')
|
|
63
|
+
* if sortProperty has a value and sorters is left blank, an automatic sorter with this property will be created.
|
|
64
|
+
*/
|
|
65
|
+
sortProperty: null,
|
|
66
|
+
|
|
61
67
|
/**
|
|
62
68
|
* @member {array} properties - Array of Property definition objects
|
|
63
69
|
*/
|