@saasquatch/mint-components 2.4.2 → 2.4.3
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/dist/cjs/{GenericTableView-be5648e4.js → GenericTableView-4c48c630.js} +46 -6
- package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +9 -5
- package/dist/cjs/sqm-referral-table_11.cjs.entry.js +9 -5
- package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +9 -5
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
- package/dist/cjs/{useReferralTable-6e9de0d5.js → useReferralTable-06887d9a.js} +10 -0
- package/dist/collection/components/sqm-invoice-table/sqm-invoice-table.js +8 -3
- package/dist/collection/components/sqm-referral-table/sqm-referral-table.js +8 -3
- package/dist/collection/components/sqm-rewards-table/sqm-rewards-table.js +8 -3
- package/dist/collection/tables/GenericTableView.js +46 -6
- package/dist/collection/tables/plopTargets.js +8 -0
- package/dist/esm/{GenericTableView-8c72ac30.js → GenericTableView-471a9386.js} +46 -6
- package/dist/esm/sqm-banking-info-form_10.entry.js +9 -5
- package/dist/esm/sqm-referral-table_11.entry.js +9 -5
- package/dist/esm/sqm-rewards-table_9.entry.js +9 -5
- package/dist/esm/sqm-stencilbook.entry.js +1 -1
- package/dist/esm/{useReferralTable-03d32c6f.js → useReferralTable-3aa4b527.js} +10 -1
- package/dist/esm-es5/GenericTableView-471a9386.js +1 -0
- package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
- package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/useReferralTable-3aa4b527.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-361e8a80.entry.js +1 -0
- package/dist/mint-components/p-381af581.js +1 -0
- package/dist/mint-components/p-41e1547d.system.entry.js +1 -0
- package/dist/mint-components/{p-2a2332a6.entry.js → p-4481f259.entry.js} +8 -8
- package/dist/mint-components/p-54c03a3e.entry.js +148 -0
- package/dist/mint-components/p-700d8950.system.js +1 -0
- package/dist/mint-components/{p-2e33148c.entry.js → p-8bdabf61.entry.js} +1 -1
- package/dist/mint-components/{p-bb0b5e4b.js → p-9944b514.js} +4 -4
- package/dist/mint-components/p-abf7c765.system.entry.js +1 -0
- package/dist/mint-components/p-b69dbed8.system.js +1 -0
- package/dist/mint-components/p-bfb00685.system.js +1 -1
- package/dist/mint-components/p-d870d624.system.entry.js +1 -0
- package/dist/mint-components/{p-3784c92c.system.entry.js → p-ee6700a3.system.entry.js} +1 -1
- package/dist/types/tables/GenericTableView.d.ts +2 -0
- package/dist/types/tables/plopTargets.d.ts +3 -0
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/esm-es5/GenericTableView-8c72ac30.js +0 -1
- package/dist/esm-es5/useReferralTable-03d32c6f.js +0 -1
- package/dist/mint-components/p-241e7226.system.entry.js +0 -1
- package/dist/mint-components/p-7c657e1f.entry.js +0 -1
- package/dist/mint-components/p-933bae53.system.entry.js +0 -1
- package/dist/mint-components/p-b1eb2a6a.js +0 -1
- package/dist/mint-components/p-d284ae70.system.js +0 -1
- package/dist/mint-components/p-d5eb601d.system.js +0 -1
- package/dist/mint-components/p-e2fb11af.entry.js +0 -148
- package/dist/mint-components/p-f7218609.system.entry.js +0 -1
|
@@ -9,6 +9,11 @@ function GenericTableView(props) {
|
|
|
9
9
|
const { columns, rows } = elements;
|
|
10
10
|
const { show } = states;
|
|
11
11
|
const hiddenCols = data.hiddenColumns && data.hiddenColumns.split(",").map(Number);
|
|
12
|
+
// Only the producer knows which columns are plop targets; a column can render a
|
|
13
|
+
// VNode label and still be real data (e.g. the invoice download column).
|
|
14
|
+
const dropZones = new Set(elements.dropZoneColumns);
|
|
15
|
+
const hasDropZones = dropZones.size > 0;
|
|
16
|
+
const showLabels = data.textOverrides.showLabels;
|
|
12
17
|
const mobile = "@media (max-width: " + data.mdBreakpoint + "px)";
|
|
13
18
|
const tablet = `@media (min-width: ${Boolean(rows.length < 2) ? data.mdBreakpoint : data.smBreakpoint}px) and (max-width: ${data.mdBreakpoint}px)`;
|
|
14
19
|
// Due to mobile media queries being dependant on props, not feasiable to move out of render function
|
|
@@ -29,6 +34,13 @@ function GenericTableView(props) {
|
|
|
29
34
|
fontWeight: "var(--sl-font-weight-semibold)",
|
|
30
35
|
overflowWrap: "anywhere",
|
|
31
36
|
},
|
|
37
|
+
"& th.collapsed": {
|
|
38
|
+
fontSize: "0",
|
|
39
|
+
padding: "14px 0",
|
|
40
|
+
},
|
|
41
|
+
"& th.drop-zone": {
|
|
42
|
+
width: "30px",
|
|
43
|
+
},
|
|
32
44
|
"& td": {
|
|
33
45
|
padding: "var(--sl-spacing-small)",
|
|
34
46
|
paddingLeft: "0",
|
|
@@ -36,10 +48,35 @@ function GenericTableView(props) {
|
|
|
36
48
|
textOverflow: "ellipsis",
|
|
37
49
|
},
|
|
38
50
|
[mobile]: {
|
|
51
|
+
// Body rows become blocks here, so the header has to leave the table layout to stay full width
|
|
39
52
|
"& thead": {
|
|
53
|
+
display: hasDropZones ? "block" : "none",
|
|
54
|
+
},
|
|
55
|
+
// Columns read top-to-bottom inside a card, so the drop zones between them stack the same way
|
|
56
|
+
"& thead tr": {
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "column",
|
|
59
|
+
},
|
|
60
|
+
"& thead th.label": {
|
|
61
|
+
padding: "0",
|
|
62
|
+
lineHeight: "20px",
|
|
63
|
+
fontSize: "var(--sl-font-size-small)",
|
|
64
|
+
color: "var(--sl-color-neutral-500)",
|
|
65
|
+
},
|
|
66
|
+
"& thead th.drop-zone": {
|
|
67
|
+
width: "auto",
|
|
68
|
+
padding: "14px 0",
|
|
69
|
+
lineHeight: "0",
|
|
70
|
+
position: "relative",
|
|
71
|
+
},
|
|
72
|
+
// The plop target is inline-styled position:absolute, so it needs the cell as its containing block to span it
|
|
73
|
+
"& thead th.drop-zone slot::slotted(raisins-plop-target)": {
|
|
74
|
+
width: "100%",
|
|
75
|
+
},
|
|
76
|
+
"& tbody td.drop-zone": {
|
|
40
77
|
display: "none",
|
|
41
78
|
},
|
|
42
|
-
"& tr": {
|
|
79
|
+
"& tbody tr": {
|
|
43
80
|
display: "block",
|
|
44
81
|
background: "inherit",
|
|
45
82
|
border: "var(--sqm-border-thickness, 1px) solid var(--sqm-border-color)",
|
|
@@ -96,11 +133,11 @@ function GenericTableView(props) {
|
|
|
96
133
|
return (index.h("div", null,
|
|
97
134
|
index.h("style", { type: "text/css" }, styleString),
|
|
98
135
|
index.h("table", { class: sheet.classes.Table },
|
|
99
|
-
|
|
100
|
-
index.h("tr", null, columns === null || columns === void 0 ? void 0 : columns.map((column) => {
|
|
101
|
-
if (
|
|
102
|
-
return index.h("th",
|
|
103
|
-
return index.h("th", {
|
|
136
|
+
(showLabels || hasDropZones) && (index.h("thead", null,
|
|
137
|
+
index.h("tr", null, columns === null || columns === void 0 ? void 0 : columns.map((column, i) => {
|
|
138
|
+
if (dropZones.has(i))
|
|
139
|
+
return index.h("th", { class: "drop-zone" }, column);
|
|
140
|
+
return (index.h("th", { class: showLabels ? "label" : "collapsed" }, column));
|
|
104
141
|
})))),
|
|
105
142
|
index.h("tbody", null,
|
|
106
143
|
show === "loading" && elements.loadingElement,
|
|
@@ -108,6 +145,9 @@ function GenericTableView(props) {
|
|
|
108
145
|
return (index.h("tr", { style: {
|
|
109
146
|
borderTop: `${!data.textOverrides.showLabels && i === 0 ? "none" : ""}`,
|
|
110
147
|
}, part: "table-row" }, row.map((cell, j) => {
|
|
148
|
+
if (dropZones.has(j))
|
|
149
|
+
return index.h("td", { class: "drop-zone" }, cell);
|
|
150
|
+
// Only string labels can be echoed into the mobile card's :before
|
|
111
151
|
return typeof columns[j] === "string" ? (index.h("td", { class: (hiddenCols === null || hiddenCols === void 0 ? void 0 : hiddenCols.includes(j)) ? "hidden" : "", "data-label": columns[j] + ":", style: {
|
|
112
152
|
gridTemplateColumns: (hiddenCols === null || hiddenCols === void 0 ? void 0 : hiddenCols.includes(j)) ? "1fr"
|
|
113
153
|
: "0.5fr 0.5fr",
|
|
@@ -13,11 +13,11 @@ const JSS = require('./JSS-8503a151.js');
|
|
|
13
13
|
require('./mixins-4761d472.js');
|
|
14
14
|
require('./AsYouType-d15caac8.js');
|
|
15
15
|
const subregions = require('./subregions-3d27e279.js');
|
|
16
|
-
const GenericTableView = require('./GenericTableView-
|
|
16
|
+
const GenericTableView = require('./GenericTableView-4c48c630.js');
|
|
17
17
|
const reRender = require('./re-render-72a0ef45.js');
|
|
18
|
+
const useReferralTable = require('./useReferralTable-06887d9a.js');
|
|
18
19
|
const useChildElements = require('./useChildElements-041127d7.js');
|
|
19
20
|
const luxon = require('./luxon-c1ad356a.js');
|
|
20
|
-
const useReferralTable = require('./useReferralTable-6e9de0d5.js');
|
|
21
21
|
const sqmUserInfoFormView = require('./sqm-user-info-form-view-c5f9b79b.js');
|
|
22
22
|
const data = require('./data-89ac73dd.js');
|
|
23
23
|
const keys = require('./keys-5a2c9ed2.js');
|
|
@@ -3436,7 +3436,12 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
|
|
|
3436
3436
|
setContent({ rows });
|
|
3437
3437
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
3438
3438
|
// Set the content to render and finish loading components
|
|
3439
|
-
setContent({
|
|
3439
|
+
setContent({
|
|
3440
|
+
columns,
|
|
3441
|
+
dropZoneColumns: useReferralTable.dropZoneColumnIndexes(columnComponents),
|
|
3442
|
+
loading: false,
|
|
3443
|
+
page: 0,
|
|
3444
|
+
});
|
|
3440
3445
|
}
|
|
3441
3446
|
domContextHooks_module.useEffect(() => {
|
|
3442
3447
|
setContent({ loading: true });
|
|
@@ -3465,8 +3470,7 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
|
|
|
3465
3470
|
smBreakpoint: 599,
|
|
3466
3471
|
},
|
|
3467
3472
|
elements: {
|
|
3468
|
-
|
|
3469
|
-
rows: content.rows,
|
|
3473
|
+
...content,
|
|
3470
3474
|
emptyElement,
|
|
3471
3475
|
loadingElement,
|
|
3472
3476
|
},
|
|
@@ -11,12 +11,12 @@ const utils = require('./utils-6847bc06.js');
|
|
|
11
11
|
const JSS = require('./JSS-8503a151.js');
|
|
12
12
|
require('./mixins-4761d472.js');
|
|
13
13
|
const sqmTextSpanView = require('./sqm-text-span-view-b9e10f5d.js');
|
|
14
|
-
const GenericTableView = require('./GenericTableView-
|
|
14
|
+
const GenericTableView = require('./GenericTableView-4c48c630.js');
|
|
15
15
|
const reRender = require('./re-render-72a0ef45.js');
|
|
16
|
+
const useReferralTable = require('./useReferralTable-06887d9a.js');
|
|
16
17
|
const useChildElements = require('./useChildElements-041127d7.js');
|
|
17
18
|
const luxon = require('./luxon-c1ad356a.js');
|
|
18
19
|
const mockRewardData = require('./mockRewardData-ed603fca.js');
|
|
19
|
-
const useReferralTable = require('./useReferralTable-6e9de0d5.js');
|
|
20
20
|
|
|
21
21
|
const mockReferralData = (count = 4) => {
|
|
22
22
|
const data = [...Array(count)].map(() => getMockData());
|
|
@@ -290,7 +290,12 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
|
|
|
290
290
|
setContent({ rows });
|
|
291
291
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
292
292
|
// Set the content to render and finish loading components
|
|
293
|
-
setContent({
|
|
293
|
+
setContent({
|
|
294
|
+
columns,
|
|
295
|
+
dropZoneColumns: useReferralTable.dropZoneColumnIndexes(columnComponents),
|
|
296
|
+
loading: false,
|
|
297
|
+
page: 0,
|
|
298
|
+
});
|
|
294
299
|
}
|
|
295
300
|
domContextHooks_module.useEffect(() => {
|
|
296
301
|
setContent({ loading: true });
|
|
@@ -319,8 +324,7 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
|
|
|
319
324
|
smBreakpoint: 599,
|
|
320
325
|
},
|
|
321
326
|
elements: {
|
|
322
|
-
|
|
323
|
-
rows: content.rows,
|
|
327
|
+
...content,
|
|
324
328
|
emptyElement,
|
|
325
329
|
loadingElement,
|
|
326
330
|
},
|
|
@@ -10,12 +10,12 @@ const cjs = require('./cjs-1066ec21.js');
|
|
|
10
10
|
const utils = require('./utils-6847bc06.js');
|
|
11
11
|
const JSS = require('./JSS-8503a151.js');
|
|
12
12
|
require('./mixins-4761d472.js');
|
|
13
|
-
const GenericTableView = require('./GenericTableView-
|
|
13
|
+
const GenericTableView = require('./GenericTableView-4c48c630.js');
|
|
14
14
|
const reRender = require('./re-render-72a0ef45.js');
|
|
15
|
+
const useReferralTable = require('./useReferralTable-06887d9a.js');
|
|
15
16
|
const useChildElements = require('./useChildElements-041127d7.js');
|
|
16
17
|
const luxon = require('./luxon-c1ad356a.js');
|
|
17
18
|
const mockRewardData = require('./mockRewardData-ed603fca.js');
|
|
18
|
-
const useReferralTable = require('./useReferralTable-6e9de0d5.js');
|
|
19
19
|
|
|
20
20
|
const debug = domContextHooks_module.browser("sq:useRewardsTable");
|
|
21
21
|
const CSS_NAMESPACE = "sqm-rewards-table";
|
|
@@ -394,7 +394,12 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
|
|
|
394
394
|
setContent({ rows });
|
|
395
395
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
396
396
|
// Set the content to render and finish loading components
|
|
397
|
-
setContent({
|
|
397
|
+
setContent({
|
|
398
|
+
columns,
|
|
399
|
+
dropZoneColumns: useReferralTable.dropZoneColumnIndexes(columnComponents),
|
|
400
|
+
loading: false,
|
|
401
|
+
page: 0,
|
|
402
|
+
});
|
|
398
403
|
}
|
|
399
404
|
domContextHooks_module.useEffect(() => {
|
|
400
405
|
setContent({ loading: true });
|
|
@@ -422,8 +427,7 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
|
|
|
422
427
|
smBreakpoint: 599,
|
|
423
428
|
},
|
|
424
429
|
elements: {
|
|
425
|
-
|
|
426
|
-
rows: content.rows,
|
|
430
|
+
...content,
|
|
427
431
|
emptyElement,
|
|
428
432
|
loadingElement,
|
|
429
433
|
},
|
|
@@ -17,7 +17,7 @@ const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-717d063
|
|
|
17
17
|
require('./AsYouType-d15caac8.js');
|
|
18
18
|
const subregions = require('./subregions-3d27e279.js');
|
|
19
19
|
const sqmPortalRegistrationFormView = require('./sqm-portal-registration-form-view-a45f7a52.js');
|
|
20
|
-
const GenericTableView = require('./GenericTableView-
|
|
20
|
+
const GenericTableView = require('./GenericTableView-4c48c630.js');
|
|
21
21
|
require('./useChildElements-041127d7.js');
|
|
22
22
|
const luxon = require('./luxon-c1ad356a.js');
|
|
23
23
|
const sqmCloseButtonView = require('./sqm-close-button-view-e9f2a454.js');
|
|
@@ -6,6 +6,15 @@ const index_module = require('./index.module-f8c8495f.js');
|
|
|
6
6
|
const reRender = require('./re-render-72a0ef45.js');
|
|
7
7
|
const useChildElements = require('./useChildElements-041127d7.js');
|
|
8
8
|
|
|
9
|
+
const PLOP_TARGET_TAG = "RAISINS-PLOP-TARGET";
|
|
10
|
+
function isPlopTarget(element) {
|
|
11
|
+
return element.tagName === PLOP_TARGET_TAG;
|
|
12
|
+
}
|
|
13
|
+
/** Indexes of the column components the widget editor injected as drop zones. */
|
|
14
|
+
function dropZoneColumnIndexes(columnComponents) {
|
|
15
|
+
return columnComponents.reduce((indexes, component, idx) => isPlopTarget(component) ? [...indexes, idx] : indexes, []);
|
|
16
|
+
}
|
|
17
|
+
|
|
9
18
|
const debug = domContextHooks_module.browser("sq:useReferralTable");
|
|
10
19
|
const CSS_NAMESPACE = "sqm-referral-table";
|
|
11
20
|
const GET_REFERRER_DATA = index_module.dist.gql `
|
|
@@ -427,6 +436,7 @@ async function tryMethod(c, callback) {
|
|
|
427
436
|
}
|
|
428
437
|
}
|
|
429
438
|
|
|
439
|
+
exports.dropZoneColumnIndexes = dropZoneColumnIndexes;
|
|
430
440
|
exports.generateUserError = generateUserError;
|
|
431
441
|
exports.tryMethod = tryMethod;
|
|
432
442
|
exports.useReferralTable = useReferralTable;
|
|
@@ -5,6 +5,7 @@ import { Component, h, Prop } from "@stencil/core";
|
|
|
5
5
|
import deepmerge from "deepmerge";
|
|
6
6
|
import { GenericTableView, } from "../../tables/GenericTableView";
|
|
7
7
|
import { useRequestRerender, useRerenderListener, } from "../../tables/re-render";
|
|
8
|
+
import { dropZoneColumnIndexes } from "../../tables/plopTargets";
|
|
8
9
|
import { useChildElements } from "../../tables/useChildElements";
|
|
9
10
|
import mockInvoiceData from "./mockInvoiceData";
|
|
10
11
|
import { InvoiceTableView } from "./sqm-invoice-table-view";
|
|
@@ -422,7 +423,12 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
|
|
|
422
423
|
setContent({ rows });
|
|
423
424
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
424
425
|
// Set the content to render and finish loading components
|
|
425
|
-
setContent({
|
|
426
|
+
setContent({
|
|
427
|
+
columns,
|
|
428
|
+
dropZoneColumns: dropZoneColumnIndexes(columnComponents),
|
|
429
|
+
loading: false,
|
|
430
|
+
page: 0,
|
|
431
|
+
});
|
|
426
432
|
}
|
|
427
433
|
useEffect(() => {
|
|
428
434
|
setContent({ loading: true });
|
|
@@ -451,8 +457,7 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
|
|
|
451
457
|
smBreakpoint: 599,
|
|
452
458
|
},
|
|
453
459
|
elements: {
|
|
454
|
-
|
|
455
|
-
rows: content.rows,
|
|
460
|
+
...content,
|
|
456
461
|
emptyElement,
|
|
457
462
|
loadingElement,
|
|
458
463
|
},
|
|
@@ -5,6 +5,7 @@ import { Component, h, Prop } from "@stencil/core";
|
|
|
5
5
|
import deepmerge from "deepmerge";
|
|
6
6
|
import { GenericTableView, } from "../../tables/GenericTableView";
|
|
7
7
|
import { useRequestRerender, useRerenderListener, } from "../../tables/re-render";
|
|
8
|
+
import { dropZoneColumnIndexes } from "../../tables/plopTargets";
|
|
8
9
|
import { useChildElements } from "../../tables/useChildElements";
|
|
9
10
|
import mockReferralData from "./mockReferralData";
|
|
10
11
|
import { tryMethod, useReferralTable } from "./useReferralTable";
|
|
@@ -380,7 +381,12 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
|
|
|
380
381
|
setContent({ rows });
|
|
381
382
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
382
383
|
// Set the content to render and finish loading components
|
|
383
|
-
setContent({
|
|
384
|
+
setContent({
|
|
385
|
+
columns,
|
|
386
|
+
dropZoneColumns: dropZoneColumnIndexes(columnComponents),
|
|
387
|
+
loading: false,
|
|
388
|
+
page: 0,
|
|
389
|
+
});
|
|
384
390
|
}
|
|
385
391
|
useEffect(() => {
|
|
386
392
|
setContent({ loading: true });
|
|
@@ -409,8 +415,7 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
|
|
|
409
415
|
smBreakpoint: 599,
|
|
410
416
|
},
|
|
411
417
|
elements: {
|
|
412
|
-
|
|
413
|
-
rows: content.rows,
|
|
418
|
+
...content,
|
|
414
419
|
emptyElement,
|
|
415
420
|
loadingElement,
|
|
416
421
|
},
|
|
@@ -5,6 +5,7 @@ import { Component, h, Prop } from "@stencil/core";
|
|
|
5
5
|
import deepmerge from "deepmerge";
|
|
6
6
|
import { GenericTableView, } from "../../tables/GenericTableView";
|
|
7
7
|
import { useRequestRerender, useRerenderListener, } from "../../tables/re-render";
|
|
8
|
+
import { dropZoneColumnIndexes } from "../../tables/plopTargets";
|
|
8
9
|
import { useChildElements } from "../../tables/useChildElements";
|
|
9
10
|
import mockRewardData from "./mockRewardData";
|
|
10
11
|
import { tryMethod, useRewardsTable } from "./useRewardsTable";
|
|
@@ -325,7 +326,12 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
|
|
|
325
326
|
setContent({ rows });
|
|
326
327
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
327
328
|
// Set the content to render and finish loading components
|
|
328
|
-
setContent({
|
|
329
|
+
setContent({
|
|
330
|
+
columns,
|
|
331
|
+
dropZoneColumns: dropZoneColumnIndexes(columnComponents),
|
|
332
|
+
loading: false,
|
|
333
|
+
page: 0,
|
|
334
|
+
});
|
|
329
335
|
}
|
|
330
336
|
useEffect(() => {
|
|
331
337
|
setContent({ loading: true });
|
|
@@ -353,8 +359,7 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
|
|
|
353
359
|
smBreakpoint: 599,
|
|
354
360
|
},
|
|
355
361
|
elements: {
|
|
356
|
-
|
|
357
|
-
rows: content.rows,
|
|
362
|
+
...content,
|
|
358
363
|
emptyElement,
|
|
359
364
|
loadingElement,
|
|
360
365
|
},
|
|
@@ -6,6 +6,11 @@ export function GenericTableView(props) {
|
|
|
6
6
|
const { columns, rows } = elements;
|
|
7
7
|
const { show } = states;
|
|
8
8
|
const hiddenCols = data.hiddenColumns && data.hiddenColumns.split(",").map(Number);
|
|
9
|
+
// Only the producer knows which columns are plop targets; a column can render a
|
|
10
|
+
// VNode label and still be real data (e.g. the invoice download column).
|
|
11
|
+
const dropZones = new Set(elements.dropZoneColumns);
|
|
12
|
+
const hasDropZones = dropZones.size > 0;
|
|
13
|
+
const showLabels = data.textOverrides.showLabels;
|
|
9
14
|
const mobile = "@media (max-width: " + data.mdBreakpoint + "px)";
|
|
10
15
|
const tablet = `@media (min-width: ${Boolean(rows.length < 2) ? data.mdBreakpoint : data.smBreakpoint}px) and (max-width: ${data.mdBreakpoint}px)`;
|
|
11
16
|
// Due to mobile media queries being dependant on props, not feasiable to move out of render function
|
|
@@ -26,6 +31,13 @@ export function GenericTableView(props) {
|
|
|
26
31
|
fontWeight: "var(--sl-font-weight-semibold)",
|
|
27
32
|
overflowWrap: "anywhere",
|
|
28
33
|
},
|
|
34
|
+
"& th.collapsed": {
|
|
35
|
+
fontSize: "0",
|
|
36
|
+
padding: "14px 0",
|
|
37
|
+
},
|
|
38
|
+
"& th.drop-zone": {
|
|
39
|
+
width: "30px",
|
|
40
|
+
},
|
|
29
41
|
"& td": {
|
|
30
42
|
padding: "var(--sl-spacing-small)",
|
|
31
43
|
paddingLeft: "0",
|
|
@@ -33,10 +45,35 @@ export function GenericTableView(props) {
|
|
|
33
45
|
textOverflow: "ellipsis",
|
|
34
46
|
},
|
|
35
47
|
[mobile]: {
|
|
48
|
+
// Body rows become blocks here, so the header has to leave the table layout to stay full width
|
|
36
49
|
"& thead": {
|
|
50
|
+
display: hasDropZones ? "block" : "none",
|
|
51
|
+
},
|
|
52
|
+
// Columns read top-to-bottom inside a card, so the drop zones between them stack the same way
|
|
53
|
+
"& thead tr": {
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexDirection: "column",
|
|
56
|
+
},
|
|
57
|
+
"& thead th.label": {
|
|
58
|
+
padding: "0",
|
|
59
|
+
lineHeight: "20px",
|
|
60
|
+
fontSize: "var(--sl-font-size-small)",
|
|
61
|
+
color: "var(--sl-color-neutral-500)",
|
|
62
|
+
},
|
|
63
|
+
"& thead th.drop-zone": {
|
|
64
|
+
width: "auto",
|
|
65
|
+
padding: "14px 0",
|
|
66
|
+
lineHeight: "0",
|
|
67
|
+
position: "relative",
|
|
68
|
+
},
|
|
69
|
+
// The plop target is inline-styled position:absolute, so it needs the cell as its containing block to span it
|
|
70
|
+
"& thead th.drop-zone slot::slotted(raisins-plop-target)": {
|
|
71
|
+
width: "100%",
|
|
72
|
+
},
|
|
73
|
+
"& tbody td.drop-zone": {
|
|
37
74
|
display: "none",
|
|
38
75
|
},
|
|
39
|
-
"& tr": {
|
|
76
|
+
"& tbody tr": {
|
|
40
77
|
display: "block",
|
|
41
78
|
background: "inherit",
|
|
42
79
|
border: "var(--sqm-border-thickness, 1px) solid var(--sqm-border-color)",
|
|
@@ -93,11 +130,11 @@ export function GenericTableView(props) {
|
|
|
93
130
|
return (h("div", null,
|
|
94
131
|
h("style", { type: "text/css" }, styleString),
|
|
95
132
|
h("table", { class: sheet.classes.Table },
|
|
96
|
-
|
|
97
|
-
h("tr", null, columns === null || columns === void 0 ? void 0 : columns.map((column) => {
|
|
98
|
-
if (
|
|
99
|
-
return h("th",
|
|
100
|
-
return h("th", {
|
|
133
|
+
(showLabels || hasDropZones) && (h("thead", null,
|
|
134
|
+
h("tr", null, columns === null || columns === void 0 ? void 0 : columns.map((column, i) => {
|
|
135
|
+
if (dropZones.has(i))
|
|
136
|
+
return h("th", { class: "drop-zone" }, column);
|
|
137
|
+
return (h("th", { class: showLabels ? "label" : "collapsed" }, column));
|
|
101
138
|
})))),
|
|
102
139
|
h("tbody", null,
|
|
103
140
|
show === "loading" && elements.loadingElement,
|
|
@@ -105,6 +142,9 @@ export function GenericTableView(props) {
|
|
|
105
142
|
return (h("tr", { style: {
|
|
106
143
|
borderTop: `${!data.textOverrides.showLabels && i === 0 ? "none" : ""}`,
|
|
107
144
|
}, part: "table-row" }, row.map((cell, j) => {
|
|
145
|
+
if (dropZones.has(j))
|
|
146
|
+
return h("td", { class: "drop-zone" }, cell);
|
|
147
|
+
// Only string labels can be echoed into the mobile card's :before
|
|
108
148
|
return typeof columns[j] === "string" ? (h("td", { class: (hiddenCols === null || hiddenCols === void 0 ? void 0 : hiddenCols.includes(j)) ? "hidden" : "", "data-label": columns[j] + ":", style: {
|
|
109
149
|
gridTemplateColumns: (hiddenCols === null || hiddenCols === void 0 ? void 0 : hiddenCols.includes(j)) ? "1fr"
|
|
110
150
|
: "0.5fr 0.5fr",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const PLOP_TARGET_TAG = "RAISINS-PLOP-TARGET";
|
|
2
|
+
export function isPlopTarget(element) {
|
|
3
|
+
return element.tagName === PLOP_TARGET_TAG;
|
|
4
|
+
}
|
|
5
|
+
/** Indexes of the column components the widget editor injected as drop zones. */
|
|
6
|
+
export function dropZoneColumnIndexes(columnComponents) {
|
|
7
|
+
return columnComponents.reduce((indexes, component, idx) => isPlopTarget(component) ? [...indexes, idx] : indexes, []);
|
|
8
|
+
}
|
|
@@ -7,6 +7,11 @@ function GenericTableView(props) {
|
|
|
7
7
|
const { columns, rows } = elements;
|
|
8
8
|
const { show } = states;
|
|
9
9
|
const hiddenCols = data.hiddenColumns && data.hiddenColumns.split(",").map(Number);
|
|
10
|
+
// Only the producer knows which columns are plop targets; a column can render a
|
|
11
|
+
// VNode label and still be real data (e.g. the invoice download column).
|
|
12
|
+
const dropZones = new Set(elements.dropZoneColumns);
|
|
13
|
+
const hasDropZones = dropZones.size > 0;
|
|
14
|
+
const showLabels = data.textOverrides.showLabels;
|
|
10
15
|
const mobile = "@media (max-width: " + data.mdBreakpoint + "px)";
|
|
11
16
|
const tablet = `@media (min-width: ${Boolean(rows.length < 2) ? data.mdBreakpoint : data.smBreakpoint}px) and (max-width: ${data.mdBreakpoint}px)`;
|
|
12
17
|
// Due to mobile media queries being dependant on props, not feasiable to move out of render function
|
|
@@ -27,6 +32,13 @@ function GenericTableView(props) {
|
|
|
27
32
|
fontWeight: "var(--sl-font-weight-semibold)",
|
|
28
33
|
overflowWrap: "anywhere",
|
|
29
34
|
},
|
|
35
|
+
"& th.collapsed": {
|
|
36
|
+
fontSize: "0",
|
|
37
|
+
padding: "14px 0",
|
|
38
|
+
},
|
|
39
|
+
"& th.drop-zone": {
|
|
40
|
+
width: "30px",
|
|
41
|
+
},
|
|
30
42
|
"& td": {
|
|
31
43
|
padding: "var(--sl-spacing-small)",
|
|
32
44
|
paddingLeft: "0",
|
|
@@ -34,10 +46,35 @@ function GenericTableView(props) {
|
|
|
34
46
|
textOverflow: "ellipsis",
|
|
35
47
|
},
|
|
36
48
|
[mobile]: {
|
|
49
|
+
// Body rows become blocks here, so the header has to leave the table layout to stay full width
|
|
37
50
|
"& thead": {
|
|
51
|
+
display: hasDropZones ? "block" : "none",
|
|
52
|
+
},
|
|
53
|
+
// Columns read top-to-bottom inside a card, so the drop zones between them stack the same way
|
|
54
|
+
"& thead tr": {
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
},
|
|
58
|
+
"& thead th.label": {
|
|
59
|
+
padding: "0",
|
|
60
|
+
lineHeight: "20px",
|
|
61
|
+
fontSize: "var(--sl-font-size-small)",
|
|
62
|
+
color: "var(--sl-color-neutral-500)",
|
|
63
|
+
},
|
|
64
|
+
"& thead th.drop-zone": {
|
|
65
|
+
width: "auto",
|
|
66
|
+
padding: "14px 0",
|
|
67
|
+
lineHeight: "0",
|
|
68
|
+
position: "relative",
|
|
69
|
+
},
|
|
70
|
+
// The plop target is inline-styled position:absolute, so it needs the cell as its containing block to span it
|
|
71
|
+
"& thead th.drop-zone slot::slotted(raisins-plop-target)": {
|
|
72
|
+
width: "100%",
|
|
73
|
+
},
|
|
74
|
+
"& tbody td.drop-zone": {
|
|
38
75
|
display: "none",
|
|
39
76
|
},
|
|
40
|
-
"& tr": {
|
|
77
|
+
"& tbody tr": {
|
|
41
78
|
display: "block",
|
|
42
79
|
background: "inherit",
|
|
43
80
|
border: "var(--sqm-border-thickness, 1px) solid var(--sqm-border-color)",
|
|
@@ -94,11 +131,11 @@ function GenericTableView(props) {
|
|
|
94
131
|
return (h("div", null,
|
|
95
132
|
h("style", { type: "text/css" }, styleString),
|
|
96
133
|
h("table", { class: sheet.classes.Table },
|
|
97
|
-
|
|
98
|
-
h("tr", null, columns === null || columns === void 0 ? void 0 : columns.map((column) => {
|
|
99
|
-
if (
|
|
100
|
-
return h("th",
|
|
101
|
-
return h("th", {
|
|
134
|
+
(showLabels || hasDropZones) && (h("thead", null,
|
|
135
|
+
h("tr", null, columns === null || columns === void 0 ? void 0 : columns.map((column, i) => {
|
|
136
|
+
if (dropZones.has(i))
|
|
137
|
+
return h("th", { class: "drop-zone" }, column);
|
|
138
|
+
return (h("th", { class: showLabels ? "label" : "collapsed" }, column));
|
|
102
139
|
})))),
|
|
103
140
|
h("tbody", null,
|
|
104
141
|
show === "loading" && elements.loadingElement,
|
|
@@ -106,6 +143,9 @@ function GenericTableView(props) {
|
|
|
106
143
|
return (h("tr", { style: {
|
|
107
144
|
borderTop: `${!data.textOverrides.showLabels && i === 0 ? "none" : ""}`,
|
|
108
145
|
}, part: "table-row" }, row.map((cell, j) => {
|
|
146
|
+
if (dropZones.has(j))
|
|
147
|
+
return h("td", { class: "drop-zone" }, cell);
|
|
148
|
+
// Only string labels can be echoed into the mobile card's :before
|
|
109
149
|
return typeof columns[j] === "string" ? (h("td", { class: (hiddenCols === null || hiddenCols === void 0 ? void 0 : hiddenCols.includes(j)) ? "hidden" : "", "data-label": columns[j] + ":", style: {
|
|
110
150
|
gridTemplateColumns: (hiddenCols === null || hiddenCols === void 0 ? void 0 : hiddenCols.includes(j)) ? "1fr"
|
|
111
151
|
: "0.5fr 0.5fr",
|
|
@@ -9,11 +9,11 @@ import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
|
9
9
|
import './mixins-f750863a.js';
|
|
10
10
|
import './AsYouType-2d56519e.js';
|
|
11
11
|
import { t as taxTypeToName, b as validTaxDocument, I as INDIRECT_TAX_SPAIN_REGIONS, a as INDIRECT_TAX_PROVINCES, o as objectIsFull, c as toDomesticNumber, A as ADDRESS_REGIONS } from './subregions-810a5c2d.js';
|
|
12
|
-
import { G as GenericTableView } from './GenericTableView-
|
|
12
|
+
import { G as GenericTableView } from './GenericTableView-471a9386.js';
|
|
13
13
|
import { u as useRerenderListener, a as useRequestRerender } from './re-render-bf46ba54.js';
|
|
14
|
+
import { g as generateUserError, d as dropZoneColumnIndexes } from './useReferralTable-3aa4b527.js';
|
|
14
15
|
import { u as useChildElements } from './useChildElements-06937df7.js';
|
|
15
16
|
import { l as luxon } from './luxon-1be92a8e.js';
|
|
16
|
-
import { g as generateUserError } from './useReferralTable-03d32c6f.js';
|
|
17
17
|
import { O as OtherRegionSlotView, I as InvoiceTableView, v as vatLabels, T as TaxAndCashDashboardView, U as UserInfoFormView } from './sqm-user-info-form-view-ceb3917a.js';
|
|
18
18
|
import { F as FORM_STEPS, a as TAX_FORM_CONTEXT_NAMESPACE, S as SORTED_COUNTRIES_NAMESPACE, f as FINANCE_NETWORK_SETTINGS_NAMESPACE, c as USER_QUERY_NAMESPACE, T as TAX_CONTEXT_NAMESPACE, C as CURRENCIES_NAMESPACE, U as USER_FORM_CONTEXT_NAMESPACE } from './data-8698cbc6.js';
|
|
19
19
|
import { c as VERIFICATION_EVENT_KEY } from './keys-1054056a.js';
|
|
@@ -3432,7 +3432,12 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
|
|
|
3432
3432
|
setContent({ rows });
|
|
3433
3433
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
3434
3434
|
// Set the content to render and finish loading components
|
|
3435
|
-
setContent({
|
|
3435
|
+
setContent({
|
|
3436
|
+
columns,
|
|
3437
|
+
dropZoneColumns: dropZoneColumnIndexes(columnComponents),
|
|
3438
|
+
loading: false,
|
|
3439
|
+
page: 0,
|
|
3440
|
+
});
|
|
3436
3441
|
}
|
|
3437
3442
|
useEffect(() => {
|
|
3438
3443
|
setContent({ loading: true });
|
|
@@ -3461,8 +3466,7 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
|
|
|
3461
3466
|
smBreakpoint: 599,
|
|
3462
3467
|
},
|
|
3463
3468
|
elements: {
|
|
3464
|
-
|
|
3465
|
-
rows: content.rows,
|
|
3469
|
+
...content,
|
|
3466
3470
|
emptyElement,
|
|
3467
3471
|
loadingElement,
|
|
3468
3472
|
},
|
|
@@ -7,12 +7,12 @@ import { l as luxonLocale } from './utils-334c1e34.js';
|
|
|
7
7
|
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
8
8
|
import './mixins-f750863a.js';
|
|
9
9
|
import { T as TextSpanView } from './sqm-text-span-view-72f43dff.js';
|
|
10
|
-
import { G as GenericTableView } from './GenericTableView-
|
|
10
|
+
import { G as GenericTableView } from './GenericTableView-471a9386.js';
|
|
11
11
|
import { a as useRequestRerender, u as useRerenderListener } from './re-render-bf46ba54.js';
|
|
12
|
+
import { u as useReferralTable, t as tryMethod, d as dropZoneColumnIndexes } from './useReferralTable-3aa4b527.js';
|
|
12
13
|
import { u as useChildElements } from './useChildElements-06937df7.js';
|
|
13
14
|
import { l as luxon } from './luxon-1be92a8e.js';
|
|
14
15
|
import { g as getPaypalMeta } from './mockRewardData-9b27d6f1.js';
|
|
15
|
-
import { u as useReferralTable, t as tryMethod } from './useReferralTable-03d32c6f.js';
|
|
16
16
|
|
|
17
17
|
const mockReferralData = (count = 4) => {
|
|
18
18
|
const data = [...Array(count)].map(() => getMockData());
|
|
@@ -286,7 +286,12 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
|
|
|
286
286
|
setContent({ rows });
|
|
287
287
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
288
288
|
// Set the content to render and finish loading components
|
|
289
|
-
setContent({
|
|
289
|
+
setContent({
|
|
290
|
+
columns,
|
|
291
|
+
dropZoneColumns: dropZoneColumnIndexes(columnComponents),
|
|
292
|
+
loading: false,
|
|
293
|
+
page: 0,
|
|
294
|
+
});
|
|
290
295
|
}
|
|
291
296
|
useEffect(() => {
|
|
292
297
|
setContent({ loading: true });
|
|
@@ -315,8 +320,7 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
|
|
|
315
320
|
smBreakpoint: 599,
|
|
316
321
|
},
|
|
317
322
|
elements: {
|
|
318
|
-
|
|
319
|
-
rows: content.rows,
|
|
323
|
+
...content,
|
|
320
324
|
emptyElement,
|
|
321
325
|
loadingElement,
|
|
322
326
|
},
|
|
@@ -6,12 +6,12 @@ import { c as cjs } from './cjs-bdfb4486.js';
|
|
|
6
6
|
import { l as luxonLocale } from './utils-334c1e34.js';
|
|
7
7
|
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
8
8
|
import './mixins-f750863a.js';
|
|
9
|
-
import { G as GenericTableView } from './GenericTableView-
|
|
9
|
+
import { G as GenericTableView } from './GenericTableView-471a9386.js';
|
|
10
10
|
import { u as useRerenderListener, a as useRequestRerender } from './re-render-bf46ba54.js';
|
|
11
|
+
import { g as generateUserError, d as dropZoneColumnIndexes } from './useReferralTable-3aa4b527.js';
|
|
11
12
|
import { u as useChildElements } from './useChildElements-06937df7.js';
|
|
12
13
|
import { l as luxon } from './luxon-1be92a8e.js';
|
|
13
14
|
import { m as mockRewardData } from './mockRewardData-9b27d6f1.js';
|
|
14
|
-
import { g as generateUserError } from './useReferralTable-03d32c6f.js';
|
|
15
15
|
|
|
16
16
|
const debug = browser("sq:useRewardsTable");
|
|
17
17
|
const CSS_NAMESPACE = "sqm-rewards-table";
|
|
@@ -390,7 +390,12 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
|
|
|
390
390
|
setContent({ rows });
|
|
391
391
|
const columns = columnsPromise && (await Promise.all(columnsPromise));
|
|
392
392
|
// Set the content to render and finish loading components
|
|
393
|
-
setContent({
|
|
393
|
+
setContent({
|
|
394
|
+
columns,
|
|
395
|
+
dropZoneColumns: dropZoneColumnIndexes(columnComponents),
|
|
396
|
+
loading: false,
|
|
397
|
+
page: 0,
|
|
398
|
+
});
|
|
394
399
|
}
|
|
395
400
|
useEffect(() => {
|
|
396
401
|
setContent({ loading: true });
|
|
@@ -418,8 +423,7 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
|
|
|
418
423
|
smBreakpoint: 599,
|
|
419
424
|
},
|
|
420
425
|
elements: {
|
|
421
|
-
|
|
422
|
-
rows: content.rows,
|
|
426
|
+
...content,
|
|
423
427
|
emptyElement,
|
|
424
428
|
loadingElement,
|
|
425
429
|
},
|
|
@@ -13,7 +13,7 @@ import { b as PortalRegisterView, P as PortalForgotPasswordView, a as PortalLogi
|
|
|
13
13
|
import './AsYouType-2d56519e.js';
|
|
14
14
|
import { t as taxTypeToName, L as LoadingView, I as INDIRECT_TAX_SPAIN_REGIONS, a as INDIRECT_TAX_PROVINCES } from './subregions-810a5c2d.js';
|
|
15
15
|
import { P as PortalRegistrationFormView } from './sqm-portal-registration-form-view-79265df5.js';
|
|
16
|
-
import { G as GenericTableView } from './GenericTableView-
|
|
16
|
+
import { G as GenericTableView } from './GenericTableView-471a9386.js';
|
|
17
17
|
import './useChildElements-06937df7.js';
|
|
18
18
|
import { l as luxon } from './luxon-1be92a8e.js';
|
|
19
19
|
import { C as CloseButtonView } from './sqm-close-button-view-fd9012e7.js';
|