@nanoporetech-digital/components 4.10.0 → 5.1.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/CHANGELOG.md +46 -0
- package/dist/cjs/{form-control-2e900f54.js → form-control-443e90bf.js} +2 -3
- package/dist/cjs/form-control-443e90bf.js.map +1 -0
- package/dist/cjs/index-71f899a7.js +6 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +2 -2
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-grid-item.cjs.entry.js +29 -0
- package/dist/cjs/nano-grid-item.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-grid_2.cjs.entry.js +443 -0
- package/dist/cjs/nano-grid_2.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-hero.cjs.entry.js +4 -10
- package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon-button_2.cjs.entry.js +2 -2
- package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-input.cjs.entry.js +2 -2
- package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-range.cjs.entry.js +1 -1
- package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sortable.cjs.entry.js +1 -0
- package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-ff33dc43.js → nano-table-5587101f.js} +37 -30
- package/dist/cjs/nano-table-5587101f.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-0a6bc962.js → table.worker-abba820e.js} +2 -2
- package/dist/cjs/table.worker-abba820e.js.map +1 -0
- package/dist/collection/components/dropdown/dropdown.css +2 -1
- package/dist/collection/components/form-control/form-control.js +1 -2
- package/dist/collection/components/form-control/form-control.js.map +1 -1
- package/dist/collection/components/grid/grid-item.js +11 -136
- package/dist/collection/components/grid/grid-item.js.map +1 -1
- package/dist/collection/components/grid/grid.css +9 -242
- package/dist/collection/components/grid/grid.js +255 -240
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/hero/hero.css +42 -89
- package/dist/collection/components/hero/hero.js +4 -11
- package/dist/collection/components/hero/hero.js.map +1 -1
- package/dist/collection/components/icon-button/icon-button.css +12 -0
- package/dist/collection/components/icon-button/icon-button.js +1 -1
- package/dist/collection/components/icon-button/icon-button.js.map +1 -1
- package/dist/collection/components/input/input.css +8 -9
- package/dist/collection/components/range/range.css +0 -3
- package/dist/collection/components/select/select.css +8 -9
- package/dist/collection/components/sortable/sortable.js +2 -1
- package/dist/collection/components/sortable/sortable.js.map +1 -1
- package/dist/collection/components/table/table.css +6 -0
- package/dist/collection/components/table/table.js +25 -18
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/table/table.row.js +7 -7
- package/dist/collection/components/table/table.row.js.map +1 -1
- package/dist/collection/utils/constructible-style.js +129 -0
- package/dist/collection/utils/constructible-style.js.map +1 -0
- package/dist/components/dropdown.js +1 -1
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/form-control.js +1 -2
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/grid.js +275 -183
- package/dist/components/grid.js.map +1 -1
- package/dist/components/icon-button.js +2 -2
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/nano-grid-item.js +33 -1
- package/dist/components/nano-grid-item.js.map +1 -1
- package/dist/components/nano-hero.js +6 -19
- package/dist/components/nano-hero.js.map +1 -1
- package/dist/components/nano-range.js +1 -1
- package/dist/components/nano-range.js.map +1 -1
- package/dist/components/nano-sortable.js +1 -0
- package/dist/components/nano-sortable.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/table.js +36 -29
- package/dist/components/table.js.map +1 -1
- package/dist/esm/{form-control-269ba84f.js → form-control-e8739b2e.js} +2 -3
- package/dist/esm/form-control-e8739b2e.js.map +1 -0
- package/dist/esm/index-dad5627b.js +6 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-dropdown.entry.js +1 -1
- package/dist/esm/nano-dropdown.entry.js.map +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js +2 -2
- package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/esm/nano-grid-item.entry.js +25 -0
- package/dist/esm/nano-grid-item.entry.js.map +1 -0
- package/dist/esm/nano-grid_2.entry.js +438 -0
- package/dist/esm/nano-grid_2.entry.js.map +1 -0
- package/dist/esm/nano-hero.entry.js +4 -10
- package/dist/esm/nano-hero.entry.js.map +1 -1
- package/dist/esm/nano-icon-button_2.entry.js +2 -2
- package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
- package/dist/esm/nano-input.entry.js +2 -2
- package/dist/esm/nano-input.entry.js.map +1 -1
- package/dist/esm/nano-range.entry.js +1 -1
- package/dist/esm/nano-range.entry.js.map +1 -1
- package/dist/esm/nano-sortable.entry.js +1 -0
- package/dist/esm/nano-sortable.entry.js.map +1 -1
- package/dist/esm/{nano-table-ec980076.js → nano-table-fb6b3bcb.js} +37 -30
- package/dist/esm/nano-table-fb6b3bcb.js.map +1 -0
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-b53db58e.js → table.worker-43365547.js} +2 -2
- package/dist/esm/table.worker-43365547.js.map +1 -0
- package/dist/nano-components/nano-components.css +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/p-17b099cc.entry.js +5 -0
- package/dist/nano-components/p-17b099cc.entry.js.map +1 -0
- package/dist/nano-components/p-553acf24.entry.js +5 -0
- package/dist/nano-components/{p-58b53239.entry.js.map → p-553acf24.entry.js.map} +1 -1
- package/dist/nano-components/p-6975f110.entry.js +5 -0
- package/dist/nano-components/p-6975f110.entry.js.map +1 -0
- package/dist/nano-components/p-71057181.js +5 -0
- package/dist/nano-components/p-71057181.js.map +1 -0
- package/dist/nano-components/{p-f591400b.entry.js → p-913cf45f.entry.js} +2 -2
- package/dist/nano-components/p-99914796.js +5 -0
- package/dist/nano-components/p-99914796.js.map +1 -0
- package/dist/nano-components/p-9b5429e1.entry.js +5 -0
- package/dist/nano-components/p-9b5429e1.entry.js.map +1 -0
- package/dist/nano-components/p-ad6209ec.entry.js +5 -0
- package/dist/nano-components/p-ad6209ec.entry.js.map +1 -0
- package/dist/nano-components/p-bdef618c.entry.js +5 -0
- package/dist/nano-components/p-bdef618c.entry.js.map +1 -0
- package/dist/nano-components/{p-241baff8.entry.js → p-d79c6862.entry.js} +2 -2
- package/dist/nano-components/p-d79c6862.entry.js.map +1 -0
- package/dist/nano-components/{p-806bcd46.js → p-daa6f834.js} +2 -2
- package/dist/nano-components/p-deb0799c.entry.js +5 -0
- package/dist/nano-components/{p-6a3a29c6.entry.js.map → p-deb0799c.entry.js.map} +1 -1
- package/dist/nano-components/p-ebb98a9e.entry.js +5 -0
- package/dist/nano-components/p-ebb98a9e.entry.js.map +1 -0
- package/dist/types/components/grid/grid-item.d.ts +3 -11
- package/dist/types/components/grid/grid.d.ts +44 -68
- package/dist/types/components/hero/hero.d.ts +1 -3
- package/dist/types/components/table/table.d.ts +5 -0
- package/dist/types/components.d.ts +85 -61
- package/dist/types/utils/constructible-style.d.ts +31 -0
- package/docs-json.json +152 -88
- package/docs-vscode.json +28 -21
- package/hydrate/index.js +348 -307
- package/package.json +2 -2
- package/dist/cjs/form-control-2e900f54.js.map +0 -1
- package/dist/cjs/nano-grid_3.cjs.entry.js +0 -431
- package/dist/cjs/nano-grid_3.cjs.entry.js.map +0 -1
- package/dist/cjs/nano-table-ff33dc43.js.map +0 -1
- package/dist/cjs/table.worker-0a6bc962.js.map +0 -1
- package/dist/collection/components/grid/grid-item.css +0 -15
- package/dist/components/grid-item.js +0 -107
- package/dist/components/grid-item.js.map +0 -1
- package/dist/esm/form-control-269ba84f.js.map +0 -1
- package/dist/esm/nano-grid_3.entry.js +0 -425
- package/dist/esm/nano-grid_3.entry.js.map +0 -1
- package/dist/esm/nano-table-ec980076.js.map +0 -1
- package/dist/esm/table.worker-b53db58e.js.map +0 -1
- package/dist/nano-components/p-064af7d0.js +0 -5
- package/dist/nano-components/p-064af7d0.js.map +0 -1
- package/dist/nano-components/p-107d4549.entry.js +0 -5
- package/dist/nano-components/p-107d4549.entry.js.map +0 -1
- package/dist/nano-components/p-239d343a.entry.js +0 -5
- package/dist/nano-components/p-239d343a.entry.js.map +0 -1
- package/dist/nano-components/p-241baff8.entry.js.map +0 -1
- package/dist/nano-components/p-58b53239.entry.js +0 -5
- package/dist/nano-components/p-5ac74848.js +0 -5
- package/dist/nano-components/p-5ac74848.js.map +0 -1
- package/dist/nano-components/p-6a3a29c6.entry.js +0 -5
- package/dist/nano-components/p-87bc66b5.entry.js +0 -5
- package/dist/nano-components/p-87bc66b5.entry.js.map +0 -1
- package/dist/nano-components/p-d3de231c.entry.js +0 -5
- package/dist/nano-components/p-d3de231c.entry.js.map +0 -1
- package/dist/nano-components/p-d792f692.entry.js +0 -5
- package/dist/nano-components/p-d792f692.entry.js.map +0 -1
- /package/dist/nano-components/{p-806bcd46.js.map → p-913cf45f.entry.js.map} +0 -0
- /package/dist/nano-components/{p-f591400b.entry.js.map → p-daa6f834.js.map} +0 -0
@@ -1,24 +1,95 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
5
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
6
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
7
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
8
|
+
else
|
9
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
10
|
+
if (d = decorators[i])
|
11
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13
|
+
};
|
14
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
16
|
+
return Reflect.metadata(k, v);
|
17
|
+
};
|
18
|
+
import { h, Host } from '@stencil/core';
|
19
|
+
import { ConstructibleStyle } from '../../utils/constructible-style';
|
7
20
|
/**
|
8
|
-
* A context-aware CSS grid implementation.
|
9
|
-
*
|
21
|
+
* A lightweight, context-aware CSS grid implementation.
|
22
|
+
*
|
23
|
+
* - Define multiple grids templates at different breakpoints
|
24
|
+
* - Uses `@container` queries to select the correct grid depending on the current dimensions
|
25
|
+
* - Use `grid-states="..."` on direct descendants for `column` / `row` - `start` / `end`
|
26
|
+
* - SSR optimised
|
27
|
+
|
28
|
+
* @part grid - the main grid element.
|
29
|
+
* Use this to set css such as `justify-items|content` / `align-items|content` / `place-content`
|
30
|
+
* @part helper - a replica grid showed when `show-helper` is true
|
31
|
+
*
|
32
|
+
* @slot - default slot. Use this to place grid items. Use `grid-states="..."` attribute to opt-out of auto / sequential placement.
|
10
33
|
*/
|
11
34
|
export class Grid {
|
12
35
|
constructor() {
|
13
|
-
this.
|
14
|
-
this.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
36
|
+
this.grids = [];
|
37
|
+
this.styles = () => {
|
38
|
+
const css = /* css */ `
|
39
|
+
${this.grids
|
40
|
+
.map((bp) => /* css */ `
|
41
|
+
@container (min-width: ${typeof bp.breakpoint === 'number'
|
42
|
+
? bp.breakpoint + 1 + 'px'
|
43
|
+
: bp.breakpoint}) {
|
44
|
+
.grid {
|
45
|
+
--current-grid-size: "grid size: ${bp.name}";
|
46
|
+
${bp.template
|
47
|
+
? `grid-template: ${bp.template};`
|
48
|
+
: `grid-template-columns: repeat(${bp.cols}, minmax(calc((100% / ${bp.cols}) - var(--grid-col-gap)), 1fr));`}
|
49
|
+
}
|
50
|
+
${[...Array(bp.cols)]
|
51
|
+
.map((_, i) => {
|
52
|
+
const gItm = i + 1;
|
53
|
+
return /* css */ `
|
54
|
+
.grid > [grid-states~="${bp.name}-col-start-${gItm}"],
|
55
|
+
::slotted([grid-states~="${bp.name}-col-start-${gItm}"]) {
|
56
|
+
grid-column-start: ${gItm} !important;
|
57
|
+
}
|
58
|
+
.grid > [grid-states~="${bp.name}-col-span-${gItm}"],
|
59
|
+
::slotted([grid-states~="${bp.name}-col-span-${gItm}"]) {
|
60
|
+
grid-column-end: span ${gItm} !important;
|
61
|
+
}
|
62
|
+
`;
|
63
|
+
})
|
64
|
+
.join('')}
|
65
|
+
${[...Array(24)]
|
66
|
+
.map((_, i) => {
|
67
|
+
const gItm = i + 1;
|
68
|
+
return /* css */ `
|
69
|
+
.grid > [grid-states~="${bp.name}-row-start-${gItm}"],
|
70
|
+
::slotted([grid-states~="${bp.name}-row-start-${gItm}"]) {
|
71
|
+
grid-row-start: ${gItm} !important;
|
72
|
+
}
|
73
|
+
.grid > [grid-states~="${bp.name}-row-span-${gItm}"],
|
74
|
+
::slotted([grid-states~="${bp.name}-row-span-${gItm}"]) {
|
75
|
+
grid-row-end: span ${gItm} !important;
|
76
|
+
}
|
77
|
+
`;
|
78
|
+
})
|
79
|
+
.join('')}
|
80
|
+
${this.showHelper &&
|
81
|
+
/* css */ `
|
82
|
+
.grid--helper :nth-child(-n+${bp.cols}) {
|
83
|
+
display: block !important;
|
84
|
+
}
|
85
|
+
`}
|
86
|
+
}
|
87
|
+
`)
|
88
|
+
.join('')}
|
89
|
+
`;
|
90
|
+
return css;
|
91
|
+
};
|
92
|
+
this.cacheKey = undefined;
|
22
93
|
this.sSize = 300;
|
23
94
|
this.mSize = 550;
|
24
95
|
this.lSize = 800;
|
@@ -28,156 +99,62 @@ export class Grid {
|
|
28
99
|
this.lCols = undefined;
|
29
100
|
this.xlCols = undefined;
|
30
101
|
this.xxlCols = undefined;
|
102
|
+
this.sTpl = undefined;
|
103
|
+
this.mTpl = undefined;
|
104
|
+
this.lTpl = undefined;
|
105
|
+
this.xlTpl = undefined;
|
106
|
+
this.xxlTpl = undefined;
|
31
107
|
this.showHelper = false;
|
32
|
-
this.contentPanel = false;
|
33
|
-
this.fullHeight = false;
|
34
|
-
this.stateChange = debounce(this.stateChange.bind(this), 100);
|
35
108
|
}
|
36
|
-
|
37
|
-
this.
|
38
|
-
}
|
39
|
-
applySizeClasses() {
|
40
|
-
const size = this.currentWidth;
|
41
|
-
this.isSmall = false;
|
42
|
-
this.isMedium = false;
|
43
|
-
this.isLarge = false;
|
44
|
-
this.isXL = false;
|
45
|
-
this.isXXL = false;
|
46
|
-
this.generalClasses = [];
|
47
|
-
this.gridClass = null;
|
48
|
-
this.isSizes = [null];
|
49
|
-
this.isSmall = true;
|
50
|
-
this.generalClasses.push('is-small');
|
109
|
+
constructSizeArray() {
|
110
|
+
this.grids = [];
|
51
111
|
if (this.sCols)
|
52
|
-
this.
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
if (this.mCols)
|
58
|
-
this.gridClass = `nano-grid-${this.mCols}`;
|
59
|
-
this.isSizes.push({ size: 'm', active: true });
|
60
|
-
}
|
61
|
-
if (size > this.mSize) {
|
62
|
-
this.isLarge = true;
|
63
|
-
this.generalClasses.push('is-large');
|
64
|
-
if (this.lCols)
|
65
|
-
this.gridClass = `nano-grid-${this.lCols}`;
|
66
|
-
this.isSizes.push({ size: 'l', active: true });
|
67
|
-
}
|
68
|
-
if (size > this.lSize) {
|
69
|
-
this.isXL = true;
|
70
|
-
this.generalClasses.push('is-xl');
|
71
|
-
if (this.xlCols)
|
72
|
-
this.gridClass = `nano-grid-${this.xlCols}`;
|
73
|
-
this.isSizes.push({ size: 'xl', active: true });
|
74
|
-
}
|
75
|
-
if (size > this.xlSize) {
|
76
|
-
this.isXXL = true;
|
77
|
-
this.generalClasses.push('is-xxl');
|
78
|
-
if (this.xxlCols)
|
79
|
-
this.gridClass = `nano-grid-${this.xxlCols}`;
|
80
|
-
this.isSizes.push({ size: 'xxl', active: true });
|
81
|
-
}
|
82
|
-
this.el.style.setProperty('--current-grid-size', `'grid size: ${this.isSizes.slice().pop().size}'`);
|
83
|
-
this.applyChildrenClasses();
|
84
|
-
setTimeout(() => (this.ready = true), 0);
|
85
|
-
}
|
86
|
-
stateChange() {
|
87
|
-
this.nanoBpChange.emit(this.generalClasses);
|
88
|
-
}
|
89
|
-
applyChildrenClasses() {
|
90
|
-
const gridItems = this.el.querySelectorAll('nano-grid-item');
|
91
|
-
if (gridItems.length) {
|
92
|
-
gridItems.forEach((gridItem) => {
|
93
|
-
gridItem.changeBP(this.isSizes);
|
112
|
+
this.grids.push({
|
113
|
+
cols: this.sCols,
|
114
|
+
breakpoint: 0,
|
115
|
+
name: 's',
|
116
|
+
template: this.sTpl,
|
94
117
|
});
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
// loop through all grid items with states.
|
109
|
-
[].map.call(ctx.children, (gItem) => {
|
110
|
-
if (!gItem.hasAttribute('grid-states'))
|
111
|
-
return;
|
112
|
-
// gridItems.forEach(gItem => {
|
113
|
-
// clear all previous grid state classnames
|
114
|
-
classes = gItem.className
|
115
|
-
.split(' ')
|
116
|
-
.filter((c) => !c.startsWith('nano-grid-'));
|
117
|
-
gItem.className = classes.join(' ').trim();
|
118
|
-
// get all potential states this element can have
|
119
|
-
const itemStates = gItem.getAttribute('grid-states').split(' ');
|
120
|
-
// loop through all potential state options: col & row span & start
|
121
|
-
STATEOPTS.forEach((stateOpt) => {
|
122
|
-
// reset found flag
|
123
|
-
found = false;
|
124
|
-
// loop through all the current valid breakpoints / sizes backwards because
|
125
|
-
// we only care about the item's state at the largest current breakpoint.
|
126
|
-
this.isSizes
|
127
|
-
.slice()
|
128
|
-
.reverse()
|
129
|
-
.forEach(function (size) {
|
130
|
-
if (found || !size)
|
131
|
-
return;
|
132
|
-
found = itemStates.find((state) => state.indexOf(`${size.size}-${stateOpt}`) === 0);
|
133
|
-
// found a state at this current size. apply class.
|
134
|
-
if (found) {
|
135
|
-
// clear previous grid state classname
|
136
|
-
classes = gItem.className
|
137
|
-
.split(' ')
|
138
|
-
.filter((c) => !c.includes('nano-grid-${stateOpt}'));
|
139
|
-
gItem.className = classes.join(' ').trim();
|
140
|
-
stateArr = found.split('-');
|
141
|
-
// remove the size of the state
|
142
|
-
stateArr.shift();
|
143
|
-
itemState = stateArr.join('-');
|
144
|
-
// add new class
|
145
|
-
gItem.classList.add(`nano-grid-${itemState}`);
|
146
|
-
}
|
147
|
-
});
|
118
|
+
if (this.mCols)
|
119
|
+
this.grids.push({
|
120
|
+
cols: this.mCols,
|
121
|
+
breakpoint: this.sSize,
|
122
|
+
name: 'm',
|
123
|
+
template: this.mTpl,
|
124
|
+
});
|
125
|
+
if (this.lSize)
|
126
|
+
this.grids.push({
|
127
|
+
cols: this.lCols,
|
128
|
+
breakpoint: this.mSize,
|
129
|
+
name: 'l',
|
130
|
+
template: this.lTpl,
|
148
131
|
});
|
149
|
-
|
132
|
+
if (this.xlCols)
|
133
|
+
this.grids.push({
|
134
|
+
cols: this.xlCols,
|
135
|
+
breakpoint: this.lSize,
|
136
|
+
name: 'xl',
|
137
|
+
template: this.xlTpl,
|
138
|
+
});
|
139
|
+
if (this.xxlCols)
|
140
|
+
this.grids.push({
|
141
|
+
cols: this.xxlCols,
|
142
|
+
breakpoint: this.xlSize,
|
143
|
+
name: 'xxl',
|
144
|
+
template: this.xxlTpl,
|
145
|
+
});
|
146
|
+
this.cacheKey =
|
147
|
+
this.grids
|
148
|
+
.map((bp) => `${bp.cols}-${bp.breakpoint}-${bp.template || ''}`)
|
149
|
+
.join('') +
|
150
|
+
'-helper-' +
|
151
|
+
this.showHelper;
|
150
152
|
}
|
151
153
|
componentWillLoad() {
|
152
|
-
|
153
|
-
[].map.call(ctx.children, (ele) => ele.classList.add('nano-griditem'));
|
154
|
-
}
|
155
|
-
componentDidLoad() {
|
156
|
-
if (!window['ResizeObserver'])
|
157
|
-
return;
|
158
|
-
this.ro = new ResizeObserver((entries) => {
|
159
|
-
for (const entry of entries) {
|
160
|
-
if (!entry.contentRect.width)
|
161
|
-
return;
|
162
|
-
this.currentWidth = entry.contentRect.width;
|
163
|
-
this.applySizeClasses();
|
164
|
-
}
|
165
|
-
});
|
166
|
-
this.ro.observe(this.el);
|
167
|
-
}
|
168
|
-
disconnectedCallback() {
|
169
|
-
if (this.ro)
|
170
|
-
this.ro.disconnect();
|
154
|
+
this.constructSizeArray();
|
171
155
|
}
|
172
156
|
render() {
|
173
|
-
return (h(Host, { class: {
|
174
|
-
[this.generalClasses.join(' ')]: true,
|
175
|
-
'has-grid': !!this.gridClass,
|
176
|
-
ready: this.ready,
|
177
|
-
[this.gridClass]: true,
|
178
|
-
} }, h("div", { class: {
|
179
|
-
grid: true,
|
180
|
-
} }, h("slot", null))));
|
157
|
+
return (h(Host, null, h("div", { part: "grid", class: "grid" }, h("slot", null)), this.showHelper && (h("div", { class: "grid grid--helper", part: "helper" }, [...Array(24)].map(() => (h("div", { class: "grid__helper-item" })))))));
|
181
158
|
}
|
182
159
|
static get is() { return "nano-grid"; }
|
183
160
|
static get encapsulation() { return "shadow"; }
|
@@ -194,18 +171,18 @@ export class Grid {
|
|
194
171
|
static get properties() {
|
195
172
|
return {
|
196
173
|
"sSize": {
|
197
|
-
"type": "
|
174
|
+
"type": "any",
|
198
175
|
"mutable": false,
|
199
176
|
"complexType": {
|
200
|
-
"original": "number",
|
201
|
-
"resolved": "number",
|
177
|
+
"original": "number | string",
|
178
|
+
"resolved": "number | string",
|
202
179
|
"references": {}
|
203
180
|
},
|
204
181
|
"required": false,
|
205
182
|
"optional": false,
|
206
183
|
"docs": {
|
207
184
|
"tags": [],
|
208
|
-
"text": "the component's small breakpoint. Note - all breakpoints are based on component width, not screen width."
|
185
|
+
"text": "the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.\nWill default to `px` if no unit supplied e.g. `20rem`"
|
209
186
|
},
|
210
187
|
"getter": false,
|
211
188
|
"setter": false,
|
@@ -214,18 +191,18 @@ export class Grid {
|
|
214
191
|
"defaultValue": "300"
|
215
192
|
},
|
216
193
|
"mSize": {
|
217
|
-
"type": "
|
194
|
+
"type": "any",
|
218
195
|
"mutable": false,
|
219
196
|
"complexType": {
|
220
|
-
"original": "number",
|
221
|
-
"resolved": "number",
|
197
|
+
"original": "number | string",
|
198
|
+
"resolved": "number | string",
|
222
199
|
"references": {}
|
223
200
|
},
|
224
201
|
"required": false,
|
225
202
|
"optional": false,
|
226
203
|
"docs": {
|
227
204
|
"tags": [],
|
228
|
-
"text": "the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width."
|
205
|
+
"text": "the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.\nWill default to `px` if no unit supplied e.g. `20rem`"
|
229
206
|
},
|
230
207
|
"getter": false,
|
231
208
|
"setter": false,
|
@@ -234,18 +211,18 @@ export class Grid {
|
|
234
211
|
"defaultValue": "550"
|
235
212
|
},
|
236
213
|
"lSize": {
|
237
|
-
"type": "
|
214
|
+
"type": "any",
|
238
215
|
"mutable": false,
|
239
216
|
"complexType": {
|
240
|
-
"original": "number",
|
241
|
-
"resolved": "number",
|
217
|
+
"original": "number | string",
|
218
|
+
"resolved": "number | string",
|
242
219
|
"references": {}
|
243
220
|
},
|
244
221
|
"required": false,
|
245
222
|
"optional": false,
|
246
223
|
"docs": {
|
247
224
|
"tags": [],
|
248
|
-
"text": "the component's large breakpoint. Note - all breakpoints are based on component width, not screen width."
|
225
|
+
"text": "the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.\nWill default to `px` if no unit supplied e.g. `20rem`"
|
249
226
|
},
|
250
227
|
"getter": false,
|
251
228
|
"setter": false,
|
@@ -254,18 +231,18 @@ export class Grid {
|
|
254
231
|
"defaultValue": "800"
|
255
232
|
},
|
256
233
|
"xlSize": {
|
257
|
-
"type": "
|
234
|
+
"type": "any",
|
258
235
|
"mutable": false,
|
259
236
|
"complexType": {
|
260
|
-
"original": "number",
|
261
|
-
"resolved": "number",
|
237
|
+
"original": "number | string",
|
238
|
+
"resolved": "number | string",
|
262
239
|
"references": {}
|
263
240
|
},
|
264
241
|
"required": false,
|
265
242
|
"optional": false,
|
266
243
|
"docs": {
|
267
244
|
"tags": [],
|
268
|
-
"text": "the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width."
|
245
|
+
"text": "the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.\nWill default to `px` if no unit supplied e.g. `20rem`"
|
269
246
|
},
|
270
247
|
"getter": false,
|
271
248
|
"setter": false,
|
@@ -368,47 +345,102 @@ export class Grid {
|
|
368
345
|
"attribute": "xxl-cols",
|
369
346
|
"reflect": false
|
370
347
|
},
|
371
|
-
"
|
372
|
-
"type": "
|
348
|
+
"sTpl": {
|
349
|
+
"type": "string",
|
373
350
|
"mutable": false,
|
374
351
|
"complexType": {
|
375
|
-
"original": "
|
376
|
-
"resolved": "
|
352
|
+
"original": "string",
|
353
|
+
"resolved": "string",
|
377
354
|
"references": {}
|
378
355
|
},
|
379
356
|
"required": false,
|
380
|
-
"optional":
|
357
|
+
"optional": true,
|
381
358
|
"docs": {
|
382
359
|
"tags": [],
|
383
|
-
"text": "
|
360
|
+
"text": "Optional small `grid-template`. *Note* - you must set `sCols` for this to take affect"
|
384
361
|
},
|
385
362
|
"getter": false,
|
386
363
|
"setter": false,
|
387
|
-
"attribute": "
|
388
|
-
"reflect":
|
389
|
-
"defaultValue": "false"
|
364
|
+
"attribute": "s-tpl",
|
365
|
+
"reflect": false
|
390
366
|
},
|
391
|
-
"
|
392
|
-
"type": "
|
367
|
+
"mTpl": {
|
368
|
+
"type": "string",
|
393
369
|
"mutable": false,
|
394
370
|
"complexType": {
|
395
|
-
"original": "
|
396
|
-
"resolved": "
|
371
|
+
"original": "string",
|
372
|
+
"resolved": "string",
|
397
373
|
"references": {}
|
398
374
|
},
|
399
375
|
"required": false,
|
400
|
-
"optional":
|
376
|
+
"optional": true,
|
401
377
|
"docs": {
|
402
378
|
"tags": [],
|
403
|
-
"text": "
|
379
|
+
"text": "Optional medium `grid-template`. *Note* - you must set `mCols` for this to take affect"
|
404
380
|
},
|
405
381
|
"getter": false,
|
406
382
|
"setter": false,
|
407
|
-
"attribute": "
|
408
|
-
"reflect":
|
409
|
-
"defaultValue": "false"
|
383
|
+
"attribute": "m-tpl",
|
384
|
+
"reflect": false
|
410
385
|
},
|
411
|
-
"
|
386
|
+
"lTpl": {
|
387
|
+
"type": "string",
|
388
|
+
"mutable": false,
|
389
|
+
"complexType": {
|
390
|
+
"original": "string",
|
391
|
+
"resolved": "string",
|
392
|
+
"references": {}
|
393
|
+
},
|
394
|
+
"required": false,
|
395
|
+
"optional": true,
|
396
|
+
"docs": {
|
397
|
+
"tags": [],
|
398
|
+
"text": "Optional large `grid-template`. *Note* - you must set `lCols` for this to take affect"
|
399
|
+
},
|
400
|
+
"getter": false,
|
401
|
+
"setter": false,
|
402
|
+
"attribute": "l-tpl",
|
403
|
+
"reflect": false
|
404
|
+
},
|
405
|
+
"xlTpl": {
|
406
|
+
"type": "string",
|
407
|
+
"mutable": false,
|
408
|
+
"complexType": {
|
409
|
+
"original": "string",
|
410
|
+
"resolved": "string",
|
411
|
+
"references": {}
|
412
|
+
},
|
413
|
+
"required": false,
|
414
|
+
"optional": true,
|
415
|
+
"docs": {
|
416
|
+
"tags": [],
|
417
|
+
"text": "Optional xl `grid-template`. *Note* - you must set `xlCols` for this to take affect"
|
418
|
+
},
|
419
|
+
"getter": false,
|
420
|
+
"setter": false,
|
421
|
+
"attribute": "xl-tpl",
|
422
|
+
"reflect": false
|
423
|
+
},
|
424
|
+
"xxlTpl": {
|
425
|
+
"type": "string",
|
426
|
+
"mutable": false,
|
427
|
+
"complexType": {
|
428
|
+
"original": "string",
|
429
|
+
"resolved": "string",
|
430
|
+
"references": {}
|
431
|
+
},
|
432
|
+
"required": false,
|
433
|
+
"optional": true,
|
434
|
+
"docs": {
|
435
|
+
"tags": [],
|
436
|
+
"text": "Optional xxl `grid-template`. *Note* - you must set `xxlCols` for this to take affect"
|
437
|
+
},
|
438
|
+
"getter": false,
|
439
|
+
"setter": false,
|
440
|
+
"attribute": "xxl-tpl",
|
441
|
+
"reflect": false
|
442
|
+
},
|
443
|
+
"showHelper": {
|
412
444
|
"type": "boolean",
|
413
445
|
"mutable": false,
|
414
446
|
"complexType": {
|
@@ -420,11 +452,11 @@ export class Grid {
|
|
420
452
|
"optional": false,
|
421
453
|
"docs": {
|
422
454
|
"tags": [],
|
423
|
-
"text": "
|
455
|
+
"text": "shows a grid helper to visualise where columns are"
|
424
456
|
},
|
425
457
|
"getter": false,
|
426
458
|
"setter": false,
|
427
|
-
"attribute": "
|
459
|
+
"attribute": "show-helper",
|
428
460
|
"reflect": true,
|
429
461
|
"defaultValue": "false"
|
430
462
|
}
|
@@ -432,77 +464,60 @@ export class Grid {
|
|
432
464
|
}
|
433
465
|
static get states() {
|
434
466
|
return {
|
435
|
-
"
|
436
|
-
"isSmall": {},
|
437
|
-
"isMedium": {},
|
438
|
-
"isLarge": {},
|
439
|
-
"isXL": {},
|
440
|
-
"isXXL": {}
|
467
|
+
"cacheKey": {}
|
441
468
|
};
|
442
469
|
}
|
443
|
-
static get events() {
|
444
|
-
return [{
|
445
|
-
"method": "nanoBpChange",
|
446
|
-
"name": "nanoBpChange",
|
447
|
-
"bubbles": true,
|
448
|
-
"cancelable": true,
|
449
|
-
"composed": true,
|
450
|
-
"docs": {
|
451
|
-
"tags": [],
|
452
|
-
"text": "Emitted when the `nano-grid` changes breakpoint"
|
453
|
-
},
|
454
|
-
"complexType": {
|
455
|
-
"original": "string[]",
|
456
|
-
"resolved": "string[]",
|
457
|
-
"references": {}
|
458
|
-
}
|
459
|
-
}];
|
460
|
-
}
|
461
|
-
static get elementRef() { return "el"; }
|
462
470
|
static get watchers() {
|
463
471
|
return [{
|
472
|
+
"propName": "sTpl",
|
473
|
+
"methodName": "constructSizeArray"
|
474
|
+
}, {
|
475
|
+
"propName": "mTpl",
|
476
|
+
"methodName": "constructSizeArray"
|
477
|
+
}, {
|
478
|
+
"propName": "lTpl",
|
479
|
+
"methodName": "constructSizeArray"
|
480
|
+
}, {
|
481
|
+
"propName": "xlTpl",
|
482
|
+
"methodName": "constructSizeArray"
|
483
|
+
}, {
|
484
|
+
"propName": "xxlTpl",
|
485
|
+
"methodName": "constructSizeArray"
|
486
|
+
}, {
|
464
487
|
"propName": "sSize",
|
465
|
-
"methodName": "
|
488
|
+
"methodName": "constructSizeArray"
|
466
489
|
}, {
|
467
490
|
"propName": "mSize",
|
468
|
-
"methodName": "
|
491
|
+
"methodName": "constructSizeArray"
|
469
492
|
}, {
|
470
493
|
"propName": "lSize",
|
471
|
-
"methodName": "
|
494
|
+
"methodName": "constructSizeArray"
|
472
495
|
}, {
|
473
496
|
"propName": "xlSize",
|
474
|
-
"methodName": "
|
497
|
+
"methodName": "constructSizeArray"
|
475
498
|
}, {
|
476
499
|
"propName": "sCols",
|
477
|
-
"methodName": "
|
500
|
+
"methodName": "constructSizeArray"
|
478
501
|
}, {
|
479
502
|
"propName": "mCols",
|
480
|
-
"methodName": "
|
503
|
+
"methodName": "constructSizeArray"
|
481
504
|
}, {
|
482
505
|
"propName": "lCols",
|
483
|
-
"methodName": "
|
506
|
+
"methodName": "constructSizeArray"
|
484
507
|
}, {
|
485
508
|
"propName": "xlCols",
|
486
|
-
"methodName": "
|
509
|
+
"methodName": "constructSizeArray"
|
487
510
|
}, {
|
488
511
|
"propName": "xxlCols",
|
489
|
-
"methodName": "
|
490
|
-
}, {
|
491
|
-
"propName": "isSmall",
|
492
|
-
"methodName": "stateChange"
|
493
|
-
}, {
|
494
|
-
"propName": "isMedium",
|
495
|
-
"methodName": "stateChange"
|
496
|
-
}, {
|
497
|
-
"propName": "isLarge",
|
498
|
-
"methodName": "stateChange"
|
499
|
-
}, {
|
500
|
-
"propName": "isXL",
|
501
|
-
"methodName": "stateChange"
|
512
|
+
"methodName": "constructSizeArray"
|
502
513
|
}, {
|
503
|
-
"propName": "
|
504
|
-
"methodName": "
|
514
|
+
"propName": "showHelper",
|
515
|
+
"methodName": "constructSizeArray"
|
505
516
|
}];
|
506
517
|
}
|
507
518
|
}
|
519
|
+
__decorate([
|
520
|
+
ConstructibleStyle({ cacheKeyProperty: 'cacheKey' }),
|
521
|
+
__metadata("design:type", Object)
|
522
|
+
], Grid.prototype, "styles", void 0);
|
508
523
|
//# sourceMappingURL=grid.js.map
|