@nanoporetech-digital/components 3.4.0 → 3.5.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 +12 -0
- package/dist/cjs/index-41582c2a.js +16 -12
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-demo.cjs.entry.js +291 -0
- package/dist/cjs/nano-demo.cjs.entry.js.map +1 -0
- package/dist/cjs/{nano-table-b9cdafab.js → nano-table-83e46f68.js} +486 -202
- package/dist/cjs/nano-table-83e46f68.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-291904c9.js → table.worker-525ec230.js} +3 -3
- package/dist/cjs/table.worker-525ec230.js.map +1 -0
- package/dist/cjs/table.worker-e9fb087e.js +4 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/alert/alert.helpers.js.map +1 -1
- package/dist/collection/components/demo/demo.js +284 -0
- package/dist/collection/components/demo/demo.js.map +1 -0
- package/dist/collection/components/dialog/dialog.helpers.js.map +1 -1
- package/dist/collection/components/table/table-interface.js.map +1 -1
- package/dist/collection/components/table/table.cell.js +65 -0
- package/dist/collection/components/table/table.cell.js.map +1 -0
- package/dist/collection/components/table/table.css +98 -20
- package/dist/collection/components/table/table.header.js +156 -0
- package/dist/collection/components/table/table.header.js.map +1 -0
- package/dist/collection/components/table/table.js +170 -18
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/table/table.row.js +113 -0
- package/dist/collection/components/table/table.row.js.map +1 -0
- package/dist/collection/components/table/table.store.js +46 -9
- package/dist/collection/components/table/table.store.js.map +1 -1
- package/dist/collection/components/table/table.utils.js +230 -0
- package/dist/collection/components/table/table.utils.js.map +1 -1
- package/dist/collection/components/table/table.worker.js +1 -0
- package/dist/collection/components/table/table.worker.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/nano-demo.d.ts +11 -0
- package/dist/components/nano-demo.js +341 -0
- package/dist/components/nano-demo.js.map +1 -0
- package/dist/components/nano-table.js +2 -1247
- package/dist/components/nano-table.js.map +1 -1
- package/dist/components/table.js +1539 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/table.worker.js +2 -2
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +772 -204
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/index-3c280603.js +16 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-demo.entry.js +287 -0
- package/dist/esm/nano-demo.entry.js.map +1 -0
- package/dist/esm/{nano-table-c8ef2276.js → nano-table-e2405350.js} +487 -203
- package/dist/esm/nano-table-e2405350.js.map +1 -0
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-65438fa0.js → table.worker-739c193f.js} +3 -3
- package/dist/esm/table.worker-739c193f.js.map +1 -0
- package/dist/esm/table.worker-e9fb087e.js +4 -0
- package/dist/nano-components/index.esm.js.map +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-28fdfa6b.js +5 -0
- package/dist/nano-components/p-28fdfa6b.js.map +1 -0
- package/dist/nano-components/p-85cfb0af.entry.js +5 -0
- package/dist/nano-components/p-85cfb0af.entry.js.map +1 -0
- package/dist/nano-components/p-a71989f3.js +5 -0
- package/dist/nano-components/{p-14218d23.entry.js.map → p-a71989f3.js.map} +0 -0
- package/dist/nano-components/{p-14218d23.entry.js → p-e4a28360.entry.js} +2 -2
- package/dist/nano-components/{p-fe1f8360.js.map → p-e4a28360.entry.js.map} +0 -0
- package/dist/nano-components/p-e9fb087e.js +4 -0
- package/dist/types/components/alert/alert.helpers.d.ts +1 -1
- package/dist/types/components/demo/demo.d.ts +6 -0
- package/dist/types/components/dialog/dialog.helpers.d.ts +1 -1
- package/dist/types/components/table/table-interface.d.ts +38 -23
- package/dist/types/components/table/table.cell.d.ts +18 -0
- package/dist/types/components/table/table.d.ts +36 -1
- package/dist/types/components/table/table.header.d.ts +16 -0
- package/dist/types/components/table/table.row.d.ts +15 -0
- package/dist/types/components/table/table.utils.d.ts +99 -0
- package/dist/types/components.d.ts +50 -0
- package/docs-json.json +124 -3
- package/docs-vscode.json +17 -1
- package/package.json +2 -2
- package/dist/cjs/nano-table-b9cdafab.js.map +0 -1
- package/dist/cjs/table.worker-1fd13775.js +0 -4
- package/dist/cjs/table.worker-291904c9.js.map +0 -1
- package/dist/collection/components/table/table.children.js +0 -224
- package/dist/collection/components/table/table.children.js.map +0 -1
- package/dist/collection/components/table/table.service.js +0 -121
- package/dist/collection/components/table/table.service.js.map +0 -1
- package/dist/esm/nano-table-c8ef2276.js.map +0 -1
- package/dist/esm/table.worker-1fd13775.js +0 -4
- package/dist/esm/table.worker-65438fa0.js.map +0 -1
- package/dist/nano-components/p-1fd13775.js +0 -4
- package/dist/nano-components/p-f9349146.js +0 -5
- package/dist/nano-components/p-f9349146.js.map +0 -1
- package/dist/nano-components/p-fe1f8360.js +0 -5
- package/dist/types/components/table/table.children.d.ts +0 -30
- package/dist/types/components/table/table.service.d.ts +0 -42
@@ -0,0 +1,284 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import { Fragment, h, Host, } from '@stencil/core';
|
5
|
+
function capitalise(value) {
|
6
|
+
if (!value)
|
7
|
+
return '';
|
8
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
9
|
+
}
|
10
|
+
function mediumDate(date) {
|
11
|
+
if (!date)
|
12
|
+
return undefined;
|
13
|
+
return new Date(date).toLocaleDateString(undefined, {
|
14
|
+
year: 'numeric',
|
15
|
+
month: 'short',
|
16
|
+
day: 'numeric',
|
17
|
+
});
|
18
|
+
}
|
19
|
+
function currency(amount = 0, currencyCode = 'USD') {
|
20
|
+
currencyCode = currencyCode?.toLocaleUpperCase() || 'USD';
|
21
|
+
return new Intl.NumberFormat('en-US', {
|
22
|
+
style: 'currency',
|
23
|
+
currency: currencyCode,
|
24
|
+
}).format(amount);
|
25
|
+
}
|
26
|
+
export class Demo {
|
27
|
+
constructor() {
|
28
|
+
this.order = {
|
29
|
+
checks: [
|
30
|
+
{
|
31
|
+
name: 'Compliance',
|
32
|
+
external_id: 'CO',
|
33
|
+
status: 'complete',
|
34
|
+
account_info: {
|
35
|
+
name: 'Jeongmin Song',
|
36
|
+
email: 'js2957@cornell.edu',
|
37
|
+
address_line_1: '930 Campus Road',
|
38
|
+
address_line_2: 'Veterinary Medical Center C4 109',
|
39
|
+
address_postcode: '14853',
|
40
|
+
address_city: 'Ithaca',
|
41
|
+
address_region: 'New York',
|
42
|
+
address_country: 'US',
|
43
|
+
},
|
44
|
+
individual_name_compliance_information: {
|
45
|
+
table: {
|
46
|
+
names: [],
|
47
|
+
addresses: [],
|
48
|
+
match: false,
|
49
|
+
false_positive: null,
|
50
|
+
},
|
51
|
+
},
|
52
|
+
organization_compliance_information: {
|
53
|
+
table: {
|
54
|
+
names: [],
|
55
|
+
addresses: [],
|
56
|
+
match: false,
|
57
|
+
false_positive: null,
|
58
|
+
},
|
59
|
+
},
|
60
|
+
checks: [
|
61
|
+
{
|
62
|
+
label: 'Compliance check',
|
63
|
+
external_id: 'compliance_check',
|
64
|
+
item_type: 'pass/fail/escalate',
|
65
|
+
answer: 'pass',
|
66
|
+
},
|
67
|
+
],
|
68
|
+
further_information: [],
|
69
|
+
attachments: [],
|
70
|
+
notes: [],
|
71
|
+
},
|
72
|
+
],
|
73
|
+
orderId: '00886434',
|
74
|
+
createdAt: '2022-12-09T15:57:50',
|
75
|
+
updatedAt: '2022-12-09T16:02:29',
|
76
|
+
status: 'Processing',
|
77
|
+
subStatus: null,
|
78
|
+
currency: 'USD',
|
79
|
+
customerPaymentMethod: 'CC-USD',
|
80
|
+
paymentPlatform: 'Shop',
|
81
|
+
dataAreaId: 'OXUS',
|
82
|
+
defaultShippingWarehouse: null,
|
83
|
+
deliveryContact: 'Jeongmin Song',
|
84
|
+
deliveryMode: null,
|
85
|
+
deliveryName: 'Cornell University',
|
86
|
+
deliveryTerms: null,
|
87
|
+
invoiceAccountNumber: 'C038330',
|
88
|
+
orderAccountNumber: 'C038330',
|
89
|
+
orderAccountName: 'Cornell University',
|
90
|
+
originalLeadTime: null,
|
91
|
+
salesDate: '2022-12-09T15:57:50',
|
92
|
+
salesName: 'Cornell University',
|
93
|
+
salesOrigin: 'Shop',
|
94
|
+
salesOriginName: 'Main USD Store View',
|
95
|
+
customerReference: '',
|
96
|
+
purchaseOrder: null,
|
97
|
+
additionalDocuments: [],
|
98
|
+
total: 860,
|
99
|
+
shippingAmount: 50,
|
100
|
+
taxAmount: 0,
|
101
|
+
projectId: null,
|
102
|
+
deliveryPhoneNumber: '+16072533722',
|
103
|
+
invoicePhoneNumber: '+16072533722',
|
104
|
+
quoteNumber: null,
|
105
|
+
customerType: 'N/A',
|
106
|
+
invoiceAccountEmail: 'js2957@cornell.edu',
|
107
|
+
partnerReference: null,
|
108
|
+
sentToD365: false,
|
109
|
+
sentToD365Status: 'unsent',
|
110
|
+
orderAccountEmail: 'js2957@cornell.edu',
|
111
|
+
controllingAccountNumber: 'C038330',
|
112
|
+
controllingAccountEmail: 'js2957@cornell.edu',
|
113
|
+
deliveryAddress: {
|
114
|
+
street: ['930 Campus Road, Veterinary Medical Center C4 109'],
|
115
|
+
city: 'Ithaca',
|
116
|
+
postcode: '14853',
|
117
|
+
region: 'New York',
|
118
|
+
regionCode: 'NY',
|
119
|
+
countryCode: 'US',
|
120
|
+
},
|
121
|
+
invoiceAddress: {
|
122
|
+
street: ['930 Campus Road, Veterinary Medical Center C4 109'],
|
123
|
+
city: 'Ithaca',
|
124
|
+
postcode: '14853',
|
125
|
+
region: 'New York',
|
126
|
+
regionCode: 'NY',
|
127
|
+
countryCode: 'US',
|
128
|
+
},
|
129
|
+
shopOrderLines: [
|
130
|
+
{
|
131
|
+
name: 'Flongle Flow Cell (R9.4.1)',
|
132
|
+
sku: 'FLO-FLG001',
|
133
|
+
quantity: 1,
|
134
|
+
price: 810,
|
135
|
+
total: 810,
|
136
|
+
createdAt: '2022-12-09T15:57:50',
|
137
|
+
updatedAt: '2022-12-09T15:57:50',
|
138
|
+
maskSku: 'FLO-FLG001',
|
139
|
+
productType: 'bundle',
|
140
|
+
salesTag: 'FLGExpSP',
|
141
|
+
requestedShippingDate: null,
|
142
|
+
discount: 0,
|
143
|
+
discountPercentage: 0,
|
144
|
+
get finalSku() {
|
145
|
+
return this.maskSku || this.sku;
|
146
|
+
},
|
147
|
+
includedItems: [
|
148
|
+
{
|
149
|
+
name: 'Flongle Flow Cell (R9.4.1)',
|
150
|
+
sku: 'FLO-FLG001D',
|
151
|
+
quantity: 12,
|
152
|
+
price: 66,
|
153
|
+
total: 792,
|
154
|
+
createdAt: '2022-12-09T15:57:50',
|
155
|
+
updatedAt: '2022-12-09T15:57:50',
|
156
|
+
maskSku: 'FLO-FLG001',
|
157
|
+
productType: 'simple',
|
158
|
+
salesTag: 'FLGExpSP',
|
159
|
+
requestedShippingDate: '2022-12-27T00:00:00',
|
160
|
+
discount: 0,
|
161
|
+
discountPercentage: 0,
|
162
|
+
},
|
163
|
+
{
|
164
|
+
name: 'Flongle Flow Cell Priming Kit',
|
165
|
+
sku: 'EXP-FSE001',
|
166
|
+
quantity: 1,
|
167
|
+
price: 18,
|
168
|
+
total: 18,
|
169
|
+
createdAt: '2022-12-09T15:57:50',
|
170
|
+
updatedAt: '2022-12-09T15:57:50',
|
171
|
+
maskSku: '',
|
172
|
+
productType: 'simple',
|
173
|
+
salesTag: 'FLGExpSP',
|
174
|
+
requestedShippingDate: '2022-12-27T00:00:00',
|
175
|
+
discount: 0,
|
176
|
+
discountPercentage: 0,
|
177
|
+
},
|
178
|
+
],
|
179
|
+
},
|
180
|
+
{
|
181
|
+
name: 'Carriage - Device shipment',
|
182
|
+
sku: 'FREIGHT',
|
183
|
+
quantity: 1,
|
184
|
+
price: 50,
|
185
|
+
total: 50,
|
186
|
+
createdAt: '2022-12-09T15:57:50',
|
187
|
+
updatedAt: '2022-12-09T15:57:50',
|
188
|
+
maskSku: '',
|
189
|
+
productType: 'virtual',
|
190
|
+
salesTag: null,
|
191
|
+
requestedShippingDate: '2022-12-27T00:00:00',
|
192
|
+
discount: 0,
|
193
|
+
discountPercentage: 0,
|
194
|
+
get finalSku() {
|
195
|
+
return this.maskSku || this.sku;
|
196
|
+
},
|
197
|
+
},
|
198
|
+
],
|
199
|
+
orderLines: [],
|
200
|
+
pickedItems: [],
|
201
|
+
packedItems: [],
|
202
|
+
trackingNumbers: [],
|
203
|
+
trackingUpdates: [],
|
204
|
+
ecoOrder: false,
|
205
|
+
revenueOrder: false,
|
206
|
+
};
|
207
|
+
}
|
208
|
+
lineItemTotal(order) {
|
209
|
+
if (!order || !order.shopOrderLines?.length)
|
210
|
+
return;
|
211
|
+
let total = 0;
|
212
|
+
order.shopOrderLines.forEach((itm) => {
|
213
|
+
if (itm.status !== 'cancelled')
|
214
|
+
total += itm.total;
|
215
|
+
});
|
216
|
+
return total;
|
217
|
+
}
|
218
|
+
render() {
|
219
|
+
return (h(Host, null, h("nano-table", { rowRender: {
|
220
|
+
template: (_, c, TableCell) => [
|
221
|
+
c.renderedRow,
|
222
|
+
c.row.includedItems?.length ? (c.row.includedItems?.map((item) => {
|
223
|
+
return (h("tr", { class: "child-row" }, h(TableCell, { header: true }, item.name), h(TableCell, null, capitalise(c.row.status || this.order.status)), h(TableCell, null, capitalise(item.sku)), h(TableCell, null, capitalise(item.salesTag)), h(TableCell, null, mediumDate(item.requestedShippingDate))));
|
224
|
+
})) : (h(Fragment, null)),
|
225
|
+
].flat(1),
|
226
|
+
}, columns: [
|
227
|
+
{
|
228
|
+
title: 'Name',
|
229
|
+
prop: 'name',
|
230
|
+
pinned: 'start',
|
231
|
+
rowHeader: true,
|
232
|
+
},
|
233
|
+
{
|
234
|
+
title: 'Status',
|
235
|
+
prop: 'status',
|
236
|
+
cellTemplate: (_, c) => capitalise(c.cellModel || this.order.status),
|
237
|
+
},
|
238
|
+
{
|
239
|
+
title: 'SKU',
|
240
|
+
prop: 'finalSku',
|
241
|
+
},
|
242
|
+
{
|
243
|
+
title: 'Sales tag',
|
244
|
+
prop: 'salesTag',
|
245
|
+
cellTemplate: (_, c) => c.cellModel || 'None',
|
246
|
+
},
|
247
|
+
{
|
248
|
+
title: 'Requested ship date',
|
249
|
+
prop: 'requestedShippingDate',
|
250
|
+
cellTemplate: (_, c) => mediumDate(c.cellModel) || 'N/A',
|
251
|
+
},
|
252
|
+
{
|
253
|
+
title: 'Quantity',
|
254
|
+
prop: 'quantity',
|
255
|
+
},
|
256
|
+
{
|
257
|
+
title: 'Unit price',
|
258
|
+
prop: 'price',
|
259
|
+
cellTemplate: (_, c) => currency(c.cellModel, this.order.currency),
|
260
|
+
},
|
261
|
+
{
|
262
|
+
title: 'Discount %',
|
263
|
+
prop: 'discountPercentage',
|
264
|
+
cellTemplate: (_, c) => c.cellModel || 0,
|
265
|
+
},
|
266
|
+
{
|
267
|
+
title: 'Line value',
|
268
|
+
prop: 'total',
|
269
|
+
cellTemplate: (_, c) => currency(c.cellModel, this.order.currency),
|
270
|
+
},
|
271
|
+
], rows: this.order.shopOrderLines, caption: `List of order line items found within order ${this.order.orderId}`, showFooter: true, footRender: {
|
272
|
+
pinned: 'bottom',
|
273
|
+
template: () => [
|
274
|
+
h("tr", null, h("td", { colSpan: 6 }, "\u00A0"), h("th", { scope: "row", class: "tbl__pin nano-tbl__pin--end", colSpan: 3 }, h("div", { class: "nano-tbl__cell-content order-lines__total" }, h("span", { class: "order-lines__total--label" }, "Sub total:"), h("span", { class: "order-lines__total--num" }, currency(this.lineItemTotal(this.order), this.order.currency))))),
|
275
|
+
h("tr", null, h("td", { colSpan: 6 }, "\u00A0"), h("th", { scope: "row", class: "tbl__pin nano-tbl__pin--end", colSpan: 3 }, h("div", { class: "nano-tbl__cell-content order-lines__total" }, h("span", { class: "order-lines__total--label" }, "Total order tax:"), h("span", { class: "order-lines__total--num" }, currency(this.order.taxAmount, this.order.currency))))),
|
276
|
+
h("tr", null, h("td", { colSpan: 6 }, "\u00A0"), h("th", { scope: "row", class: "tbl__pin nano-tbl__pin--end", colSpan: 3 }, h("div", { class: "nano-tbl__cell-content order-lines__total" }, h("span", { class: "order-lines__total--label" }, "Total on order placement:"), h("span", { class: "order-lines__total--num" }, currency(this.order.total, this.order.currency))))),
|
277
|
+
],
|
278
|
+
} })));
|
279
|
+
}
|
280
|
+
static get is() { return "nano-demo"; }
|
281
|
+
static get encapsulation() { return "shadow"; }
|
282
|
+
static get styles() { return ":host {display: block}\n .child-row {\n opacity: .8;\n font-style: italic;\n }"; }
|
283
|
+
}
|
284
|
+
//# sourceMappingURL=demo.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"demo.js","sourceRoot":"","sources":["../../../src/components/demo/demo.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,QAAQ,EACR,CAAC,EACD,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,SAAS,UAAU,CAAC,KAAa;EAC/B,IAAI,CAAC,KAAK;IAAE,OAAO,EAAE,CAAC;EACtB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,UAAU,CAAC,IAAU;EAC5B,IAAI,CAAC,IAAI;IAAE,OAAO,SAAS,CAAC;EAC5B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;IAClD,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,SAAS;GACf,CAAC,CAA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ACF;YACL;cACE,UAAI,OAAO,EAAE,CAAC,aAAa;cAC3B,UAAI,KAAK,EAAC,KAAK,EAAC,KAAK,EAAC,6BAA6B,EAAC,OAAO,EAAE,CAAC;gBAC5D,WAAK,KAAK,EAAC,2CAA2C;kBACpD,YAAM,KAAK,EAAC,2BAA2B,uBAEhC;kBACP,YAAM,KAAK,EAAC,yBAAyB,IAClC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC/C,CACH,CACH,CACF;YACL;cACE,UAAI,OAAO,EAAE,CAAC,aAAa;cAC3B,UAAI,KAAK,EAAC,KAAK,EAAC,KAAK,EAAC,6BAA6B,EAAC,OAAO,EAAE,CAAC;gBAC5D,WAAK,KAAK,EAAC,2CAA2C;kBACpD,YAAM,KAAK,EAAC,2BAA2B,gCAEhC;kBACP,YAAM,KAAK,EAAC,yBAAyB,IAClC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC3C,CACH,CACH,CACF;WACN;SACF,GACD,CACG,CACR,CAAC;EACJ,CAAC;;;;CACF","sourcesContent":["import {\n Component,\n ComponentInterface,\n Fragment,\n h,\n Host,\n} from '@stencil/core';\n\nfunction capitalise(value: string) {\n if (!value) return '';\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\n\nfunction mediumDate(date: Date) {\n if (!date) return undefined;\n return new Date(date).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n}\n\nfunction currency(amount: number = 0, currencyCode: string = 'USD') {\n currencyCode = currencyCode?.toLocaleUpperCase() || 'USD';\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: currencyCode,\n }).format(amount);\n}\n\n@Component({\n tag: 'nano-demo',\n shadow: true,\n styles: /* css */ `\n :host {display: block}\n .child-row {\n opacity: .8;\n font-style: italic;\n }\n `,\n})\nexport class Demo implements ComponentInterface {\n private order = {\n checks: [\n {\n name: 'Compliance',\n external_id: 'CO',\n status: 'complete',\n account_info: {\n name: 'Jeongmin Song',\n email: 'js2957@cornell.edu',\n address_line_1: '930 Campus Road',\n address_line_2: 'Veterinary Medical Center C4 109',\n address_postcode: '14853',\n address_city: 'Ithaca',\n address_region: 'New York',\n address_country: 'US',\n },\n individual_name_compliance_information: {\n table: {\n names: [],\n addresses: [],\n match: false,\n false_positive: null,\n },\n },\n organization_compliance_information: {\n table: {\n names: [],\n addresses: [],\n match: false,\n false_positive: null,\n },\n },\n checks: [\n {\n label: 'Compliance check',\n external_id: 'compliance_check',\n item_type: 'pass/fail/escalate',\n answer: 'pass',\n },\n ],\n further_information: [],\n attachments: [],\n notes: [],\n },\n ],\n orderId: '00886434',\n createdAt: '2022-12-09T15:57:50',\n updatedAt: '2022-12-09T16:02:29',\n status: 'Processing',\n subStatus: null,\n currency: 'USD',\n customerPaymentMethod: 'CC-USD',\n paymentPlatform: 'Shop',\n dataAreaId: 'OXUS',\n defaultShippingWarehouse: null,\n deliveryContact: 'Jeongmin Song',\n deliveryMode: null,\n deliveryName: 'Cornell University',\n deliveryTerms: null,\n invoiceAccountNumber: 'C038330',\n orderAccountNumber: 'C038330',\n orderAccountName: 'Cornell University',\n originalLeadTime: null,\n salesDate: '2022-12-09T15:57:50',\n salesName: 'Cornell University',\n salesOrigin: 'Shop',\n salesOriginName: 'Main USD Store View',\n customerReference: '',\n purchaseOrder: null,\n additionalDocuments: [],\n total: 860,\n shippingAmount: 50,\n taxAmount: 0,\n projectId: null,\n deliveryPhoneNumber: '+16072533722',\n invoicePhoneNumber: '+16072533722',\n quoteNumber: null,\n customerType: 'N/A',\n invoiceAccountEmail: 'js2957@cornell.edu',\n partnerReference: null,\n sentToD365: false,\n sentToD365Status: 'unsent',\n orderAccountEmail: 'js2957@cornell.edu',\n controllingAccountNumber: 'C038330',\n controllingAccountEmail: 'js2957@cornell.edu',\n deliveryAddress: {\n street: ['930 Campus Road, Veterinary Medical Center C4 109'],\n city: 'Ithaca',\n postcode: '14853',\n region: 'New York',\n regionCode: 'NY',\n countryCode: 'US',\n },\n invoiceAddress: {\n street: ['930 Campus Road, Veterinary Medical Center C4 109'],\n city: 'Ithaca',\n postcode: '14853',\n region: 'New York',\n regionCode: 'NY',\n countryCode: 'US',\n },\n shopOrderLines: [\n {\n name: 'Flongle Flow Cell (R9.4.1)',\n sku: 'FLO-FLG001',\n quantity: 1,\n price: 810,\n total: 810,\n createdAt: '2022-12-09T15:57:50',\n updatedAt: '2022-12-09T15:57:50',\n maskSku: 'FLO-FLG001',\n productType: 'bundle',\n salesTag: 'FLGExpSP',\n requestedShippingDate: null,\n discount: 0,\n discountPercentage: 0,\n get finalSku() {\n return this.maskSku || this.sku;\n },\n includedItems: [\n {\n name: 'Flongle Flow Cell (R9.4.1)',\n sku: 'FLO-FLG001D',\n quantity: 12,\n price: 66,\n total: 792,\n createdAt: '2022-12-09T15:57:50',\n updatedAt: '2022-12-09T15:57:50',\n maskSku: 'FLO-FLG001',\n productType: 'simple',\n salesTag: 'FLGExpSP',\n requestedShippingDate: '2022-12-27T00:00:00',\n discount: 0,\n discountPercentage: 0,\n },\n {\n name: 'Flongle Flow Cell Priming Kit',\n sku: 'EXP-FSE001',\n quantity: 1,\n price: 18,\n total: 18,\n createdAt: '2022-12-09T15:57:50',\n updatedAt: '2022-12-09T15:57:50',\n maskSku: '',\n productType: 'simple',\n salesTag: 'FLGExpSP',\n requestedShippingDate: '2022-12-27T00:00:00',\n discount: 0,\n discountPercentage: 0,\n },\n ],\n },\n {\n name: 'Carriage - Device shipment',\n sku: 'FREIGHT',\n quantity: 1,\n price: 50,\n total: 50,\n createdAt: '2022-12-09T15:57:50',\n updatedAt: '2022-12-09T15:57:50',\n maskSku: '',\n productType: 'virtual',\n salesTag: null,\n requestedShippingDate: '2022-12-27T00:00:00',\n discount: 0,\n discountPercentage: 0,\n get finalSku() {\n return this.maskSku || this.sku;\n },\n },\n ],\n orderLines: [],\n pickedItems: [],\n packedItems: [],\n trackingNumbers: [],\n trackingUpdates: [],\n ecoOrder: false,\n revenueOrder: false,\n };\n\n private lineItemTotal(order) {\n if (!order || !order.shopOrderLines?.length) return;\n let total = 0;\n order.shopOrderLines.forEach((itm) => {\n if (itm.status !== 'cancelled') total += itm.total;\n });\n return total;\n }\n\n render() {\n return (\n <Host>\n <nano-table\n rowRender={{\n template: (_, c, TableCell) =>\n [\n c.renderedRow,\n c.row.includedItems?.length ? (\n c.row.includedItems?.map((item) => {\n return (\n <tr class=\"child-row\">\n <TableCell header={true}>{item.name}</TableCell>\n <TableCell>\n {capitalise(c.row.status || this.order.status)}\n </TableCell>\n <TableCell>{capitalise(item.sku)}</TableCell>\n <TableCell>{capitalise(item.salesTag)}</TableCell>\n <TableCell>\n {mediumDate(item.requestedShippingDate)}\n </TableCell>\n </tr>\n );\n })\n ) : (\n <Fragment />\n ),\n ].flat(1),\n }}\n columns={[\n {\n title: 'Name',\n prop: 'name',\n pinned: 'start',\n rowHeader: true,\n },\n {\n title: 'Status',\n prop: 'status',\n cellTemplate: (_, c) =>\n capitalise(c.cellModel || this.order.status),\n },\n {\n title: 'SKU',\n prop: 'finalSku',\n },\n {\n title: 'Sales tag',\n prop: 'salesTag',\n cellTemplate: (_, c) => c.cellModel || 'None',\n },\n {\n title: 'Requested ship date',\n prop: 'requestedShippingDate',\n cellTemplate: (_, c) => mediumDate(c.cellModel) || 'N/A',\n },\n {\n title: 'Quantity',\n prop: 'quantity',\n },\n {\n title: 'Unit price',\n prop: 'price',\n cellTemplate: (_, c) =>\n currency(c.cellModel, this.order.currency),\n },\n {\n title: 'Discount %',\n prop: 'discountPercentage',\n cellTemplate: (_, c) => c.cellModel || 0,\n },\n {\n title: 'Line value',\n prop: 'total',\n cellTemplate: (_, c) =>\n currency(c.cellModel, this.order.currency),\n },\n ]}\n rows={this.order.shopOrderLines}\n caption={`List of order line items found within order ${this.order.orderId}`}\n showFooter={true}\n footRender={{\n pinned: 'bottom',\n template: () => [\n <tr>\n <td colSpan={6}> </td>\n <th scope=\"row\" class=\"tbl__pin nano-tbl__pin--end\" colSpan={3}>\n <div class=\"nano-tbl__cell-content order-lines__total\">\n <span class=\"order-lines__total--label\">Sub total:</span>\n <span class=\"order-lines__total--num\">\n {currency(\n this.lineItemTotal(this.order),\n this.order.currency\n )}\n </span>\n </div>\n </th>\n </tr>,\n <tr>\n <td colSpan={6}> </td>\n <th scope=\"row\" class=\"tbl__pin nano-tbl__pin--end\" colSpan={3}>\n <div class=\"nano-tbl__cell-content order-lines__total\">\n <span class=\"order-lines__total--label\">\n Total order tax:\n </span>\n <span class=\"order-lines__total--num\">\n {currency(this.order.taxAmount, this.order.currency)}\n </span>\n </div>\n </th>\n </tr>,\n <tr>\n <td colSpan={6}> </td>\n <th scope=\"row\" class=\"tbl__pin nano-tbl__pin--end\" colSpan={3}>\n <div class=\"nano-tbl__cell-content order-lines__total\">\n <span class=\"order-lines__total--label\">\n Total on order placement:\n </span>\n <span class=\"order-lines__total--num\">\n {currency(this.order.total, this.order.currency)}\n </span>\n </div>\n </th>\n </tr>,\n ],\n }}\n />\n </Host>\n );\n }\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dialog.helpers.js","sourceRoot":"","sources":["../../../src/components/dialog/dialog.helpers.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,
|
1
|
+
{"version":3,"file":"dialog.helpers.js","sourceRoot":"","sources":["../../../src/components/dialog/dialog.helpers.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,UAAuE,EAAE,EACzE,aAAuC;EAEvC,MAAM,IAAI,GAA4B;IACpC,aAAa,EAAE,KAAK;IACpB,KAAK,EAAE,QAAQ;IACf,GAAG,aAAa;GACjB,CAAC;EACF,MAAM,MAAM,GAA0B,MAAM,CAAC,MAAM,CACjD,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,EACrC;IACE,GAAG,IAAI;IACP,IAAI,EAAE,KAAK;IACX,SAAS,EAAE;QACT,IAAI;QAEJ,OAAO,CAAC,MAAM;MACZ,CAAC,CAAC,OAAO;SACJ,GAAG,CACF,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CACT,qBAAqB,CAAC,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,GAAG,CAAC,OAAO,WAAW,CAChG;SACA,IAAI,CAAC,EAAE,CAAC;MACb,CAAC,CAAC,EACN,EAAE;GACH,CACF,CAAC;EAEF,IAAI,OAAO,CAAC,MAAM,EAAE;IAClB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAC9D,CAAC,GAAgB,EAAE,EAAE;MACnB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAC3B,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;MACF,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE;QAChC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;OACjD;IACH,CAAC,CACF,CAAC;GACH;EAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;EAClC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["interface ImperativeDialogOptions {\n noUserDismiss: boolean;\n noHeader?: boolean;\n noFooter?: boolean;\n label: string;\n}\n/**\n * `nano-dialog` helper to create dialog modals imperatively.\n * @param body - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param dialogOptions - { noUserDismiss: boolean, noHeader?: boolean, noFooter?: boolean, label: string }\n * @returns `Promise<void>`\n */\nexport function nanoCreateDialog(\n body: string,\n buttons: { classes: string; content: string; handler: () => void }[] = [],\n dialogOptions?: ImperativeDialogOptions\n) {\n const opts: ImperativeDialogOptions = {\n noUserDismiss: false,\n label: 'Dialog',\n ...dialogOptions,\n };\n const dialog: HTMLNanoDialogElement = Object.assign(\n document.createElement('nano-dialog'),\n {\n ...opts,\n open: false,\n innerHTML: `\n ${body}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`,\n }\n );\n\n if (buttons.length) {\n Array.from(dialog.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n\n document.body.appendChild(dialog);\n return dialog;\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table-interface.js","sourceRoot":"","sources":["../../../src/components/table/table-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type { VNode } from '@stencil/core';\n\nexport declare namespace TableTypes {\n /** The column property */\n type ColumnProp = string | number;\n\n /** Possible positions. Horizontally means l/r. Vertically means top/bottom */\n type Position = 'start' | 'end' | 'top' | 'bottom';\n\n /** A function to assess whether a rendered row will be pinned to the top or bottom */\n type PinFunc = (props?: RowDataSchemaModel) => Position;\n\n /** Potential column ordering options */\n type Order = 'asc' | 'desc' | undefined;\n\n /** Column filtering */\n interface Filter {\n prop: TableTypes.Prop;\n filter: string;\n }\n\n /** Column sorting */\n interface Sort {\n prop: TableTypes.Prop;\n order: TableTypes.Order;\n }\n\n /** Potential html properties which can be passed to a
|
1
|
+
{"version":3,"file":"table-interface.js","sourceRoot":"","sources":["../../../src/components/table/table-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type { JSXBase } from '@stencil/core/internal';\nimport type { VNode, FunctionalComponent } from '@stencil/core';\n\nexport declare namespace TableTypes {\n /** The column property */\n type ColumnProp = string | number;\n\n /** Possible positions. Horizontally means l/r. Vertically means top/bottom */\n type Position = 'start' | 'end' | 'top' | 'bottom';\n\n /** A function to assess whether a rendered row will be pinned to the top or bottom */\n type PinFunc = (props?: RowDataSchemaModel) => Position;\n\n /** Function called, via intersection observer, when an element's pinned status changes */\n type PinnedCb = (positions: { [key in Position]?: boolean }) => void;\n\n /** Potential column ordering options */\n type Order = 'asc' | 'desc' | undefined;\n\n /** Column filtering */\n interface Filter {\n prop: TableTypes.Prop;\n filter: string;\n }\n\n /** Column sorting */\n interface Sort {\n prop: TableTypes.Prop;\n order: TableTypes.Order;\n }\n\n /** Potential html properties which can be passed to a cell or column */\n type CellProps = JSXBase.ThHTMLAttributes<HTMLTableCellElement>;\n\n /** Potential html properties which can be passed to a row */\n type RowProps = JSXBase.HTMLAttributes<HTMLTableRowElement>;\n\n /** data model passed to cell rendering functions */\n interface ColumnDataSchemaModel {\n /** The column property being iterated over */\n prop: ColumnProp;\n /** The data for this cell */\n cellModel: any;\n /** The column config object */\n column: ColumnConfig;\n /** The row index currently being iterated over */\n rowIndex: number;\n /** The row model currently being iterated over */\n rowModel: any;\n }\n\n /** data model passed to row rendering functions */\n interface RowDataSchemaModel {\n /** the current data row model being iterated over */\n row?: RowData;\n /** the current data row index */\n rowIndex?: number;\n /** The row being rendered. You *must* nest this in your render function otherwise it will not be shown */\n renderedRow?: VNode;\n }\n\n /** A JSX `createElement` function passed to rendering functions.\n * You can use this to create markup outside of JSX environments\n * e.g. https://reactjs.org/docs/react-without-jsx.html */\n interface HFunc<T> {\n (tag: any): T;\n }\n interface HFunc<T> {\n (tag: any, data: any): T;\n }\n interface HFunc<T> {\n (tag: any, text: string): T;\n }\n interface HFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, text: string): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, children: T): T;\n }\n\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row\n **/\n type RowTemplateFunc<T> = (\n /** use this to create markup outside of JSX environments\n * e.g. https://reactjs.org/docs/react-without-jsx.html */\n createElement: HFunc<T>,\n /** data passed to each template */\n props: RowDataSchemaModel,\n /** a helper template to minimise boilerplate.\n * A shortcut for `<td><div class=\"nano-tbl__cell-content\"></div></td>` */\n TableCell: FunctionalComponent<{ header?: boolean }>\n ) => T | undefined;\n\n /**\n * A cell render function, called during any cell's render to the dom.\n * It can be used to add any markup within a table cell.\n */\n type CellTemplateFunc<T> = (\n createElement: HFunc<T>,\n props: ColumnDataSchemaModel\n ) => T | string | undefined;\n\n /**\n * A table header render function, called during any column's render to the dom.\n * It can be used to add any markup within a table header `th`.\n */\n type ColumnTemplateFunc<T> = (\n createElement: HFunc<T>,\n col: ColumnConfig\n ) => T | string | undefined;\n\n /** A function used to assess the order of any given column.\n * e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\n */\n type ColSortComparator = (\n prop: keyof RowData,\n order: Order\n ) => (a: RowData, b: RowData) => number;\n\n /** A function which can be used to apply any html attribute/s onto a table cell `td` */\n type PropertiesFunc = (\n props: ColumnDataSchemaModel\n ) => CellProps | void | undefined;\n\n /** A function which can be used to apply any html attribute/s onto a table head `th` */\n type ColPropertiesFunc = (\n props: ColumnConfig\n ) => CellProps | void | undefined;\n\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n type RowPropertiesFunc = (\n props: RowDataSchemaModel\n ) => RowProps | void | undefined;\n\n /** An individual table cell's data */\n type RowData = {\n [key: string | number]: any;\n __uuid?: string | number;\n __index?: number;\n };\n\n /** A data property */\n type Prop = keyof TableTypes.RowData;\n\n /** Valid column data types */\n type ColumnType = 'text' | 'string' | 'number' | 'date' | 'unknown';\n\n /**\n * A table column's configuration\n */\n interface ColumnConfig<T = RowData> {\n /** The title of the column. Displayed in the table header `th` */\n title: string;\n /** The row's data property to retrieve per cell render */\n prop: keyof T;\n /** The type of data. Will affect how it is sorted and the available\n * filter operations ('text' uses browser locale to compare).\n * If none supplied, it will be derived by default using the first row of data retrieved. */\n type?: ColumnType;\n /** Whether this column is horizontally pinned to viewport */\n pinned?: Position;\n /** Whether this column is a row header; the cell will render a `th` not a `td` */\n rowHeader?: boolean;\n /** Whether this column can be sorted. Defaults to true */\n sortable?: boolean;\n /** Current order of this column */\n order?: Order;\n /** Whether to include this column when doing a general search. Defaults to true */\n searchable?: boolean;\n /** Current filters applied to this column */\n filter?: string;\n /** Whether this column can be dragged to change column order */\n draggable?: boolean;\n /**\n * A cell render function, called during any cell's render to the dom.\n * It can be used to add any markup within a table cell.\n */\n cellTemplate?: CellTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table cell `td` */\n cellProperties?: PropertiesFunc;\n /**\n * A table header render function, called during any column's render to the dom.\n * It can be used to add any markup within a table header `th`.\n */\n colTemplate?: ColumnTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table head `th` */\n columnProperties?: ColPropertiesFunc;\n /** A custom sorting comparator function - assess the order of any given column.\n * e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort */\n sortCompareFn?: ColSortComparator | string;\n }\n\n /**\n * Row renderer property. Called during the rendering of any table row\n * controlling it's visual state.\n */\n interface RowRenderer {\n /** Function to decide whether the row is vertically pinned. */\n pinned?: PinFunc;\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row\n **/\n template?: RowTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n rowProperties?: RowPropertiesFunc;\n }\n\n /**\n * Row renderer property. Called during the rendering of a tables head and foot\n * controlling their visual state.\n */\n interface HeadFootRenderer {\n /** Function to decide whether the row is vertically pinned. Defaults to `start` for the header and `end` the footer */\n pinned: Position;\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row.\n * If used, and you want to see the rendered row, you *must* nest it within your\n * jsx function e.g. `(h, props) => { return [props.renderedRow, <tr><td>Custom thing</td></tr>]}`\n **/\n template?: RowTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n rowProperties?: () => RowProps | void | undefined;\n }\n\n type TBody = {\n rows: TableTypes.NanoTable['rows'];\n __uuid: string | number;\n };\n\n class NanoTable<T = RowData> {\n rows: T[];\n columns: ColumnConfig<T>[];\n }\n}\n"]}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import { Fragment, h } from '@stencil/core';
|
5
|
+
import { CSSNAMESPACE } from './table.constants';
|
6
|
+
import { classListToStr, colDataModel, fetchStores, mergeCellProperties, } from './table.utils';
|
7
|
+
// TABLE CELL
|
8
|
+
// (tbody > tr > td, tbody > tr > th)
|
9
|
+
/**
|
10
|
+
* Renders a cell using a custom renderer if set.
|
11
|
+
* @param rowIndex - the current row index being rendered
|
12
|
+
* @param colIndex - the current column index being rendered
|
13
|
+
* @returns - a JSX node
|
14
|
+
*/
|
15
|
+
export function cellRender(rowIndex, colIndex) {
|
16
|
+
const store = fetchStores();
|
17
|
+
const columns = store.config.state.columns;
|
18
|
+
const tpl = columns[colIndex]?.cellTemplate;
|
19
|
+
const model = colDataModel(rowIndex, colIndex);
|
20
|
+
if (!!model.cellModel && columns[colIndex].type === 'date') {
|
21
|
+
const d = new Date(model.cellModel);
|
22
|
+
if (d instanceof Date && !isNaN(d)) {
|
23
|
+
model.cellModel = !tpl
|
24
|
+
? `${new Date(model.cellModel).toLocaleDateString()} ${new Date(model.cellModel).toLocaleTimeString()}`
|
25
|
+
: d;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
return tpl ? (tpl(h, model)) : (h(Fragment, null, model.cellModel?.toString()));
|
29
|
+
}
|
30
|
+
export const baseCellClasses = (colIndex, toString = false) => {
|
31
|
+
const store = fetchStores();
|
32
|
+
const column = store.config.state.columns[colIndex];
|
33
|
+
const classes = {
|
34
|
+
[`${CSSNAMESPACE}__td`]: true,
|
35
|
+
[`${CSSNAMESPACE}__ordered`]: !!column.order,
|
36
|
+
[`${CSSNAMESPACE}__pin`]: !!column.pinned,
|
37
|
+
[`${CSSNAMESPACE}__pin--start`]: column.pinned === 'start',
|
38
|
+
[`${CSSNAMESPACE}__pin--end`]: column.pinned === 'end',
|
39
|
+
};
|
40
|
+
if (toString)
|
41
|
+
return classListToStr(classes);
|
42
|
+
return classes;
|
43
|
+
};
|
44
|
+
export const TableCell = ({ rowIndex, colIndex, nestedContent, }) => {
|
45
|
+
const content = nestedContent || cellRender(rowIndex, colIndex);
|
46
|
+
if (!content)
|
47
|
+
return h(Fragment, null);
|
48
|
+
let CellType = 'td';
|
49
|
+
const store = fetchStores();
|
50
|
+
const column = store.config.state.columns[colIndex];
|
51
|
+
let props = mergeCellProperties(rowIndex, colIndex, {
|
52
|
+
class: baseCellClasses(colIndex),
|
53
|
+
});
|
54
|
+
if (column.rowHeader) {
|
55
|
+
props =
|
56
|
+
Number(props.rowSpan) > 1
|
57
|
+
? { ...props, scope: 'rowgroup' }
|
58
|
+
: { ...props, scope: 'row' };
|
59
|
+
CellType = 'th';
|
60
|
+
}
|
61
|
+
return (h(CellType
|
62
|
+
// role="gridcell"
|
63
|
+
, { ...props }, h("div", { class: `${CSSNAMESPACE}__cell-content` }, content)));
|
64
|
+
};
|
65
|
+
//# sourceMappingURL=table.cell.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"table.cell.js","sourceRoot":"","sources":["../../../src/components/table/table.cell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,CAAC,EAAS,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL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GAAG,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE;QACjC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACjC,QAAQ,GAAG,IAAI,CAAC;GACjB;EAED,OAAO,CACL,EAAC,QAAQ;EACP,kBAAkB;SACd,KAAK;IAET,WAAK,KAAK,EAAE,GAAG,YAAY,gBAAgB,IAAG,OAAO,CAAO,CACnD,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Fragment, FunctionalComponent, h, VNode } from '@stencil/core';\nimport { CSSNAMESPACE } from './table.constants';\nimport {\n classListToStr,\n colDataModel,\n fetchStores,\n mergeCellProperties,\n} from './table.utils';\nimport type { TableTypes } from '../../interface';\n\n// TABLE CELL\n// (tbody > tr > td, tbody > tr > th)\n\n/**\n * Renders a cell using a custom renderer if set.\n * @param rowIndex - the current row index being rendered\n * @param colIndex - the current column index being rendered\n * @returns - a JSX node\n */\nexport function cellRender(rowIndex: number, colIndex: number): VNode {\n const store = fetchStores();\n const columns = store.config.state.columns;\n const tpl = columns[colIndex]?.cellTemplate;\n const model = colDataModel(rowIndex, colIndex);\n\n if (!!model.cellModel && columns[colIndex].type === 'date') {\n const d = new Date(model.cellModel);\n if (d instanceof Date && !isNaN(d as any)) {\n model.cellModel = !tpl\n ? `${new Date(model.cellModel).toLocaleDateString()} ${new Date(\n model.cellModel\n ).toLocaleTimeString()}`\n : d;\n }\n }\n\n return tpl ? (\n tpl(h as unknown as TableTypes.HFunc<VNode>, model)\n ) : (\n <Fragment>{model.cellModel?.toString()}</Fragment>\n );\n}\n\nexport const baseCellClasses = (\n colIndex: number,\n toString: boolean = false\n) => {\n const store = fetchStores();\n const column = store.config.state.columns[colIndex];\n\n const classes = {\n [`${CSSNAMESPACE}__td`]: true,\n [`${CSSNAMESPACE}__ordered`]: !!column.order,\n [`${CSSNAMESPACE}__pin`]: !!column.pinned,\n [`${CSSNAMESPACE}__pin--start`]: column.pinned === 'start',\n [`${CSSNAMESPACE}__pin--end`]: column.pinned === 'end',\n };\n\n if (toString) return classListToStr(classes);\n return classes;\n};\n\ntype TableCellProps = {\n rowIndex: number;\n colIndex: number;\n nestedContent?: VNode;\n};\n\nexport const TableCell: FunctionalComponent<TableCellProps> = ({\n rowIndex,\n colIndex,\n nestedContent,\n}) => {\n const content = nestedContent || cellRender(rowIndex, colIndex);\n if (!content) return <Fragment></Fragment>;\n\n let CellType = 'td';\n const store = fetchStores();\n const column = store.config.state.columns[colIndex];\n let props = mergeCellProperties(rowIndex, colIndex, {\n class: baseCellClasses(colIndex),\n });\n\n if (column.rowHeader) {\n props =\n Number((props as TableTypes.CellProps).rowSpan) > 1\n ? { ...props, scope: 'rowgroup' }\n : { ...props, scope: 'row' };\n CellType = 'th';\n }\n\n return (\n <CellType\n // role=\"gridcell\"\n {...props}\n >\n <div class={`${CSSNAMESPACE}__cell-content`}>{content}</div>\n </CellType>\n );\n};\n"]}
|