@nanoporetech-digital/components 4.9.4 → 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 +51 -0
- package/dist/cjs/drag-777bd8dd.js +74 -0
- package/dist/cjs/drag-777bd8dd.js.map +1 -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 +10 -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 +6 -6
- 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 +40 -3
- 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 +654 -0
- package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-split-pane.cjs.entry.js +30 -45
- package/dist/cjs/nano-split-pane.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-group.cjs.entry.js +39 -43
- package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js +3 -3
- package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-54a4ba34.js → nano-table-11052a34.js} +52 -172
- 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-20ed37a5.js → table.worker-83433a8b.js} +3 -3
- package/dist/cjs/table.worker-83433a8b.js.map +1 -0
- package/dist/cjs/{table.worker-f820b411.js → table.worker-bd51e29f.js} +1 -1
- package/dist/collection/collection-manifest.json +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 +18 -4
- package/dist/collection/components/icon-button/icon-button.js +83 -4
- 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/nav-item/nav-item.js +4 -4
- package/dist/collection/components/nav-item/nav-item.js.map +1 -1
- package/dist/collection/components/range/range.css +0 -3
- package/dist/collection/components/select/select.css +8 -9
- package/dist/collection/components/sortable/sortable.css +28 -0
- package/dist/collection/components/sortable/sortable.js +1181 -0
- package/dist/collection/components/sortable/sortable.js.map +1 -0
- package/dist/collection/components/split-pane/split-pane.js +29 -27
- package/dist/collection/components/split-pane/split-pane.js.map +1 -1
- package/dist/collection/components/table/table-interface.js.map +1 -1
- package/dist/collection/components/table/table.css +18 -38
- package/dist/collection/components/table/table.header.js +3 -86
- package/dist/collection/components/table/table.header.js.map +1 -1
- package/dist/collection/components/table/table.js +27 -108
- 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/components/table/table.store.js +1 -1
- package/dist/collection/components/table/table.store.js.map +1 -1
- package/dist/collection/components/table/table.worker.js +3 -3
- package/dist/collection/components/table/table.worker.js.map +1 -1
- package/dist/collection/components/tabs/tab-group.css +9 -13
- package/dist/collection/components/tabs/tab-group.js +39 -43
- package/dist/collection/components/tabs/tab-group.js.map +1 -1
- package/dist/collection/components/tabs/tab.css +53 -14
- package/dist/collection/components/tabs/tab.js +8 -2
- package/dist/collection/components/tabs/tab.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/collection/utils/drag.js +52 -4
- package/dist/collection/utils/drag.js.map +1 -1
- package/dist/components/drag.js +72 -0
- package/dist/components/drag.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 +45 -5
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.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.d.ts +11 -0
- package/dist/components/nano-sortable.js +692 -0
- package/dist/components/nano-sortable.js.map +1 -0
- package/dist/components/nano-split-pane.js +30 -45
- package/dist/components/nano-split-pane.js.map +1 -1
- package/dist/components/nano-tab-group.js +40 -44
- package/dist/components/nano-tab-group.js.map +1 -1
- package/dist/components/nano-tab.js +3 -3
- package/dist/components/nano-tab.js.map +1 -1
- package/dist/components/nav-item.js +4 -4
- package/dist/components/nav-item.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/table.js +52 -173
- package/dist/components/table.js.map +1 -1
- package/dist/components/table.worker.js +1 -1
- package/dist/esm/drag-1723a4cc.js +72 -0
- package/dist/esm/drag-1723a4cc.js.map +1 -0
- 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 +10 -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 +6 -6
- 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 +41 -4
- 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 +650 -0
- package/dist/esm/nano-sortable.entry.js.map +1 -0
- package/dist/esm/nano-split-pane.entry.js +30 -45
- package/dist/esm/nano-split-pane.entry.js.map +1 -1
- package/dist/esm/nano-tab-group.entry.js +39 -43
- package/dist/esm/nano-tab-group.entry.js.map +1 -1
- package/dist/esm/nano-tab.entry.js +3 -3
- package/dist/esm/nano-tab.entry.js.map +1 -1
- package/dist/esm/{nano-table-929ac4d9.js → nano-table-ba637f26.js} +53 -173
- package/dist/esm/nano-table-ba637f26.js.map +1 -0
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-2425382a.js → table.worker-1cae39c9.js} +3 -3
- package/dist/esm/table.worker-1cae39c9.js.map +1 -0
- package/dist/{nano-components/p-f820b411.js → esm/table.worker-bd51e29f.js} +1 -1
- 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-906de5a2.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-553acf24.entry.js.map +1 -0
- 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-842cf127.js +5 -0
- package/dist/nano-components/p-842cf127.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-b8e76fdf.entry.js +5 -0
- package/dist/nano-components/p-b8e76fdf.entry.js.map +1 -0
- package/dist/{esm/table.worker-f820b411.js → nano-components/p-bd51e29f.js} +1 -1
- 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-d79c6862.entry.js +5 -0
- 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-f60fe933.entry.js +5 -0
- package/dist/nano-components/p-f60fe933.entry.js.map +1 -0
- package/dist/nano-components/p-f7535f45.entry.js +5 -0
- package/dist/nano-components/p-f7535f45.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/icon-button/icon-button.d.ts +14 -0
- package/dist/types/components/sortable/sortable.d.ts +204 -0
- package/dist/types/components/table/table-interface.d.ts +2 -4
- package/dist/types/components/table/table.d.ts +5 -30
- package/dist/types/components/table/table.header.d.ts +0 -3
- package/dist/types/components/tabs/tab-group.d.ts +0 -1
- package/dist/types/components/tabs/tab.d.ts +6 -0
- package/dist/types/components.d.ts +333 -89
- package/dist/types/utils/constructible-style.d.ts +31 -0
- package/dist/types/utils/drag.d.ts +21 -1
- package/docs-json.json +743 -168
- package/docs-vscode.json +102 -26
- package/hydrate/index.js +1210 -552
- 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-54a4ba34.js.map +0 -1
- package/dist/cjs/table.worker-20ed37a5.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-929ac4d9.js.map +0 -1
- package/dist/esm/table.worker-2425382a.js.map +0 -1
- package/dist/nano-components/p-068bdd89.entry.js +0 -5
- package/dist/nano-components/p-068bdd89.entry.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-4f260028.js +0 -5
- package/dist/nano-components/p-4f260028.js.map +0 -1
- package/dist/nano-components/p-5381c118.js +0 -5
- package/dist/nano-components/p-58b53239.entry.js +0 -5
- package/dist/nano-components/p-58b53239.entry.js.map +0 -1
- package/dist/nano-components/p-5ac74848.js +0 -5
- package/dist/nano-components/p-5ac74848.js.map +0 -1
- package/dist/nano-components/p-64b56ee6.entry.js +0 -5
- package/dist/nano-components/p-64b56ee6.entry.js.map +0 -1
- package/dist/nano-components/p-6a3a29c6.entry.js +0 -5
- package/dist/nano-components/p-a5a560e7.entry.js +0 -5
- package/dist/nano-components/p-a5a560e7.entry.js.map +0 -1
- package/dist/nano-components/p-a761ac89.entry.js +0 -5
- package/dist/nano-components/p-a761ac89.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-5381c118.js.map → p-158c73b0.entry.js.map} +0 -0
- /package/dist/nano-components/{p-906de5a2.entry.js.map → p-365c997a.js.map} +0 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
/** Begins listening for dragging. */
|
5
|
+
function drag(container, options) {
|
6
|
+
const initialOffsets = {
|
7
|
+
pageX: 0,
|
8
|
+
pageY: 0,
|
9
|
+
offsetX: 0,
|
10
|
+
offsetY: 0,
|
11
|
+
};
|
12
|
+
function move(pointerEvent) {
|
13
|
+
const dims = container.getBoundingClientRect();
|
14
|
+
const defaultView = container.ownerDocument.defaultView;
|
15
|
+
const offsetX = dims.left + defaultView.pageXOffset;
|
16
|
+
const offsetY = dims.top + defaultView.pageYOffset;
|
17
|
+
let x = 0;
|
18
|
+
let y = 0;
|
19
|
+
if (options.relative) {
|
20
|
+
x =
|
21
|
+
pointerEvent.pageX -
|
22
|
+
initialOffsets.pageX -
|
23
|
+
(offsetX - initialOffsets.offsetX);
|
24
|
+
y =
|
25
|
+
pointerEvent.pageY -
|
26
|
+
initialOffsets.pageY -
|
27
|
+
(offsetY - initialOffsets.offsetY);
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
x = pointerEvent.pageX - offsetX;
|
31
|
+
y = pointerEvent.pageY - offsetY;
|
32
|
+
}
|
33
|
+
if (options === null || options === void 0 ? void 0 : options.onMove) {
|
34
|
+
options.onMove(x, y);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
function stop() {
|
38
|
+
document.removeEventListener('pointermove', move);
|
39
|
+
document.removeEventListener('pointerup', stop);
|
40
|
+
if (options === null || options === void 0 ? void 0 : options.onStop) {
|
41
|
+
options.onStop();
|
42
|
+
}
|
43
|
+
}
|
44
|
+
document.addEventListener('pointermove', move, { passive: true });
|
45
|
+
document.addEventListener('pointerup', stop);
|
46
|
+
if (!!!(options === null || options === void 0 ? void 0 : options.initialEvent))
|
47
|
+
return;
|
48
|
+
let initialEvent;
|
49
|
+
if (options === null || options === void 0 ? void 0 : options.initialEvent['touches']) {
|
50
|
+
initialEvent = {
|
51
|
+
pageX: (options === null || options === void 0 ? void 0 : options.initialEvent).touches[0].pageX,
|
52
|
+
pageY: (options === null || options === void 0 ? void 0 : options.initialEvent).touches[0].pageY,
|
53
|
+
};
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
initialEvent = {
|
57
|
+
pageX: (options === null || options === void 0 ? void 0 : options.initialEvent).pageX,
|
58
|
+
pageY: (options === null || options === void 0 ? void 0 : options.initialEvent).pageY,
|
59
|
+
};
|
60
|
+
}
|
61
|
+
const defaultView = container.ownerDocument.defaultView;
|
62
|
+
const dims = container.getBoundingClientRect();
|
63
|
+
initialOffsets.pageX = initialEvent.pageX;
|
64
|
+
initialOffsets.pageY = initialEvent.pageY;
|
65
|
+
initialOffsets.offsetX = dims.left + defaultView.pageXOffset;
|
66
|
+
initialOffsets.offsetY = dims.top + defaultView.pageYOffset;
|
67
|
+
// move(initialEvent);
|
68
|
+
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AAC;EAC1C,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC;EAC7D,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,WAAW,CAAC;;AAG9D;;;;","names":[],"sources":["./src/utils/drag.ts"],"sourcesContent":["interface DragOptions {\n /** Callback that runs as dragging occurs. */\n onMove: (x: number, y: number) => void;\n /** Callback that runs when dragging stops. */\n onStop: () => void;\n /**\n * When an initial event is passed, the first drag will be triggered immediately using the coordinates therein. This\n * is useful when the drag is initiated by a mousedown/touchstart event but you want the initial \"click\" to activate\n * a drag (e.g. positioning a handle initially at the click target).\n */\n initialEvent: TouchEvent | PointerEvent | MouseEvent;\n /**\n * Used in conjunction with `options.initialEvent`\n * Subtracts the initial pointer co-ordinates from the move co-ordinates.\n * This is useful for tracking how far an element has been dragged\n */\n relative?: boolean;\n}\n\ninterface InitialOffsets {\n pageX: number;\n pageY: number;\n offsetX: number;\n offsetY: number;\n}\n\n/** Begins listening for dragging. */\nexport function drag(container: HTMLElement, options?: Partial<DragOptions>) {\n const initialOffsets: InitialOffsets = {\n pageX: 0,\n pageY: 0,\n offsetX: 0,\n offsetY: 0,\n };\n\n function move(pointerEvent: { pageX: number; pageY: number }) {\n const dims = container.getBoundingClientRect();\n const defaultView = container.ownerDocument.defaultView!;\n const offsetX = dims.left + defaultView.pageXOffset;\n const offsetY = dims.top + defaultView.pageYOffset;\n let x = 0;\n let y = 0;\n\n if (options.relative) {\n x =\n pointerEvent.pageX -\n initialOffsets.pageX -\n (offsetX - initialOffsets.offsetX);\n y =\n pointerEvent.pageY -\n initialOffsets.pageY -\n (offsetY - initialOffsets.offsetY);\n } else {\n x = pointerEvent.pageX - offsetX;\n y = pointerEvent.pageY - offsetY;\n }\n\n if (options?.onMove) {\n options.onMove(x, y);\n }\n }\n\n function stop() {\n document.removeEventListener('pointermove', move);\n document.removeEventListener('pointerup', stop);\n\n if (options?.onStop) {\n options.onStop();\n }\n }\n\n document.addEventListener('pointermove', move, { passive: true });\n document.addEventListener('pointerup', stop);\n\n if (!!!options?.initialEvent) return;\n\n let initialEvent: { pageX: number; pageY: number };\n\n if (options?.initialEvent['touches']) {\n initialEvent = {\n pageX: (options?.initialEvent as TouchEvent).touches[0].pageX,\n pageY: (options?.initialEvent as TouchEvent).touches[0].pageY,\n };\n } else {\n initialEvent = {\n pageX: (options?.initialEvent as MouseEvent).pageX,\n pageY: (options?.initialEvent as MouseEvent).pageY,\n };\n }\n\n const defaultView = container.ownerDocument.defaultView!;\n const dims = container.getBoundingClientRect();\n\n initialOffsets.pageX = initialEvent.pageX;\n initialOffsets.pageY = initialEvent.pageY;\n initialOffsets.offsetX = dims.left + defaultView.pageXOffset;\n initialOffsets.offsetY = dims.top + defaultView.pageYOffset;\n\n // move(initialEvent);\n}\n"],"version":3}
|
@@ -31,8 +31,7 @@ const renderLabel = ({ label, hasLabelSlot, controlId, labelId, floatLabel, plac
|
|
31
31
|
};
|
32
32
|
const FormControlWrap = (props, children) => {
|
33
33
|
const { rtl, floatLabel, label, moreId, helperEndId, type, hasHelperSlot, showInlineError, errorMessage, hasHelperEndSlot, } = props;
|
34
|
-
|
35
|
-
return (h(MainTag, { states: "350w has-enough-width", class: {
|
34
|
+
return (h("div", { class: {
|
36
35
|
'has-label': label !== null && !floatLabel,
|
37
36
|
'has-float-label': label !== null && floatLabel,
|
38
37
|
'has-helper-end': hasHelperEndSlot,
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"form-control.js","mappings":";;;;;AAyCA,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,EACH,aAAa,EACb,SAAS,EACT,SAAS,GACE;EACX,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY;IAAE,OAAO;EACpC,IAAI,UAAU,EAAE;IACd,QACE,aAAO,KAAK,E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AC;EACV,MAAM,YAAY,GAAG;IACnB,OAAO,CAAC,QAAQ,EAAE,CAAC;GACpB,CAAC;EAEF,QACE,WACE,KAAK,EAAC,uBAAuB,EAC7B,GAAG,EAAE,CAAC,EAAE;MACN,IAAI,GAAG;QAAE,GAAG,CAAC,EAAE,CAAC,CAAC;KAClB;IAED,YAAM,KAAK,EAAC,uBAAuB;MACjC,YAAM,IAAI,EAAC,OAAO,GAAG;MACpB,SAAS,CACL;IACN,QAAQ;IACR,YAAY,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,KACrC,cACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,2BAA2B,EACjC,QAAQ,EAAC,IAAI,EACb,YAAY,EAAE,WAAW,EACzB,WAAW,EAAE,WAAW;MAExB,iBAAW,IAAI,EAAC,aAAa,GAAa,CACnC,CACV;IACD,YAAM,KAAK,EAAC,2BAA2B,EAAC,OAAO,EAAE,YAAY;MAC3D,YAAM,IAAI,EAAC,WAAW,GAAG;MACxB,YAAY,CACR;IACP,YAAM,KAAK,EAAC,qBAAqB;MAC/B,YAAM,IAAI,EAAC,KAAK,GAAG;MAClB,OAAO,CACH,CACH,EACN;AACJ;;;;","names":[],"sources":["./src/components/form-control/form-control.tsx"],"sourcesContent":["import { FunctionalComponent, h, VNode } from '@stencil/core';\nimport type { TextFieldTypes } from '../../interface';\n\ninterface FormControlWrapProps {\n rtl: boolean;\n floatLabel: boolean;\n labelId: string;\n label: string;\n moreId: string;\n helperEndId: string;\n type?: TextFieldTypes;\n showInlineError: boolean;\n hasHelperSlot: boolean;\n errorMessage: string;\n controlId: string;\n hasLabelSlot: boolean;\n hideLabel: boolean;\n placeholder: string;\n hasValue: boolean;\n showCharCount?: boolean;\n maxlength?: number;\n charCount?: number;\n hasHelperEndSlot?: boolean;\n}\n\ninterface FormControlProps {\n clearControl: boolean;\n onClearText?: () => void;\n readonly: boolean;\n disabled: boolean;\n control: HTMLNanoInputElement | HTMLNanoSelectElement;\n ref?: (elm?: HTMLElement) => void;\n endSlot?: VNode;\n endValueSlot?: VNode;\n startSlot?: VNode;\n}\n\ninterface LabelProps extends FormControlWrapProps {\n rtl: boolean;\n}\n\nconst renderLabel = ({\n label,\n hasLabelSlot,\n controlId,\n labelId,\n floatLabel,\n placeholder,\n hideLabel,\n hasValue,\n rtl,\n showCharCount,\n maxlength,\n charCount,\n}: LabelProps) => {\n if (!label && !hasLabelSlot) return;\n if (floatLabel) {\n return (\n <label class=\"form-ctrl__float-label\" htmlFor={controlId} id={labelId}>\n {label && label}\n {!label && hasLabelSlot && <slot name=\"label\" />}\n {showCharCount && (\n <span class=\"form-ctrl__label-charcount\">\n {maxlength ? ` ${charCount}/${maxlength}` : ` ${charCount}`}\n </span>\n )}\n </label>\n );\n } else {\n return (\n <label\n class={{ 'form-ctrl__label': true, 'visually-hide': hideLabel }}\n htmlFor={controlId}\n id={labelId}\n >\n <div class=\"form-ctrl__label-wrap\">\n {placeholder && hasValue && rtl && (\n <span class=\"form-ctrl__label-placeholder\">{placeholder} / </span>\n )}\n <span class=\"form-ctrl__labeltext\">\n {label && label}\n {!label && hasLabelSlot && <slot name=\"label\" />}\n </span>\n {placeholder && hasValue && !rtl && (\n <span class=\"form-ctrl__label-placeholder\"> / {placeholder}</span>\n )}\n </div>\n {showCharCount && (\n <span class=\"form-ctrl__label-charcount\">\n {maxlength\n ? maxlength - charCount + ' left'\n : charCount + ' characters'}\n </span>\n )}\n </label>\n );\n }\n};\n\nexport const FormControlWrap: FunctionalComponent<FormControlWrapProps> = (\n props: FormControlWrapProps,\n children\n) => {\n const {\n rtl,\n floatLabel,\n label,\n moreId,\n helperEndId,\n type,\n hasHelperSlot,\n showInlineError,\n errorMessage,\n hasHelperEndSlot,\n } = props;\n\n return (\n <div\n class={{\n 'has-label': label !== null && !floatLabel,\n 'has-float-label': label !== null && floatLabel,\n 'has-helper-end': hasHelperEndSlot,\n rtl,\n 'form-ctrl': true,\n }}\n >\n <div class=\"form-ctrl__wrapper\">\n {!floatLabel ? renderLabel({ ...props }) : ''}\n <div\n class={{\n 'form-ctrl__input': true,\n 'form-ctrl__textarea': type === 'textarea',\n }}\n >\n {floatLabel && renderLabel({ ...props, rtl })}\n {children}\n </div>\n {showInlineError || hasHelperSlot ? (\n <div class=\"form-ctrl__more\" id={moreId}>\n {!!showInlineError ? (\n <div class=\"form-ctrl__error\" aria-live=\"polite\">\n {errorMessage}\n </div>\n ) : (\n ''\n )}\n <div class=\"form-ctrl__helper\">\n <slot name=\"helper\" />\n </div>\n </div>\n ) : (\n ''\n )}\n </div>\n {hasHelperEndSlot ? (\n <div class=\"form-ctrl__helper-end\" id={helperEndId}>\n <slot name=\"helper-end\" />\n </div>\n ) : (\n ''\n )}\n </div>\n );\n};\n\nexport const FormControl: FunctionalComponent<FormControlProps> = (\n props: FormControlProps,\n children\n) => {\n const {\n clearControl,\n onClearText,\n readonly,\n disabled,\n control,\n ref,\n endSlot,\n endValueSlot,\n startSlot,\n } = props;\n const clickThrough = () => {\n control.setFocus();\n };\n\n return (\n <div\n class=\"form-ctrl__input-wrap\"\n ref={(el) => {\n if (ref) ref(el);\n }}\n >\n <span class=\"form-ctrl__slot-start\">\n <slot name=\"start\" />\n {startSlot}\n </span>\n {children}\n {clearControl && !readonly && !disabled && (\n <button\n type=\"button\"\n class=\"icon form-ctrl__clear-btn\"\n tabindex=\"-1\"\n onTouchStart={onClearText}\n onMouseDown={onClearText}\n >\n <nano-icon name=\"light/times\"></nano-icon>\n </button>\n )}\n <span class=\"form-ctrl__slot-value-end\" onClick={clickThrough}>\n <slot name=\"value-end\" />\n {endValueSlot}\n </span>\n <span class=\"form-ctrl__slot-end\">\n <slot name=\"end\" />\n {endSlot}\n </span>\n </div>\n );\n};\n"],"version":3}
|
package/dist/components/grid.js
CHANGED
@@ -1,27 +1,204 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
import {
|
5
|
-
import { d as debounce } from './throttle.js';
|
4
|
+
import { h, Host, getElement, proxyCustomElement, HTMLElement as HTMLElement$1 } from '@stencil/core/internal/client';
|
6
5
|
|
7
|
-
|
6
|
+
// import type { VNode, HTMLStencilElement } from "@stencil/core";
|
7
|
+
const supportsConstructibleStylesheets = (() => {
|
8
|
+
try {
|
9
|
+
return !!new CSSStyleSheet();
|
10
|
+
}
|
11
|
+
catch (e) {
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
})();
|
15
|
+
const cacheKeys = new WeakMap();
|
16
|
+
/**
|
17
|
+
* Dynamically create a constructible stylesheet which is applied to the component.
|
18
|
+
* The stylesheet is then cached for future instances of the component.
|
19
|
+
* @usage
|
20
|
+
As a string:
|
21
|
+
```
|
22
|
+
@ConstructableStyle() style = `.bg { background: url('assets/${ this.mode }/bg.png'); }`;
|
23
|
+
```
|
24
|
+
As a function:
|
25
|
+
```
|
26
|
+
@ConstructableStyle() style = () => `.bg { background: url('assets/${ this.mode }/bg.png'); }`;
|
27
|
+
```
|
28
|
+
* @param opts - optional `cacheKeyProperty` - in case an instance of a component could produce different styles based on variables.
|
29
|
+
* @returns `@ConstructableStyle` decorator
|
30
|
+
*/
|
31
|
+
function ConstructibleStyle(opts = {}) {
|
32
|
+
return (target, propertyKey) => {
|
33
|
+
if (!opts.cacheKeyProperty) {
|
34
|
+
opts.cacheKeyProperty = propertyKey;
|
35
|
+
}
|
36
|
+
const { componentWillLoad, render, componentWillRender } = target;
|
37
|
+
if (!componentWillLoad)
|
38
|
+
console.warn(`ConstructibleStyle requires you to have a \`componentWillLoad\` lifecycle method in \`${target.constructor.name}\`. Failure to add this function may cause ConstructibleStyle to fail due to StencilJS build optimizations.`);
|
39
|
+
if (supportsConstructibleStylesheets) {
|
40
|
+
const addStylesheet = (instance) => {
|
41
|
+
if (!instance[opts.cacheKeyProperty] ||
|
42
|
+
(cacheKeys.get(instance) &&
|
43
|
+
cacheKeys.get(instance) === instance[opts.cacheKeyProperty]))
|
44
|
+
return;
|
45
|
+
cacheKeys.set(instance, instance[opts.cacheKeyProperty]);
|
46
|
+
const host = getElement(instance);
|
47
|
+
const cssText = typeof instance[propertyKey] === 'function'
|
48
|
+
? instance[propertyKey]()
|
49
|
+
: instance[propertyKey];
|
50
|
+
const root = (host.shadowRoot || document);
|
51
|
+
root.adoptedStyleSheets = [
|
52
|
+
...(root.adoptedStyleSheets || []),
|
53
|
+
getOrCreateStylesheet(instance, target, cssText, opts),
|
54
|
+
];
|
55
|
+
};
|
56
|
+
target.componentWillLoad = function () {
|
57
|
+
const willLoadResult = componentWillLoad && componentWillLoad.call(this);
|
58
|
+
addStylesheet(this);
|
59
|
+
return willLoadResult;
|
60
|
+
};
|
61
|
+
target.componentWillRender = function () {
|
62
|
+
const willRenderResult = componentWillRender && componentWillRender.call(this);
|
63
|
+
addStylesheet(this);
|
64
|
+
return willRenderResult;
|
65
|
+
};
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
target.render = function () {
|
69
|
+
const cssText = typeof this[propertyKey] === 'function'
|
70
|
+
? this[propertyKey]()
|
71
|
+
: this[propertyKey];
|
72
|
+
let renderedNode = render.call(this);
|
73
|
+
if (isHost(renderedNode)) {
|
74
|
+
appendStyleToHost(renderedNode, target.constructor.name, cssText);
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
renderedNode = h(Host, null, renderedNode);
|
78
|
+
if (!('attachShadow' in HTMLElement.prototype)) {
|
79
|
+
appendStyleToHost(renderedNode, target.constructor.name, cssText);
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
if (!target.__constructableStyle) {
|
83
|
+
const style = document.createElement('style');
|
84
|
+
style.setAttribute('type', 'text/css');
|
85
|
+
style.setAttribute('constructible-style', target.constructor.name);
|
86
|
+
style.innerHTML = cssText;
|
87
|
+
target.__constructableStyle = style;
|
88
|
+
document.head.appendChild(style);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
return renderedNode;
|
93
|
+
};
|
94
|
+
}
|
95
|
+
};
|
96
|
+
}
|
97
|
+
function appendStyleToHost(node, targetName, cssText) {
|
98
|
+
(getHostChildren(node) || []).push(h("style", { type: "text/css", "constructible-style": targetName }, cssText));
|
99
|
+
}
|
100
|
+
function getOrCreateStylesheet(instance, target, cssText, opts) {
|
101
|
+
if (!target.__constructableStyle) {
|
102
|
+
target.__constructableStyle = {};
|
103
|
+
}
|
104
|
+
const key = instance[opts.cacheKeyProperty];
|
105
|
+
if (!target.__constructableStyle[key]) {
|
106
|
+
target.__constructableStyle[key] = new CSSStyleSheet();
|
107
|
+
target.__constructableStyle[key].replace(cssText);
|
108
|
+
}
|
109
|
+
return target.__constructableStyle[key];
|
110
|
+
}
|
111
|
+
function isHost(node) {
|
112
|
+
for (const prop in node) {
|
113
|
+
if (node.hasOwnProperty(prop)) {
|
114
|
+
if (node[prop] === Host) {
|
115
|
+
return true;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
return false;
|
120
|
+
}
|
121
|
+
function getHostChildren(node) {
|
122
|
+
for (const prop in node) {
|
123
|
+
if (node.hasOwnProperty(prop)) {
|
124
|
+
if (Array.isArray(node[prop])) {
|
125
|
+
return node[prop];
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
const gridCss = ":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--grid-col-gap:var(--nano-spacing-medium, 16px);--grid-row-gap:var(--nano-spacing-medium, 16px);--current-grid-size:\"grid size: s\";container-type:inline-size;display:block}:host .grid{display:grid;gap:var(--grid-row-gap) var(--grid-col-gap);block-size:inherit;min-block-size:inherit}:host([show-helper]:not([show-helper=false])){position:relative}:host([show-helper]:not([show-helper=false])) .grid--helper{position:absolute;inset:0;pointer-events:none}:host([show-helper]:not([show-helper=false])) .grid--helper::before{content:var(--current-grid-size);font-size:30px;position:absolute;inline-size:100%;inset-inline-start:0;text-align:center;inset-block-start:50%;transform:translateY(-50%);color:rgba(0, 0, 0, 0.2);text-transform:uppercase;z-index:99;pointer-events:none}:host([show-helper]:not([show-helper=false])) .grid__helper-item{display:none;background:rgba(126, 195, 241, 0.25)}";
|
8
132
|
|
9
|
-
|
10
|
-
|
133
|
+
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
134
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
135
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
136
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
137
|
+
else
|
138
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
139
|
+
if (d = decorators[i])
|
140
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
141
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
142
|
+
};
|
143
|
+
var __metadata = (undefined && undefined.__metadata) || function (k, v) {
|
144
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
145
|
+
return Reflect.metadata(k, v);
|
146
|
+
};
|
147
|
+
const Grid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
|
11
148
|
constructor() {
|
12
149
|
super();
|
13
150
|
this.__registerHost();
|
14
151
|
this.__attachShadow();
|
15
|
-
this.
|
16
|
-
this.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
152
|
+
this.grids = [];
|
153
|
+
this.styles = () => {
|
154
|
+
const css = /* css */ `
|
155
|
+
${this.grids
|
156
|
+
.map((bp) => /* css */ `
|
157
|
+
@container (min-width: ${typeof bp.breakpoint === 'number'
|
158
|
+
? bp.breakpoint + 1 + 'px'
|
159
|
+
: bp.breakpoint}) {
|
160
|
+
.grid {
|
161
|
+
--current-grid-size: "grid size: ${bp.name}";
|
162
|
+
${bp.template
|
163
|
+
? `grid-template: ${bp.template};`
|
164
|
+
: `grid-template-columns: repeat(${bp.cols}, 1fr);`}
|
165
|
+
}
|
166
|
+
${[...Array(bp.cols)]
|
167
|
+
.map((_, i) => {
|
168
|
+
const gItm = i + 1;
|
169
|
+
return /* css */ `
|
170
|
+
.grid > [grid-states~="${bp.name}-col-start-${gItm}"],
|
171
|
+
::slotted([grid-states~="${bp.name}-col-start-${gItm}"]) {
|
172
|
+
grid-column-start: ${gItm} !important;
|
173
|
+
}
|
174
|
+
.grid > [grid-states~="${bp.name}-row-start-${gItm}"],
|
175
|
+
::slotted([grid-states~="${bp.name}-row-start-${gItm}"]) {
|
176
|
+
grid-row-start: ${gItm} !important;
|
177
|
+
}
|
178
|
+
.grid > [grid-states~="${bp.name}-col-span-${gItm}"],
|
179
|
+
::slotted([grid-states~="${bp.name}-col-span-${gItm}"]) {
|
180
|
+
grid-column-end: span ${gItm} !important;
|
181
|
+
}
|
182
|
+
.grid > [grid-states~="${bp.name}-row-span-${gItm}"],
|
183
|
+
::slotted([grid-states~="${bp.name}-row-span-${gItm}"]) {
|
184
|
+
grid-row-end: span ${gItm} !important;
|
185
|
+
}
|
186
|
+
`;
|
187
|
+
})
|
188
|
+
.join('')}
|
189
|
+
${this.showHelper &&
|
190
|
+
/* css */ `
|
191
|
+
.grid--helper :nth-child(-n+${bp.cols}) {
|
192
|
+
display: block !important;
|
193
|
+
}
|
194
|
+
`}
|
195
|
+
}
|
196
|
+
`)
|
197
|
+
.join('')}
|
198
|
+
`;
|
199
|
+
return css;
|
200
|
+
};
|
201
|
+
this.cacheKey = undefined;
|
25
202
|
this.sSize = 300;
|
26
203
|
this.mSize = 550;
|
27
204
|
this.lSize = 800;
|
@@ -31,195 +208,103 @@ const Grid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
31
208
|
this.lCols = undefined;
|
32
209
|
this.xlCols = undefined;
|
33
210
|
this.xxlCols = undefined;
|
211
|
+
this.sTpl = undefined;
|
212
|
+
this.mTpl = undefined;
|
213
|
+
this.lTpl = undefined;
|
214
|
+
this.xlTpl = undefined;
|
215
|
+
this.xxlTpl = undefined;
|
34
216
|
this.showHelper = false;
|
35
|
-
this.contentPanel = false;
|
36
|
-
this.fullHeight = false;
|
37
|
-
this.stateChange = debounce(this.stateChange.bind(this), 100);
|
38
|
-
}
|
39
|
-
propChanged() {
|
40
|
-
this.applySizeClasses();
|
41
217
|
}
|
42
|
-
|
43
|
-
|
44
|
-
this.isSmall = false;
|
45
|
-
this.isMedium = false;
|
46
|
-
this.isLarge = false;
|
47
|
-
this.isXL = false;
|
48
|
-
this.isXXL = false;
|
49
|
-
this.generalClasses = [];
|
50
|
-
this.gridClass = null;
|
51
|
-
this.isSizes = [null];
|
52
|
-
this.isSmall = true;
|
53
|
-
this.generalClasses.push('is-small');
|
218
|
+
constructSizeArray() {
|
219
|
+
this.grids = [];
|
54
220
|
if (this.sCols)
|
55
|
-
this.
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
if (this.mCols)
|
61
|
-
this.gridClass = `nano-grid-${this.mCols}`;
|
62
|
-
this.isSizes.push({ size: 'm', active: true });
|
63
|
-
}
|
64
|
-
if (size > this.mSize) {
|
65
|
-
this.isLarge = true;
|
66
|
-
this.generalClasses.push('is-large');
|
67
|
-
if (this.lCols)
|
68
|
-
this.gridClass = `nano-grid-${this.lCols}`;
|
69
|
-
this.isSizes.push({ size: 'l', active: true });
|
70
|
-
}
|
71
|
-
if (size > this.lSize) {
|
72
|
-
this.isXL = true;
|
73
|
-
this.generalClasses.push('is-xl');
|
74
|
-
if (this.xlCols)
|
75
|
-
this.gridClass = `nano-grid-${this.xlCols}`;
|
76
|
-
this.isSizes.push({ size: 'xl', active: true });
|
77
|
-
}
|
78
|
-
if (size > this.xlSize) {
|
79
|
-
this.isXXL = true;
|
80
|
-
this.generalClasses.push('is-xxl');
|
81
|
-
if (this.xxlCols)
|
82
|
-
this.gridClass = `nano-grid-${this.xxlCols}`;
|
83
|
-
this.isSizes.push({ size: 'xxl', active: true });
|
84
|
-
}
|
85
|
-
this.el.style.setProperty('--current-grid-size', `'grid size: ${this.isSizes.slice().pop().size}'`);
|
86
|
-
this.applyChildrenClasses();
|
87
|
-
setTimeout(() => (this.ready = true), 0);
|
88
|
-
}
|
89
|
-
stateChange() {
|
90
|
-
this.nanoBpChange.emit(this.generalClasses);
|
91
|
-
}
|
92
|
-
applyChildrenClasses() {
|
93
|
-
const gridItems = this.el.querySelectorAll('nano-grid-item');
|
94
|
-
if (gridItems.length) {
|
95
|
-
gridItems.forEach((gridItem) => {
|
96
|
-
gridItem.changeBP(this.isSizes);
|
221
|
+
this.grids.push({
|
222
|
+
cols: this.sCols,
|
223
|
+
breakpoint: 0,
|
224
|
+
name: 's',
|
225
|
+
template: this.sTpl,
|
97
226
|
});
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
.split(' ')
|
119
|
-
.filter((c) => !c.startsWith('nano-grid-'));
|
120
|
-
gItem.className = classes.join(' ').trim();
|
121
|
-
// get all potential states this element can have
|
122
|
-
const itemStates = gItem.getAttribute('grid-states').split(' ');
|
123
|
-
// loop through all potential state options: col & row span & start
|
124
|
-
STATEOPTS.forEach((stateOpt) => {
|
125
|
-
// reset found flag
|
126
|
-
found = false;
|
127
|
-
// loop through all the current valid breakpoints / sizes backwards because
|
128
|
-
// we only care about the item's state at the largest current breakpoint.
|
129
|
-
this.isSizes
|
130
|
-
.slice()
|
131
|
-
.reverse()
|
132
|
-
.forEach(function (size) {
|
133
|
-
if (found || !size)
|
134
|
-
return;
|
135
|
-
found = itemStates.find((state) => state.indexOf(`${size.size}-${stateOpt}`) === 0);
|
136
|
-
// found a state at this current size. apply class.
|
137
|
-
if (found) {
|
138
|
-
// clear previous grid state classname
|
139
|
-
classes = gItem.className
|
140
|
-
.split(' ')
|
141
|
-
.filter((c) => !c.includes('nano-grid-${stateOpt}'));
|
142
|
-
gItem.className = classes.join(' ').trim();
|
143
|
-
stateArr = found.split('-');
|
144
|
-
// remove the size of the state
|
145
|
-
stateArr.shift();
|
146
|
-
itemState = stateArr.join('-');
|
147
|
-
// add new class
|
148
|
-
gItem.classList.add(`nano-grid-${itemState}`);
|
149
|
-
}
|
150
|
-
});
|
227
|
+
if (this.mCols)
|
228
|
+
this.grids.push({
|
229
|
+
cols: this.mCols,
|
230
|
+
breakpoint: this.sSize,
|
231
|
+
name: 'm',
|
232
|
+
template: this.mTpl,
|
233
|
+
});
|
234
|
+
if (this.lSize)
|
235
|
+
this.grids.push({
|
236
|
+
cols: this.lCols,
|
237
|
+
breakpoint: this.mSize,
|
238
|
+
name: 'l',
|
239
|
+
template: this.lTpl,
|
240
|
+
});
|
241
|
+
if (this.xlCols)
|
242
|
+
this.grids.push({
|
243
|
+
cols: this.xlCols,
|
244
|
+
breakpoint: this.lSize,
|
245
|
+
name: 'xl',
|
246
|
+
template: this.xlTpl,
|
151
247
|
});
|
152
|
-
|
248
|
+
if (this.xxlCols)
|
249
|
+
this.grids.push({
|
250
|
+
cols: this.xxlCols,
|
251
|
+
breakpoint: this.xlSize,
|
252
|
+
name: 'xxl',
|
253
|
+
template: this.xxlTpl,
|
254
|
+
});
|
255
|
+
this.cacheKey =
|
256
|
+
this.grids
|
257
|
+
.map((bp) => `${bp.cols}-${bp.breakpoint}-${bp.template || ''}`)
|
258
|
+
.join('') +
|
259
|
+
'-helper-' +
|
260
|
+
this.showHelper;
|
153
261
|
}
|
154
262
|
componentWillLoad() {
|
155
|
-
|
156
|
-
[].map.call(ctx.children, (ele) => ele.classList.add('nano-griditem'));
|
157
|
-
}
|
158
|
-
componentDidLoad() {
|
159
|
-
if (!window['ResizeObserver'])
|
160
|
-
return;
|
161
|
-
this.ro = new ResizeObserver((entries) => {
|
162
|
-
for (const entry of entries) {
|
163
|
-
if (!entry.contentRect.width)
|
164
|
-
return;
|
165
|
-
this.currentWidth = entry.contentRect.width;
|
166
|
-
this.applySizeClasses();
|
167
|
-
}
|
168
|
-
});
|
169
|
-
this.ro.observe(this.el);
|
170
|
-
}
|
171
|
-
disconnectedCallback() {
|
172
|
-
if (this.ro)
|
173
|
-
this.ro.disconnect();
|
263
|
+
this.constructSizeArray();
|
174
264
|
}
|
175
265
|
render() {
|
176
|
-
return (h(Host, { class: {
|
177
|
-
[this.generalClasses.join(' ')]: true,
|
178
|
-
'has-grid': !!this.gridClass,
|
179
|
-
ready: this.ready,
|
180
|
-
[this.gridClass]: true,
|
181
|
-
} }, h("div", { class: {
|
182
|
-
grid: true,
|
183
|
-
} }, h("slot", null))));
|
266
|
+
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" })))))));
|
184
267
|
}
|
185
|
-
get el() { return this; }
|
186
268
|
static get watchers() { return {
|
187
|
-
"
|
188
|
-
"
|
189
|
-
"
|
190
|
-
"
|
191
|
-
"
|
192
|
-
"
|
193
|
-
"
|
194
|
-
"
|
195
|
-
"
|
196
|
-
"
|
197
|
-
"
|
198
|
-
"
|
199
|
-
"
|
200
|
-
"
|
269
|
+
"sTpl": ["constructSizeArray"],
|
270
|
+
"mTpl": ["constructSizeArray"],
|
271
|
+
"lTpl": ["constructSizeArray"],
|
272
|
+
"xlTpl": ["constructSizeArray"],
|
273
|
+
"xxlTpl": ["constructSizeArray"],
|
274
|
+
"sSize": ["constructSizeArray"],
|
275
|
+
"mSize": ["constructSizeArray"],
|
276
|
+
"lSize": ["constructSizeArray"],
|
277
|
+
"xlSize": ["constructSizeArray"],
|
278
|
+
"sCols": ["constructSizeArray"],
|
279
|
+
"mCols": ["constructSizeArray"],
|
280
|
+
"lCols": ["constructSizeArray"],
|
281
|
+
"xlCols": ["constructSizeArray"],
|
282
|
+
"xxlCols": ["constructSizeArray"],
|
283
|
+
"showHelper": ["constructSizeArray"]
|
201
284
|
}; }
|
202
285
|
static get style() { return gridCss; }
|
203
286
|
}, [1, "nano-grid", {
|
204
|
-
"sSize": [
|
205
|
-
"mSize": [
|
206
|
-
"lSize": [
|
207
|
-
"xlSize": [
|
287
|
+
"sSize": [8, "s-size"],
|
288
|
+
"mSize": [8, "m-size"],
|
289
|
+
"lSize": [8, "l-size"],
|
290
|
+
"xlSize": [8, "xl-size"],
|
208
291
|
"sCols": [2, "s-cols"],
|
209
292
|
"mCols": [2, "m-cols"],
|
210
293
|
"lCols": [2, "l-cols"],
|
211
294
|
"xlCols": [2, "xl-cols"],
|
212
295
|
"xxlCols": [2, "xxl-cols"],
|
296
|
+
"sTpl": [1, "s-tpl"],
|
297
|
+
"mTpl": [1, "m-tpl"],
|
298
|
+
"lTpl": [1, "l-tpl"],
|
299
|
+
"xlTpl": [1, "xl-tpl"],
|
300
|
+
"xxlTpl": [1, "xxl-tpl"],
|
213
301
|
"showHelper": [516, "show-helper"],
|
214
|
-
"
|
215
|
-
"fullHeight": [516, "full-height"],
|
216
|
-
"ready": [32],
|
217
|
-
"isSmall": [32],
|
218
|
-
"isMedium": [32],
|
219
|
-
"isLarge": [32],
|
220
|
-
"isXL": [32],
|
221
|
-
"isXXL": [32]
|
302
|
+
"cacheKey": [32]
|
222
303
|
}]);
|
304
|
+
__decorate([
|
305
|
+
ConstructibleStyle({ cacheKeyProperty: 'cacheKey' }),
|
306
|
+
__metadata("design:type", Object)
|
307
|
+
], Grid.prototype, "styles", void 0);
|
223
308
|
function defineCustomElement() {
|
224
309
|
if (typeof customElements === "undefined") {
|
225
310
|
return;
|