@nyaruka/temba-components 0.105.1 → 0.107.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 +19 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/pt.js.map +1 -1
- package/dist/temba-components.js +489 -373
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/contactsearch/ContactSearch.js +31 -13
- package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
- package/out-tsc/src/date/TembaDate.js +4 -0
- package/out-tsc/src/date/TembaDate.js.map +1 -1
- package/out-tsc/src/locales/es.js +1 -1
- package/out-tsc/src/locales/es.js.map +1 -1
- package/out-tsc/src/locales/fr.js +1 -1
- package/out-tsc/src/locales/fr.js.map +1 -1
- package/out-tsc/src/locales/pt.js +1 -1
- package/out-tsc/src/locales/pt.js.map +1 -1
- package/out-tsc/src/progress/FlowStartProgress.js +60 -0
- package/out-tsc/src/progress/FlowStartProgress.js.map +1 -0
- package/out-tsc/src/progress/ProgressBar.js +163 -0
- package/out-tsc/src/progress/ProgressBar.js.map +1 -0
- package/out-tsc/src/store/Store.js +23 -0
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/temba-modules.js +4 -0
- package/out-tsc/temba-modules.js.map +1 -1
- package/package.json +2 -2
- package/src/contactsearch/ContactSearch.ts +36 -15
- package/src/date/TembaDate.ts +3 -0
- package/src/locales/es.ts +1 -1
- package/src/locales/fr.ts +1 -1
- package/src/locales/pt.ts +1 -1
- package/src/progress/FlowStartProgress.ts +67 -0
- package/src/progress/ProgressBar.ts +159 -0
- package/src/store/Store.ts +28 -0
- package/temba-modules.ts +4 -0
|
@@ -215,6 +215,7 @@ export class ContactSearch extends FormElement {
|
|
|
215
215
|
--temba-select-selected-line-height: 1em;
|
|
216
216
|
--temba-select-selected-font-size: 1em;
|
|
217
217
|
--search-input-height: 0px !important;
|
|
218
|
+
--temba-select-min-height: 1.8em;
|
|
218
219
|
min-width: 100px;
|
|
219
220
|
}
|
|
220
221
|
|
|
@@ -226,7 +227,18 @@ export class ContactSearch extends FormElement {
|
|
|
226
227
|
`;
|
|
227
228
|
}
|
|
228
229
|
refresh() {
|
|
229
|
-
this.
|
|
230
|
+
if (this.advanced || this.recipients.length > 0) {
|
|
231
|
+
this.refreshKey = 'requested_' + new Date().getTime();
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.summary = null;
|
|
235
|
+
this.fetching = false;
|
|
236
|
+
this.requestUpdate();
|
|
237
|
+
this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
firstUpdated(changes) {
|
|
241
|
+
super.firstUpdated(changes);
|
|
230
242
|
}
|
|
231
243
|
updated(changedProperties) {
|
|
232
244
|
super.updated(changedProperties);
|
|
@@ -271,6 +283,9 @@ export class ContactSearch extends FormElement {
|
|
|
271
283
|
}).then((response) => {
|
|
272
284
|
this.fetching = false;
|
|
273
285
|
this.initialized = true;
|
|
286
|
+
if (this.recipients.length == 0 && !this.advanced) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
274
289
|
if (response.status === 200) {
|
|
275
290
|
this.summary = response.json;
|
|
276
291
|
if (!this.advanced) {
|
|
@@ -373,7 +388,7 @@ export class ContactSearch extends FormElement {
|
|
|
373
388
|
else {
|
|
374
389
|
this.exclusions[checkbox.name] = value;
|
|
375
390
|
}
|
|
376
|
-
if (ex !== JSON.stringify(this.exclusions)) {
|
|
391
|
+
if (ex !== JSON.stringify(this.exclusions) && this.endpoint) {
|
|
377
392
|
this.refresh();
|
|
378
393
|
}
|
|
379
394
|
}
|
|
@@ -422,10 +437,11 @@ export class ContactSearch extends FormElement {
|
|
|
422
437
|
}
|
|
423
438
|
}
|
|
424
439
|
const notSeenSinceDays = this.exclusions['not_seen_since_days'];
|
|
440
|
+
let blockers = null;
|
|
425
441
|
if (this.summary &&
|
|
426
442
|
this.summary.blockers &&
|
|
427
443
|
this.summary.blockers.length > 0) {
|
|
428
|
-
|
|
444
|
+
blockers = html `${this.summary.blockers.map((error) => html `<temba-alert level="error">${unsafeHTML(error)}</temba-alert>`)}`;
|
|
429
445
|
}
|
|
430
446
|
return html `
|
|
431
447
|
${this.advanced
|
|
@@ -474,7 +490,14 @@ export class ContactSearch extends FormElement {
|
|
|
474
490
|
Only include contacts who...
|
|
475
491
|
</div>
|
|
476
492
|
</div>
|
|
477
|
-
|
|
493
|
+
${this.in_a_flow
|
|
494
|
+
? html `<temba-checkbox
|
|
495
|
+
name="in_a_flow"
|
|
496
|
+
label="${msg('Are not currently in a flow')}"
|
|
497
|
+
?checked=${this.exclusions['in_a_flow']}
|
|
498
|
+
@change=${this.handleExclusionChanged}
|
|
499
|
+
></temba-checkbox>`
|
|
500
|
+
: null}
|
|
478
501
|
${this.not_seen_since_days
|
|
479
502
|
? html `
|
|
480
503
|
<div
|
|
@@ -518,14 +541,6 @@ export class ContactSearch extends FormElement {
|
|
|
518
541
|
<div></div>
|
|
519
542
|
</div>
|
|
520
543
|
`
|
|
521
|
-
: null}
|
|
522
|
-
${this.in_a_flow
|
|
523
|
-
? html `<temba-checkbox
|
|
524
|
-
name="in_a_flow"
|
|
525
|
-
label="${msg('Are not currently in a flow')}"
|
|
526
|
-
?checked=${this.exclusions['in_a_flow']}
|
|
527
|
-
@change=${this.handleExclusionChanged}
|
|
528
|
-
></temba-checkbox>`
|
|
529
544
|
: null}
|
|
530
545
|
${this.started_previously
|
|
531
546
|
? html `<temba-checkbox
|
|
@@ -550,11 +565,14 @@ export class ContactSearch extends FormElement {
|
|
|
550
565
|
<temba-loading units="6" size="8"></temba-loading>
|
|
551
566
|
<div class="summary ${this.expanded ? 'expanded' : ''}">${summary}</div>
|
|
552
567
|
</div>
|
|
553
|
-
${
|
|
568
|
+
${blockers}
|
|
569
|
+
${!blockers && this.summary && this.summary.warnings
|
|
554
570
|
? this.summary.warnings.map((warning) => html `<temba-alert level="warning"
|
|
555
571
|
>${unsafeHTML(warning)}</temba-alert
|
|
556
572
|
>`)
|
|
557
573
|
: ``}
|
|
574
|
+
|
|
575
|
+
|
|
558
576
|
`;
|
|
559
577
|
}
|
|
560
578
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactSearch.js","sourceRoot":"","sources":["../../../src/contactsearch/ContactSearch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAExE,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAW,eAAe,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,MAAM,YAAY,GAAG,IAAI,CAAC;AAY1B,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QAgOE,gBAAW,GAAG,EAAE,CAAC;QAGjB,SAAI,GAAG,EAAE,CAAC;QAGV,UAAK,GAAG,EAAE,CAAC;QAGX,sBAAiB,GAAG,IAAI,CAAC;QAGzB,iBAAY,GAAG,EAAE,CAAC;QASlB,eAAU,GAAiB,EAAE,CAAC;QAG9B,aAAQ,GAAG,KAAK,CAAC;QAGjB,eAAU,GAAG,GAAG,CAAC;QAOT,eAAU,GAAG,EAAE,CAAC;QAGhB,gBAAW,GAAG,KAAK,CAAC;IAmX9B,CAAC;IAvnBC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;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O,EAAE,CAAC;+CACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACjB;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAChB;AAGX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDACF;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACT;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACpB;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACnC;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;iDACI;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACV;AAOT;IADP,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACH","sourcesContent":["import { TemplateResult, html, css } from 'lit';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport { property } from 'lit/decorators.js';\nimport { getClasses, postJSON, stopEvent, WebResponse } from '../utils';\nimport { TextInput } from '../textinput/TextInput';\nimport '../alert/Alert';\nimport { Contact, CustomEventType } from '../interfaces';\nimport { FormElement } from '../FormElement';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { msg } from '@lit/localize';\nimport { OmniOption } from '../omnibox/Omnibox';\nimport { Select } from '../select/Select';\n\nconst QUEIT_MILLIS = 2000;\n\ninterface SummaryResponse {\n total: number;\n sample: Contact[];\n query: string;\n fields: { [uuid: string]: { label: string; type: string } };\n error?: string;\n warnings: string[];\n blockers: string[];\n}\n\nexport class ContactSearch extends FormElement {\n static get styles() {\n return css`\n :host {\n color: var(--color-text);\n }\n\n .urn {\n width: 120px;\n }\n\n .name {\n width: 160px;\n }\n\n .date {\n text-align: right;\n }\n\n .field-header {\n font-size: 80%;\n color: var(--color-text-dark);\n }\n\n .field-header.date {\n text-align: right;\n }\n\n .more {\n font-size: 90%;\n padding-top: 5px;\n padding-right: 3px;\n text-align: right;\n width: 100px;\n vertical-align: top;\n }\n\n table {\n width: 100%;\n }\n\n .contact td {\n border-bottom: 1px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .table-footer td {\n padding: 10px 3px;\n }\n\n .query-replaced,\n .count-replaced {\n display: inline-block;\n background: var(--color-primary-light);\n color: var(--color-text-dark);\n padding: 3px 6px;\n border-radius: var(--curvature);\n font-size: 85%;\n margin: 0px 3px;\n }\n\n temba-loading {\n transform: scale(0);\n max-width: 0;\n opacity: 0;\n transition: transform 200ms ease-in-out;\n }\n\n .fetching temba-loading {\n transform: scale(1);\n max-width: 500px;\n opacity: 1;\n display: block;\n }\n\n .error {\n margin-top: 10px;\n }\n\n .match-count {\n padding: 4px;\n margin-top: 6px;\n }\n\n .linked {\n color: var(--color-link-primary);\n text-decoration: none;\n cursor: pointer;\n }\n\n .header td {\n border-bottom: 0px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .expanded .header td {\n border-bottom: 2px solid var(--color-borders);\n }\n\n td.field-header,\n tr.table-footer,\n tr.contact {\n display: none;\n }\n\n .expanded td.field-header {\n display: table-cell;\n }\n\n .expanded tr.contact,\n .expanded tr.table-footer {\n display: table-row;\n }\n\n .query {\n display: var(--contact-search-query-display);\n margin-bottom: 10px;\n }\n\n .results {\n display: none;\n }\n\n .summary {\n min-height: 2.2em;\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n\n .summary .result-count {\n flex-grow: 1;\n }\n\n .results.empty {\n display: none !important;\n }\n\n .results.initialized {\n display: flex;\n align-items: center;\n margin-top: 0.5em;\n margin-left: 0.6em;\n }\n\n .advanced-icon {\n cursor: pointer;\n margin-right: 0.5em;\n }\n\n .query .advanced-icon {\n margin-top: 1em;\n margin-right: 1em;\n }\n\n .advanced-icon:hover {\n --icon-color: var(--color-link-primary-hover) !important;\n }\n\n .query {\n --textarea-height: 5em;\n }\n\n #recipients {\n margin-bottom: 1em;\n display: block;\n }\n\n temba-alert {\n margin: 1em 0;\n }\n\n temba-select[name='not_seen_since_days'] {\n margin-bottom: 1em;\n display: block;\n }\n\n .activity-select {\n display: flex;\n align-items: center;\n padding: var(--checkbox-padding, 10px);\n border-radius: var(--curvature);\n cursor: pointer;\n }\n\n .activity-select:hover {\n background: #f9f9f9;\n }\n\n .small-select {\n --temba-select-selected-padding: 0px 0.5em;\n --temba-select-selected-line-height: 1em;\n --temba-select-selected-font-size: 1em;\n --search-input-height: 0px !important;\n min-width: 100px;\n }\n\n .filters {\n padding: 1em;\n border: 1px solid var(--color-borders);\n border-radius: var(--curvature);\n }\n `;\n }\n\n @property({ type: Boolean })\n in_a_flow: boolean;\n\n @property({ type: Boolean })\n started_previously: boolean;\n\n @property({ type: Boolean })\n not_seen_since_days: boolean;\n\n @property({ type: Boolean })\n fetching: boolean;\n\n @property({ type: Boolean })\n expanded: boolean;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: String })\n query = '';\n\n @property({ type: Number })\n inactiveThreshold = 1000;\n\n @property({ type: Number })\n inactiveDays = 90;\n\n @property({ type: Object, attribute: false })\n summary: SummaryResponse;\n\n @property({ type: Object, attribute: false })\n flow: any;\n\n @property({ type: Array })\n recipients: OmniOption[] = [];\n\n @property({ type: Boolean })\n advanced = false;\n\n @property({ type: String })\n refreshKey = '0';\n\n public refresh(): void {\n this.refreshKey = 'requested_' + new Date().getTime();\n }\n\n @property({ type: Object })\n private exclusions = {};\n\n private lastQuery: number;\n private initialized = false;\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('recipients')) {\n this.handleRecipientsChanged();\n }\n\n // if we remove the in_a_flow option, make sure it's not part of our exclusions\n if (changedProperties.has('in_a_flow') && !this.in_a_flow) {\n delete this.exclusions['in_a_flow'];\n this.requestUpdate('exclusions');\n }\n\n if (\n (changedProperties.has('query') && this.advanced) ||\n (changedProperties.has('refreshKey') && this.refreshKey !== '0')\n ) {\n this.summary = null;\n // this.errors = [];\n this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });\n if (this.lastQuery) {\n window.clearTimeout(this.lastQuery);\n this.fetching = false;\n }\n\n if (this.query.trim().length > 0 || this.recipients.length > 0) {\n this.fetching = true;\n this.lastQuery = window.setTimeout(() => {\n this.fetchSummary();\n }, QUEIT_MILLIS);\n }\n }\n }\n\n public fetchSummary(): any {\n if (this.endpoint) {\n const group_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'group')\n .map((value: OmniOption) => value.id);\n\n const contact_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'contact')\n .map((value: OmniOption) => value.id);\n\n postJSON(this.endpoint, {\n include: this.advanced\n ? { query: this.query }\n : { contact_uuids, group_uuids },\n\n exclude: this.exclusions\n }).then((response: WebResponse) => {\n this.fetching = false;\n this.initialized = true;\n if (response.status === 200) {\n this.summary = response.json as SummaryResponse;\n if (!this.advanced) {\n this.query = this.summary.query;\n }\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n\n if (this.summary.error) {\n this.errors = [this.summary.error];\n } else {\n this.errors = [];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n } else {\n this.summary = response.json as SummaryResponse;\n if (this.summary.error) {\n this.errors = [this.summary.error];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n }\n });\n }\n }\n\n private handleAdvancedToggle(evt: MouseEvent) {\n stopEvent(evt);\n this.recipients = [];\n this.exclusions = {};\n if (this.advanced) {\n this.query = '';\n this.value = null;\n }\n this.advanced = !this.advanced;\n\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n }\n\n private handleQueryChange(evt: KeyboardEvent) {\n const input = evt.target as TextInput;\n this.query = input.inputElement.value;\n }\n\n private handleRecipientsChanged() {\n if (!this.endpoint) {\n return;\n }\n\n if (this.recipients && (this.refreshKey !== '0' || this.initialized)) {\n this.refresh();\n } else {\n this.initialized = true;\n }\n }\n\n private handleActivityLevelChanged(evt: any) {\n const select = evt.target as Select;\n const option = select.values[0];\n if (option) {\n if (this.exclusions['not_seen_since_days']) {\n this.exclusions['not_seen_since_days'] = parseInt(option.value);\n this.refresh();\n }\n }\n }\n\n private handleActivityLabelClicked(evt: any) {\n if (\n evt.target &&\n evt.target.tagName !== 'TEMBA-CHECKBOX' &&\n evt.target.tagName !== 'TEMBA-SELECT' &&\n !evt.target.disabled\n ) {\n const checkbox = evt.currentTarget.querySelector('temba-checkbox');\n checkbox.checked = !checkbox.checked;\n }\n }\n\n private handleExclusionChanged(evt: any) {\n if (evt.target.tagName === 'TEMBA-CHECKBOX') {\n const ex = JSON.stringify(this.exclusions);\n const checkbox = evt.target as Checkbox;\n let value = checkbox.checked as any;\n\n // if we check the activity box, look inside the select for the value\n if (checkbox.name === 'not_seen_since_days' && value) {\n const select = checkbox.parentElement.querySelector(\n 'temba-select'\n ) as Select;\n if (select.values[0]) {\n value = parseInt(select.values[0].value);\n } else {\n value = this.exclusions[checkbox.name];\n }\n }\n\n if (!value) {\n delete this.exclusions[checkbox.name];\n } else {\n this.exclusions[checkbox.name] = value;\n }\n\n if (ex !== JSON.stringify(this.exclusions)) {\n this.refresh();\n }\n }\n }\n\n public render(): TemplateResult {\n let summary: TemplateResult;\n if (this.summary) {\n if (!this.summary.error) {\n const count = this.summary.total || 0;\n\n summary = html`\n <div class=\"result-count\">\n Found\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(this.summary.query)}\"\n >\n ${count.toLocaleString()}\n </a>\n contact${count !== 1 ? 's' : ''}\n </div>\n <temba-button\n class=\"edit\"\n name=\"edit\"\n secondary\n small\n @click=${this.handleAdvancedToggle}\n >\n <div slot=\"name\">\n <div style=\"display: flex; align-items: center;\">\n ${this.advanced\n ? html` <temba-icon\n name=\"reset\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Start Over`\n : html` <temba-icon\n name=\"edit\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Edit Query`}\n </div>\n </div>\n </temba-button>\n `;\n }\n }\n\n const notSeenSinceDays = this.exclusions['not_seen_since_days'];\n if (\n this.summary &&\n this.summary.blockers &&\n this.summary.blockers.length > 0\n ) {\n return html`${this.summary.blockers.map(\n (error) =>\n html`<temba-alert level=\"error\">${unsafeHTML(error)}</temba-alert>`\n )}`;\n }\n\n return html`\n ${\n this.advanced\n ? html`<div class=\"query\">\n <temba-textinput\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n .errors=${this.errors}\n name=${this.name}\n .inputRoot=${this}\n @input=${this.handleQueryChange}\n placeholder=${this.placeholder}\n .value=${this.query}\n textarea\n autogrow\n >\n </temba-textinput>\n </div>`\n : html`<temba-omnibox\n placeholder=\"Search for contacts or groups\"\n widget_only=\"\"\n groups=\"\"\n contacts=\"\"\n label=\"Recipients\"\n help_text=\"The contacts to send the message to.\"\n .errors=${this.errors}\n id=\"recipients\"\n name=\"recipients\"\n .value=${this.recipients}\n endpoint=\"/contact/omnibox/?\"\n @change=${this.handleRecipientsChanged}\n >\n </temba-omnibox>\n\n ${this.not_seen_since_days ||\n this.in_a_flow ||\n this.started_previously\n ? html`\n <div class=\"filters\">\n <div\n style=\"display:flex;font-size:1em;margin-bottom:0.5em\"\n >\n <temba-icon size=\"1\" name=\"filter\"></temba-icon>\n <div style=\"margin-left:0.5em\">\n Only include contacts who...\n </div>\n </div>\n\n ${this.not_seen_since_days\n ? html`\n <div\n class=\"activity-select\"\n @click=${this.handleActivityLabelClicked}\n >\n <temba-checkbox\n style=\"display:inline;\"\n name=\"not_seen_since_days\"\n ?checked=${notSeenSinceDays}\n @change=${this.handleExclusionChanged}\n >\n </temba-checkbox>\n\n <div style=\"margin-left:0.5em\">\n ${msg('Have sent a message in the last')}\n </div>\n\n <temba-select\n style=\"margin-left:0.5em\"\n class=\"small-select\"\n @change=${this.handleActivityLevelChanged}\n ?disabled=${!notSeenSinceDays}\n >\n <temba-option\n name=\"90 days\"\n value=\"90\"\n ?selected=${notSeenSinceDays === 90}\n ></temba-option>\n <temba-option\n name=\"180 days\"\n value=\"180\"\n ?selected=${notSeenSinceDays === 180}\n ></temba-option>\n <temba-option\n name=\"Year\"\n value=\"365\"\n ?selected=${notSeenSinceDays === 365}\n ></temba-option>\n </temba-select>\n <div></div>\n </div>\n `\n : null}\n ${this.in_a_flow\n ? html`<temba-checkbox\n name=\"in_a_flow\"\n label=\"${msg('Are not currently in a flow')}\"\n ?checked=${this.exclusions['in_a_flow']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n ${this.started_previously\n ? html`<temba-checkbox\n name=\"started_previously\"\n label=\"${msg(\n 'Have not started this flow in the last 90 days'\n )}\"\n ?checked=${this.exclusions['started_previously']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n </div>\n `\n : null} `\n }\n </div>\n <div\n class=\"results ${getClasses({\n fetching: this.fetching,\n initialized: this.initialized || this.fetching,\n empty:\n ((this.summary && this.summary.error) || !this.summary) &&\n !this.fetching\n })}\"\n >\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n <div class=\"summary ${this.expanded ? 'expanded' : ''}\">${summary}</div>\n </div>\n ${\n this.summary && this.summary.warnings\n ? this.summary.warnings.map(\n (warning) =>\n html`<temba-alert level=\"warning\"\n >${unsafeHTML(warning)}</temba-alert\n >`\n )\n : ``\n }\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ContactSearch.js","sourceRoot":"","sources":["../../../src/contactsearch/ContactSearch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAoB,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAExE,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAW,eAAe,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,MAAM,YAAY,GAAG,IAAI,CAAC;AAY1B,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QAiOE,gBAAW,GAAG,EAAE,CAAC;QAGjB,SAAI,GAAG,EAAE,CAAC;QAGV,UAAK,GAAG,EAAE,CAAC;QAGX,sBAAiB,GAAG,IAAI,CAAC;QAGzB,iBAAY,GAAG,EAAE,CAAC;QASlB,eAAU,GAAiB,EAAE,CAAC;QAG9B,aAAQ,GAAG,KAAK,CAAC;QAGjB,eAAU,GAAG,GAAG,CAAC;QAcV,eAAU,GAAG,EAAE,CAAC;QAGf,gBAAW,GAAG,KAAK,CAAC;IAgY9B,CAAC;IA5oBC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;iDACI;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACV;AAcV;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACJ","sourcesContent":["import { TemplateResult, html, css, PropertyValueMap } from 'lit';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport { property } from 'lit/decorators.js';\nimport { getClasses, postJSON, stopEvent, WebResponse } from '../utils';\nimport { TextInput } from '../textinput/TextInput';\nimport '../alert/Alert';\nimport { Contact, CustomEventType } from '../interfaces';\nimport { FormElement } from '../FormElement';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { msg } from '@lit/localize';\nimport { OmniOption } from '../omnibox/Omnibox';\nimport { Select } from '../select/Select';\n\nconst QUEIT_MILLIS = 2000;\n\ninterface SummaryResponse {\n total: number;\n sample: Contact[];\n query: string;\n fields: { [uuid: string]: { label: string; type: string } };\n error?: string;\n warnings: string[];\n blockers: string[];\n}\n\nexport class ContactSearch extends FormElement {\n static get styles() {\n return css`\n :host {\n color: var(--color-text);\n }\n\n .urn {\n width: 120px;\n }\n\n .name {\n width: 160px;\n }\n\n .date {\n text-align: right;\n }\n\n .field-header {\n font-size: 80%;\n color: var(--color-text-dark);\n }\n\n .field-header.date {\n text-align: right;\n }\n\n .more {\n font-size: 90%;\n padding-top: 5px;\n padding-right: 3px;\n text-align: right;\n width: 100px;\n vertical-align: top;\n }\n\n table {\n width: 100%;\n }\n\n .contact td {\n border-bottom: 1px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .table-footer td {\n padding: 10px 3px;\n }\n\n .query-replaced,\n .count-replaced {\n display: inline-block;\n background: var(--color-primary-light);\n color: var(--color-text-dark);\n padding: 3px 6px;\n border-radius: var(--curvature);\n font-size: 85%;\n margin: 0px 3px;\n }\n\n temba-loading {\n transform: scale(0);\n max-width: 0;\n opacity: 0;\n transition: transform 200ms ease-in-out;\n }\n\n .fetching temba-loading {\n transform: scale(1);\n max-width: 500px;\n opacity: 1;\n display: block;\n }\n\n .error {\n margin-top: 10px;\n }\n\n .match-count {\n padding: 4px;\n margin-top: 6px;\n }\n\n .linked {\n color: var(--color-link-primary);\n text-decoration: none;\n cursor: pointer;\n }\n\n .header td {\n border-bottom: 0px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .expanded .header td {\n border-bottom: 2px solid var(--color-borders);\n }\n\n td.field-header,\n tr.table-footer,\n tr.contact {\n display: none;\n }\n\n .expanded td.field-header {\n display: table-cell;\n }\n\n .expanded tr.contact,\n .expanded tr.table-footer {\n display: table-row;\n }\n\n .query {\n display: var(--contact-search-query-display);\n margin-bottom: 10px;\n }\n\n .results {\n display: none;\n }\n\n .summary {\n min-height: 2.2em;\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n\n .summary .result-count {\n flex-grow: 1;\n }\n\n .results.empty {\n display: none !important;\n }\n\n .results.initialized {\n display: flex;\n align-items: center;\n margin-top: 0.5em;\n margin-left: 0.6em;\n }\n\n .advanced-icon {\n cursor: pointer;\n margin-right: 0.5em;\n }\n\n .query .advanced-icon {\n margin-top: 1em;\n margin-right: 1em;\n }\n\n .advanced-icon:hover {\n --icon-color: var(--color-link-primary-hover) !important;\n }\n\n .query {\n --textarea-height: 5em;\n }\n\n #recipients {\n margin-bottom: 1em;\n display: block;\n }\n\n temba-alert {\n margin: 1em 0;\n }\n\n temba-select[name='not_seen_since_days'] {\n margin-bottom: 1em;\n display: block;\n }\n\n .activity-select {\n display: flex;\n align-items: center;\n padding: var(--checkbox-padding, 10px);\n border-radius: var(--curvature);\n cursor: pointer;\n }\n\n .activity-select:hover {\n background: #f9f9f9;\n }\n\n .small-select {\n --temba-select-selected-padding: 0px 0.5em;\n --temba-select-selected-line-height: 1em;\n --temba-select-selected-font-size: 1em;\n --search-input-height: 0px !important;\n --temba-select-min-height: 1.8em;\n min-width: 100px;\n }\n\n .filters {\n padding: 1em;\n border: 1px solid var(--color-borders);\n border-radius: var(--curvature);\n }\n `;\n }\n\n @property({ type: Boolean })\n in_a_flow: boolean;\n\n @property({ type: Boolean })\n started_previously: boolean;\n\n @property({ type: Boolean })\n not_seen_since_days: boolean;\n\n @property({ type: Boolean })\n fetching: boolean;\n\n @property({ type: Boolean })\n expanded: boolean;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: String })\n query = '';\n\n @property({ type: Number })\n inactiveThreshold = 1000;\n\n @property({ type: Number })\n inactiveDays = 90;\n\n @property({ type: Object, attribute: false })\n summary: SummaryResponse;\n\n @property({ type: Object, attribute: false })\n flow: any;\n\n @property({ type: Array })\n recipients: OmniOption[] = [];\n\n @property({ type: Boolean })\n advanced = false;\n\n @property({ type: String })\n refreshKey = '0';\n\n public refresh(): void {\n if (this.advanced || this.recipients.length > 0) {\n this.refreshKey = 'requested_' + new Date().getTime();\n } else {\n this.summary = null;\n this.fetching = false;\n this.requestUpdate();\n this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });\n }\n }\n\n @property({ type: Object })\n public exclusions = {};\n\n private lastQuery: number;\n private initialized = false;\n\n public firstUpdated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changes);\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('recipients')) {\n this.handleRecipientsChanged();\n }\n\n // if we remove the in_a_flow option, make sure it's not part of our exclusions\n if (changedProperties.has('in_a_flow') && !this.in_a_flow) {\n delete this.exclusions['in_a_flow'];\n this.requestUpdate('exclusions');\n }\n\n if (\n (changedProperties.has('query') && this.advanced) ||\n (changedProperties.has('refreshKey') && this.refreshKey !== '0')\n ) {\n this.summary = null;\n // this.errors = [];\n this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });\n if (this.lastQuery) {\n window.clearTimeout(this.lastQuery);\n this.fetching = false;\n }\n\n if (this.query.trim().length > 0 || this.recipients.length > 0) {\n this.fetching = true;\n this.lastQuery = window.setTimeout(() => {\n this.fetchSummary();\n }, QUEIT_MILLIS);\n }\n }\n }\n\n public fetchSummary(): any {\n if (this.endpoint) {\n const group_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'group')\n .map((value: OmniOption) => value.id);\n\n const contact_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'contact')\n .map((value: OmniOption) => value.id);\n\n postJSON(this.endpoint, {\n include: this.advanced\n ? { query: this.query }\n : { contact_uuids, group_uuids },\n\n exclude: this.exclusions\n }).then((response: WebResponse) => {\n this.fetching = false;\n this.initialized = true;\n if (this.recipients.length == 0 && !this.advanced) {\n return;\n }\n if (response.status === 200) {\n this.summary = response.json as SummaryResponse;\n if (!this.advanced) {\n this.query = this.summary.query;\n }\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n\n if (this.summary.error) {\n this.errors = [this.summary.error];\n } else {\n this.errors = [];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n } else {\n this.summary = response.json as SummaryResponse;\n if (this.summary.error) {\n this.errors = [this.summary.error];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n }\n });\n }\n }\n\n private handleAdvancedToggle(evt: MouseEvent) {\n stopEvent(evt);\n this.recipients = [];\n this.exclusions = {};\n if (this.advanced) {\n this.query = '';\n this.value = null;\n }\n this.advanced = !this.advanced;\n\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n }\n\n private handleQueryChange(evt: KeyboardEvent) {\n const input = evt.target as TextInput;\n this.query = input.inputElement.value;\n }\n\n private handleRecipientsChanged() {\n if (!this.endpoint) {\n return;\n }\n\n if (this.recipients && (this.refreshKey !== '0' || this.initialized)) {\n this.refresh();\n } else {\n this.initialized = true;\n }\n }\n\n private handleActivityLevelChanged(evt: any) {\n const select = evt.target as Select;\n const option = select.values[0];\n if (option) {\n if (this.exclusions['not_seen_since_days']) {\n this.exclusions['not_seen_since_days'] = parseInt(option.value);\n this.refresh();\n }\n }\n }\n\n private handleActivityLabelClicked(evt: any) {\n if (\n evt.target &&\n evt.target.tagName !== 'TEMBA-CHECKBOX' &&\n evt.target.tagName !== 'TEMBA-SELECT' &&\n !evt.target.disabled\n ) {\n const checkbox = evt.currentTarget.querySelector('temba-checkbox');\n checkbox.checked = !checkbox.checked;\n }\n }\n\n private handleExclusionChanged(evt: any) {\n if (evt.target.tagName === 'TEMBA-CHECKBOX') {\n const ex = JSON.stringify(this.exclusions);\n const checkbox = evt.target as Checkbox;\n let value = checkbox.checked as any;\n\n // if we check the activity box, look inside the select for the value\n if (checkbox.name === 'not_seen_since_days' && value) {\n const select = checkbox.parentElement.querySelector(\n 'temba-select'\n ) as Select;\n if (select.values[0]) {\n value = parseInt(select.values[0].value);\n } else {\n value = this.exclusions[checkbox.name];\n }\n }\n\n if (!value) {\n delete this.exclusions[checkbox.name];\n } else {\n this.exclusions[checkbox.name] = value;\n }\n\n if (ex !== JSON.stringify(this.exclusions) && this.endpoint) {\n this.refresh();\n }\n }\n }\n\n public render(): TemplateResult {\n let summary: TemplateResult;\n if (this.summary) {\n if (!this.summary.error) {\n const count = this.summary.total || 0;\n\n summary = html`\n <div class=\"result-count\">\n Found\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(this.summary.query)}\"\n >\n ${count.toLocaleString()}\n </a>\n contact${count !== 1 ? 's' : ''}\n </div>\n <temba-button\n class=\"edit\"\n name=\"edit\"\n secondary\n small\n @click=${this.handleAdvancedToggle}\n >\n <div slot=\"name\">\n <div style=\"display: flex; align-items: center;\">\n ${this.advanced\n ? html` <temba-icon\n name=\"reset\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Start Over`\n : html` <temba-icon\n name=\"edit\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Edit Query`}\n </div>\n </div>\n </temba-button>\n `;\n }\n }\n\n const notSeenSinceDays = this.exclusions['not_seen_since_days'];\n let blockers = null;\n\n if (\n this.summary &&\n this.summary.blockers &&\n this.summary.blockers.length > 0\n ) {\n blockers = html`${this.summary.blockers.map(\n (error) =>\n html`<temba-alert level=\"error\">${unsafeHTML(error)}</temba-alert>`\n )}`;\n }\n\n return html`\n ${\n this.advanced\n ? html`<div class=\"query\">\n <temba-textinput\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n .errors=${this.errors}\n name=${this.name}\n .inputRoot=${this}\n @input=${this.handleQueryChange}\n placeholder=${this.placeholder}\n .value=${this.query}\n textarea\n autogrow\n >\n </temba-textinput>\n </div>`\n : html`<temba-omnibox\n placeholder=\"Search for contacts or groups\"\n widget_only=\"\"\n groups=\"\"\n contacts=\"\"\n label=\"Recipients\"\n help_text=\"The contacts to send the message to.\"\n .errors=${this.errors}\n id=\"recipients\"\n name=\"recipients\"\n .value=${this.recipients}\n endpoint=\"/contact/omnibox/?\"\n @change=${this.handleRecipientsChanged}\n >\n </temba-omnibox>\n\n ${this.not_seen_since_days ||\n this.in_a_flow ||\n this.started_previously\n ? html`\n <div class=\"filters\">\n <div\n style=\"display:flex;font-size:1em;margin-bottom:0.5em\"\n >\n <temba-icon size=\"1\" name=\"filter\"></temba-icon>\n <div style=\"margin-left:0.5em\">\n Only include contacts who...\n </div>\n </div>\n ${this.in_a_flow\n ? html`<temba-checkbox\n name=\"in_a_flow\"\n label=\"${msg('Are not currently in a flow')}\"\n ?checked=${this.exclusions['in_a_flow']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n ${this.not_seen_since_days\n ? html`\n <div\n class=\"activity-select\"\n @click=${this.handleActivityLabelClicked}\n >\n <temba-checkbox\n style=\"display:inline;\"\n name=\"not_seen_since_days\"\n ?checked=${notSeenSinceDays}\n @change=${this.handleExclusionChanged}\n >\n </temba-checkbox>\n\n <div style=\"margin-left:0.5em\">\n ${msg('Have sent a message in the last')}\n </div>\n\n <temba-select\n style=\"margin-left:0.5em\"\n class=\"small-select\"\n @change=${this.handleActivityLevelChanged}\n ?disabled=${!notSeenSinceDays}\n >\n <temba-option\n name=\"90 days\"\n value=\"90\"\n ?selected=${notSeenSinceDays === 90}\n ></temba-option>\n <temba-option\n name=\"180 days\"\n value=\"180\"\n ?selected=${notSeenSinceDays === 180}\n ></temba-option>\n <temba-option\n name=\"Year\"\n value=\"365\"\n ?selected=${notSeenSinceDays === 365}\n ></temba-option>\n </temba-select>\n <div></div>\n </div>\n `\n : null}\n ${this.started_previously\n ? html`<temba-checkbox\n name=\"started_previously\"\n label=\"${msg(\n 'Have not started this flow in the last 90 days'\n )}\"\n ?checked=${this.exclusions['started_previously']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n </div>\n `\n : null} `\n }\n </div>\n <div\n class=\"results ${getClasses({\n fetching: this.fetching,\n initialized: this.initialized || this.fetching,\n empty:\n ((this.summary && this.summary.error) || !this.summary) &&\n !this.fetching\n })}\"\n >\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n <div class=\"summary ${this.expanded ? 'expanded' : ''}\">${summary}</div>\n </div>\n ${blockers}\n ${\n !blockers && this.summary && this.summary.warnings\n ? this.summary.warnings.map(\n (warning) =>\n html`<temba-alert level=\"warning\"\n >${unsafeHTML(warning)}</temba-alert\n >`\n )\n : ``\n }\n\n\n `;\n }\n}\n"]}
|
|
@@ -10,6 +10,7 @@ export const Display = {
|
|
|
10
10
|
timedate: 'timedate',
|
|
11
11
|
duration: 'duration',
|
|
12
12
|
relative: 'relative',
|
|
13
|
+
countdown: 'countdown',
|
|
13
14
|
day: 'LLL d'
|
|
14
15
|
};
|
|
15
16
|
export class TembaDate extends RapidElement {
|
|
@@ -75,6 +76,9 @@ export class TembaDate extends RapidElement {
|
|
|
75
76
|
}
|
|
76
77
|
formatted = this.store.getShortDuration(this.datetime);
|
|
77
78
|
}
|
|
79
|
+
else if (this.display === Display.countdown) {
|
|
80
|
+
formatted = this.store.getCountdown(this.datetime);
|
|
81
|
+
}
|
|
78
82
|
else if (this.display === Display.day) {
|
|
79
83
|
formatted = this.datetime.toLocaleString(Display.day);
|
|
80
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TembaDate.js","sourceRoot":"","sources":["../../../src/date/TembaDate.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAoC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,QAAQ,CAAC,UAAU;IACzB,QAAQ,EAAE,QAAQ,CAAC,cAAc;IACjC,IAAI,EAAE,QAAQ,CAAC,WAAW;IAC1B,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,OAAO;CACb,CAAC;AAEF,MAAM,OAAO,SAAU,SAAQ,YAAY;IAA3C;;QAaE,YAAO,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TembaDate.js","sourceRoot":"","sources":["../../../src/date/TembaDate.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAoC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,CAAC,MAAM,OAAO,GA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AAO,IAAI,CAAA;;qBAEA,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC;;YAEvD,CAAC;gBACL,CAAC;gBACD,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzD,CAAC;iBAAM,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC;gBAC9C,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrD,CAAC;iBAAM,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;gBACxC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAClE,CAAC;YAED,OAAO,IAAI,CAAA;;iBAEA,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC;WACpD,SAAS;QACZ,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAtFC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAC1B","sourcesContent":["import { css, html, PropertyValueMap, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { RapidElement } from '../RapidElement';\nimport { Store } from '../store/Store';\nimport { DateTime } from 'luxon';\n\nexport const Display = {\n date: DateTime.DATE_SHORT,\n datetime: DateTime.DATETIME_SHORT,\n time: DateTime.TIME_SIMPLE,\n timedate: 'timedate',\n duration: 'duration',\n relative: 'relative',\n countdown: 'countdown',\n day: 'LLL d'\n};\n\nexport class TembaDate extends RapidElement {\n static get styles() {\n return css`\n .date {\n display: inline;\n }\n `;\n }\n\n @property({ type: String })\n value: string;\n\n @property({ type: String })\n display = 'date';\n\n @property({ type: Object, attribute: false })\n datetime: DateTime;\n\n store: Store;\n\n protected firstUpdated(\n changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changedProperties);\n this.store = document.querySelector('temba-store');\n }\n\n protected updated(\n changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.updated(changedProperties);\n if (changedProperties.has('value')) {\n this.datetime = DateTime.fromISO(this.value);\n }\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n }\n\n public render(): TemplateResult {\n if (this.datetime && this.store) {\n this.datetime.setLocale(this.store.getLocale());\n\n let formatted = '';\n if (this.display === Display.timedate) {\n const hours = Math.abs(\n this.datetime.diffNow().milliseconds / 1000 / 60 / 60\n );\n if (hours < 24) {\n formatted = this.datetime.toLocaleString(Display.time);\n } else if (hours < 24 * 365) {\n formatted = this.datetime.toFormat(Display.day);\n } else {\n formatted = this.datetime.toLocaleString(Display.date);\n }\n } else if (this.display === Display.relative) {\n const minutes = Math.abs(\n this.datetime.diffNow().milliseconds / 1000 / 60\n );\n if (minutes < 1) {\n return html`<span\n class=\"date\"\n title=\"${this.datetime.toLocaleString(Display.datetime)}\"\n >just now</span\n >`;\n }\n\n formatted = this.store.getShortDuration(this.datetime);\n } else if (this.display === Display.duration) {\n const minutes = Math.abs(\n this.datetime.diffNow().milliseconds / 1000 / 60\n );\n if (minutes < 1) {\n return html`<span\n class=\"date\"\n title=\"${this.datetime.toLocaleString(Display.datetime)}\"\n >just now</span\n >`;\n }\n formatted = this.store.getShortDuration(this.datetime);\n } else if (this.display === Display.countdown) {\n formatted = this.store.getCountdown(this.datetime);\n } else if (this.display === Display.day) {\n formatted = this.datetime.toLocaleString(Display.day);\n } else {\n formatted = this.datetime.toLocaleString(Display[this.display]);\n }\n\n return html`<span\n class=\"date\"\n title=\"${this.datetime.toLocaleString(Display.datetime)}\"\n >${formatted}</span\n >`;\n }\n }\n}\n"]}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
export const templates = {
|
|
6
6
|
scf1453991c986b25: `Tab para completar, enter para seleccionar`,
|
|
7
|
-
s638236250662c6b3: `Have sent a message in the last`,
|
|
8
7
|
s8f02e3a18ffc083a: `Are not currently in a flow`,
|
|
8
|
+
s638236250662c6b3: `Have sent a message in the last`,
|
|
9
9
|
s4788ee206c4570c7: `Have not started this flow in the last 90 days`
|
|
10
10
|
};
|
|
11
11
|
//# sourceMappingURL=es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.js","sourceRoot":"","sources":["../../../src/locales/es.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,4CAA4C;IAC/D,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"es.js","sourceRoot":"","sources":["../../../src/locales/es.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,4CAA4C;IAC/D,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab para completar, enter para seleccionar`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s638236250662c6b3: `Have sent a message in the last`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
export const templates = {
|
|
6
6
|
scf1453991c986b25: `Tab to complete, enter to select`,
|
|
7
|
-
s638236250662c6b3: `Have sent a message in the last`,
|
|
8
7
|
s8f02e3a18ffc083a: `Are not currently in a flow`,
|
|
8
|
+
s638236250662c6b3: `Have sent a message in the last`,
|
|
9
9
|
s4788ee206c4570c7: `Have not started this flow in the last 90 days`
|
|
10
10
|
};
|
|
11
11
|
//# sourceMappingURL=fr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.js","sourceRoot":"","sources":["../../../src/locales/fr.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"fr.js","sourceRoot":"","sources":["../../../src/locales/fr.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab to complete, enter to select`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s638236250662c6b3: `Have sent a message in the last`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
export const templates = {
|
|
6
6
|
scf1453991c986b25: `Tab to complete, enter to select`,
|
|
7
|
-
s638236250662c6b3: `Have sent a message in the last`,
|
|
8
7
|
s8f02e3a18ffc083a: `Are not currently in a flow`,
|
|
8
|
+
s638236250662c6b3: `Have sent a message in the last`,
|
|
9
9
|
s4788ee206c4570c7: `Have not started this flow in the last 90 days`
|
|
10
10
|
};
|
|
11
11
|
//# sourceMappingURL=pt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pt.js","sourceRoot":"","sources":["../../../src/locales/pt.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"pt.js","sourceRoot":"","sources":["../../../src/locales/pt.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab to complete, enter to select`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s638236250662c6b3: `Have sent a message in the last`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { RapidElement } from '../RapidElement';
|
|
4
|
+
import { property } from 'lit/decorators.js';
|
|
5
|
+
import { fetchResults } from '../utils';
|
|
6
|
+
export class FlowStartProgress extends RapidElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.refreshes = 0;
|
|
10
|
+
}
|
|
11
|
+
updated(changes) {
|
|
12
|
+
super.updated(changes);
|
|
13
|
+
if (changes.has('uuid')) {
|
|
14
|
+
this.refresh();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
refresh() {
|
|
18
|
+
fetchResults(`/api/v2/flow_starts.json?uuid=${this.uuid}`).then((data) => {
|
|
19
|
+
if (data.length > 0) {
|
|
20
|
+
this.refreshes++;
|
|
21
|
+
const start = data[0];
|
|
22
|
+
this.started = start.progress.started;
|
|
23
|
+
this.total = start.progress.total;
|
|
24
|
+
const elapsed = new Date().getTime() - new Date(start.created_on).getTime();
|
|
25
|
+
const rate = this.started / (elapsed / 1000);
|
|
26
|
+
// calculate the estimated time of arrival
|
|
27
|
+
this.eta = new Date(new Date().getTime() + ((this.total - this.started) / rate) * 1000).toISOString();
|
|
28
|
+
if (this.started < this.total) {
|
|
29
|
+
// refresh with a backoff up to 1 minute
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
this.refresh();
|
|
32
|
+
}, Math.min(1000 * this.refreshes, 60000));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return html `<temba-progress
|
|
39
|
+
total=${this.total}
|
|
40
|
+
current=${this.started}
|
|
41
|
+
eta=${this.eta}
|
|
42
|
+
></temba-progress>`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
__decorate([
|
|
46
|
+
property({ type: String })
|
|
47
|
+
], FlowStartProgress.prototype, "uuid", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
property({ type: Number })
|
|
50
|
+
], FlowStartProgress.prototype, "started", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
property({ type: Number })
|
|
53
|
+
], FlowStartProgress.prototype, "total", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
property({ type: Number })
|
|
56
|
+
], FlowStartProgress.prototype, "refreshes", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: String })
|
|
59
|
+
], FlowStartProgress.prototype, "eta", void 0);
|
|
60
|
+
//# sourceMappingURL=FlowStartProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowStartProgress.js","sourceRoot":"","sources":["../../../src/progress/FlowStartProgress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAoC,MAAM,KAAK,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAAnD;;QAWE,cAAS,GAAW,CAAC,CAAC;IAkDxB,CAAC;IA7CQ,OAAO,CACZ,OAA0D;QAE1D,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAEM,OAAO;QACZ,YAAY,CAAC,iCAAiC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAC7D,CAAC,IAAS,EAAE,EAAE;YACZ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpB,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACtB,IAAI,CAAC,OAA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CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDACL;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACf","sourcesContent":["import { html, PropertyValueMap, TemplateResult } from 'lit';\nimport { RapidElement } from '../RapidElement';\nimport { property } from 'lit/decorators.js';\nimport { fetchResults } from '../utils';\n\nexport class FlowStartProgress extends RapidElement {\n @property({ type: String })\n uuid: string;\n\n @property({ type: Number })\n started: number;\n\n @property({ type: Number })\n total: number;\n\n @property({ type: Number })\n refreshes: number = 0;\n\n @property({ type: String })\n eta: string;\n\n public updated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.updated(changes);\n if (changes.has('uuid')) {\n this.refresh();\n }\n }\n\n public refresh(): void {\n fetchResults(`/api/v2/flow_starts.json?uuid=${this.uuid}`).then(\n (data: any) => {\n if (data.length > 0) {\n this.refreshes++;\n const start = data[0];\n this.started = start.progress.started;\n this.total = start.progress.total;\n\n const elapsed =\n new Date().getTime() - new Date(start.created_on).getTime();\n const rate = this.started / (elapsed / 1000);\n\n // calculate the estimated time of arrival\n this.eta = new Date(\n new Date().getTime() + ((this.total - this.started) / rate) * 1000\n ).toISOString();\n\n if (this.started < this.total) {\n // refresh with a backoff up to 1 minute\n setTimeout(() => {\n this.refresh();\n }, Math.min(1000 * this.refreshes, 60000));\n }\n }\n }\n );\n }\n\n public render(): TemplateResult {\n return html`<temba-progress\n total=${this.total}\n current=${this.started}\n eta=${this.eta}\n ></temba-progress>`;\n }\n}\n"]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { RapidElement } from '../RapidElement';
|
|
4
|
+
import { property } from 'lit/decorators.js';
|
|
5
|
+
export class ProgressBar extends RapidElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.total = 100;
|
|
9
|
+
this.current = 0;
|
|
10
|
+
this.pct = 0;
|
|
11
|
+
this.done = false;
|
|
12
|
+
this.showEstimatedCompletion = false;
|
|
13
|
+
}
|
|
14
|
+
updated(changes) {
|
|
15
|
+
if (changes.has('eta') && this.eta) {
|
|
16
|
+
this.estimatedCompletionDate = new Date(this.eta);
|
|
17
|
+
this.showEstimatedCompletion = this.estimatedCompletionDate > new Date();
|
|
18
|
+
}
|
|
19
|
+
if (changes.has('current')) {
|
|
20
|
+
this.pct = Math.floor(Math.min((this.current / this.total) * 100, 100));
|
|
21
|
+
this.done = this.pct >= 100;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `<div class="meter ${this.done ? 'done' : ''}">
|
|
26
|
+
<span class="complete" style="width: ${this.pct}%"></span>
|
|
27
|
+
<div class="incomplete"></div>
|
|
28
|
+
${this.pct >= 0 || this.estimatedCompletionDate
|
|
29
|
+
? html ` <div class="etc">
|
|
30
|
+
${this.estimatedCompletionDate
|
|
31
|
+
? html `<temba-date
|
|
32
|
+
value="${this.estimatedCompletionDate.toISOString()}"
|
|
33
|
+
display="countdown"
|
|
34
|
+
></temba-date>`
|
|
35
|
+
: html `${this.pct}%`}
|
|
36
|
+
</div>`
|
|
37
|
+
: null}
|
|
38
|
+
</div>`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
ProgressBar.styles = css `
|
|
42
|
+
.meter {
|
|
43
|
+
display: flex;
|
|
44
|
+
box-sizing: content-box;
|
|
45
|
+
height: 8px;
|
|
46
|
+
position: relative;
|
|
47
|
+
background: #f1f1f1;
|
|
48
|
+
border-radius: var(--curvature);
|
|
49
|
+
padding: 4px;
|
|
50
|
+
box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
|
|
51
|
+
}
|
|
52
|
+
.meter > span {
|
|
53
|
+
display: block;
|
|
54
|
+
height: 100%;
|
|
55
|
+
border-top-right-radius: var(--curvature);
|
|
56
|
+
border-bottom-right-radius: var(--curvature);
|
|
57
|
+
border-top-left-radius: var(--curvature);
|
|
58
|
+
border-bottom-left-radius: var(--curvature);
|
|
59
|
+
background-color: var(--color-primary-dark);
|
|
60
|
+
background-image: linear-gradient(
|
|
61
|
+
center bottom,
|
|
62
|
+
rgb(43, 194, 83) 37%,
|
|
63
|
+
rgb(84, 240, 83) 69%
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
position: relative;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
}
|
|
69
|
+
.meter > span:after,
|
|
70
|
+
.animate > span > span {
|
|
71
|
+
content: '';
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
left: 0;
|
|
75
|
+
bottom: 0;
|
|
76
|
+
right: 0;
|
|
77
|
+
background-image: linear-gradient(
|
|
78
|
+
-45deg,
|
|
79
|
+
rgba(255, 255, 255, 0.2) 25%,
|
|
80
|
+
transparent 25%,
|
|
81
|
+
transparent 50%,
|
|
82
|
+
rgba(255, 255, 255, 0.2) 50%,
|
|
83
|
+
rgba(255, 255, 255, 0.2) 75%,
|
|
84
|
+
transparent 75%,
|
|
85
|
+
transparent
|
|
86
|
+
);
|
|
87
|
+
z-index: 1;
|
|
88
|
+
background-size: 50px 50px;
|
|
89
|
+
animation: move 16s linear infinite;
|
|
90
|
+
border-top-right-radius: var(--curvature);
|
|
91
|
+
border-bottom-right-radius: var(--curvature);
|
|
92
|
+
border-top-left-radius: var(--curvature);
|
|
93
|
+
border-bottom-left-radius: var(--curvature);
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.animate > span:after {
|
|
98
|
+
display: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@keyframes move {
|
|
102
|
+
0% {
|
|
103
|
+
background-position: 0 0;
|
|
104
|
+
}
|
|
105
|
+
100% {
|
|
106
|
+
background-position: 50px 50px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.complete {
|
|
111
|
+
transition: width 2s;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.incomplete {
|
|
115
|
+
flex-grow: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.etc {
|
|
119
|
+
font-size: 0.7em;
|
|
120
|
+
padding: 4px;
|
|
121
|
+
padding-top: 1px;
|
|
122
|
+
padding-left: 8px;
|
|
123
|
+
padding-right: 8px;
|
|
124
|
+
margin-top: -4px;
|
|
125
|
+
margin-bottom: -4px;
|
|
126
|
+
margin-right: -4px;
|
|
127
|
+
margin-left: 0.5em;
|
|
128
|
+
background: rgba(0, 0, 0, 0.07);
|
|
129
|
+
font-weight: bold;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.meter.done > span:after,
|
|
134
|
+
.done .animate > span > span {
|
|
135
|
+
display: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.meter.done > span {
|
|
139
|
+
background: rgb(var(--success-rgb));
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: Number })
|
|
144
|
+
], ProgressBar.prototype, "total", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ type: Number })
|
|
147
|
+
], ProgressBar.prototype, "current", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: Number })
|
|
150
|
+
], ProgressBar.prototype, "pct", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: Boolean })
|
|
153
|
+
], ProgressBar.prototype, "done", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
property({ type: String })
|
|
156
|
+
], ProgressBar.prototype, "eta", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: String, attribute: false })
|
|
159
|
+
], ProgressBar.prototype, "estimatedCompletionDate", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: Boolean })
|
|
162
|
+
], ProgressBar.prototype, "showEstimatedCompletion", void 0);
|
|
163
|
+
//# sourceMappingURL=Pro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IAAI,CAAC,GAAG;;QAE7C,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,uBAAuB;YAC7C,CAAC,CAAC,IAAI,CAAA;cACA,IAAI,CAAC,uBAAuB;gBAC5B,CAAC,CAAC,IAAI,CAAA;2BACO,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE;;+BAEtC;gBACjB,CAAC,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,GAAG,GAAG;iBACjB;YACT,CAAC,CAAC,IAAI;WACH,CAAC;IACV,CAAC;;AAxJM,kBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGlB,AApGY,CAoGX;AAGF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACnB;AAGR;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACf;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4DACf;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4DACI","sourcesContent":["import { css, html, PropertyValueMap, TemplateResult } from 'lit';\nimport { RapidElement } from '../RapidElement';\nimport { property } from 'lit/decorators.js';\n\nexport class ProgressBar extends RapidElement {\n static styles = css`\n .meter {\n display: flex;\n box-sizing: content-box;\n height: 8px;\n position: relative;\n background: #f1f1f1;\n border-radius: var(--curvature);\n padding: 4px;\n box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);\n }\n .meter > span {\n display: block;\n height: 100%;\n border-top-right-radius: var(--curvature);\n border-bottom-right-radius: var(--curvature);\n border-top-left-radius: var(--curvature);\n border-bottom-left-radius: var(--curvature);\n background-color: var(--color-primary-dark);\n background-image: linear-gradient(\n center bottom,\n rgb(43, 194, 83) 37%,\n rgb(84, 240, 83) 69%\n );\n\n position: relative;\n overflow: hidden;\n }\n .meter > span:after,\n .animate > span > span {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background-image: linear-gradient(\n -45deg,\n rgba(255, 255, 255, 0.2) 25%,\n transparent 25%,\n transparent 50%,\n rgba(255, 255, 255, 0.2) 50%,\n rgba(255, 255, 255, 0.2) 75%,\n transparent 75%,\n transparent\n );\n z-index: 1;\n background-size: 50px 50px;\n animation: move 16s linear infinite;\n border-top-right-radius: var(--curvature);\n border-bottom-right-radius: var(--curvature);\n border-top-left-radius: var(--curvature);\n border-bottom-left-radius: var(--curvature);\n overflow: hidden;\n }\n\n .animate > span:after {\n display: none;\n }\n\n @keyframes move {\n 0% {\n background-position: 0 0;\n }\n 100% {\n background-position: 50px 50px;\n }\n }\n\n .complete {\n transition: width 2s;\n }\n\n .incomplete {\n flex-grow: 1;\n }\n\n .etc {\n font-size: 0.7em;\n padding: 4px;\n padding-top: 1px;\n padding-left: 8px;\n padding-right: 8px;\n margin-top: -4px;\n margin-bottom: -4px;\n margin-right: -4px;\n margin-left: 0.5em;\n background: rgba(0, 0, 0, 0.07);\n font-weight: bold;\n white-space: nowrap;\n }\n\n .meter.done > span:after,\n .done .animate > span > span {\n display: none;\n }\n\n .meter.done > span {\n background: rgb(var(--success-rgb));\n }\n `;\n\n @property({ type: Number })\n total = 100;\n\n @property({ type: Number })\n current = 0;\n\n @property({ type: Number })\n pct = 0;\n\n @property({ type: Boolean })\n done = false;\n\n @property({ type: String })\n eta: string;\n\n @property({ type: String, attribute: false })\n estimatedCompletionDate: Date;\n\n @property({ type: Boolean })\n showEstimatedCompletion = false;\n\n public updated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n if (changes.has('eta') && this.eta) {\n this.estimatedCompletionDate = new Date(this.eta);\n this.showEstimatedCompletion = this.estimatedCompletionDate > new Date();\n }\n\n if (changes.has('current')) {\n this.pct = Math.floor(Math.min((this.current / this.total) * 100, 100));\n this.done = this.pct >= 100;\n }\n }\n\n public render(): TemplateResult {\n return html`<div class=\"meter ${this.done ? 'done' : ''}\">\n <span class=\"complete\" style=\"width: ${this.pct}%\"></span>\n <div class=\"incomplete\"></div>\n ${this.pct >= 0 || this.estimatedCompletionDate\n ? html` <div class=\"etc\">\n ${this.estimatedCompletionDate\n ? html`<temba-date\n value=\"${this.estimatedCompletionDate.toISOString()}\"\n display=\"countdown\"\n ></temba-date>`\n : html`${this.pct}%`}\n </div>`\n : null}\n </div>`;\n }\n}\n"]}
|