@avakhula/ui 0.0.32 → 0.0.33

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
@@ -82,6 +82,9 @@ export default {
82
82
  isToggle: {
83
83
  control: { type: "boolean" },
84
84
  },
85
+ alphabetSort: {
86
+ control: { type: "boolean" },
87
+ },
85
88
  },
86
89
  };
87
90
 
@@ -131,7 +134,7 @@ const testData = [
131
134
  const testData1 = [
132
135
  {
133
136
  id: "1",
134
- title: "Education",
137
+ title: "A Education",
135
138
  is_category: true,
136
139
  initiallyVisible: true,
137
140
  visible: true,
@@ -367,6 +367,10 @@ export default {
367
367
  type: Boolean,
368
368
  default: false,
369
369
  },
370
+ alphabetSort: {
371
+ type: Boolean,
372
+ default: false,
373
+ },
370
374
  },
371
375
  watch: {
372
376
  value(value) {
@@ -577,17 +581,22 @@ export default {
577
581
  this.$emit("search", { search: this.filterString });
578
582
  this.defaultFilter(options);
579
583
  },
580
- setPreparedValues(options) {
581
- return this.prepare(options || this.options).then(
582
- ([options, selected]) => {
583
- this.actualOptions = options;
584
- this.allOptionsIsChecked = this.checkIfOptionsChecked(options);
585
- this.countVisibleChildren = options.length;
586
- this.isInitialized = true;
587
- this.selected = selected;
588
- this.setBookmarkedOptions(options);
589
- }
590
- );
584
+ setPreparedValues(opt) {
585
+ let options = opt || this.options;
586
+ if (this.alphabetSort) {
587
+ options = options.sort((a, b) =>
588
+ a.title.toLowerCase().localeCompare(b.title.toLowerCase())
589
+ );
590
+ }
591
+
592
+ return this.prepare(options).then(([options, selected]) => {
593
+ this.actualOptions = options;
594
+ this.allOptionsIsChecked = this.checkIfOptionsChecked(options);
595
+ this.countVisibleChildren = options.length;
596
+ this.isInitialized = true;
597
+ this.selected = selected;
598
+ this.setBookmarkedOptions(options);
599
+ });
591
600
  },
592
601
  clear() {
593
602
  this.actualOptions = [];