@nanoporetech-digital/components 4.10.0 → 5.0.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 +30 -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-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 +436 -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-11052a34.js} +37 -30
- package/dist/cjs/nano-table-11052a34.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-0a6bc962.js → table.worker-83433a8b.js} +2 -2
- package/dist/cjs/table.worker-83433a8b.js.map +1 -0
- 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 +248 -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/form-control.js +1 -2
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/grid.js +268 -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-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 +431 -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-ba637f26.js} +37 -30
- package/dist/esm/nano-table-ba637f26.js.map +1 -0
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-b53db58e.js → table.worker-1cae39c9.js} +2 -2
- package/dist/esm/table.worker-1cae39c9.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-00cf8021.entry.js +5 -0
- package/dist/nano-components/p-00cf8021.entry.js.map +1 -0
- package/dist/nano-components/{p-f591400b.entry.js → p-158c73b0.entry.js} +2 -2
- package/dist/nano-components/p-365c997a.js +5 -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-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-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/nano-components/p-fc585ea2.js +5 -0
- package/dist/nano-components/p-fc585ea2.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 +147 -88
- package/docs-vscode.json +28 -21
- package/hydrate/index.js +340 -306
- 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-806bcd46.js +0 -5
- 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-158c73b0.entry.js.map} +0 -0
- /package/dist/nano-components/{p-f591400b.entry.js.map → p-365c997a.js.map} +0 -0
@@ -1,24 +1,88 @@
|
|
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}, 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}-row-start-${gItm}"],
|
59
|
+
::slotted([grid-states~="${bp.name}-row-start-${gItm}"]) {
|
60
|
+
grid-row-start: ${gItm} !important;
|
61
|
+
}
|
62
|
+
.grid > [grid-states~="${bp.name}-col-span-${gItm}"],
|
63
|
+
::slotted([grid-states~="${bp.name}-col-span-${gItm}"]) {
|
64
|
+
grid-column-end: span ${gItm} !important;
|
65
|
+
}
|
66
|
+
.grid > [grid-states~="${bp.name}-row-span-${gItm}"],
|
67
|
+
::slotted([grid-states~="${bp.name}-row-span-${gItm}"]) {
|
68
|
+
grid-row-end: span ${gItm} !important;
|
69
|
+
}
|
70
|
+
`;
|
71
|
+
})
|
72
|
+
.join('')}
|
73
|
+
${this.showHelper &&
|
74
|
+
/* css */ `
|
75
|
+
.grid--helper :nth-child(-n+${bp.cols}) {
|
76
|
+
display: block !important;
|
77
|
+
}
|
78
|
+
`}
|
79
|
+
}
|
80
|
+
`)
|
81
|
+
.join('')}
|
82
|
+
`;
|
83
|
+
return css;
|
84
|
+
};
|
85
|
+
this.cacheKey = undefined;
|
22
86
|
this.sSize = 300;
|
23
87
|
this.mSize = 550;
|
24
88
|
this.lSize = 800;
|
@@ -28,156 +92,62 @@ export class Grid {
|
|
28
92
|
this.lCols = undefined;
|
29
93
|
this.xlCols = undefined;
|
30
94
|
this.xxlCols = undefined;
|
95
|
+
this.sTpl = undefined;
|
96
|
+
this.mTpl = undefined;
|
97
|
+
this.lTpl = undefined;
|
98
|
+
this.xlTpl = undefined;
|
99
|
+
this.xxlTpl = undefined;
|
31
100
|
this.showHelper = false;
|
32
|
-
this.contentPanel = false;
|
33
|
-
this.fullHeight = false;
|
34
|
-
this.stateChange = debounce(this.stateChange.bind(this), 100);
|
35
101
|
}
|
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');
|
102
|
+
constructSizeArray() {
|
103
|
+
this.grids = [];
|
51
104
|
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);
|
105
|
+
this.grids.push({
|
106
|
+
cols: this.sCols,
|
107
|
+
breakpoint: 0,
|
108
|
+
name: 's',
|
109
|
+
template: this.sTpl,
|
94
110
|
});
|
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
|
-
});
|
111
|
+
if (this.mCols)
|
112
|
+
this.grids.push({
|
113
|
+
cols: this.mCols,
|
114
|
+
breakpoint: this.sSize,
|
115
|
+
name: 'm',
|
116
|
+
template: this.mTpl,
|
117
|
+
});
|
118
|
+
if (this.lSize)
|
119
|
+
this.grids.push({
|
120
|
+
cols: this.lCols,
|
121
|
+
breakpoint: this.mSize,
|
122
|
+
name: 'l',
|
123
|
+
template: this.lTpl,
|
148
124
|
});
|
149
|
-
|
125
|
+
if (this.xlCols)
|
126
|
+
this.grids.push({
|
127
|
+
cols: this.xlCols,
|
128
|
+
breakpoint: this.lSize,
|
129
|
+
name: 'xl',
|
130
|
+
template: this.xlTpl,
|
131
|
+
});
|
132
|
+
if (this.xxlCols)
|
133
|
+
this.grids.push({
|
134
|
+
cols: this.xxlCols,
|
135
|
+
breakpoint: this.xlSize,
|
136
|
+
name: 'xxl',
|
137
|
+
template: this.xxlTpl,
|
138
|
+
});
|
139
|
+
this.cacheKey =
|
140
|
+
this.grids
|
141
|
+
.map((bp) => `${bp.cols}-${bp.breakpoint}-${bp.template || ''}`)
|
142
|
+
.join('') +
|
143
|
+
'-helper-' +
|
144
|
+
this.showHelper;
|
150
145
|
}
|
151
146
|
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();
|
147
|
+
this.constructSizeArray();
|
171
148
|
}
|
172
149
|
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))));
|
150
|
+
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
151
|
}
|
182
152
|
static get is() { return "nano-grid"; }
|
183
153
|
static get encapsulation() { return "shadow"; }
|
@@ -194,18 +164,18 @@ export class Grid {
|
|
194
164
|
static get properties() {
|
195
165
|
return {
|
196
166
|
"sSize": {
|
197
|
-
"type": "
|
167
|
+
"type": "any",
|
198
168
|
"mutable": false,
|
199
169
|
"complexType": {
|
200
|
-
"original": "number",
|
201
|
-
"resolved": "number",
|
170
|
+
"original": "number | string",
|
171
|
+
"resolved": "number | string",
|
202
172
|
"references": {}
|
203
173
|
},
|
204
174
|
"required": false,
|
205
175
|
"optional": false,
|
206
176
|
"docs": {
|
207
177
|
"tags": [],
|
208
|
-
"text": "the component's small breakpoint. Note - all breakpoints are based on component width, not screen width."
|
178
|
+
"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
179
|
},
|
210
180
|
"getter": false,
|
211
181
|
"setter": false,
|
@@ -214,18 +184,18 @@ export class Grid {
|
|
214
184
|
"defaultValue": "300"
|
215
185
|
},
|
216
186
|
"mSize": {
|
217
|
-
"type": "
|
187
|
+
"type": "any",
|
218
188
|
"mutable": false,
|
219
189
|
"complexType": {
|
220
|
-
"original": "number",
|
221
|
-
"resolved": "number",
|
190
|
+
"original": "number | string",
|
191
|
+
"resolved": "number | string",
|
222
192
|
"references": {}
|
223
193
|
},
|
224
194
|
"required": false,
|
225
195
|
"optional": false,
|
226
196
|
"docs": {
|
227
197
|
"tags": [],
|
228
|
-
"text": "the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width."
|
198
|
+
"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
199
|
},
|
230
200
|
"getter": false,
|
231
201
|
"setter": false,
|
@@ -234,18 +204,18 @@ export class Grid {
|
|
234
204
|
"defaultValue": "550"
|
235
205
|
},
|
236
206
|
"lSize": {
|
237
|
-
"type": "
|
207
|
+
"type": "any",
|
238
208
|
"mutable": false,
|
239
209
|
"complexType": {
|
240
|
-
"original": "number",
|
241
|
-
"resolved": "number",
|
210
|
+
"original": "number | string",
|
211
|
+
"resolved": "number | string",
|
242
212
|
"references": {}
|
243
213
|
},
|
244
214
|
"required": false,
|
245
215
|
"optional": false,
|
246
216
|
"docs": {
|
247
217
|
"tags": [],
|
248
|
-
"text": "the component's large breakpoint. Note - all breakpoints are based on component width, not screen width."
|
218
|
+
"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
219
|
},
|
250
220
|
"getter": false,
|
251
221
|
"setter": false,
|
@@ -254,18 +224,18 @@ export class Grid {
|
|
254
224
|
"defaultValue": "800"
|
255
225
|
},
|
256
226
|
"xlSize": {
|
257
|
-
"type": "
|
227
|
+
"type": "any",
|
258
228
|
"mutable": false,
|
259
229
|
"complexType": {
|
260
|
-
"original": "number",
|
261
|
-
"resolved": "number",
|
230
|
+
"original": "number | string",
|
231
|
+
"resolved": "number | string",
|
262
232
|
"references": {}
|
263
233
|
},
|
264
234
|
"required": false,
|
265
235
|
"optional": false,
|
266
236
|
"docs": {
|
267
237
|
"tags": [],
|
268
|
-
"text": "the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width."
|
238
|
+
"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
239
|
},
|
270
240
|
"getter": false,
|
271
241
|
"setter": false,
|
@@ -368,47 +338,102 @@ export class Grid {
|
|
368
338
|
"attribute": "xxl-cols",
|
369
339
|
"reflect": false
|
370
340
|
},
|
371
|
-
"
|
372
|
-
"type": "
|
341
|
+
"sTpl": {
|
342
|
+
"type": "string",
|
373
343
|
"mutable": false,
|
374
344
|
"complexType": {
|
375
|
-
"original": "
|
376
|
-
"resolved": "
|
345
|
+
"original": "string",
|
346
|
+
"resolved": "string",
|
377
347
|
"references": {}
|
378
348
|
},
|
379
349
|
"required": false,
|
380
|
-
"optional":
|
350
|
+
"optional": true,
|
381
351
|
"docs": {
|
382
352
|
"tags": [],
|
383
|
-
"text": "
|
353
|
+
"text": "Optional small `grid-template`. *Note* - you must set `sCols` for this to take affect"
|
384
354
|
},
|
385
355
|
"getter": false,
|
386
356
|
"setter": false,
|
387
|
-
"attribute": "
|
388
|
-
"reflect":
|
389
|
-
"defaultValue": "false"
|
357
|
+
"attribute": "s-tpl",
|
358
|
+
"reflect": false
|
390
359
|
},
|
391
|
-
"
|
392
|
-
"type": "
|
360
|
+
"mTpl": {
|
361
|
+
"type": "string",
|
393
362
|
"mutable": false,
|
394
363
|
"complexType": {
|
395
|
-
"original": "
|
396
|
-
"resolved": "
|
364
|
+
"original": "string",
|
365
|
+
"resolved": "string",
|
397
366
|
"references": {}
|
398
367
|
},
|
399
368
|
"required": false,
|
400
|
-
"optional":
|
369
|
+
"optional": true,
|
401
370
|
"docs": {
|
402
371
|
"tags": [],
|
403
|
-
"text": "
|
372
|
+
"text": "Optional medium `grid-template`. *Note* - you must set `mCols` for this to take affect"
|
404
373
|
},
|
405
374
|
"getter": false,
|
406
375
|
"setter": false,
|
407
|
-
"attribute": "
|
408
|
-
"reflect":
|
409
|
-
"defaultValue": "false"
|
376
|
+
"attribute": "m-tpl",
|
377
|
+
"reflect": false
|
410
378
|
},
|
411
|
-
"
|
379
|
+
"lTpl": {
|
380
|
+
"type": "string",
|
381
|
+
"mutable": false,
|
382
|
+
"complexType": {
|
383
|
+
"original": "string",
|
384
|
+
"resolved": "string",
|
385
|
+
"references": {}
|
386
|
+
},
|
387
|
+
"required": false,
|
388
|
+
"optional": true,
|
389
|
+
"docs": {
|
390
|
+
"tags": [],
|
391
|
+
"text": "Optional large `grid-template`. *Note* - you must set `lCols` for this to take affect"
|
392
|
+
},
|
393
|
+
"getter": false,
|
394
|
+
"setter": false,
|
395
|
+
"attribute": "l-tpl",
|
396
|
+
"reflect": false
|
397
|
+
},
|
398
|
+
"xlTpl": {
|
399
|
+
"type": "string",
|
400
|
+
"mutable": false,
|
401
|
+
"complexType": {
|
402
|
+
"original": "string",
|
403
|
+
"resolved": "string",
|
404
|
+
"references": {}
|
405
|
+
},
|
406
|
+
"required": false,
|
407
|
+
"optional": true,
|
408
|
+
"docs": {
|
409
|
+
"tags": [],
|
410
|
+
"text": "Optional xl `grid-template`. *Note* - you must set `xlCols` for this to take affect"
|
411
|
+
},
|
412
|
+
"getter": false,
|
413
|
+
"setter": false,
|
414
|
+
"attribute": "xl-tpl",
|
415
|
+
"reflect": false
|
416
|
+
},
|
417
|
+
"xxlTpl": {
|
418
|
+
"type": "string",
|
419
|
+
"mutable": false,
|
420
|
+
"complexType": {
|
421
|
+
"original": "string",
|
422
|
+
"resolved": "string",
|
423
|
+
"references": {}
|
424
|
+
},
|
425
|
+
"required": false,
|
426
|
+
"optional": true,
|
427
|
+
"docs": {
|
428
|
+
"tags": [],
|
429
|
+
"text": "Optional xxl `grid-template`. *Note* - you must set `xxlCols` for this to take affect"
|
430
|
+
},
|
431
|
+
"getter": false,
|
432
|
+
"setter": false,
|
433
|
+
"attribute": "xxl-tpl",
|
434
|
+
"reflect": false
|
435
|
+
},
|
436
|
+
"showHelper": {
|
412
437
|
"type": "boolean",
|
413
438
|
"mutable": false,
|
414
439
|
"complexType": {
|
@@ -420,11 +445,11 @@ export class Grid {
|
|
420
445
|
"optional": false,
|
421
446
|
"docs": {
|
422
447
|
"tags": [],
|
423
|
-
"text": "
|
448
|
+
"text": "shows a grid helper to visualise where columns are"
|
424
449
|
},
|
425
450
|
"getter": false,
|
426
451
|
"setter": false,
|
427
|
-
"attribute": "
|
452
|
+
"attribute": "show-helper",
|
428
453
|
"reflect": true,
|
429
454
|
"defaultValue": "false"
|
430
455
|
}
|
@@ -432,77 +457,60 @@ export class Grid {
|
|
432
457
|
}
|
433
458
|
static get states() {
|
434
459
|
return {
|
435
|
-
"
|
436
|
-
"isSmall": {},
|
437
|
-
"isMedium": {},
|
438
|
-
"isLarge": {},
|
439
|
-
"isXL": {},
|
440
|
-
"isXXL": {}
|
460
|
+
"cacheKey": {}
|
441
461
|
};
|
442
462
|
}
|
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
463
|
static get watchers() {
|
463
464
|
return [{
|
465
|
+
"propName": "sTpl",
|
466
|
+
"methodName": "constructSizeArray"
|
467
|
+
}, {
|
468
|
+
"propName": "mTpl",
|
469
|
+
"methodName": "constructSizeArray"
|
470
|
+
}, {
|
471
|
+
"propName": "lTpl",
|
472
|
+
"methodName": "constructSizeArray"
|
473
|
+
}, {
|
474
|
+
"propName": "xlTpl",
|
475
|
+
"methodName": "constructSizeArray"
|
476
|
+
}, {
|
477
|
+
"propName": "xxlTpl",
|
478
|
+
"methodName": "constructSizeArray"
|
479
|
+
}, {
|
464
480
|
"propName": "sSize",
|
465
|
-
"methodName": "
|
481
|
+
"methodName": "constructSizeArray"
|
466
482
|
}, {
|
467
483
|
"propName": "mSize",
|
468
|
-
"methodName": "
|
484
|
+
"methodName": "constructSizeArray"
|
469
485
|
}, {
|
470
486
|
"propName": "lSize",
|
471
|
-
"methodName": "
|
487
|
+
"methodName": "constructSizeArray"
|
472
488
|
}, {
|
473
489
|
"propName": "xlSize",
|
474
|
-
"methodName": "
|
490
|
+
"methodName": "constructSizeArray"
|
475
491
|
}, {
|
476
492
|
"propName": "sCols",
|
477
|
-
"methodName": "
|
493
|
+
"methodName": "constructSizeArray"
|
478
494
|
}, {
|
479
495
|
"propName": "mCols",
|
480
|
-
"methodName": "
|
496
|
+
"methodName": "constructSizeArray"
|
481
497
|
}, {
|
482
498
|
"propName": "lCols",
|
483
|
-
"methodName": "
|
499
|
+
"methodName": "constructSizeArray"
|
484
500
|
}, {
|
485
501
|
"propName": "xlCols",
|
486
|
-
"methodName": "
|
502
|
+
"methodName": "constructSizeArray"
|
487
503
|
}, {
|
488
504
|
"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"
|
505
|
+
"methodName": "constructSizeArray"
|
502
506
|
}, {
|
503
|
-
"propName": "
|
504
|
-
"methodName": "
|
507
|
+
"propName": "showHelper",
|
508
|
+
"methodName": "constructSizeArray"
|
505
509
|
}];
|
506
510
|
}
|
507
511
|
}
|
512
|
+
__decorate([
|
513
|
+
ConstructibleStyle({ cacheKeyProperty: 'cacheKey' }),
|
514
|
+
__metadata("design:type", Object)
|
515
|
+
], Grid.prototype, "styles", void 0);
|
508
516
|
//# sourceMappingURL=grid.js.map
|