@momentum-design/components 0.122.6 → 0.122.8

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.
Files changed (32) hide show
  1. package/dist/browser/index.js +428 -409
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/list/list.component.d.ts +12 -17
  4. package/dist/components/list/list.component.js +29 -39
  5. package/dist/components/listitem/listitem.component.d.ts +10 -0
  6. package/dist/components/listitem/listitem.component.js +7 -0
  7. package/dist/components/virtualizedlist/virtualizedlist.component.d.ts +244 -41
  8. package/dist/components/virtualizedlist/virtualizedlist.component.js +597 -78
  9. package/dist/components/virtualizedlist/virtualizedlist.constants.d.ts +7 -4
  10. package/dist/components/virtualizedlist/virtualizedlist.constants.js +7 -4
  11. package/dist/components/virtualizedlist/virtualizedlist.styles.js +17 -3
  12. package/dist/components/virtualizedlist/virtualizedlist.types.d.ts +12 -10
  13. package/dist/components/virtualizedlist/virtualizedlist.utils.d.ts +11 -0
  14. package/dist/components/virtualizedlist/virtualizedlist.utils.js +23 -0
  15. package/dist/custom-elements.json +867 -196
  16. package/dist/react/index.d.ts +1 -1
  17. package/dist/react/index.js +1 -1
  18. package/dist/react/virtualizedlist/index.d.ts +44 -6
  19. package/dist/react/virtualizedlist/index.js +44 -6
  20. package/dist/utils/mixins/AutoFocusOnMountMixin.js +2 -2
  21. package/dist/utils/mixins/ListNavigationMixin.d.ts +5 -2
  22. package/dist/utils/mixins/ListNavigationMixin.js +77 -68
  23. package/dist/utils/mixins/lifecycle/LifeCycleMixin.js +4 -0
  24. package/dist/utils/mixins/lifecycle/lifecycle.contants.d.ts +1 -0
  25. package/dist/utils/mixins/lifecycle/lifecycle.contants.js +1 -0
  26. package/dist/utils/range.d.ts +40 -0
  27. package/dist/utils/range.js +66 -0
  28. package/dist/utils/virtualIndexArray.d.ts +27 -0
  29. package/dist/utils/virtualIndexArray.js +42 -0
  30. package/package.json +2 -2
  31. package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +0 -22
  32. package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +0 -82
@@ -1,82 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { html } from 'lit';
11
- import { property, state } from 'lit/decorators.js';
12
- import { ref } from 'lit/directives/ref.js';
13
- import { styleMap } from 'lit/directives/style-map.js';
14
- import { Component } from '../../models';
15
- class VirtualizedWrapper extends Component {
16
- constructor() {
17
- super();
18
- this.virtualizerProps = { count: 100, estimateSize: () => 100, overscan: 60 };
19
- this.list = html ``;
20
- this.listItemTexts = new Array(this.virtualizerProps.count).fill(true).map((_, index) => `list item number ${index}`);
21
- this.onscroll = null;
22
- this.setListData = this.setListData.bind(this);
23
- }
24
- update(changedProperties) {
25
- super.update(changedProperties);
26
- if (changedProperties.get('virtualizerProps')) {
27
- this.updateListItemTextArray();
28
- }
29
- }
30
- connectedCallback() {
31
- var _a;
32
- super.connectedCallback();
33
- if ((_a = this.virtualizerProps) === null || _a === void 0 ? void 0 : _a.count) {
34
- this.updateListItemTextArray();
35
- }
36
- }
37
- updateListItemTextArray() {
38
- var _a;
39
- this.listItemTexts = new Array((_a = this.virtualizerProps) === null || _a === void 0 ? void 0 : _a.count)
40
- .fill(true)
41
- .map((_, index) => `list item number ${index}`);
42
- }
43
- setListData({ virtualItems, measureElement, listStyle }) {
44
- if (virtualItems) {
45
- this.list = html `<ul style="margin: 0;${styleMap(listStyle)}">
46
- ${virtualItems.map((virtualItem) => html `<li role="listitem" key=${virtualItem.key} data-index=${virtualItem.index} ref=${ref(measureElement)}>
47
- ${this.listItemTexts[virtualItem.index]}
48
- </li>`)}
49
- </ul>`;
50
- }
51
- }
52
- render() {
53
- return html `
54
- <div style="height: 500px; width: 500px;">
55
- <mdc-virtualizedlist
56
- @scroll=${this.onscroll}
57
- .virtualizerProps=${this.virtualizerProps}
58
- .setlistdata=${this.setListData}
59
- >${this.list}</mdc-virtualizedlist
60
- >
61
- </div>
62
- `;
63
- }
64
- }
65
- VirtualizedWrapper.styles = Component.styles;
66
- __decorate([
67
- property({ type: Function, attribute: 'onscroll' }),
68
- __metadata("design:type", Object)
69
- ], VirtualizedWrapper.prototype, "onscroll", void 0);
70
- __decorate([
71
- property({ type: Object, attribute: 'virtualizerprops' }),
72
- __metadata("design:type", Object)
73
- ], VirtualizedWrapper.prototype, "virtualizerProps", void 0);
74
- __decorate([
75
- state(),
76
- __metadata("design:type", Object)
77
- ], VirtualizedWrapper.prototype, "list", void 0);
78
- __decorate([
79
- state(),
80
- __metadata("design:type", Object)
81
- ], VirtualizedWrapper.prototype, "listItemTexts", void 0);
82
- VirtualizedWrapper.register('mdc-virtualizedwrapper');