@nyaruka/temba-components 0.46.0 → 0.47.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 +6 -0
- package/dist/{041a136a.js → df04e47b.js} +68 -35
- package/dist/index.js +68 -35
- 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/ContactFieldEditor.js +34 -8
- package/out-tsc/src/contacts/ContactFieldEditor.js.map +1 -1
- package/out-tsc/src/contacts/ContactFields.js +34 -21
- package/out-tsc/src/contacts/ContactFields.js.map +1 -1
- package/out-tsc/src/datepicker/DatePicker.js +15 -4
- package/out-tsc/src/datepicker/DatePicker.js.map +1 -1
- package/out-tsc/src/formfield/FormField.js +1 -1
- package/out-tsc/src/formfield/FormField.js.map +1 -1
- package/out-tsc/src/list/TembaList.js +1 -1
- package/out-tsc/src/list/TembaList.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/contacts/fields-updated.png +0 -0
- package/screenshots/truth/contacts/fields.png +0 -0
- package/screenshots/truth/datepicker/datetime.png +0 -0
- package/screenshots/truth/datepicker/initial-timezone.png +0 -0
- package/screenshots/truth/datepicker/initial-value.png +0 -0
- package/screenshots/truth/datepicker/updated-keyboard.png +0 -0
- package/src/contacts/ContactFieldEditor.ts +33 -8
- package/src/contacts/ContactFields.ts +31 -22
- package/src/datepicker/DatePicker.ts +15 -4
- package/src/formfield/FormField.ts +1 -1
- package/src/list/TembaList.ts +1 -1
- package/static/css/temba-components.css +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v0.47.0](https://github.com/nyaruka/temba-components/compare/v0.46.0...v0.47.0)
|
|
8
|
+
|
|
9
|
+
- Add disabled option for contact field editing [`#299`](https://github.com/nyaruka/temba-components/pull/299)
|
|
10
|
+
|
|
7
11
|
#### [v0.46.0](https://github.com/nyaruka/temba-components/compare/v0.45.0...v0.46.0)
|
|
8
12
|
|
|
13
|
+
> 5 April 2023
|
|
14
|
+
|
|
9
15
|
- Move tickets out of contact chat [`#298`](https://github.com/nyaruka/temba-components/pull/298)
|
|
10
16
|
- Remove tickets from contact chat [`0eab01e`](https://github.com/nyaruka/temba-components/commit/0eab01e7df9a7e00ee4f857e17e279124fbb0e3f)
|
|
11
17
|
- remove ticket tests from contact chat [`8d07356`](https://github.com/nyaruka/temba-components/commit/8d073563c85f47c0a9c40416bc08adf5ed73afbf)
|
|
@@ -1714,7 +1714,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
1714
1714
|
}
|
|
1715
1715
|
|
|
1716
1716
|
.disabled {
|
|
1717
|
-
opacity:
|
|
1717
|
+
opacity: var(--disabled-opacity) !important;
|
|
1718
1718
|
pointer-events: none !important;
|
|
1719
1719
|
}
|
|
1720
1720
|
`}render(){const t=this.hideErrors?[]:(this.errors||[]).map((t=>D` <div class="alert-error">${t}</div> `));return this.widgetOnly?D`
|
|
@@ -2824,7 +2824,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
2824
2824
|
width: 100%;
|
|
2825
2825
|
flex-grow: 1;
|
|
2826
2826
|
}
|
|
2827
|
-
`}constructor(){super(),this.items=[],this.cursorIndex=-1,this.tabIndex=1,this.valueKey="id",this.loading=!1,this.paused=!1,this.refreshKey="0",this.reverseRefresh=!0,this.nextPage=null,this.pages=0,this.pending=[],this.refreshInterval=null,this.store=document.querySelector("temba-store"),this.handleSelection.bind(this)}reset(){this.selected=null,this.nextPage=null,this.cursorIndex=-1,this.mostRecentItem=null,this.items=[]}connectedCallback(){super.connectedCallback(),this.refreshInterval=setInterval((()=>{this.paused||(this.refreshKey="default_"+(new Date).getTime())}),1e4)}disconnectedCallback(){clearInterval(this.refreshInterval)}updated(t){super.updated(t),t.has("endpoint")&&this.endpoint&&(this.reset(),this.loading=!0,this.fetchItems()),t.has("loading")&&(this.loading||this.fireCustomEvent(_t.FetchComplete)),t.has("refreshKey")&&!t.has("endpoint")&&this.refreshTop(),t.has("mostRecentItem")&&this.fireCustomEvent(_t.Refreshed),t.has("cursorIndex")&&this.cursorIndex>-1&&(this.selected=this.items[this.cursorIndex],this.handleSelected(this.selected))}handleSelected(t){const e=new Event("change",{bubbles:!0});this.dispatchEvent(e)}getValue(t){if(!t)return null;const e=this.valueKey.split(".");let i=t;for(;e.length>0;){i=i[e.shift()]}return i}setSelection(t){const e=this.items.findIndex((e=>this.getValue(e)===t));this.cursorIndex=e,this.selected=this.items[e];const i=new Event("change",{bubbles:!0});this.dispatchEvent(i)}getItemIndex(t){return this.items.findIndex((e=>this.getValue(e)===t))}removeItem(t){const e=this.getItemIndex(t);this.items.splice(e,1),this.items=[...this.items],this.cursorIndex=Math.max(0,Math.min(this.items.length-1,this.cursorIndex-1)),this.requestUpdate("cursorIndex"),this.requestUpdate("items")}getSelection(){return this.selected}refresh(){this.refreshKey="requested_"+(new Date).getTime()}setEndpoint(t,e=null){this.endpoint=t,this.nextSelection=e}getRefreshEndpoint(){return this.endpoint}async refreshTop(){if(!this.getRefreshEndpoint())return;for(;this.pending.length>0;){this.pending.pop().abort()}const t=new AbortController;this.pending.push(t);const e=this.items[this.cursorIndex];try{const i=await ne(this.getRefreshEndpoint(),t),n=[...this.items];if(i.results){i.results.forEach((t=>{this.sanitizeOption&&this.sanitizeOption(t);const e=this.getValue(t),i=n.findIndex((t=>this.getValue(t)===e));i>-1&&n.splice(i,1)}));let t=i.results;this.reverseRefresh&&(t=i.results.reverse());const o=[...t,...n],s=o[0];if(this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s),e){const t=o[this.cursorIndex],i=this.getValue(e);if(i!==this.getValue(t)){const t=o.findIndex((t=>this.getValue(t)===i));this.cursorIndex=t,window.setTimeout((()=>{const t=this.shadowRoot.querySelector("temba-options");if(t){t.shadowRoot.querySelector(".option.focused").scrollIntoView({block:"end",inline:"nearest"})}}),0)}}this.items=o}}catch(t){console.error(t)}}async fetchItems(){for(;this.pending.length>0;){this.pending.pop().abort()}let t=this.endpoint,e=this.pages||1,i=0,n=null,o=[];for(;e>0&&t;){const s=new AbortController;this.pending.push(s);try{const r=await ne(t,s);this.sanitizeOption&&r.results.forEach(this.sanitizeOption),r.results&&(o=o.concat(r.results)),n=r.next,t=n,e--,i++}catch(t){return this.reset(),void console.log(t)}this.nextPage=n}this.pages=i;const s=o[0];this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s);const r=o[this.cursorIndex];if(!this.nextSelection&&this.selected&&r&&this.getValue(r)!==this.getValue(this.selected)){const t=o.findIndex((t=>this.getValue(t)===this.getValue(this.selected)));t>-1?this.cursorIndex=t:0===this.cursorIndex?this.requestUpdate("cursorIndex"):this.cursorIndex=0}return this.items=o,this.loading=!1,this.pending=[],this.nextSelection?(this.setSelection(this.nextSelection),this.nextSelection=!1):-1===this.cursorIndex&&(this.cursorIndex=0),this.value&&(this.setSelection(this.value),this.value=null),Promise.resolve()}handleScrollThreshold(){this.nextPage&&!this.loading&&(this.loading=!0,ne(this.nextPage).then((t=>{this.sanitizeOption&&t.results.forEach(this.sanitizeOption),this.items=[...this.items,...t.results],this.nextPage=t.next,this.pages++,this.loading=!1})))}renderHeader(){return null}renderFooter(){return null}getListStyle(){return""}handleSelection(t){const{selected:e,index:i}=t.detail;this.selected=e,this.cursorIndex=i,t.stopPropagation(),t.preventDefault()}render(){return D`
|
|
2827
|
+
`}constructor(){super(),this.items=[],this.cursorIndex=-1,this.tabIndex=1,this.valueKey="id",this.loading=!1,this.paused=!1,this.refreshKey="0",this.reverseRefresh=!0,this.nextPage=null,this.pages=0,this.pending=[],this.refreshInterval=null,this.store=document.querySelector("temba-store"),this.handleSelection.bind(this)}reset(){this.selected=null,this.nextPage=null,this.cursorIndex=-1,this.mostRecentItem=null,this.items=[]}connectedCallback(){super.connectedCallback(),this.refreshInterval=setInterval((()=>{this.paused||(this.refreshKey="default_"+(new Date).getTime())}),1e4)}disconnectedCallback(){clearInterval(this.refreshInterval)}updated(t){super.updated(t),t.has("endpoint")&&this.endpoint&&(this.reset(),this.loading=!0,this.fetchItems()),t.has("loading")&&(this.loading||this.fireCustomEvent(_t.FetchComplete)),t.has("refreshKey")&&!t.has("endpoint")&&this.refreshTop(),t.has("mostRecentItem")&&this.mostRecentItem&&this.fireCustomEvent(_t.Refreshed),t.has("cursorIndex")&&this.cursorIndex>-1&&(this.selected=this.items[this.cursorIndex],this.handleSelected(this.selected))}handleSelected(t){const e=new Event("change",{bubbles:!0});this.dispatchEvent(e)}getValue(t){if(!t)return null;const e=this.valueKey.split(".");let i=t;for(;e.length>0;){i=i[e.shift()]}return i}setSelection(t){const e=this.items.findIndex((e=>this.getValue(e)===t));this.cursorIndex=e,this.selected=this.items[e];const i=new Event("change",{bubbles:!0});this.dispatchEvent(i)}getItemIndex(t){return this.items.findIndex((e=>this.getValue(e)===t))}removeItem(t){const e=this.getItemIndex(t);this.items.splice(e,1),this.items=[...this.items],this.cursorIndex=Math.max(0,Math.min(this.items.length-1,this.cursorIndex-1)),this.requestUpdate("cursorIndex"),this.requestUpdate("items")}getSelection(){return this.selected}refresh(){this.refreshKey="requested_"+(new Date).getTime()}setEndpoint(t,e=null){this.endpoint=t,this.nextSelection=e}getRefreshEndpoint(){return this.endpoint}async refreshTop(){if(!this.getRefreshEndpoint())return;for(;this.pending.length>0;){this.pending.pop().abort()}const t=new AbortController;this.pending.push(t);const e=this.items[this.cursorIndex];try{const i=await ne(this.getRefreshEndpoint(),t),n=[...this.items];if(i.results){i.results.forEach((t=>{this.sanitizeOption&&this.sanitizeOption(t);const e=this.getValue(t),i=n.findIndex((t=>this.getValue(t)===e));i>-1&&n.splice(i,1)}));let t=i.results;this.reverseRefresh&&(t=i.results.reverse());const o=[...t,...n],s=o[0];if(this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s),e){const t=o[this.cursorIndex],i=this.getValue(e);if(i!==this.getValue(t)){const t=o.findIndex((t=>this.getValue(t)===i));this.cursorIndex=t,window.setTimeout((()=>{const t=this.shadowRoot.querySelector("temba-options");if(t){t.shadowRoot.querySelector(".option.focused").scrollIntoView({block:"end",inline:"nearest"})}}),0)}}this.items=o}}catch(t){console.error(t)}}async fetchItems(){for(;this.pending.length>0;){this.pending.pop().abort()}let t=this.endpoint,e=this.pages||1,i=0,n=null,o=[];for(;e>0&&t;){const s=new AbortController;this.pending.push(s);try{const r=await ne(t,s);this.sanitizeOption&&r.results.forEach(this.sanitizeOption),r.results&&(o=o.concat(r.results)),n=r.next,t=n,e--,i++}catch(t){return this.reset(),void console.log(t)}this.nextPage=n}this.pages=i;const s=o[0];this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s);const r=o[this.cursorIndex];if(!this.nextSelection&&this.selected&&r&&this.getValue(r)!==this.getValue(this.selected)){const t=o.findIndex((t=>this.getValue(t)===this.getValue(this.selected)));t>-1?this.cursorIndex=t:0===this.cursorIndex?this.requestUpdate("cursorIndex"):this.cursorIndex=0}return this.items=o,this.loading=!1,this.pending=[],this.nextSelection?(this.setSelection(this.nextSelection),this.nextSelection=!1):-1===this.cursorIndex&&(this.cursorIndex=0),this.value&&(this.setSelection(this.value),this.value=null),Promise.resolve()}handleScrollThreshold(){this.nextPage&&!this.loading&&(this.loading=!0,ne(this.nextPage).then((t=>{this.sanitizeOption&&t.results.forEach(this.sanitizeOption),this.items=[...this.items,...t.results],this.nextPage=t.next,this.pages++,this.loading=!1})))}renderHeader(){return null}renderFooter(){return null}getListStyle(){return""}handleSelection(t){const{selected:e,index:i}=t.detail;this.selected=e,this.cursorIndex=i,t.stopPropagation(),t.preventDefault()}render(){return D`
|
|
2828
2828
|
${this.renderHeader()}
|
|
2829
2829
|
<temba-options
|
|
2830
2830
|
style="${this.getListStyle()}"
|
|
@@ -4477,13 +4477,11 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4477
4477
|
height="${this.size}em"
|
|
4478
4478
|
src="${this.prefix||window.static_url||"/static/"}img/schemes/${t}.svg"
|
|
4479
4479
|
/>
|
|
4480
|
-
`}}t([st({type:String})],ul.prototype,"urn",void 0),t([st({type:String})],ul.prototype,"scheme",void 0),t([st({type:Number})],ul.prototype,"size",void 0);class pl extends Oa{static get styles(){return r`
|
|
4480
|
+
`}}t([st({type:String})],ul.prototype,"urn",void 0),t([st({type:String})],ul.prototype,"scheme",void 0),t([st({type:Number})],ul.prototype,"size",void 0);class pl extends Oa{constructor(){super(...arguments),this.disabled=!1}static get styles(){return r`
|
|
4481
4481
|
:host {
|
|
4482
|
-
--curvature-widget: 0px;
|
|
4483
4482
|
}
|
|
4484
4483
|
|
|
4485
4484
|
.fields {
|
|
4486
|
-
box-shadow: var(--widget-box-shadow);
|
|
4487
4485
|
}
|
|
4488
4486
|
|
|
4489
4487
|
.field {
|
|
@@ -4534,12 +4532,15 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4534
4532
|
temba-contact-field {
|
|
4535
4533
|
}
|
|
4536
4534
|
|
|
4537
|
-
.
|
|
4538
|
-
margin-bottom: 0;
|
|
4535
|
+
.toggle {
|
|
4539
4536
|
display: flex;
|
|
4540
4537
|
background: #fff;
|
|
4541
4538
|
align-items: center;
|
|
4542
|
-
margin-
|
|
4539
|
+
margin-bottom: 0.5em;
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4542
|
+
.disabled .toggle {
|
|
4543
|
+
display: none;
|
|
4543
4544
|
}
|
|
4544
4545
|
`}connectedCallback(){super.connectedCallback(),this.handleFieldChanged=this.handleFieldChanged.bind(this)}updated(t){super.updated(t),t.has("data")&&Object.keys(this.data.fields).length<=10&&(this.showAll=!0)}handleFieldChanged(t){const e=t.currentTarget,i=e.value;le("/api/v2/contacts.json?uuid="+this.data.uuid,{fields:{[e.key]:i}}).then((t=>{this.setContact(t.json)}))}handleToggle(t){const e=t.currentTarget;this.showAll=e.checked}render(){if(this.data){const t=Object.entries(this.data.fields).filter((t=>this.featured&&this.store.getContactField(t[0]).featured||!this.featured&&!this.store.getContactField(t[0]).featured)).sort(((t,e)=>{const[i]=t,[n]=e,o=this.store.getContactField(n).priority-this.store.getContactField(i).priority;return 0!==o?o:i.localeCompare(n)}));if(0==t.length)return D`<slot name="empty"></slot>`;const e=t.map((t=>{const[e,i]=t,n=this.store.getContactField(e);return D`<temba-contact-field
|
|
4545
4546
|
class=${i?"set":"unset"}
|
|
@@ -4549,51 +4550,59 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4549
4550
|
type=${n.value_type}
|
|
4550
4551
|
@change=${this.handleFieldChanged}
|
|
4551
4552
|
timezone=${this.timezone}
|
|
4553
|
+
?disabled=${this.disabled}
|
|
4552
4554
|
></temba-contact-field>`}));return D`
|
|
4553
|
-
<div class
|
|
4554
|
-
${
|
|
4555
|
-
|
|
4555
|
+
<div class=${ie({disabled:this.disabled})}>
|
|
4556
|
+
${!this.featured&&Object.keys(this.data.fields).length>=10?D`<div class="toggle">
|
|
4557
|
+
<div style="flex-grow: 1"></div>
|
|
4558
|
+
<div>
|
|
4559
|
+
<temba-checkbox
|
|
4560
|
+
?checked=${this.showAll}
|
|
4561
|
+
@change=${this.handleToggle}
|
|
4562
|
+
label="Show All"
|
|
4563
|
+
/>
|
|
4564
|
+
</div>
|
|
4565
|
+
</div>`:null}
|
|
4556
4566
|
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
/>
|
|
4565
|
-
</div>
|
|
4566
|
-
</div>`:null}
|
|
4567
|
-
`}return super.render()}}t([st({type:Boolean})],pl.prototype,"featured",void 0),t([st({type:Boolean})],pl.prototype,"system",void 0),t([st({type:Boolean})],pl.prototype,"dirty",void 0),t([st({type:Boolean})],pl.prototype,"showAll",void 0),t([st({type:String})],pl.prototype,"timezone",void 0);class ml extends nt{constructor(){super(...arguments),this.icon=navigator.clipboard?at.copy:"",this.iconClass=""}static get styles(){return r`
|
|
4567
|
+
<div
|
|
4568
|
+
class="fields ${this.showAll||this.featured?"show-all":""}"
|
|
4569
|
+
>
|
|
4570
|
+
${e}
|
|
4571
|
+
</div>
|
|
4572
|
+
</div>
|
|
4573
|
+
`}return super.render()}}t([st({type:Boolean})],pl.prototype,"featured",void 0),t([st({type:Boolean})],pl.prototype,"system",void 0),t([st({type:Boolean})],pl.prototype,"dirty",void 0),t([st({type:Boolean})],pl.prototype,"showAll",void 0),t([st({type:String})],pl.prototype,"timezone",void 0),t([st({type:Boolean})],pl.prototype,"disabled",void 0);class ml extends nt{constructor(){super(...arguments),this.icon=navigator.clipboard?at.copy:"",this.iconClass="",this.disabled=!1}static get styles(){return r`
|
|
4568
4574
|
.wrapper {
|
|
4569
4575
|
--widget-box-shadow: none;
|
|
4576
|
+
--temba-textinput-padding: 1.4em 0.8em 0.4em 0.8em;
|
|
4577
|
+
--disabled-opacity: 1;
|
|
4578
|
+
position: relative;
|
|
4570
4579
|
}
|
|
4571
4580
|
|
|
4572
4581
|
.prefix {
|
|
4573
|
-
background: rgba(0, 0, 0, 0.05);
|
|
4574
4582
|
border-top-left-radius: var(--curvature-widget);
|
|
4575
4583
|
border-bottom-left-radius: var(--curvature-widget);
|
|
4576
4584
|
color: #888;
|
|
4577
4585
|
cursor: pointer;
|
|
4578
|
-
width: 200px;
|
|
4579
4586
|
white-space: nowrap;
|
|
4580
4587
|
overflow: hidden;
|
|
4581
4588
|
text-overflow: ellipsis;
|
|
4582
4589
|
display: flex;
|
|
4583
4590
|
padding: 0em 0.5em;
|
|
4591
|
+
position: absolute;
|
|
4592
|
+
margin-top: 0.2em;
|
|
4584
4593
|
}
|
|
4585
4594
|
|
|
4586
4595
|
.wrapper {
|
|
4587
|
-
margin-bottom:
|
|
4596
|
+
margin-bottom: 0.5em;
|
|
4588
4597
|
}
|
|
4589
4598
|
|
|
4590
4599
|
.prefix .name {
|
|
4591
|
-
padding: 0.
|
|
4592
|
-
color: #
|
|
4593
|
-
width: 200px;
|
|
4600
|
+
padding: 0em 0.4em;
|
|
4601
|
+
color: #999;
|
|
4594
4602
|
white-space: nowrap;
|
|
4595
4603
|
overflow: hidden;
|
|
4596
4604
|
text-overflow: ellipsis;
|
|
4605
|
+
font-size: 0.8em;
|
|
4597
4606
|
}
|
|
4598
4607
|
|
|
4599
4608
|
.postfix {
|
|
@@ -4639,6 +4648,16 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4639
4648
|
transform: scale(1);
|
|
4640
4649
|
}
|
|
4641
4650
|
|
|
4651
|
+
.disabled temba-textinput .postfix {
|
|
4652
|
+
display: none;
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4655
|
+
.disabled {
|
|
4656
|
+
--color-widget-border: transparent;
|
|
4657
|
+
padding-bottom: 0.4em;
|
|
4658
|
+
border-bottom: 1px solid #e6e6e6;
|
|
4659
|
+
}
|
|
4660
|
+
|
|
4642
4661
|
.unset temba-textinput:focus .popper,
|
|
4643
4662
|
.unset temba-textinput:hover .popper {
|
|
4644
4663
|
opacity: 0;
|
|
@@ -4657,16 +4676,18 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4657
4676
|
}
|
|
4658
4677
|
|
|
4659
4678
|
temba-datepicker {
|
|
4660
|
-
--curvature: 0px;
|
|
4661
4679
|
position: relative;
|
|
4662
4680
|
}
|
|
4663
4681
|
`}connectedCallback(){super.connectedCallback(),this.handleInput=this.handleInput.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleIconClick(t){const e=t.target.getAttribute("icon-action"),i=this.shadowRoot.querySelector("temba-textinput");"copy"===e&&navigator.clipboard&&(this.iconClass="clicked",navigator.clipboard.writeText(i.getDisplayValue()).then((()=>{window.setTimeout((()=>{this.iconClass=""}),300)}))),"search"===e&&this.fireCustomEvent(_t.ButtonClicked,{key:this.key,value:this.value}),t.preventDefault(),t.stopPropagation()}handleSubmit(){const t=this.shadowRoot.querySelector("temba-textinput, temba-datepicker");t.value!==this.value&&(this.value=t.value,this.fireEvent("change")),this.icon=navigator.clipboard?"copy":""}handleChange(t){t.preventDefault(),t.stopPropagation()}handleInput(t){if("Enter"===t.key){t.currentTarget.blur()}}render(){return D`
|
|
4664
|
-
<div
|
|
4682
|
+
<div
|
|
4683
|
+
class=${ie({wrapper:!0,set:!!this.value,unset:!this.value,disabled:this.disabled})}
|
|
4684
|
+
>
|
|
4665
4685
|
${"datetime"===this.type?D`
|
|
4666
4686
|
<temba-datepicker
|
|
4667
4687
|
timezone=${this.timezone}
|
|
4668
4688
|
value="${this.value?this.value:""}"
|
|
4669
4689
|
@change=${this.handleSubmit}
|
|
4690
|
+
?disabled=${this.disabled}
|
|
4670
4691
|
time
|
|
4671
4692
|
>
|
|
4672
4693
|
<div class="prefix" slot="prefix">
|
|
@@ -4679,6 +4700,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4679
4700
|
@blur=${this.handleSubmit}
|
|
4680
4701
|
@keydown=${this.handleInput}
|
|
4681
4702
|
@change=${this.handleChange}
|
|
4703
|
+
?disabled=${this.disabled}
|
|
4682
4704
|
>
|
|
4683
4705
|
<div class="prefix" slot="prefix">
|
|
4684
4706
|
<div class="name">${this.name}</div>
|
|
@@ -4709,7 +4731,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4709
4731
|
</temba-textinput>
|
|
4710
4732
|
`}
|
|
4711
4733
|
</div>
|
|
4712
|
-
`}}t([st({type:String})],ml.prototype,"key",void 0),t([st({type:String})],ml.prototype,"value",void 0),t([st({type:String})],ml.prototype,"name",void 0),t([st({type:String})],ml.prototype,"type",void 0),t([st({type:String})],ml.prototype,"timezone",void 0),t([st({type:String})],ml.prototype,"icon",void 0),t([st({type:String})],ml.prototype,"iconClass",void 0);const fl={stopped:{name:"Stopped"},blocked:{name:"Blocked"},archived:{name:"Archived"}};class gl extends Oa{constructor(){super(...arguments),this.hasMore=!1,this.expanded=!1}static get styles(){return r`
|
|
4734
|
+
`}}t([st({type:String})],ml.prototype,"key",void 0),t([st({type:String})],ml.prototype,"value",void 0),t([st({type:String})],ml.prototype,"name",void 0),t([st({type:String})],ml.prototype,"type",void 0),t([st({type:String})],ml.prototype,"timezone",void 0),t([st({type:String})],ml.prototype,"icon",void 0),t([st({type:String})],ml.prototype,"iconClass",void 0),t([st({type:Boolean})],ml.prototype,"disabled",void 0);const fl={stopped:{name:"Stopped"},blocked:{name:"Blocked"},archived:{name:"Archived"}};class gl extends Oa{constructor(){super(...arguments),this.hasMore=!1,this.expanded=!1}static get styles(){return r`
|
|
4713
4735
|
.wrapper {
|
|
4714
4736
|
display: flex;
|
|
4715
4737
|
flex-direction: column;
|
|
@@ -5365,11 +5387,13 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5365
5387
|
display: flex;
|
|
5366
5388
|
cursor: pointer;
|
|
5367
5389
|
box-shadow: var(--widget-box-shadow);
|
|
5390
|
+
flex-wrap: wrap;
|
|
5391
|
+
overflow: hidden;
|
|
5368
5392
|
}
|
|
5369
5393
|
|
|
5370
5394
|
.input-wrapper {
|
|
5371
5395
|
padding: var(--temba-textinput-padding);
|
|
5372
|
-
flex-grow:
|
|
5396
|
+
flex-grow: 20;
|
|
5373
5397
|
}
|
|
5374
5398
|
|
|
5375
5399
|
.tz {
|
|
@@ -5384,7 +5408,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5384
5408
|
padding: 0em 1em;
|
|
5385
5409
|
font-weight: 400;
|
|
5386
5410
|
cursor: pointer;
|
|
5387
|
-
margin: auto;
|
|
5411
|
+
margin: auto 0;
|
|
5388
5412
|
}
|
|
5389
5413
|
|
|
5390
5414
|
.tz .label {
|
|
@@ -5401,11 +5425,11 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5401
5425
|
|
|
5402
5426
|
.tz-wrapper {
|
|
5403
5427
|
background: #efefef;
|
|
5404
|
-
border-top-right-radius: var(--curvature);
|
|
5405
|
-
border-bottom-right-radius: var(--curvature);
|
|
5406
5428
|
display: flex;
|
|
5407
5429
|
flex-direction: row;
|
|
5408
5430
|
align-items: center;
|
|
5431
|
+
flex-grow: 1;
|
|
5432
|
+
padding: 0.4em 0em;
|
|
5409
5433
|
}
|
|
5410
5434
|
|
|
5411
5435
|
.container:focus-within {
|
|
@@ -5439,6 +5463,14 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5439
5463
|
outline: none;
|
|
5440
5464
|
}
|
|
5441
5465
|
|
|
5466
|
+
.disabled ::-webkit-calendar-picker-indicator {
|
|
5467
|
+
display: none;
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5470
|
+
.disabled .tz-wrapper {
|
|
5471
|
+
border-radius: var(--curvature);
|
|
5472
|
+
}
|
|
5473
|
+
|
|
5442
5474
|
::-webkit-calendar-picker-indicator {
|
|
5443
5475
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path fill="%23bbbbbb" d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"/></svg>');
|
|
5444
5476
|
cursor: pointer;
|
|
@@ -5454,6 +5486,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5454
5486
|
}
|
|
5455
5487
|
`}serializeValue(t){return t}constructor(){super(),this.timezone="",this.timezoneFriendly="",this.datetime=null,this.time=!1}firstUpdated(t){if(t.has("value"))if(this.time){if(this.timezone=this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,this.timezoneFriendly=this.timezone.replace("_"," ").replace("/",", "),this.value){let t=Ss.fromSQL(this.value).setZone(this.timezone);t.invalid&&(t=Ss.fromISO(this.value).setZone(this.timezone)),this.datetime=t,this.setValue(this.datetime.toUTC().toISO())}}else this.datetime=Ss.fromSQL(this.value),this.setValue(this.datetime.toISODate())}updated(t){super.updated(t),t.has("timezone")&&this.time&&(this.timezone=this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,this.timezoneFriendly=this.timezone.replace("_"," ").replace("/",", "),this.requestUpdate("value"))}handleChange(t){t.preventDefault(),t.stopPropagation()}handleBlur(t){this.time?(this.datetime=Ss.fromISO(t.target.value,{zone:this.timezone}),this.setValue(this.datetime.toUTC().toISO())):this.setValue(t.target.value),this.fireEvent("change")}handleClicked(){this.shadowRoot.querySelector("input").focus()}render(){const t=ie({unset:!this.value});let e=null;return this.time&&this.datetime&&!this.datetime.invalid?e=this.datetime.toFormat("yyyy-LL-dd'T'HH:mm"):this.time||(e=this.value),D`
|
|
5456
5488
|
<temba-field
|
|
5489
|
+
class=${ie({disabled:this.disabled})}
|
|
5457
5490
|
name=${this.name}
|
|
5458
5491
|
.label="${this.label}"
|
|
5459
5492
|
.helpText="${this.helpText}"
|
package/dist/index.js
CHANGED
|
@@ -1714,7 +1714,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
1714
1714
|
}
|
|
1715
1715
|
|
|
1716
1716
|
.disabled {
|
|
1717
|
-
opacity:
|
|
1717
|
+
opacity: var(--disabled-opacity) !important;
|
|
1718
1718
|
pointer-events: none !important;
|
|
1719
1719
|
}
|
|
1720
1720
|
`}render(){const t=this.hideErrors?[]:(this.errors||[]).map((t=>D` <div class="alert-error">${t}</div> `));return this.widgetOnly?D`
|
|
@@ -2824,7 +2824,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
2824
2824
|
width: 100%;
|
|
2825
2825
|
flex-grow: 1;
|
|
2826
2826
|
}
|
|
2827
|
-
`}constructor(){super(),this.items=[],this.cursorIndex=-1,this.tabIndex=1,this.valueKey="id",this.loading=!1,this.paused=!1,this.refreshKey="0",this.reverseRefresh=!0,this.nextPage=null,this.pages=0,this.pending=[],this.refreshInterval=null,this.store=document.querySelector("temba-store"),this.handleSelection.bind(this)}reset(){this.selected=null,this.nextPage=null,this.cursorIndex=-1,this.mostRecentItem=null,this.items=[]}connectedCallback(){super.connectedCallback(),this.refreshInterval=setInterval((()=>{this.paused||(this.refreshKey="default_"+(new Date).getTime())}),1e4)}disconnectedCallback(){clearInterval(this.refreshInterval)}updated(t){super.updated(t),t.has("endpoint")&&this.endpoint&&(this.reset(),this.loading=!0,this.fetchItems()),t.has("loading")&&(this.loading||this.fireCustomEvent(_t.FetchComplete)),t.has("refreshKey")&&!t.has("endpoint")&&this.refreshTop(),t.has("mostRecentItem")&&this.fireCustomEvent(_t.Refreshed),t.has("cursorIndex")&&this.cursorIndex>-1&&(this.selected=this.items[this.cursorIndex],this.handleSelected(this.selected))}handleSelected(t){const e=new Event("change",{bubbles:!0});this.dispatchEvent(e)}getValue(t){if(!t)return null;const e=this.valueKey.split(".");let i=t;for(;e.length>0;){i=i[e.shift()]}return i}setSelection(t){const e=this.items.findIndex((e=>this.getValue(e)===t));this.cursorIndex=e,this.selected=this.items[e];const i=new Event("change",{bubbles:!0});this.dispatchEvent(i)}getItemIndex(t){return this.items.findIndex((e=>this.getValue(e)===t))}removeItem(t){const e=this.getItemIndex(t);this.items.splice(e,1),this.items=[...this.items],this.cursorIndex=Math.max(0,Math.min(this.items.length-1,this.cursorIndex-1)),this.requestUpdate("cursorIndex"),this.requestUpdate("items")}getSelection(){return this.selected}refresh(){this.refreshKey="requested_"+(new Date).getTime()}setEndpoint(t,e=null){this.endpoint=t,this.nextSelection=e}getRefreshEndpoint(){return this.endpoint}async refreshTop(){if(!this.getRefreshEndpoint())return;for(;this.pending.length>0;){this.pending.pop().abort()}const t=new AbortController;this.pending.push(t);const e=this.items[this.cursorIndex];try{const i=await ne(this.getRefreshEndpoint(),t),n=[...this.items];if(i.results){i.results.forEach((t=>{this.sanitizeOption&&this.sanitizeOption(t);const e=this.getValue(t),i=n.findIndex((t=>this.getValue(t)===e));i>-1&&n.splice(i,1)}));let t=i.results;this.reverseRefresh&&(t=i.results.reverse());const o=[...t,...n],s=o[0];if(this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s),e){const t=o[this.cursorIndex],i=this.getValue(e);if(i!==this.getValue(t)){const t=o.findIndex((t=>this.getValue(t)===i));this.cursorIndex=t,window.setTimeout((()=>{const t=this.shadowRoot.querySelector("temba-options");if(t){t.shadowRoot.querySelector(".option.focused").scrollIntoView({block:"end",inline:"nearest"})}}),0)}}this.items=o}}catch(t){console.error(t)}}async fetchItems(){for(;this.pending.length>0;){this.pending.pop().abort()}let t=this.endpoint,e=this.pages||1,i=0,n=null,o=[];for(;e>0&&t;){const s=new AbortController;this.pending.push(s);try{const r=await ne(t,s);this.sanitizeOption&&r.results.forEach(this.sanitizeOption),r.results&&(o=o.concat(r.results)),n=r.next,t=n,e--,i++}catch(t){return this.reset(),void console.log(t)}this.nextPage=n}this.pages=i;const s=o[0];this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s);const r=o[this.cursorIndex];if(!this.nextSelection&&this.selected&&r&&this.getValue(r)!==this.getValue(this.selected)){const t=o.findIndex((t=>this.getValue(t)===this.getValue(this.selected)));t>-1?this.cursorIndex=t:0===this.cursorIndex?this.requestUpdate("cursorIndex"):this.cursorIndex=0}return this.items=o,this.loading=!1,this.pending=[],this.nextSelection?(this.setSelection(this.nextSelection),this.nextSelection=!1):-1===this.cursorIndex&&(this.cursorIndex=0),this.value&&(this.setSelection(this.value),this.value=null),Promise.resolve()}handleScrollThreshold(){this.nextPage&&!this.loading&&(this.loading=!0,ne(this.nextPage).then((t=>{this.sanitizeOption&&t.results.forEach(this.sanitizeOption),this.items=[...this.items,...t.results],this.nextPage=t.next,this.pages++,this.loading=!1})))}renderHeader(){return null}renderFooter(){return null}getListStyle(){return""}handleSelection(t){const{selected:e,index:i}=t.detail;this.selected=e,this.cursorIndex=i,t.stopPropagation(),t.preventDefault()}render(){return D`
|
|
2827
|
+
`}constructor(){super(),this.items=[],this.cursorIndex=-1,this.tabIndex=1,this.valueKey="id",this.loading=!1,this.paused=!1,this.refreshKey="0",this.reverseRefresh=!0,this.nextPage=null,this.pages=0,this.pending=[],this.refreshInterval=null,this.store=document.querySelector("temba-store"),this.handleSelection.bind(this)}reset(){this.selected=null,this.nextPage=null,this.cursorIndex=-1,this.mostRecentItem=null,this.items=[]}connectedCallback(){super.connectedCallback(),this.refreshInterval=setInterval((()=>{this.paused||(this.refreshKey="default_"+(new Date).getTime())}),1e4)}disconnectedCallback(){clearInterval(this.refreshInterval)}updated(t){super.updated(t),t.has("endpoint")&&this.endpoint&&(this.reset(),this.loading=!0,this.fetchItems()),t.has("loading")&&(this.loading||this.fireCustomEvent(_t.FetchComplete)),t.has("refreshKey")&&!t.has("endpoint")&&this.refreshTop(),t.has("mostRecentItem")&&this.mostRecentItem&&this.fireCustomEvent(_t.Refreshed),t.has("cursorIndex")&&this.cursorIndex>-1&&(this.selected=this.items[this.cursorIndex],this.handleSelected(this.selected))}handleSelected(t){const e=new Event("change",{bubbles:!0});this.dispatchEvent(e)}getValue(t){if(!t)return null;const e=this.valueKey.split(".");let i=t;for(;e.length>0;){i=i[e.shift()]}return i}setSelection(t){const e=this.items.findIndex((e=>this.getValue(e)===t));this.cursorIndex=e,this.selected=this.items[e];const i=new Event("change",{bubbles:!0});this.dispatchEvent(i)}getItemIndex(t){return this.items.findIndex((e=>this.getValue(e)===t))}removeItem(t){const e=this.getItemIndex(t);this.items.splice(e,1),this.items=[...this.items],this.cursorIndex=Math.max(0,Math.min(this.items.length-1,this.cursorIndex-1)),this.requestUpdate("cursorIndex"),this.requestUpdate("items")}getSelection(){return this.selected}refresh(){this.refreshKey="requested_"+(new Date).getTime()}setEndpoint(t,e=null){this.endpoint=t,this.nextSelection=e}getRefreshEndpoint(){return this.endpoint}async refreshTop(){if(!this.getRefreshEndpoint())return;for(;this.pending.length>0;){this.pending.pop().abort()}const t=new AbortController;this.pending.push(t);const e=this.items[this.cursorIndex];try{const i=await ne(this.getRefreshEndpoint(),t),n=[...this.items];if(i.results){i.results.forEach((t=>{this.sanitizeOption&&this.sanitizeOption(t);const e=this.getValue(t),i=n.findIndex((t=>this.getValue(t)===e));i>-1&&n.splice(i,1)}));let t=i.results;this.reverseRefresh&&(t=i.results.reverse());const o=[...t,...n],s=o[0];if(this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s),e){const t=o[this.cursorIndex],i=this.getValue(e);if(i!==this.getValue(t)){const t=o.findIndex((t=>this.getValue(t)===i));this.cursorIndex=t,window.setTimeout((()=>{const t=this.shadowRoot.querySelector("temba-options");if(t){t.shadowRoot.querySelector(".option.focused").scrollIntoView({block:"end",inline:"nearest"})}}),0)}}this.items=o}}catch(t){console.error(t)}}async fetchItems(){for(;this.pending.length>0;){this.pending.pop().abort()}let t=this.endpoint,e=this.pages||1,i=0,n=null,o=[];for(;e>0&&t;){const s=new AbortController;this.pending.push(s);try{const r=await ne(t,s);this.sanitizeOption&&r.results.forEach(this.sanitizeOption),r.results&&(o=o.concat(r.results)),n=r.next,t=n,e--,i++}catch(t){return this.reset(),void console.log(t)}this.nextPage=n}this.pages=i;const s=o[0];this.mostRecentItem&&JSON.stringify(this.mostRecentItem)===JSON.stringify(s)||(this.mostRecentItem=s);const r=o[this.cursorIndex];if(!this.nextSelection&&this.selected&&r&&this.getValue(r)!==this.getValue(this.selected)){const t=o.findIndex((t=>this.getValue(t)===this.getValue(this.selected)));t>-1?this.cursorIndex=t:0===this.cursorIndex?this.requestUpdate("cursorIndex"):this.cursorIndex=0}return this.items=o,this.loading=!1,this.pending=[],this.nextSelection?(this.setSelection(this.nextSelection),this.nextSelection=!1):-1===this.cursorIndex&&(this.cursorIndex=0),this.value&&(this.setSelection(this.value),this.value=null),Promise.resolve()}handleScrollThreshold(){this.nextPage&&!this.loading&&(this.loading=!0,ne(this.nextPage).then((t=>{this.sanitizeOption&&t.results.forEach(this.sanitizeOption),this.items=[...this.items,...t.results],this.nextPage=t.next,this.pages++,this.loading=!1})))}renderHeader(){return null}renderFooter(){return null}getListStyle(){return""}handleSelection(t){const{selected:e,index:i}=t.detail;this.selected=e,this.cursorIndex=i,t.stopPropagation(),t.preventDefault()}render(){return D`
|
|
2828
2828
|
${this.renderHeader()}
|
|
2829
2829
|
<temba-options
|
|
2830
2830
|
style="${this.getListStyle()}"
|
|
@@ -4477,13 +4477,11 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4477
4477
|
height="${this.size}em"
|
|
4478
4478
|
src="${this.prefix||window.static_url||"/static/"}img/schemes/${t}.svg"
|
|
4479
4479
|
/>
|
|
4480
|
-
`}}t([st({type:String})],ul.prototype,"urn",void 0),t([st({type:String})],ul.prototype,"scheme",void 0),t([st({type:Number})],ul.prototype,"size",void 0);class pl extends Oa{static get styles(){return r`
|
|
4480
|
+
`}}t([st({type:String})],ul.prototype,"urn",void 0),t([st({type:String})],ul.prototype,"scheme",void 0),t([st({type:Number})],ul.prototype,"size",void 0);class pl extends Oa{constructor(){super(...arguments),this.disabled=!1}static get styles(){return r`
|
|
4481
4481
|
:host {
|
|
4482
|
-
--curvature-widget: 0px;
|
|
4483
4482
|
}
|
|
4484
4483
|
|
|
4485
4484
|
.fields {
|
|
4486
|
-
box-shadow: var(--widget-box-shadow);
|
|
4487
4485
|
}
|
|
4488
4486
|
|
|
4489
4487
|
.field {
|
|
@@ -4534,12 +4532,15 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4534
4532
|
temba-contact-field {
|
|
4535
4533
|
}
|
|
4536
4534
|
|
|
4537
|
-
.
|
|
4538
|
-
margin-bottom: 0;
|
|
4535
|
+
.toggle {
|
|
4539
4536
|
display: flex;
|
|
4540
4537
|
background: #fff;
|
|
4541
4538
|
align-items: center;
|
|
4542
|
-
margin-
|
|
4539
|
+
margin-bottom: 0.5em;
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4542
|
+
.disabled .toggle {
|
|
4543
|
+
display: none;
|
|
4543
4544
|
}
|
|
4544
4545
|
`}connectedCallback(){super.connectedCallback(),this.handleFieldChanged=this.handleFieldChanged.bind(this)}updated(t){super.updated(t),t.has("data")&&Object.keys(this.data.fields).length<=10&&(this.showAll=!0)}handleFieldChanged(t){const e=t.currentTarget,i=e.value;le("/api/v2/contacts.json?uuid="+this.data.uuid,{fields:{[e.key]:i}}).then((t=>{this.setContact(t.json)}))}handleToggle(t){const e=t.currentTarget;this.showAll=e.checked}render(){if(this.data){const t=Object.entries(this.data.fields).filter((t=>this.featured&&this.store.getContactField(t[0]).featured||!this.featured&&!this.store.getContactField(t[0]).featured)).sort(((t,e)=>{const[i]=t,[n]=e,o=this.store.getContactField(n).priority-this.store.getContactField(i).priority;return 0!==o?o:i.localeCompare(n)}));if(0==t.length)return D`<slot name="empty"></slot>`;const e=t.map((t=>{const[e,i]=t,n=this.store.getContactField(e);return D`<temba-contact-field
|
|
4545
4546
|
class=${i?"set":"unset"}
|
|
@@ -4549,51 +4550,59 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4549
4550
|
type=${n.value_type}
|
|
4550
4551
|
@change=${this.handleFieldChanged}
|
|
4551
4552
|
timezone=${this.timezone}
|
|
4553
|
+
?disabled=${this.disabled}
|
|
4552
4554
|
></temba-contact-field>`}));return D`
|
|
4553
|
-
<div class
|
|
4554
|
-
${
|
|
4555
|
-
|
|
4555
|
+
<div class=${ie({disabled:this.disabled})}>
|
|
4556
|
+
${!this.featured&&Object.keys(this.data.fields).length>=10?D`<div class="toggle">
|
|
4557
|
+
<div style="flex-grow: 1"></div>
|
|
4558
|
+
<div>
|
|
4559
|
+
<temba-checkbox
|
|
4560
|
+
?checked=${this.showAll}
|
|
4561
|
+
@change=${this.handleToggle}
|
|
4562
|
+
label="Show All"
|
|
4563
|
+
/>
|
|
4564
|
+
</div>
|
|
4565
|
+
</div>`:null}
|
|
4556
4566
|
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
/>
|
|
4565
|
-
</div>
|
|
4566
|
-
</div>`:null}
|
|
4567
|
-
`}return super.render()}}t([st({type:Boolean})],pl.prototype,"featured",void 0),t([st({type:Boolean})],pl.prototype,"system",void 0),t([st({type:Boolean})],pl.prototype,"dirty",void 0),t([st({type:Boolean})],pl.prototype,"showAll",void 0),t([st({type:String})],pl.prototype,"timezone",void 0);class ml extends nt{constructor(){super(...arguments),this.icon=navigator.clipboard?at.copy:"",this.iconClass=""}static get styles(){return r`
|
|
4567
|
+
<div
|
|
4568
|
+
class="fields ${this.showAll||this.featured?"show-all":""}"
|
|
4569
|
+
>
|
|
4570
|
+
${e}
|
|
4571
|
+
</div>
|
|
4572
|
+
</div>
|
|
4573
|
+
`}return super.render()}}t([st({type:Boolean})],pl.prototype,"featured",void 0),t([st({type:Boolean})],pl.prototype,"system",void 0),t([st({type:Boolean})],pl.prototype,"dirty",void 0),t([st({type:Boolean})],pl.prototype,"showAll",void 0),t([st({type:String})],pl.prototype,"timezone",void 0),t([st({type:Boolean})],pl.prototype,"disabled",void 0);class ml extends nt{constructor(){super(...arguments),this.icon=navigator.clipboard?at.copy:"",this.iconClass="",this.disabled=!1}static get styles(){return r`
|
|
4568
4574
|
.wrapper {
|
|
4569
4575
|
--widget-box-shadow: none;
|
|
4576
|
+
--temba-textinput-padding: 1.4em 0.8em 0.4em 0.8em;
|
|
4577
|
+
--disabled-opacity: 1;
|
|
4578
|
+
position: relative;
|
|
4570
4579
|
}
|
|
4571
4580
|
|
|
4572
4581
|
.prefix {
|
|
4573
|
-
background: rgba(0, 0, 0, 0.05);
|
|
4574
4582
|
border-top-left-radius: var(--curvature-widget);
|
|
4575
4583
|
border-bottom-left-radius: var(--curvature-widget);
|
|
4576
4584
|
color: #888;
|
|
4577
4585
|
cursor: pointer;
|
|
4578
|
-
width: 200px;
|
|
4579
4586
|
white-space: nowrap;
|
|
4580
4587
|
overflow: hidden;
|
|
4581
4588
|
text-overflow: ellipsis;
|
|
4582
4589
|
display: flex;
|
|
4583
4590
|
padding: 0em 0.5em;
|
|
4591
|
+
position: absolute;
|
|
4592
|
+
margin-top: 0.2em;
|
|
4584
4593
|
}
|
|
4585
4594
|
|
|
4586
4595
|
.wrapper {
|
|
4587
|
-
margin-bottom:
|
|
4596
|
+
margin-bottom: 0.5em;
|
|
4588
4597
|
}
|
|
4589
4598
|
|
|
4590
4599
|
.prefix .name {
|
|
4591
|
-
padding: 0.
|
|
4592
|
-
color: #
|
|
4593
|
-
width: 200px;
|
|
4600
|
+
padding: 0em 0.4em;
|
|
4601
|
+
color: #999;
|
|
4594
4602
|
white-space: nowrap;
|
|
4595
4603
|
overflow: hidden;
|
|
4596
4604
|
text-overflow: ellipsis;
|
|
4605
|
+
font-size: 0.8em;
|
|
4597
4606
|
}
|
|
4598
4607
|
|
|
4599
4608
|
.postfix {
|
|
@@ -4639,6 +4648,16 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4639
4648
|
transform: scale(1);
|
|
4640
4649
|
}
|
|
4641
4650
|
|
|
4651
|
+
.disabled temba-textinput .postfix {
|
|
4652
|
+
display: none;
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4655
|
+
.disabled {
|
|
4656
|
+
--color-widget-border: transparent;
|
|
4657
|
+
padding-bottom: 0.4em;
|
|
4658
|
+
border-bottom: 1px solid #e6e6e6;
|
|
4659
|
+
}
|
|
4660
|
+
|
|
4642
4661
|
.unset temba-textinput:focus .popper,
|
|
4643
4662
|
.unset temba-textinput:hover .popper {
|
|
4644
4663
|
opacity: 0;
|
|
@@ -4657,16 +4676,18 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4657
4676
|
}
|
|
4658
4677
|
|
|
4659
4678
|
temba-datepicker {
|
|
4660
|
-
--curvature: 0px;
|
|
4661
4679
|
position: relative;
|
|
4662
4680
|
}
|
|
4663
4681
|
`}connectedCallback(){super.connectedCallback(),this.handleInput=this.handleInput.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleIconClick(t){const e=t.target.getAttribute("icon-action"),i=this.shadowRoot.querySelector("temba-textinput");"copy"===e&&navigator.clipboard&&(this.iconClass="clicked",navigator.clipboard.writeText(i.getDisplayValue()).then((()=>{window.setTimeout((()=>{this.iconClass=""}),300)}))),"search"===e&&this.fireCustomEvent(_t.ButtonClicked,{key:this.key,value:this.value}),t.preventDefault(),t.stopPropagation()}handleSubmit(){const t=this.shadowRoot.querySelector("temba-textinput, temba-datepicker");t.value!==this.value&&(this.value=t.value,this.fireEvent("change")),this.icon=navigator.clipboard?"copy":""}handleChange(t){t.preventDefault(),t.stopPropagation()}handleInput(t){if("Enter"===t.key){t.currentTarget.blur()}}render(){return D`
|
|
4664
|
-
<div
|
|
4682
|
+
<div
|
|
4683
|
+
class=${ie({wrapper:!0,set:!!this.value,unset:!this.value,disabled:this.disabled})}
|
|
4684
|
+
>
|
|
4665
4685
|
${"datetime"===this.type?D`
|
|
4666
4686
|
<temba-datepicker
|
|
4667
4687
|
timezone=${this.timezone}
|
|
4668
4688
|
value="${this.value?this.value:""}"
|
|
4669
4689
|
@change=${this.handleSubmit}
|
|
4690
|
+
?disabled=${this.disabled}
|
|
4670
4691
|
time
|
|
4671
4692
|
>
|
|
4672
4693
|
<div class="prefix" slot="prefix">
|
|
@@ -4679,6 +4700,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4679
4700
|
@blur=${this.handleSubmit}
|
|
4680
4701
|
@keydown=${this.handleInput}
|
|
4681
4702
|
@change=${this.handleChange}
|
|
4703
|
+
?disabled=${this.disabled}
|
|
4682
4704
|
>
|
|
4683
4705
|
<div class="prefix" slot="prefix">
|
|
4684
4706
|
<div class="name">${this.name}</div>
|
|
@@ -4709,7 +4731,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
4709
4731
|
</temba-textinput>
|
|
4710
4732
|
`}
|
|
4711
4733
|
</div>
|
|
4712
|
-
`}}t([st({type:String})],ml.prototype,"key",void 0),t([st({type:String})],ml.prototype,"value",void 0),t([st({type:String})],ml.prototype,"name",void 0),t([st({type:String})],ml.prototype,"type",void 0),t([st({type:String})],ml.prototype,"timezone",void 0),t([st({type:String})],ml.prototype,"icon",void 0),t([st({type:String})],ml.prototype,"iconClass",void 0);const fl={stopped:{name:"Stopped"},blocked:{name:"Blocked"},archived:{name:"Archived"}};class gl extends Oa{constructor(){super(...arguments),this.hasMore=!1,this.expanded=!1}static get styles(){return r`
|
|
4734
|
+
`}}t([st({type:String})],ml.prototype,"key",void 0),t([st({type:String})],ml.prototype,"value",void 0),t([st({type:String})],ml.prototype,"name",void 0),t([st({type:String})],ml.prototype,"type",void 0),t([st({type:String})],ml.prototype,"timezone",void 0),t([st({type:String})],ml.prototype,"icon",void 0),t([st({type:String})],ml.prototype,"iconClass",void 0),t([st({type:Boolean})],ml.prototype,"disabled",void 0);const fl={stopped:{name:"Stopped"},blocked:{name:"Blocked"},archived:{name:"Archived"}};class gl extends Oa{constructor(){super(...arguments),this.hasMore=!1,this.expanded=!1}static get styles(){return r`
|
|
4713
4735
|
.wrapper {
|
|
4714
4736
|
display: flex;
|
|
4715
4737
|
flex-direction: column;
|
|
@@ -5365,11 +5387,13 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5365
5387
|
display: flex;
|
|
5366
5388
|
cursor: pointer;
|
|
5367
5389
|
box-shadow: var(--widget-box-shadow);
|
|
5390
|
+
flex-wrap: wrap;
|
|
5391
|
+
overflow: hidden;
|
|
5368
5392
|
}
|
|
5369
5393
|
|
|
5370
5394
|
.input-wrapper {
|
|
5371
5395
|
padding: var(--temba-textinput-padding);
|
|
5372
|
-
flex-grow:
|
|
5396
|
+
flex-grow: 20;
|
|
5373
5397
|
}
|
|
5374
5398
|
|
|
5375
5399
|
.tz {
|
|
@@ -5384,7 +5408,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5384
5408
|
padding: 0em 1em;
|
|
5385
5409
|
font-weight: 400;
|
|
5386
5410
|
cursor: pointer;
|
|
5387
|
-
margin: auto;
|
|
5411
|
+
margin: auto 0;
|
|
5388
5412
|
}
|
|
5389
5413
|
|
|
5390
5414
|
.tz .label {
|
|
@@ -5401,11 +5425,11 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5401
5425
|
|
|
5402
5426
|
.tz-wrapper {
|
|
5403
5427
|
background: #efefef;
|
|
5404
|
-
border-top-right-radius: var(--curvature);
|
|
5405
|
-
border-bottom-right-radius: var(--curvature);
|
|
5406
5428
|
display: flex;
|
|
5407
5429
|
flex-direction: row;
|
|
5408
5430
|
align-items: center;
|
|
5431
|
+
flex-grow: 1;
|
|
5432
|
+
padding: 0.4em 0em;
|
|
5409
5433
|
}
|
|
5410
5434
|
|
|
5411
5435
|
.container:focus-within {
|
|
@@ -5439,6 +5463,14 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5439
5463
|
outline: none;
|
|
5440
5464
|
}
|
|
5441
5465
|
|
|
5466
|
+
.disabled ::-webkit-calendar-picker-indicator {
|
|
5467
|
+
display: none;
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5470
|
+
.disabled .tz-wrapper {
|
|
5471
|
+
border-radius: var(--curvature);
|
|
5472
|
+
}
|
|
5473
|
+
|
|
5442
5474
|
::-webkit-calendar-picker-indicator {
|
|
5443
5475
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path fill="%23bbbbbb" d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"/></svg>');
|
|
5444
5476
|
cursor: pointer;
|
|
@@ -5454,6 +5486,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5454
5486
|
}
|
|
5455
5487
|
`}serializeValue(t){return t}constructor(){super(),this.timezone="",this.timezoneFriendly="",this.datetime=null,this.time=!1}firstUpdated(t){if(t.has("value"))if(this.time){if(this.timezone=this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,this.timezoneFriendly=this.timezone.replace("_"," ").replace("/",", "),this.value){let t=Ss.fromSQL(this.value).setZone(this.timezone);t.invalid&&(t=Ss.fromISO(this.value).setZone(this.timezone)),this.datetime=t,this.setValue(this.datetime.toUTC().toISO())}}else this.datetime=Ss.fromSQL(this.value),this.setValue(this.datetime.toISODate())}updated(t){super.updated(t),t.has("timezone")&&this.time&&(this.timezone=this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,this.timezoneFriendly=this.timezone.replace("_"," ").replace("/",", "),this.requestUpdate("value"))}handleChange(t){t.preventDefault(),t.stopPropagation()}handleBlur(t){this.time?(this.datetime=Ss.fromISO(t.target.value,{zone:this.timezone}),this.setValue(this.datetime.toUTC().toISO())):this.setValue(t.target.value),this.fireEvent("change")}handleClicked(){this.shadowRoot.querySelector("input").focus()}render(){const t=ie({unset:!this.value});let e=null;return this.time&&this.datetime&&!this.datetime.invalid?e=this.datetime.toFormat("yyyy-LL-dd'T'HH:mm"):this.time||(e=this.value),D`
|
|
5456
5488
|
<temba-field
|
|
5489
|
+
class=${ie({disabled:this.disabled})}
|
|
5457
5490
|
name=${this.name}
|
|
5458
5491
|
.label="${this.label}"
|
|
5459
5492
|
.helpText="${this.helpText}"
|
package/dist/sw.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const l=e=>o(e,i),f={module:{uri:i},exports:r,require:l};t[i]=Promise.all(n.map((e=>f[e]||l(e)))).then((e=>(s(...e),r)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"
|
|
1
|
+
if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const l=e=>o(e,i),f={module:{uri:i},exports:r,require:l};t[i]=Promise.all(n.map((e=>f[e]||l(e)))).then((e=>(s(...e),r)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"df04e47b.js",revision:"fcf56d76b99f7b731008cf3d3179bfb9"},{url:"templates/components-body.html",revision:"14c9b7ec2de8e9684b880be7b97d2aa0"},{url:"templates/components-head.html",revision:"8a6bdfb057917960592231fb99997fae"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|
package/dist/sw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sw.js","sources":["../../../../../tmp/
|
|
1
|
+
{"version":3,"file":"sw.js","sources":["../../../../../tmp/6f4797727c175b089a439883b46011e4/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"df04e47b.js\",\n \"revision\": \"fcf56d76b99f7b731008cf3d3179bfb9\"\n },\n {\n \"url\": \"templates/components-body.html\",\n \"revision\": \"14c9b7ec2de8e9684b880be7b97d2aa0\"\n },\n {\n \"url\": \"templates/components-head.html\",\n \"revision\": \"8a6bdfb057917960592231fb99997fae\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/
|
|
1
|
+
<script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/df04e47b.js"></script><script>window.TEMBA_COMPONENTS_VERSION="0.47.0"</script>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/
|
|
1
|
+
<link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/df04e47b.js" crossorigin="anonymous">
|