@nyaruka/temba-components 0.29.3 → 0.30.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 +8 -0
- package/dist/{a439f561.js → dd72d92e.js} +256 -71
- package/dist/index.js +256 -71
- package/dist/static/icons/symbol-defs.svg +10 -20
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/templates/components-body.html +1 -1
- package/dist/templates/components-head.html +1 -1
- package/out-tsc/src/contacts/ContactName.js +19 -16
- package/out-tsc/src/contacts/ContactName.js.map +1 -1
- package/out-tsc/src/contacts/ContactNameFetch.js +36 -0
- package/out-tsc/src/contacts/ContactNameFetch.js.map +1 -0
- package/out-tsc/src/contacts/ContactUrn.js +12 -1
- package/out-tsc/src/contacts/ContactUrn.js.map +1 -1
- package/out-tsc/src/flow/FlowStoreElement.js +43 -0
- package/out-tsc/src/flow/FlowStoreElement.js.map +1 -0
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/list/RunList.js +317 -0
- package/out-tsc/src/list/RunList.js.map +1 -0
- package/out-tsc/src/list/TembaList.js +38 -14
- package/out-tsc/src/list/TembaList.js.map +1 -1
- package/out-tsc/src/options/Options.js +18 -2
- package/out-tsc/src/options/Options.js.map +1 -1
- package/out-tsc/src/store/Store.js +13 -3
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/src/tabpane/TabPane.js +3 -1
- package/out-tsc/src/tabpane/TabPane.js.map +1 -1
- package/out-tsc/src/utils/index.js +1 -0
- package/out-tsc/src/utils/index.js.map +1 -1
- package/out-tsc/src/vectoricon/VectorIcon.js +6 -6
- package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
- package/out-tsc/temba-modules.js +6 -0
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/test/utils.test.js +1 -1
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +1 -1
- package/src/contacts/ContactName.ts +19 -17
- package/src/contacts/ContactNameFetch.ts +32 -0
- package/src/contacts/ContactUrn.ts +12 -1
- package/src/flow/FlowStoreElement.ts +42 -0
- package/src/interfaces.ts +19 -0
- package/src/list/RunList.ts +353 -0
- package/src/list/TembaList.ts +50 -14
- package/src/options/Options.ts +17 -2
- package/src/store/Store.ts +20 -3
- package/src/tabpane/TabPane.ts +3 -1
- package/src/utils/index.ts +3 -0
- package/src/vectoricon/VectorIcon.ts +5 -5
- package/static/css/temba-components.css +1 -1
- package/static/icons/Read Me.txt +15 -15
- package/static/icons/SVG/hourglass.svg +5 -0
- package/static/icons/demo-external-svg.html +142 -157
- package/static/icons/demo-files/demo.css +4 -4
- package/static/icons/demo.html +152 -177
- package/static/icons/selection.json +396 -339
- package/static/icons/style.css +0 -4
- package/static/icons/symbol-defs.svg +10 -20
- package/temba-modules.ts +6 -0
- package/test/utils.test.ts +1 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators';
|
|
4
|
+
import { capitalize } from '../utils';
|
|
5
|
+
import { TembaList } from './TembaList';
|
|
6
|
+
const FLOW_COLOR = 'rgb(223, 65, 159)';
|
|
7
|
+
export class RunList extends TembaList {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.responses = true;
|
|
11
|
+
this.resultKeys = {};
|
|
12
|
+
this.reverseRefresh = false;
|
|
13
|
+
this.valueKey = 'uuid';
|
|
14
|
+
this.hideShadow = true;
|
|
15
|
+
this.createRenderOption();
|
|
16
|
+
}
|
|
17
|
+
firstUpdated(changedProperties) {
|
|
18
|
+
super.firstUpdated(changedProperties);
|
|
19
|
+
}
|
|
20
|
+
updated(changedProperties) {
|
|
21
|
+
super.updated(changedProperties);
|
|
22
|
+
if (changedProperties.has('responses') || changedProperties.has('flow')) {
|
|
23
|
+
if (this.flow) {
|
|
24
|
+
this.endpoint = `/api/v2/runs.json?flow=${this.flow}${this.responses ? '&responded=1' : ''}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (changedProperties.has('resultPreview')) {
|
|
28
|
+
this.createRenderOption();
|
|
29
|
+
}
|
|
30
|
+
if (changedProperties.has('results')) {
|
|
31
|
+
if (this.results) {
|
|
32
|
+
const select = this.shadowRoot.querySelector('temba-select');
|
|
33
|
+
select.setOptions(this.results);
|
|
34
|
+
this.resultKeys = this.results.reduce((current, result) => ({ ...current, [result.key]: result }), {});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
renderResultPreview(run) {
|
|
39
|
+
if (this.resultPreview) {
|
|
40
|
+
const runResult = run.values[this.resultPreview.key];
|
|
41
|
+
if (runResult) {
|
|
42
|
+
if (this.resultPreview.categories.length > 1) {
|
|
43
|
+
if (runResult.category) {
|
|
44
|
+
return runResult.category;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return runResult.value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
removeRun(id) {
|
|
55
|
+
this.items = this.items.filter(run => run.id !== id);
|
|
56
|
+
this.cursorIndex = Math.min(this.cursorIndex, this.items.length);
|
|
57
|
+
this.requestUpdate('cursorIndex');
|
|
58
|
+
}
|
|
59
|
+
getIcon(run) {
|
|
60
|
+
let icon = null;
|
|
61
|
+
if (run.exit_type == 'completed') {
|
|
62
|
+
icon = html `<temba-icon
|
|
63
|
+
name="check"
|
|
64
|
+
style="--icon-color:#666;margin-left:0.5em"
|
|
65
|
+
/>`;
|
|
66
|
+
}
|
|
67
|
+
else if (run.exit_type == 'interrupted') {
|
|
68
|
+
icon = html `<temba-icon
|
|
69
|
+
name="x-octagon"
|
|
70
|
+
style="--icon-color:${FLOW_COLOR};margin-left:0.5em"
|
|
71
|
+
/>`;
|
|
72
|
+
}
|
|
73
|
+
else if (run.exit_type == 'expired') {
|
|
74
|
+
icon = html `<temba-icon
|
|
75
|
+
name="clock"
|
|
76
|
+
style="--icon-color:${FLOW_COLOR};margin-left:0.5em"
|
|
77
|
+
/>`;
|
|
78
|
+
}
|
|
79
|
+
else if (!run.exit_type) {
|
|
80
|
+
if (run.responded) {
|
|
81
|
+
icon = html `<temba-icon
|
|
82
|
+
name="activity"
|
|
83
|
+
style="--icon-color:var(--color-primary-dark);margin-left:0.5em"
|
|
84
|
+
/>`;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
icon = html `<temba-icon
|
|
88
|
+
name="hourglass"
|
|
89
|
+
style="--icon-color:var(--color-primary-dark);margin-left:0.5em"
|
|
90
|
+
/>`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return icon;
|
|
94
|
+
}
|
|
95
|
+
createRenderOption() {
|
|
96
|
+
this.renderOption = (run) => {
|
|
97
|
+
let statusStyle = '';
|
|
98
|
+
if (!run.exited_on) {
|
|
99
|
+
statusStyle = 'font-weight:400;';
|
|
100
|
+
}
|
|
101
|
+
if (!run.responded) {
|
|
102
|
+
statusStyle += '';
|
|
103
|
+
}
|
|
104
|
+
return html `
|
|
105
|
+
<div class="row" style="${statusStyle}display:flex;align-items:center">
|
|
106
|
+
<div
|
|
107
|
+
style="width: 12em;white-space:nowrap;overflow: hidden; text-overflow: ellipsis;"
|
|
108
|
+
>
|
|
109
|
+
<temba-contact-name
|
|
110
|
+
name=${run.contact.name}
|
|
111
|
+
urn=${run.contact.urn}
|
|
112
|
+
icon-size="15"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<div
|
|
117
|
+
style="margin: 0em 1em;flex:1;white-space:nowrap; overflow:hidden; text-overflow: ellipsis;"
|
|
118
|
+
>
|
|
119
|
+
${this.renderResultPreview(run)}
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div style="flex-shrink:1">
|
|
123
|
+
${this.store.getShortDuration(run.modified_on)}
|
|
124
|
+
</div>
|
|
125
|
+
${this.getIcon(run)}
|
|
126
|
+
</div>
|
|
127
|
+
`;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
getRefreshEndpoint() {
|
|
131
|
+
if (this.items.length > 0) {
|
|
132
|
+
const modifiedOn = this.items[0].modified_on;
|
|
133
|
+
return this.endpoint + '&after=' + modifiedOn;
|
|
134
|
+
}
|
|
135
|
+
return this.endpoint;
|
|
136
|
+
}
|
|
137
|
+
toggleResponded() {
|
|
138
|
+
this.responses = this.shadowRoot.querySelector('#responded').checked;
|
|
139
|
+
}
|
|
140
|
+
handleColumnChanged(event) {
|
|
141
|
+
if (event.target.values.length > 0) {
|
|
142
|
+
this.resultPreview = event.target.values[0];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.resultPreview = null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
handleSelected(selected) {
|
|
149
|
+
this.selectedRun = selected;
|
|
150
|
+
}
|
|
151
|
+
getListStyle() {
|
|
152
|
+
return '';
|
|
153
|
+
}
|
|
154
|
+
renderHeader() {
|
|
155
|
+
return html `
|
|
156
|
+
<div style="display:flex;width:100%;margin-bottom: 1em;">
|
|
157
|
+
<div style="flex-grow:1">
|
|
158
|
+
${this.results
|
|
159
|
+
? html `
|
|
160
|
+
<temba-select
|
|
161
|
+
clearable
|
|
162
|
+
placeholder="Result Preview"
|
|
163
|
+
@change=${this.handleColumnChanged}
|
|
164
|
+
/>
|
|
165
|
+
`
|
|
166
|
+
: null}
|
|
167
|
+
</div>
|
|
168
|
+
<div style="margin-left:1em;">
|
|
169
|
+
<temba-checkbox
|
|
170
|
+
id="responded"
|
|
171
|
+
label="Responses Only"
|
|
172
|
+
checked="true"
|
|
173
|
+
@click=${this.toggleResponded}
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
<div
|
|
178
|
+
style="
|
|
179
|
+
font-size:0.8em;
|
|
180
|
+
color:rgba(0,0,0,.4);
|
|
181
|
+
text-align:right;
|
|
182
|
+
background:#f9f9f9;
|
|
183
|
+
border: 1px solid var(--color-widget-border);
|
|
184
|
+
margin-bottom:-0.5em;
|
|
185
|
+
padding-bottom: 0.6em;
|
|
186
|
+
padding-top: 0.3em;
|
|
187
|
+
padding-right: 4.5em;
|
|
188
|
+
border-top-right-radius: var(--curvature);
|
|
189
|
+
border-top-left-radius: var(--curvature)
|
|
190
|
+
"
|
|
191
|
+
>
|
|
192
|
+
Last Updated
|
|
193
|
+
</div>
|
|
194
|
+
`;
|
|
195
|
+
}
|
|
196
|
+
renderFooter() {
|
|
197
|
+
if (!this.selectedRun || !this.resultKeys) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const exitType = this.selectedRun.exit_type;
|
|
201
|
+
const resultKeys = Object.keys(this.selectedRun.values);
|
|
202
|
+
return html ` <div
|
|
203
|
+
style="margin-top: 1.5em; margin-bottom:0.5em;flex-grow:1;border-radius:var(--curvature); border: 1px solid var(--color-widget-border);"
|
|
204
|
+
>
|
|
205
|
+
<div style="display:flex;flex-direction:column;">
|
|
206
|
+
<div
|
|
207
|
+
style="font-size:1.5em;background:#f9f9f9;padding:.75em;padding-top:.35em;display:flex;align-items:center;border-top-right-radius:var(--curvature);border-top-left-radius:var(--curvature)"
|
|
208
|
+
>
|
|
209
|
+
<div>
|
|
210
|
+
<temba-contact-name
|
|
211
|
+
style="cursor:pointer"
|
|
212
|
+
name=${this.selectedRun.contact.name}
|
|
213
|
+
urn=${this.selectedRun.contact.urn}
|
|
214
|
+
onclick="goto(event, this)"
|
|
215
|
+
href="/contact/read/${this.selectedRun.contact.uuid}/"
|
|
216
|
+
></temba-contact-name>
|
|
217
|
+
<div
|
|
218
|
+
style="display:flex;margin-left:-0.2em;margin-top:0.25em;font-size: 0.65em"
|
|
219
|
+
>
|
|
220
|
+
${this.selectedRun.exit_type
|
|
221
|
+
? html `
|
|
222
|
+
${this.getIcon(this.selectedRun)}
|
|
223
|
+
<div style="margin-left:0.5em;flex-grow:1">
|
|
224
|
+
${capitalize(this.selectedRun.exit_type)}
|
|
225
|
+
${exitType == 'completed'
|
|
226
|
+
? html ` in
|
|
227
|
+
${this.store.getShortDuration(this.selectedRun.created_on, this.selectedRun.exited_on, true)}`
|
|
228
|
+
: null}
|
|
229
|
+
${exitType == 'interrupted' || exitType == 'expired'
|
|
230
|
+
? html ` after
|
|
231
|
+
${this.store.getShortDuration(this.selectedRun.created_on, this.selectedRun.exited_on, true)}`
|
|
232
|
+
: null}
|
|
233
|
+
</div>
|
|
234
|
+
`
|
|
235
|
+
: html `${this.getIcon(this.selectedRun)}
|
|
236
|
+
<div style="margin-left:0.5em;flex-grow:1">
|
|
237
|
+
Active for
|
|
238
|
+
${this.store.getShortDuration(this.selectedRun.created_on, null, true)}
|
|
239
|
+
</div>`}
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
<div style="flex-grow:1"></div>
|
|
243
|
+
<div style="display:flex;flex-direction: column">
|
|
244
|
+
<div style="font-size:0.75em">
|
|
245
|
+
${new Date(this.selectedRun.created_on).toLocaleString()}
|
|
246
|
+
</div>
|
|
247
|
+
<div
|
|
248
|
+
style="font-size:0.6em;align-self:flex-end;color:#888;line-height:0.75em"
|
|
249
|
+
>
|
|
250
|
+
Started
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
<temba-icon
|
|
254
|
+
clickable
|
|
255
|
+
style="margin-left:0.75em;"
|
|
256
|
+
name="trash"
|
|
257
|
+
onclick="deleteRun(${this.selectedRun.id});"
|
|
258
|
+
></temba-icon>
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
${resultKeys.length > 0
|
|
262
|
+
? html `
|
|
263
|
+
<div
|
|
264
|
+
style="padding:1em;overflow-y:auto;overflow-x:hidden;max-height:15vh;"
|
|
265
|
+
>
|
|
266
|
+
<div
|
|
267
|
+
style="display:flex;font-size:1.2em;position:relative;right:0px"
|
|
268
|
+
>
|
|
269
|
+
<div style="flex-grow:1"></div>
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<table width="100%">
|
|
273
|
+
<tr>
|
|
274
|
+
<th style="text-align:left" width="25%">Result</th>
|
|
275
|
+
<th style="text-align:left" width="25%">Category</th>
|
|
276
|
+
<th style="text-align:left">Value</th>
|
|
277
|
+
</tr>
|
|
278
|
+
|
|
279
|
+
${Object.keys(this.selectedRun.values).map((key) => {
|
|
280
|
+
const result = this.selectedRun.values[key];
|
|
281
|
+
const meta = this.resultKeys[key];
|
|
282
|
+
// if our result is no longer represented in the flow, skip it
|
|
283
|
+
if (meta) {
|
|
284
|
+
return html `<tr>
|
|
285
|
+
<td>${result.name}</td>
|
|
286
|
+
<td>
|
|
287
|
+
${meta.categories.length > 1 ? result.category : '--'}
|
|
288
|
+
</td>
|
|
289
|
+
<td>${result.value}</td>
|
|
290
|
+
</tr>`;
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
})}
|
|
294
|
+
</table>
|
|
295
|
+
</div>
|
|
296
|
+
`
|
|
297
|
+
: null}
|
|
298
|
+
</div>
|
|
299
|
+
</div>`;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
__decorate([
|
|
303
|
+
property({ type: String })
|
|
304
|
+
], RunList.prototype, "flow", void 0);
|
|
305
|
+
__decorate([
|
|
306
|
+
property({ type: Object, attribute: false })
|
|
307
|
+
], RunList.prototype, "results", void 0);
|
|
308
|
+
__decorate([
|
|
309
|
+
property({ type: Boolean })
|
|
310
|
+
], RunList.prototype, "responses", void 0);
|
|
311
|
+
__decorate([
|
|
312
|
+
property({ type: Object })
|
|
313
|
+
], RunList.prototype, "resultPreview", void 0);
|
|
314
|
+
__decorate([
|
|
315
|
+
property({ type: Object })
|
|
316
|
+
], RunList.prototype, "selectedRun", void 0);
|
|
317
|
+
//# sourceMappingURL=RunList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunList.js","sourceRoot":"","sources":["../../../src/list/RunList.ts"],"names":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AC,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAW,EAAE,EAAE;gBACzD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBAElC,8DAA8D;gBAC9D,IAAI,IAAI,EAAE;oBACR,OAAO,IAAI,CAAA;8BACH,MAAM,CAAC,IAAI;;4BAEb,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;;8BAEjD,MAAM,CAAC,KAAK;4BACd,CAAC;iBACR;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;;;aAGP;YACH,CAAC,CAAC,IAAI;;WAEL,CAAC;IACV,CAAC;CASF;AArVC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACd;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCAC9B;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACR;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACV","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { Select } from '../select/Select';\nimport { capitalize } from '../utils';\nimport { TembaList } from './TembaList';\n\nconst FLOW_COLOR = 'rgb(223, 65, 159)';\n\nexport class RunList extends TembaList {\n @property({ type: String })\n flow: string;\n\n @property({ type: Object, attribute: false })\n results: any[];\n\n @property({ type: Boolean })\n responses = true;\n\n @property({ type: Object })\n resultPreview: any;\n\n @property({ type: Object })\n selectedRun: any;\n\n private resultKeys = {};\n\n public firstUpdated(changedProperties: Map<string, any>) {\n super.firstUpdated(changedProperties);\n }\n\n public updated(changedProperties: Map<string, any>): void {\n super.updated(changedProperties);\n if (changedProperties.has('responses') || changedProperties.has('flow')) {\n if (this.flow) {\n this.endpoint = `/api/v2/runs.json?flow=${this.flow}${\n this.responses ? '&responded=1' : ''\n }`;\n }\n }\n\n if (changedProperties.has('resultPreview')) {\n this.createRenderOption();\n }\n\n if (changedProperties.has('results')) {\n if (this.results) {\n const select = this.shadowRoot.querySelector('temba-select') as Select;\n select.setOptions(this.results);\n this.resultKeys = this.results.reduce(\n (current, result) => ({ ...current, [result.key]: result }),\n {}\n );\n }\n }\n }\n\n public renderResultPreview(run: any) {\n if (this.resultPreview) {\n const runResult = run.values[this.resultPreview.key];\n if (runResult) {\n if (this.resultPreview.categories.length > 1) {\n if (runResult.category) {\n return runResult.category;\n }\n } else {\n return runResult.value;\n }\n }\n }\n return null;\n }\n\n public removeRun(id: number) {\n this.items = this.items.filter(run => run.id !== id);\n this.cursorIndex = Math.min(this.cursorIndex, this.items.length);\n this.requestUpdate('cursorIndex');\n }\n\n public getIcon(run: any): TemplateResult {\n let icon = null;\n if (run.exit_type == 'completed') {\n icon = html`<temba-icon\n name=\"check\"\n style=\"--icon-color:#666;margin-left:0.5em\"\n />`;\n } else if (run.exit_type == 'interrupted') {\n icon = html`<temba-icon\n name=\"x-octagon\"\n style=\"--icon-color:${FLOW_COLOR};margin-left:0.5em\"\n />`;\n } else if (run.exit_type == 'expired') {\n icon = html`<temba-icon\n name=\"clock\"\n style=\"--icon-color:${FLOW_COLOR};margin-left:0.5em\"\n />`;\n } else if (!run.exit_type) {\n if (run.responded) {\n icon = html`<temba-icon\n name=\"activity\"\n style=\"--icon-color:var(--color-primary-dark);margin-left:0.5em\"\n />`;\n } else {\n icon = html`<temba-icon\n name=\"hourglass\"\n style=\"--icon-color:var(--color-primary-dark);margin-left:0.5em\"\n />`;\n }\n }\n return icon;\n }\n\n public createRenderOption() {\n this.renderOption = (run: any): TemplateResult => {\n let statusStyle = '';\n\n if (!run.exited_on) {\n statusStyle = 'font-weight:400;';\n }\n\n if (!run.responded) {\n statusStyle += '';\n }\n\n return html`\n <div class=\"row\" style=\"${statusStyle}display:flex;align-items:center\">\n <div\n style=\"width: 12em;white-space:nowrap;overflow: hidden; text-overflow: ellipsis;\"\n >\n <temba-contact-name\n name=${run.contact.name}\n urn=${run.contact.urn}\n icon-size=\"15\"\n />\n </div>\n\n <div\n style=\"margin: 0em 1em;flex:1;white-space:nowrap; overflow:hidden; text-overflow: ellipsis;\"\n >\n ${this.renderResultPreview(run)}\n </div>\n\n <div style=\"flex-shrink:1\">\n ${this.store.getShortDuration(run.modified_on)}\n </div>\n ${this.getIcon(run)}\n </div>\n `;\n };\n }\n\n public getRefreshEndpoint() {\n if (this.items.length > 0) {\n const modifiedOn = this.items[0].modified_on;\n return this.endpoint + '&after=' + modifiedOn;\n }\n return this.endpoint;\n }\n\n public toggleResponded() {\n this.responses = (\n this.shadowRoot.querySelector('#responded') as Checkbox\n ).checked;\n }\n\n public handleColumnChanged(event: any) {\n if (event.target.values.length > 0) {\n this.resultPreview = event.target.values[0];\n } else {\n this.resultPreview = null;\n }\n }\n\n public handleSelected(selected: any) {\n this.selectedRun = selected;\n }\n\n public getListStyle(): string {\n return '';\n }\n\n public renderHeader(): TemplateResult {\n return html`\n <div style=\"display:flex;width:100%;margin-bottom: 1em;\">\n <div style=\"flex-grow:1\">\n ${this.results\n ? html`\n <temba-select\n clearable\n placeholder=\"Result Preview\"\n @change=${this.handleColumnChanged}\n />\n `\n : null}\n </div>\n <div style=\"margin-left:1em;\">\n <temba-checkbox\n id=\"responded\"\n label=\"Responses Only\"\n checked=\"true\"\n @click=${this.toggleResponded}\n />\n </div>\n </div>\n <div\n style=\"\n font-size:0.8em;\n color:rgba(0,0,0,.4);\n text-align:right;\n background:#f9f9f9;\n border: 1px solid var(--color-widget-border);\n margin-bottom:-0.5em; \n padding-bottom: 0.6em;\n padding-top: 0.3em;\n padding-right: 4.5em;\n border-top-right-radius: var(--curvature);\n border-top-left-radius: var(--curvature)\n \"\n >\n Last Updated\n </div>\n `;\n }\n\n public renderFooter(): TemplateResult {\n if (!this.selectedRun || !this.resultKeys) {\n return null;\n }\n\n const exitType = this.selectedRun.exit_type;\n const resultKeys = Object.keys(this.selectedRun.values);\n\n return html` <div\n style=\"margin-top: 1.5em; margin-bottom:0.5em;flex-grow:1;border-radius:var(--curvature); border: 1px solid var(--color-widget-border);\"\n >\n <div style=\"display:flex;flex-direction:column;\">\n <div\n style=\"font-size:1.5em;background:#f9f9f9;padding:.75em;padding-top:.35em;display:flex;align-items:center;border-top-right-radius:var(--curvature);border-top-left-radius:var(--curvature)\"\n >\n <div>\n <temba-contact-name\n style=\"cursor:pointer\"\n name=${this.selectedRun.contact.name}\n urn=${this.selectedRun.contact.urn}\n onclick=\"goto(event, this)\"\n href=\"/contact/read/${this.selectedRun.contact.uuid}/\"\n ></temba-contact-name>\n <div\n style=\"display:flex;margin-left:-0.2em;margin-top:0.25em;font-size: 0.65em\"\n >\n ${this.selectedRun.exit_type\n ? html`\n ${this.getIcon(this.selectedRun)}\n <div style=\"margin-left:0.5em;flex-grow:1\">\n ${capitalize(this.selectedRun.exit_type)}\n ${exitType == 'completed'\n ? html` in\n ${this.store.getShortDuration(\n this.selectedRun.created_on,\n this.selectedRun.exited_on,\n true\n )}`\n : null}\n ${exitType == 'interrupted' || exitType == 'expired'\n ? html` after\n ${this.store.getShortDuration(\n this.selectedRun.created_on,\n this.selectedRun.exited_on,\n true\n )}`\n : null}\n </div>\n `\n : html`${this.getIcon(this.selectedRun)}\n <div style=\"margin-left:0.5em;flex-grow:1\">\n Active for\n ${this.store.getShortDuration(\n this.selectedRun.created_on,\n null,\n true\n )}\n </div>`}\n </div>\n </div>\n <div style=\"flex-grow:1\"></div>\n <div style=\"display:flex;flex-direction: column\">\n <div style=\"font-size:0.75em\">\n ${new Date(this.selectedRun.created_on).toLocaleString()}\n </div>\n <div\n style=\"font-size:0.6em;align-self:flex-end;color:#888;line-height:0.75em\"\n >\n Started\n </div>\n </div>\n <temba-icon\n clickable\n style=\"margin-left:0.75em;\"\n name=\"trash\"\n onclick=\"deleteRun(${this.selectedRun.id});\"\n ></temba-icon>\n </div>\n\n ${resultKeys.length > 0\n ? html`\n <div\n style=\"padding:1em;overflow-y:auto;overflow-x:hidden;max-height:15vh;\"\n >\n <div\n style=\"display:flex;font-size:1.2em;position:relative;right:0px\"\n >\n <div style=\"flex-grow:1\"></div>\n </div>\n\n <table width=\"100%\">\n <tr>\n <th style=\"text-align:left\" width=\"25%\">Result</th>\n <th style=\"text-align:left\" width=\"25%\">Category</th>\n <th style=\"text-align:left\">Value</th>\n </tr>\n\n ${Object.keys(this.selectedRun.values).map((key: string) => {\n const result = this.selectedRun.values[key];\n const meta = this.resultKeys[key];\n\n // if our result is no longer represented in the flow, skip it\n if (meta) {\n return html`<tr>\n <td>${result.name}</td>\n <td>\n ${meta.categories.length > 1 ? result.category : '--'}\n </td>\n <td>${result.value}</td>\n </tr>`;\n }\n return null;\n })}\n </table>\n </div>\n `\n : null}\n </div>\n </div>`;\n }\n\n constructor() {\n super();\n this.reverseRefresh = false;\n this.valueKey = 'uuid';\n this.hideShadow = true;\n this.createRenderOption();\n }\n}\n"]}
|
|
@@ -15,19 +15,18 @@ export class TembaList extends RapidElement {
|
|
|
15
15
|
this.loading = false;
|
|
16
16
|
// changes to the refresh key force a refresh
|
|
17
17
|
this.refreshKey = '0';
|
|
18
|
+
this.reverseRefresh = true;
|
|
18
19
|
// our next page from our endpoint
|
|
19
20
|
this.nextPage = null;
|
|
20
21
|
this.pages = 0;
|
|
21
22
|
this.pending = [];
|
|
22
23
|
this.refreshInterval = null;
|
|
24
|
+
this.store = document.querySelector('temba-store');
|
|
23
25
|
this.handleSelection.bind(this);
|
|
24
26
|
}
|
|
25
27
|
static get styles() {
|
|
26
28
|
return css `
|
|
27
29
|
:host {
|
|
28
|
-
display: block;
|
|
29
|
-
height: 100%;
|
|
30
|
-
width: 100%;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
temba-options {
|
|
@@ -35,13 +34,6 @@ export class TembaList extends RapidElement {
|
|
|
35
34
|
width: 100%;
|
|
36
35
|
flex-grow: 1;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
.wrapper {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
height: 100%;
|
|
43
|
-
align-items: center;
|
|
44
|
-
}
|
|
45
37
|
`;
|
|
46
38
|
}
|
|
47
39
|
reset() {
|
|
@@ -75,7 +67,9 @@ export class TembaList extends RapidElement {
|
|
|
75
67
|
this.refreshTop();
|
|
76
68
|
}
|
|
77
69
|
if (changedProperties.has('mostRecentItem')) {
|
|
78
|
-
this.
|
|
70
|
+
if (this.mostRecentItem) {
|
|
71
|
+
this.fireCustomEvent(CustomEventType.Refreshed);
|
|
72
|
+
}
|
|
79
73
|
}
|
|
80
74
|
if (changedProperties.has('cursorIndex')) {
|
|
81
75
|
if (this.cursorIndex > -1) {
|
|
@@ -140,6 +134,10 @@ export class TembaList extends RapidElement {
|
|
|
140
134
|
* Refreshes the first page, updating any found items in our list
|
|
141
135
|
*/
|
|
142
136
|
async refreshTop() {
|
|
137
|
+
const refreshEndpoint = this.getRefreshEndpoint();
|
|
138
|
+
if (!refreshEndpoint) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
143
141
|
// cancel any outstanding requests
|
|
144
142
|
while (this.pending.length > 0) {
|
|
145
143
|
const pending = this.pending.pop();
|
|
@@ -164,7 +162,16 @@ export class TembaList extends RapidElement {
|
|
|
164
162
|
}
|
|
165
163
|
});
|
|
166
164
|
// insert our new items at the front
|
|
167
|
-
|
|
165
|
+
let results = page.results;
|
|
166
|
+
if (this.reverseRefresh) {
|
|
167
|
+
results = page.results.reverse();
|
|
168
|
+
}
|
|
169
|
+
const newItems = [...results, ...items];
|
|
170
|
+
const topItem = newItems[0];
|
|
171
|
+
if (!this.mostRecentItem ||
|
|
172
|
+
JSON.stringify(this.mostRecentItem) !== JSON.stringify(topItem)) {
|
|
173
|
+
this.mostRecentItem = topItem;
|
|
174
|
+
}
|
|
168
175
|
if (prevItem) {
|
|
169
176
|
const newItem = newItems[this.cursorIndex];
|
|
170
177
|
const prevValue = this.getValue(prevItem);
|
|
@@ -220,6 +227,7 @@ export class TembaList extends RapidElement {
|
|
|
220
227
|
catch (error) {
|
|
221
228
|
// aborted
|
|
222
229
|
this.reset();
|
|
230
|
+
console.log('error, resetting');
|
|
223
231
|
return;
|
|
224
232
|
}
|
|
225
233
|
this.nextPage = nextPage;
|
|
@@ -290,6 +298,15 @@ export class TembaList extends RapidElement {
|
|
|
290
298
|
});
|
|
291
299
|
}
|
|
292
300
|
}
|
|
301
|
+
renderHeader() {
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
renderFooter() {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
getListStyle() {
|
|
308
|
+
return '';
|
|
309
|
+
}
|
|
293
310
|
handleSelection(event) {
|
|
294
311
|
const { selected, index } = event.detail;
|
|
295
312
|
this.selected = selected;
|
|
@@ -298,10 +315,13 @@ export class TembaList extends RapidElement {
|
|
|
298
315
|
event.preventDefault();
|
|
299
316
|
}
|
|
300
317
|
render() {
|
|
301
|
-
return html
|
|
318
|
+
return html `
|
|
319
|
+
${this.renderHeader()}
|
|
302
320
|
<temba-options
|
|
321
|
+
style="${this.getListStyle()}"
|
|
303
322
|
?visible=${true}
|
|
304
323
|
?block=${true}
|
|
324
|
+
?hideShadow=${this.hideShadow}
|
|
305
325
|
?collapsed=${this.collapsed}
|
|
306
326
|
?loading=${this.loading}
|
|
307
327
|
.renderOption=${this.renderOption}
|
|
@@ -313,7 +333,8 @@ export class TembaList extends RapidElement {
|
|
|
313
333
|
>
|
|
314
334
|
<slot></slot>
|
|
315
335
|
</temba-options>
|
|
316
|
-
|
|
336
|
+
${this.renderFooter()}
|
|
337
|
+
`;
|
|
317
338
|
}
|
|
318
339
|
}
|
|
319
340
|
__decorate([
|
|
@@ -346,6 +367,9 @@ __decorate([
|
|
|
346
367
|
__decorate([
|
|
347
368
|
property({ type: Boolean })
|
|
348
369
|
], TembaList.prototype, "collapsed", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
property({ type: Boolean })
|
|
372
|
+
], TembaList.prototype, "hideShadow", void 0);
|
|
349
373
|
__decorate([
|
|
350
374
|
property({ attribute: false })
|
|
351
375
|
], TembaList.prototype, "getNextRefresh", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TembaList.js","sourceRoot":"","sources":["../../../src/list/TembaList.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;AAEzD,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,MAAM,OAAO,SAAU,SAAQ,YAAY;IAsFzC;QACE,KAAK,EAAE,CAAC;QArFV,UAAK,GAAU,EAAE,CAAC;QAMlB,gBAAW,GAAG,CAAC,CAAC,CAAC;QASjB,aAAQ,GAAG,CAAC,CAAC;QAGb,aAAQ,GAAG,IAAI,CAAC;QAMhB,YAAO,GAAG,KAAK,CAAC;QAoBhB,6CAA6C;QAE7C,eAAU,GAAG,GAAG,CAAC;QAEjB,kCAAkC;QAClC,aAAQ,GAAW,IAAI,CAAC;QAExB,UAAK,GAAG,CAAC,CAAC;QAEV,YAAO,GAAsB,EAAE,CAAC;QA4ChC,oBAAe,GAAG,IAAI,CAAC;QAXrB,IAAI,CAAC,eAAe,CAAC,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AAS,EAAE,KAAK,EAAE,CAAC;qDACwC;AAGvE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACzB;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACV","sourcesContent":["import { css, html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators';\nimport { CustomEventType } from '../interfaces';\nimport { RapidElement } from '../RapidElement';\nimport { fetchResultsPage, ResultsPage } from '../utils';\n\nconst DEFAULT_REFRESH = 10000;\n\nexport class TembaList extends RapidElement {\n @property({ type: Array, attribute: false })\n items: any[] = [];\n\n @property({ type: Object, attribute: false })\n selected: any;\n\n @property({ type: Number })\n cursorIndex = -1;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n nextSelection: any;\n\n @property({ type: Number })\n tabIndex = 1;\n\n @property({ type: String })\n valueKey = 'id';\n\n @property({ type: String })\n value: string;\n\n @property({ type: Boolean })\n loading = false;\n\n @property({ type: Boolean })\n collapsed: boolean;\n\n @property({ attribute: false })\n getNextRefresh: (firstOption: any) => any;\n\n @property({ attribute: false })\n sanitizeOption: (option: any) => any;\n\n @property({ attribute: false })\n renderOption: (option: any, selected: boolean) => TemplateResult;\n\n @property({ attribute: false })\n renderOptionDetail: (option: any, selected: boolean) => TemplateResult;\n\n @property({ attribute: false, type: Object })\n mostRecentItem: any;\n\n // changes to the refresh key force a refresh\n @property({ type: String })\n refreshKey = '0';\n\n // our next page from our endpoint\n nextPage: string = null;\n\n pages = 0;\n clearRefreshTimeout: any;\n pending: AbortController[] = [];\n\n // used for testing only\n preserve: boolean;\n\n // http promise to monitor for completeness\n public httpComplete: Promise<void>;\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n width: 100%;\n }\n\n temba-options {\n display: block;\n width: 100%;\n flex-grow: 1;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n align-items: center;\n }\n `;\n }\n\n constructor() {\n super();\n this.handleSelection.bind(this);\n }\n\n private reset(): void {\n this.selected = null;\n this.nextPage = null;\n this.cursorIndex = -1;\n this.mostRecentItem = null;\n this.items = [];\n }\n\n refreshInterval = null;\n\n public connectedCallback() {\n super.connectedCallback();\n this.refreshInterval = setInterval(() => {\n this.refreshKey = 'default_' + new Date().getTime();\n }, DEFAULT_REFRESH);\n }\n\n public disconnectedCallback() {\n clearInterval(this.refreshInterval);\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('endpoint') && this.endpoint) {\n // if our tests aren't preserving our properties, reset\n if (!this.preserve) {\n this.reset();\n this.loading = true;\n }\n\n this.httpComplete = this.fetchItems();\n }\n\n if (\n changedProperties.has('refreshKey') &&\n !changedProperties.has('endpoint')\n ) {\n this.refreshTop();\n }\n\n if (changedProperties.has('mostRecentItem')) {\n this.fireCustomEvent(CustomEventType.Refreshed);\n }\n\n if (changedProperties.has('cursorIndex')) {\n if (this.cursorIndex > -1) {\n this.selected = this.items[this.cursorIndex];\n this.handleSelected(this.selected);\n }\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public handleSelected(selected: any) {\n const evt = new Event('change', { bubbles: true });\n this.dispatchEvent(evt);\n }\n\n private getValue(obj: any): any {\n if (!obj) {\n return null;\n }\n\n const path = this.valueKey.split('.');\n let current = obj;\n while (path.length > 0) {\n const key = path.shift();\n current = current[key];\n }\n return current;\n }\n\n public setSelection(value: string) {\n const index = this.items.findIndex(item => {\n return this.getValue(item) === value;\n });\n this.cursorIndex = index;\n this.selected = this.items[index];\n const evt = new Event('change', { bubbles: true });\n this.dispatchEvent(evt);\n }\n\n public getItemIndex(value: string) {\n return this.items.findIndex(option => this.getValue(option) === value);\n }\n\n public removeItem(value: string) {\n const index = this.getItemIndex(value);\n this.items.splice(index, 1);\n this.items = [...this.items];\n\n // if we were at the end, move us down\n this.cursorIndex = Math.max(\n 0,\n Math.min(this.items.length - 1, this.cursorIndex - 1)\n );\n\n // request a change even if it is the same, the item is different\n this.requestUpdate('cursorIndex');\n this.requestUpdate('items');\n }\n\n public getSelection(): any {\n return this.selected;\n }\n\n public refresh(): void {\n this.refreshKey = 'requested_' + new Date().getTime();\n }\n\n public setEndpoint(endpoint: string, nextSelection: any = null) {\n this.endpoint = endpoint;\n this.nextSelection = nextSelection;\n }\n\n public getRefreshEndpoint() {\n return this.endpoint;\n }\n\n /**\n * Refreshes the first page, updating any found items in our list\n */\n private async refreshTop(): Promise<void> {\n // cancel any outstanding requests\n while (this.pending.length > 0) {\n const pending = this.pending.pop();\n pending.abort();\n }\n\n const controller = new AbortController();\n this.pending.push(controller);\n\n const prevItem = this.items[this.cursorIndex];\n\n try {\n const page = await fetchResultsPage(\n this.getRefreshEndpoint(),\n controller\n );\n\n const items = [...this.items];\n // remove any dupes already in our list\n if (page.results) {\n page.results.forEach((newOption: any) => {\n if (this.sanitizeOption) {\n this.sanitizeOption(newOption);\n }\n const newValue = this.getValue(newOption);\n const removeIndex = items.findIndex(\n option => this.getValue(option) === newValue\n );\n\n if (removeIndex > -1) {\n items.splice(removeIndex, 1);\n }\n });\n\n // insert our new items at the front\n const newItems = [...page.results.reverse(), ...items];\n\n if (prevItem) {\n const newItem = newItems[this.cursorIndex];\n const prevValue = this.getValue(prevItem);\n if (prevValue !== this.getValue(newItem)) {\n const newIndex = newItems.findIndex(\n option => this.getValue(option) === prevValue\n );\n this.cursorIndex = newIndex;\n\n // make sure our focused item is visible\n window.setTimeout(() => {\n const options = this.shadowRoot.querySelector('temba-options');\n if (options) {\n const option =\n options.shadowRoot.querySelector('.option.focused');\n option.scrollIntoView({ block: 'end', inline: 'nearest' });\n }\n }, 0);\n }\n }\n\n this.items = newItems;\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n private async fetchItems(): Promise<void> {\n // cancel any outstanding requests\n while (this.pending.length > 0) {\n const pending = this.pending.pop();\n pending.abort();\n }\n\n let endpoint = this.endpoint;\n let pagesToFetch = this.pages || 1;\n let pages = 0;\n let nextPage = null;\n\n let fetchedItems: any[] = [];\n\n while (pagesToFetch > 0 && endpoint) {\n const controller = new AbortController();\n this.pending.push(controller);\n\n try {\n const page = await fetchResultsPage(endpoint, controller);\n\n // sanitize our options if necessary\n if (this.sanitizeOption) {\n page.results.forEach(this.sanitizeOption);\n }\n\n if (page.results) {\n fetchedItems = fetchedItems.concat(page.results);\n }\n\n // save our next pages\n nextPage = page.next;\n endpoint = nextPage;\n pagesToFetch--;\n pages++;\n } catch (error) {\n // aborted\n this.reset();\n return;\n }\n\n this.nextPage = nextPage;\n }\n this.pages = pages;\n\n const topItem = fetchedItems[0];\n if (\n !this.mostRecentItem ||\n JSON.stringify(this.mostRecentItem) !== JSON.stringify(topItem)\n ) {\n this.mostRecentItem = topItem;\n }\n\n // see if our cursor needs to move to stay on the same item\n const newItem = fetchedItems[this.cursorIndex];\n\n if (\n !this.nextSelection &&\n this.selected &&\n newItem &&\n this.getValue(newItem) !== this.getValue(this.selected)\n ) {\n const index = fetchedItems.findIndex(item => {\n return this.getValue(item) === this.getValue(this.selected);\n });\n\n // old selection is in the new fetch\n if (index > -1) {\n this.cursorIndex = index;\n }\n // old selection is missing from the new fetch\n else {\n // if our index didn't change, our item still did, fire change\n if (this.cursorIndex === 0) {\n this.requestUpdate('cursorIndex');\n }\n // otherwise select the first item\n else {\n this.cursorIndex = 0;\n }\n }\n }\n\n // save our results\n this.items = fetchedItems;\n this.loading = false;\n this.pending = [];\n\n if (this.nextSelection) {\n this.setSelection(this.nextSelection);\n this.nextSelection = false;\n } else {\n if (this.cursorIndex === -1) {\n this.cursorIndex = 0;\n }\n }\n\n // TODO: Not sure why this is needed\n // this.requestUpdate('cursorIndex');\n\n if (this.value) {\n this.setSelection(this.value);\n this.value = null;\n }\n\n return Promise.resolve();\n }\n\n private handleScrollThreshold() {\n if (this.nextPage && !this.loading) {\n this.loading = true;\n fetchResultsPage(this.nextPage).then((page: ResultsPage) => {\n if (this.sanitizeOption) {\n page.results.forEach(this.sanitizeOption);\n }\n\n this.items = [...this.items, ...page.results];\n this.nextPage = page.next;\n this.pages++;\n this.loading = false;\n });\n }\n }\n\n private handleSelection(event: CustomEvent) {\n const { selected, index } = event.detail;\n\n this.selected = selected;\n this.cursorIndex = index;\n\n event.stopPropagation();\n event.preventDefault();\n }\n\n public render(): TemplateResult {\n return html`<div class=\"wrapper\">\n <temba-options\n ?visible=${true}\n ?block=${true}\n ?collapsed=${this.collapsed}\n ?loading=${this.loading}\n .renderOption=${this.renderOption}\n .renderOptionDetail=${this.renderOptionDetail}\n @temba-scroll-threshold=${this.handleScrollThreshold}\n @temba-selection=${this.handleSelection.bind(this)}\n .options=${this.items}\n .cursorIndex=${this.cursorIndex}\n >\n <slot></slot>\n </temba-options>\n </div>`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TembaList.js","sourceRoot":"","sources":["../../../src/list/TembaList.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;AAEzD,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,MAAM,OAAO,SAAU,SAAQ,YAAY;IAmFzC;QACE,KAAK,EAAE,CAAC;QAlFV,UAAK,GAAU,EAAE,CAAC;QAMlB,gBAAW,GAAG,CAAC,CAAC,CAAC;QASjB,aAAQ,GAAG,CAAC,CAAC;QAGb,aAAQ,GAAG,IAAI,CAAC;QAMhB,YAAO,GAAG,KAAK,CAAC;QAuBhB,6CAA6C;QAE7C,eAAU,GAAG,GAAG,CAAC;QAEjB,mBAAc,GAAG,IAAI,CAAC;QAEtB,kCAAkC;QAClC,aAAQ,GAAW,I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QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACV","sourcesContent":["import { css, html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators';\nimport { CustomEventType } from '../interfaces';\nimport { RapidElement } from '../RapidElement';\nimport { Store } from '../store/Store';\nimport { fetchResultsPage, ResultsPage } from '../utils';\n\nconst DEFAULT_REFRESH = 10000;\n\nexport class TembaList extends RapidElement {\n @property({ type: Array, attribute: false })\n items: any[] = [];\n\n @property({ type: Object, attribute: false })\n selected: any;\n\n @property({ type: Number })\n cursorIndex = -1;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n nextSelection: any;\n\n @property({ type: Number })\n tabIndex = 1;\n\n @property({ type: String })\n valueKey = 'id';\n\n @property({ type: String })\n value: string;\n\n @property({ type: Boolean })\n loading = false;\n\n @property({ type: Boolean })\n collapsed: boolean;\n\n @property({ type: Boolean })\n hideShadow: boolean;\n\n @property({ attribute: false })\n getNextRefresh: (firstOption: any) => any;\n\n @property({ attribute: false })\n sanitizeOption: (option: any) => any;\n\n @property({ attribute: false })\n renderOption: (option: any, selected: boolean) => TemplateResult;\n\n @property({ attribute: false })\n renderOptionDetail: (option: any, selected: boolean) => TemplateResult;\n\n @property({ attribute: false, type: Object })\n mostRecentItem: any;\n\n // changes to the refresh key force a refresh\n @property({ type: String })\n refreshKey = '0';\n\n reverseRefresh = true;\n\n // our next page from our endpoint\n nextPage: string = null;\n\n pages = 0;\n clearRefreshTimeout: any;\n pending: AbortController[] = [];\n\n store: Store;\n\n // used for testing only\n preserve: boolean;\n\n // http promise to monitor for completeness\n public httpComplete: Promise<void>;\n\n static get styles() {\n return css`\n :host {\n }\n\n temba-options {\n display: block;\n width: 100%;\n flex-grow: 1;\n }\n `;\n }\n\n constructor() {\n super();\n this.store = document.querySelector('temba-store') as Store;\n this.handleSelection.bind(this);\n }\n\n private reset(): void {\n this.selected = null;\n this.nextPage = null;\n this.cursorIndex = -1;\n this.mostRecentItem = null;\n this.items = [];\n }\n\n refreshInterval = null;\n\n public connectedCallback() {\n super.connectedCallback();\n this.refreshInterval = setInterval(() => {\n this.refreshKey = 'default_' + new Date().getTime();\n }, DEFAULT_REFRESH);\n }\n\n public disconnectedCallback() {\n clearInterval(this.refreshInterval);\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('endpoint') && this.endpoint) {\n // if our tests aren't preserving our properties, reset\n if (!this.preserve) {\n this.reset();\n this.loading = true;\n }\n\n this.httpComplete = this.fetchItems();\n }\n\n if (\n changedProperties.has('refreshKey') &&\n !changedProperties.has('endpoint')\n ) {\n this.refreshTop();\n }\n\n if (changedProperties.has('mostRecentItem')) {\n if (this.mostRecentItem) {\n this.fireCustomEvent(CustomEventType.Refreshed);\n }\n }\n\n if (changedProperties.has('cursorIndex')) {\n if (this.cursorIndex > -1) {\n this.selected = this.items[this.cursorIndex];\n this.handleSelected(this.selected);\n }\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public handleSelected(selected: any) {\n const evt = new Event('change', { bubbles: true });\n this.dispatchEvent(evt);\n }\n\n private getValue(obj: any): any {\n if (!obj) {\n return null;\n }\n\n const path = this.valueKey.split('.');\n let current = obj;\n while (path.length > 0) {\n const key = path.shift();\n current = current[key];\n }\n return current;\n }\n\n public setSelection(value: string) {\n const index = this.items.findIndex(item => {\n return this.getValue(item) === value;\n });\n this.cursorIndex = index;\n this.selected = this.items[index];\n const evt = new Event('change', { bubbles: true });\n this.dispatchEvent(evt);\n }\n\n public getItemIndex(value: string) {\n return this.items.findIndex(option => this.getValue(option) === value);\n }\n\n public removeItem(value: string) {\n const index = this.getItemIndex(value);\n this.items.splice(index, 1);\n this.items = [...this.items];\n\n // if we were at the end, move us down\n this.cursorIndex = Math.max(\n 0,\n Math.min(this.items.length - 1, this.cursorIndex - 1)\n );\n\n // request a change even if it is the same, the item is different\n this.requestUpdate('cursorIndex');\n this.requestUpdate('items');\n }\n\n public getSelection(): any {\n return this.selected;\n }\n\n public refresh(): void {\n this.refreshKey = 'requested_' + new Date().getTime();\n }\n\n public setEndpoint(endpoint: string, nextSelection: any = null) {\n this.endpoint = endpoint;\n this.nextSelection = nextSelection;\n }\n\n public getRefreshEndpoint() {\n return this.endpoint;\n }\n\n /**\n * Refreshes the first page, updating any found items in our list\n */\n private async refreshTop(): Promise<void> {\n const refreshEndpoint = this.getRefreshEndpoint();\n if (!refreshEndpoint) {\n return;\n }\n\n // cancel any outstanding requests\n while (this.pending.length > 0) {\n const pending = this.pending.pop();\n pending.abort();\n }\n\n const controller = new AbortController();\n this.pending.push(controller);\n\n const prevItem = this.items[this.cursorIndex];\n\n try {\n const page = await fetchResultsPage(\n this.getRefreshEndpoint(),\n controller\n );\n\n const items = [...this.items];\n // remove any dupes already in our list\n if (page.results) {\n page.results.forEach((newOption: any) => {\n if (this.sanitizeOption) {\n this.sanitizeOption(newOption);\n }\n const newValue = this.getValue(newOption);\n const removeIndex = items.findIndex(\n option => this.getValue(option) === newValue\n );\n\n if (removeIndex > -1) {\n items.splice(removeIndex, 1);\n }\n });\n\n // insert our new items at the front\n let results = page.results;\n if (this.reverseRefresh) {\n results = page.results.reverse();\n }\n const newItems = [...results, ...items];\n\n const topItem = newItems[0];\n if (\n !this.mostRecentItem ||\n JSON.stringify(this.mostRecentItem) !== JSON.stringify(topItem)\n ) {\n this.mostRecentItem = topItem;\n }\n\n if (prevItem) {\n const newItem = newItems[this.cursorIndex];\n const prevValue = this.getValue(prevItem);\n if (prevValue !== this.getValue(newItem)) {\n const newIndex = newItems.findIndex(\n option => this.getValue(option) === prevValue\n );\n this.cursorIndex = newIndex;\n\n // make sure our focused item is visible\n window.setTimeout(() => {\n const options = this.shadowRoot.querySelector('temba-options');\n if (options) {\n const option =\n options.shadowRoot.querySelector('.option.focused');\n option.scrollIntoView({ block: 'end', inline: 'nearest' });\n }\n }, 0);\n }\n }\n\n this.items = newItems;\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n private async fetchItems(): Promise<void> {\n // cancel any outstanding requests\n while (this.pending.length > 0) {\n const pending = this.pending.pop();\n pending.abort();\n }\n\n let endpoint = this.endpoint;\n let pagesToFetch = this.pages || 1;\n let pages = 0;\n let nextPage = null;\n\n let fetchedItems: any[] = [];\n\n while (pagesToFetch > 0 && endpoint) {\n const controller = new AbortController();\n this.pending.push(controller);\n\n try {\n const page = await fetchResultsPage(endpoint, controller);\n\n // sanitize our options if necessary\n if (this.sanitizeOption) {\n page.results.forEach(this.sanitizeOption);\n }\n\n if (page.results) {\n fetchedItems = fetchedItems.concat(page.results);\n }\n\n // save our next pages\n nextPage = page.next;\n endpoint = nextPage;\n pagesToFetch--;\n pages++;\n } catch (error) {\n // aborted\n this.reset();\n\n console.log('error, resetting');\n return;\n }\n\n this.nextPage = nextPage;\n }\n this.pages = pages;\n\n const topItem = fetchedItems[0];\n if (\n !this.mostRecentItem ||\n JSON.stringify(this.mostRecentItem) !== JSON.stringify(topItem)\n ) {\n this.mostRecentItem = topItem;\n }\n\n // see if our cursor needs to move to stay on the same item\n const newItem = fetchedItems[this.cursorIndex];\n\n if (\n !this.nextSelection &&\n this.selected &&\n newItem &&\n this.getValue(newItem) !== this.getValue(this.selected)\n ) {\n const index = fetchedItems.findIndex(item => {\n return this.getValue(item) === this.getValue(this.selected);\n });\n\n // old selection is in the new fetch\n if (index > -1) {\n this.cursorIndex = index;\n }\n // old selection is missing from the new fetch\n else {\n // if our index didn't change, our item still did, fire change\n if (this.cursorIndex === 0) {\n this.requestUpdate('cursorIndex');\n }\n // otherwise select the first item\n else {\n this.cursorIndex = 0;\n }\n }\n }\n\n // save our results\n this.items = fetchedItems;\n this.loading = false;\n this.pending = [];\n\n if (this.nextSelection) {\n this.setSelection(this.nextSelection);\n this.nextSelection = false;\n } else {\n if (this.cursorIndex === -1) {\n this.cursorIndex = 0;\n }\n }\n\n // TODO: Not sure why this is needed\n // this.requestUpdate('cursorIndex');\n\n if (this.value) {\n this.setSelection(this.value);\n this.value = null;\n }\n\n return Promise.resolve();\n }\n\n private handleScrollThreshold() {\n if (this.nextPage && !this.loading) {\n this.loading = true;\n fetchResultsPage(this.nextPage).then((page: ResultsPage) => {\n if (this.sanitizeOption) {\n page.results.forEach(this.sanitizeOption);\n }\n\n this.items = [...this.items, ...page.results];\n this.nextPage = page.next;\n this.pages++;\n this.loading = false;\n });\n }\n }\n\n public renderHeader(): TemplateResult {\n return null;\n }\n\n public renderFooter(): TemplateResult {\n return null;\n }\n\n public getListStyle() {\n return '';\n }\n\n private handleSelection(event: CustomEvent) {\n const { selected, index } = event.detail;\n\n this.selected = selected;\n this.cursorIndex = index;\n\n event.stopPropagation();\n event.preventDefault();\n }\n\n public render(): TemplateResult {\n return html`\n ${this.renderHeader()}\n <temba-options\n style=\"${this.getListStyle()}\"\n ?visible=${true}\n ?block=${true}\n ?hideShadow=${this.hideShadow}\n ?collapsed=${this.collapsed}\n ?loading=${this.loading}\n .renderOption=${this.renderOption}\n .renderOptionDetail=${this.renderOptionDetail}\n @temba-scroll-threshold=${this.handleScrollThreshold}\n @temba-selection=${this.handleSelection.bind(this)}\n .options=${this.items}\n .cursorIndex=${this.cursorIndex}\n >\n <slot></slot>\n </temba-options>\n ${this.renderFooter()}\n `;\n }\n}\n"]}
|
|
@@ -14,6 +14,7 @@ export class Options extends RapidElement {
|
|
|
14
14
|
this.cursorIndex = -1;
|
|
15
15
|
this.nameKey = 'name';
|
|
16
16
|
this.loading = false;
|
|
17
|
+
this.hideShadow = false;
|
|
17
18
|
this.getName = function (option) {
|
|
18
19
|
return option[this.nameKey || 'name'];
|
|
19
20
|
};
|
|
@@ -34,7 +35,6 @@ export class Options extends RapidElement {
|
|
|
34
35
|
.options-container {
|
|
35
36
|
background: var(--color-widget-bg-focused);
|
|
36
37
|
user-select: none;
|
|
37
|
-
box-shadow: var(--options-shadow);
|
|
38
38
|
border-radius: var(--curvature-widget);
|
|
39
39
|
overflow: hidden;
|
|
40
40
|
margin-top: var(--options-margin-top);
|
|
@@ -50,6 +50,10 @@ export class Options extends RapidElement {
|
|
|
50
50
|
border: 1px transparent;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
.shadow {
|
|
54
|
+
box-shadow: var(--options-shadow);
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
.anchored {
|
|
54
58
|
position: fixed;
|
|
55
59
|
}
|
|
@@ -70,12 +74,19 @@ export class Options extends RapidElement {
|
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
:host([block]) {
|
|
73
|
-
box-shadow: var(--options-block-shadow);
|
|
74
77
|
border-radius: var(--curvature);
|
|
75
78
|
display: block;
|
|
76
79
|
height: 100%;
|
|
77
80
|
}
|
|
78
81
|
|
|
82
|
+
:host([block]) .shadow {
|
|
83
|
+
box-shadow: var(--options-block-shadow);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.bordered {
|
|
87
|
+
border: 1px solid var(--color-widget-border) !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
79
90
|
:host([block]) .options {
|
|
80
91
|
margin-bottom: 1.5em;
|
|
81
92
|
}
|
|
@@ -452,6 +463,8 @@ export class Options extends RapidElement {
|
|
|
452
463
|
top: this.poppedTop,
|
|
453
464
|
anchored: !this.block,
|
|
454
465
|
loading: this.loading,
|
|
466
|
+
shadow: !this.hideShadow,
|
|
467
|
+
bordered: this.hideShadow,
|
|
455
468
|
});
|
|
456
469
|
const classesInner = getClasses({
|
|
457
470
|
options: true,
|
|
@@ -544,6 +557,9 @@ __decorate([
|
|
|
544
557
|
__decorate([
|
|
545
558
|
property({ type: Boolean })
|
|
546
559
|
], Options.prototype, "collapsed", void 0);
|
|
560
|
+
__decorate([
|
|
561
|
+
property({ type: Boolean })
|
|
562
|
+
], Options.prototype, "hideShadow", void 0);
|
|
547
563
|
__decorate([
|
|
548
564
|
property({ attribute: false })
|
|
549
565
|
], Options.prototype, "getName", void 0);
|