forked from MapComplete/MapComplete
		
	Fix bugs with the opening hours picker
This commit is contained in:
		
							parent
							
								
									09b7bfb9ca
								
							
						
					
					
						commit
						4d139b45e6
					
				
					 4 changed files with 12 additions and 34 deletions
				
			
		| 
						 | 
				
			
			@ -202,9 +202,12 @@ export default class OpeningHoursPickerTable extends InputElement<OpeningHour> {
 | 
			
		|||
                    ev.preventDefault();
 | 
			
		||||
                    for (const k in ev.targetTouches) {
 | 
			
		||||
                        const touch = ev.targetTouches[k];
 | 
			
		||||
                        if(touch.clientX === undefined || touch.clientY === undefined){
 | 
			
		||||
                            continue;
 | 
			
		||||
                        }
 | 
			
		||||
                        const elUnderTouch = document.elementFromPoint(
 | 
			
		||||
                            touch.screenX,
 | 
			
		||||
                            touch.screenY
 | 
			
		||||
                            touch.clientX,
 | 
			
		||||
                            touch.clientY
 | 
			
		||||
                        );
 | 
			
		||||
                        // @ts-ignore
 | 
			
		||||
                        const f = elUnderTouch.onmouseenter;
 | 
			
		||||
| 
						 | 
				
			
			@ -217,18 +220,7 @@ export default class OpeningHoursPickerTable extends InputElement<OpeningHour> {
 | 
			
		|||
 | 
			
		||||
                cell.ontouchend = (ev) => {
 | 
			
		||||
                    ev.preventDefault();
 | 
			
		||||
                    for (const k in ev.targetTouches) {
 | 
			
		||||
                        const touch = ev.targetTouches[k];
 | 
			
		||||
                        const elUnderTouch = document.elementFromPoint(
 | 
			
		||||
                            touch.pageX,
 | 
			
		||||
                            touch.pageY
 | 
			
		||||
                        );
 | 
			
		||||
                        // @ts-ignore
 | 
			
		||||
                        const f = elUnderTouch.onmouseup;
 | 
			
		||||
                        if (f) {
 | 
			
		||||
                            f();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    endSelection();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,10 +103,10 @@ export default class Translations {
 | 
			
		|||
            }),
 | 
			
		||||
 | 
			
		||||
            respectPrivacy: new T({
 | 
			
		||||
                en: "Please respect privacy. Do not photograph people nor license plates",
 | 
			
		||||
                en: "Please respect privacy. Do not photograph people nor license plates.<br/>Respect copyright. Only upload images you made yourself. Do not upload Google Streetview Images - these will be removed.",
 | 
			
		||||
                ca: "Respecta la privacitat. No fotografiïs gent o matrícules",
 | 
			
		||||
                es: "Respeta la privacidad. No fotografíes gente o matrículas",
 | 
			
		||||
                nl: "Respecteer privacy. Fotografeer geen mensen of nummerplaten",
 | 
			
		||||
                nl: "Respecteer privacy. Fotografeer geen mensen of nummerplaten.<br/>Repecteer auteursrechten. Voeg enkel foto's toe die je zelf maakte. Screenshots van andere services (zoals Google Streetview) worden verwijderd",
 | 
			
		||||
                fr: "Merci de respecter la vie privée. Ne publiez pas les plaques d\'immatriculation",
 | 
			
		||||
                gl: "Respecta a privacidade. Non fotografes xente ou matrículas",
 | 
			
		||||
                de: "Bitte respektieren Sie die Privatsphäre. Fotografieren Sie weder Personen noch Nummernschilder"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										20
									
								
								test.ts
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								test.ts
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,23 +1,9 @@
 | 
			
		|||
//*
 | 
			
		||||
import {VariableUiElement} from "./UI/Base/VariableUIElement";
 | 
			
		||||
import OpeningHoursRange from "./UI/Input/OpeningHours/OpeningHoursRange";
 | 
			
		||||
import {UIEventSource} from "./Logic/UIEventSource";
 | 
			
		||||
import OpeningHoursPicker from "./UI/Input/OpeningHours/OpeningHoursPicker";
 | 
			
		||||
import {OpeningHour} from "./Logic/OpeningHours";
 | 
			
		||||
 | 
			
		||||
let oh = new OpeningHoursPicker(new UIEventSource<OpeningHour[]>([]));
 | 
			
		||||
oh.SetStyle("height:100vh;display:block;").AttachTo('maindiv');
 | 
			
		||||
 | 
			
		||||
oh.GetValue().addCallback(data => console.log(data))
 | 
			
		||||
 | 
			
		||||
new VariableUiElement(oh.GetValue().map(oh => {
 | 
			
		||||
    if(oh === undefined){
 | 
			
		||||
        return "<no value selected>";
 | 
			
		||||
    }
 | 
			
		||||
    return oh.weekdayStart + " " + oh.startHour + ":" + oh.startMinutes + " --> " +
 | 
			
		||||
        oh.weekdayEnd + " " + oh.endHour + ":" + oh.endMinutes
 | 
			
		||||
})).AttachTo("extradiv");
 | 
			
		||||
import opening_hours from "opening_hours";
 | 
			
		||||
 | 
			
		||||
const oh =new  opening_hours("mo 09:00-17:00;Tu 09:00-17:00;We 09:00-17:00");
 | 
			
		||||
console.log(oh)
 | 
			
		||||
 | 
			
		||||
 /*/
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue