@panoramax/web-viewer 5.0.0-develop-d26305dd → 5.0.0-develop-be5ba1a7

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.
Files changed (153) hide show
  1. package/build/cjs/index.js +1 -1
  2. package/build/cjs/index_photoviewer.js +1 -1
  3. package/build/esm/components/core/Basic.js +1 -1
  4. package/build/esm/translations/el.json +92 -1
  5. package/package.json +1 -1
  6. package/build/bundle.cjs +0 -3399
  7. package/build/bundle.cjs.map +0 -1
  8. package/build/bundle_photoviewer.cjs +0 -2510
  9. package/build/bundle_photoviewer.cjs.map +0 -1
  10. package/build/components/core/Basic.css +0 -56
  11. package/build/components/core/Basic.js +0 -378
  12. package/build/components/core/CoverageMap.css +0 -10
  13. package/build/components/core/CoverageMap.js +0 -169
  14. package/build/components/core/Editor.css +0 -33
  15. package/build/components/core/Editor.js +0 -398
  16. package/build/components/core/PhotoViewer.css +0 -70
  17. package/build/components/core/PhotoViewer.js +0 -650
  18. package/build/components/core/Viewer.css +0 -130
  19. package/build/components/core/Viewer.js +0 -711
  20. package/build/components/core/index.js +0 -10
  21. package/build/components/index.js +0 -11
  22. package/build/components/index_photoviewer.js +0 -6
  23. package/build/components/layout/BottomDrawer.js +0 -258
  24. package/build/components/layout/CorneredGrid.js +0 -143
  25. package/build/components/layout/Mini.js +0 -121
  26. package/build/components/layout/Tabs.js +0 -140
  27. package/build/components/layout/index.js +0 -9
  28. package/build/components/menus/LocationPrecisionDoc.js +0 -42
  29. package/build/components/menus/MapBackground.js +0 -110
  30. package/build/components/menus/MapFilters.js +0 -567
  31. package/build/components/menus/MapLayers.js +0 -238
  32. package/build/components/menus/MapLegend.js +0 -68
  33. package/build/components/menus/MiniPictureLegend.js +0 -73
  34. package/build/components/menus/PictureLegend.js +0 -379
  35. package/build/components/menus/PictureMetadata.js +0 -380
  36. package/build/components/menus/PlayerOptions.js +0 -93
  37. package/build/components/menus/QualityScoreDoc.js +0 -42
  38. package/build/components/menus/ReportForm.js +0 -132
  39. package/build/components/menus/SemanticsDoc.js +0 -38
  40. package/build/components/menus/SemanticsDownload.js +0 -33
  41. package/build/components/menus/SemanticsFilters.js +0 -153
  42. package/build/components/menus/SemanticsList.js +0 -413
  43. package/build/components/menus/SemanticsMetadata.js +0 -368
  44. package/build/components/menus/Share.js +0 -105
  45. package/build/components/menus/index.js +0 -22
  46. package/build/components/menus/index_photoviewer.js +0 -11
  47. package/build/components/styles.js +0 -557
  48. package/build/components/ui/AnnotationsSwitch.js +0 -159
  49. package/build/components/ui/Button.js +0 -77
  50. package/build/components/ui/ButtonGroup.css +0 -59
  51. package/build/components/ui/ButtonGroup.js +0 -69
  52. package/build/components/ui/CopyButton.js +0 -110
  53. package/build/components/ui/Grade.js +0 -54
  54. package/build/components/ui/GradeFilter.js +0 -122
  55. package/build/components/ui/IconSwitch.js +0 -193
  56. package/build/components/ui/LinkButton.js +0 -67
  57. package/build/components/ui/ListGroup.js +0 -66
  58. package/build/components/ui/ListItem.js +0 -90
  59. package/build/components/ui/Loader.js +0 -203
  60. package/build/components/ui/Map.css +0 -63
  61. package/build/components/ui/Map.js +0 -853
  62. package/build/components/ui/MapMore.js +0 -175
  63. package/build/components/ui/Photo.css +0 -50
  64. package/build/components/ui/Photo.js +0 -1502
  65. package/build/components/ui/Popup.js +0 -145
  66. package/build/components/ui/ProgressBar.js +0 -104
  67. package/build/components/ui/QualityScore.js +0 -147
  68. package/build/components/ui/SearchBar.js +0 -374
  69. package/build/components/ui/SemanticsEditor.js +0 -191
  70. package/build/components/ui/SemanticsTable.js +0 -88
  71. package/build/components/ui/Switch.js +0 -139
  72. package/build/components/ui/TogglableGroup.js +0 -157
  73. package/build/components/ui/index.js +0 -29
  74. package/build/components/ui/index_photoviewer.js +0 -21
  75. package/build/components/ui/widgets/CopyCoordinates.js +0 -75
  76. package/build/components/ui/widgets/GeoSearch.css +0 -21
  77. package/build/components/ui/widgets/GeoSearch.js +0 -150
  78. package/build/components/ui/widgets/Legend.js +0 -190
  79. package/build/components/ui/widgets/LevelSelect.css +0 -51
  80. package/build/components/ui/widgets/LevelSelect.js +0 -143
  81. package/build/components/ui/widgets/MapFiltersButton.js +0 -114
  82. package/build/components/ui/widgets/MapLayersButton.js +0 -79
  83. package/build/components/ui/widgets/OSMEditors.js +0 -155
  84. package/build/components/ui/widgets/PictureLegendActions.js +0 -99
  85. package/build/components/ui/widgets/Player.css +0 -7
  86. package/build/components/ui/widgets/Player.js +0 -154
  87. package/build/components/ui/widgets/SemanticsFiltersButton.js +0 -65
  88. package/build/components/ui/widgets/Zoom.js +0 -84
  89. package/build/components/ui/widgets/index.js +0 -16
  90. package/build/components/ui/widgets/index_photoviewer.js +0 -7
  91. package/build/img/arrow_360.svg +0 -14
  92. package/build/img/arrow_flat.svg +0 -11
  93. package/build/img/arrow_triangle.svg +0 -9
  94. package/build/img/arrow_turn.svg +0 -8
  95. package/build/img/bg_aerial.jpg +0 -0
  96. package/build/img/bg_streets.jpg +0 -0
  97. package/build/img/loader_base.jpg +0 -0
  98. package/build/img/logo_dead.svg +0 -91
  99. package/build/img/marker.svg +0 -17
  100. package/build/img/marker_blue.svg +0 -20
  101. package/build/img/osm.svg +0 -49
  102. package/build/img/panoramax.svg +0 -13
  103. package/build/img/switch_big.svg +0 -54
  104. package/build/img/switch_mini.svg +0 -48
  105. package/build/img/wd.svg +0 -1
  106. package/build/index_photoviewer.js +0 -4
  107. package/build/package.json +0 -148
  108. package/build/servers.js +0 -14
  109. package/build/translations/ar.json +0 -1
  110. package/build/translations/be.json +0 -257
  111. package/build/translations/br.json +0 -81
  112. package/build/translations/cy.json +0 -117
  113. package/build/translations/da.json +0 -300
  114. package/build/translations/de.json +0 -309
  115. package/build/translations/en.json +0 -294
  116. package/build/translations/eo.json +0 -235
  117. package/build/translations/es.json +0 -292
  118. package/build/translations/fi.json +0 -1
  119. package/build/translations/fr.json +0 -294
  120. package/build/translations/hr.json +0 -294
  121. package/build/translations/hu.json +0 -294
  122. package/build/translations/it.json +0 -306
  123. package/build/translations/ja.json +0 -182
  124. package/build/translations/ko.json +0 -1
  125. package/build/translations/nl.json +0 -305
  126. package/build/translations/nn.json +0 -1
  127. package/build/translations/pl.json +0 -169
  128. package/build/translations/pt.json +0 -296
  129. package/build/translations/pt_BR.json +0 -304
  130. package/build/translations/sv.json +0 -182
  131. package/build/translations/ti.json +0 -9
  132. package/build/translations/tr.json +0 -297
  133. package/build/translations/uk.json +0 -268
  134. package/build/translations/zh_Hant.json +0 -309
  135. package/build/utils/API.js +0 -928
  136. package/build/utils/InitParameters.js +0 -521
  137. package/build/utils/MapStyleComposer.js +0 -889
  138. package/build/utils/PanoraMapProtocol.js +0 -49
  139. package/build/utils/PhotoAdapter.js +0 -49
  140. package/build/utils/PresetsManager.js +0 -148
  141. package/build/utils/SemanticsMapProtocol.js +0 -144
  142. package/build/utils/URLHandler.js +0 -426
  143. package/build/utils/geocoder.js +0 -203
  144. package/build/utils/i18n.js +0 -128
  145. package/build/utils/index.js +0 -17
  146. package/build/utils/index_photoviewer.js +0 -14
  147. package/build/utils/indoor.js +0 -200
  148. package/build/utils/map.js +0 -788
  149. package/build/utils/picture.js +0 -507
  150. package/build/utils/semantics.js +0 -321
  151. package/build/utils/services.js +0 -148
  152. package/build/utils/utils.js +0 -433
  153. package/build/utils/widgets.js +0 -110
@@ -1,77 +0,0 @@
1
- import { LitElement } from "lit";
2
- import { btn } from "../styles.js";
3
-
4
- /**
5
- * Button element displays a direct action button.
6
- * Binds to a HTML button, so you can use any events offered by it.
7
- * @class Panoramax.components.ui.Button
8
- * @element pnx-button
9
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
10
- * @example
11
- * ```html
12
- * <pnx-button kind="flat" size="l" @click=${() => alert("click!")}>
13
- * Click on me
14
- * </pnx-button>
15
- * ```
16
- */
17
- export default class Button extends LitElement {
18
- /** @private */
19
- static styles = btn;
20
-
21
- /**
22
- * Component properties.
23
- * @memberof Panoramax.components.ui.Button#
24
- * @type {Object}
25
- * @property {boolean} [active=false] Whether the button is in an active state.
26
- * @property {string} [kind=full] The style variation of the button (full, fullwarn, fullsuccess, outline, flat, superflat, inline, superinline)
27
- * @property {string} [size=md] The size of the button (sm, md, l, xl, xxl)
28
- * @property {boolean} [disabled=false] Whether the button is disabled.
29
- * @property {string} [type] The button type (e.g., 'submit').
30
- * @property {string} [title] Tooltip text displayed when hovering over the button
31
- */
32
- static properties = {
33
- active: {type: Boolean},
34
- kind: {type: String},
35
- size: {type: String},
36
- disabled: {type: Boolean},
37
- type: {type: String},
38
- title: { type: String },
39
- };
40
-
41
- constructor() {
42
- super();
43
- this.active = false;
44
- this.disabled = false;
45
- this.kind = "full";
46
- this.size = "md";
47
- }
48
-
49
- /** @private */
50
- connectedCallback() {
51
- super.connectedCallback();
52
-
53
- if(this.type === "submit") {
54
- this.addEventListener("click", () => this.closest("FORM")?.requestSubmit());
55
- }
56
- }
57
-
58
- /** @private */
59
- render() {
60
- const b = document.createElement("button");
61
- b.setAttribute("part", "btn");
62
-
63
- this.constructor.observedAttributes
64
- .filter(k => this[k] !== undefined && this[k] !== false && !["active", "kind", "size"].includes(k))
65
- .forEach(k => b.setAttribute(k, this[k]));
66
-
67
- b.classList.add("pnx-btn", `pnx-btn-${this.kind}`, `pnx-btn-${this.size}`);
68
- if(this.active) { b.classList.add("pnx-btn-active"); }
69
-
70
- const slot = document.createElement("slot");
71
- b.appendChild(slot);
72
-
73
- return b;
74
- }
75
- }
76
-
77
- customElements.define("pnx-button", Button);
@@ -1,59 +0,0 @@
1
- /* Also defined in styles.js */
2
-
3
- pnx-button-group > pnx-button {
4
- display: inline-flex;
5
- }
6
-
7
- pnx-button-group > pnx-button::part(btn) {
8
- height: unset;
9
- }
10
-
11
- /* Togglable in group */
12
- pnx-button-group > pnx-togglable-group > pnx-button {
13
- width: 100%;
14
- height: 100%;
15
- }
16
-
17
- /* Row */
18
- pnx-button-group[dir="row"] > :not(:first-child):not(:last-child)::part(btn),
19
- pnx-button-group[dir="row"] > :not(:first-child):not(:last-child) > ::part(btn) {
20
- border-radius: 0;
21
- border-left: none;
22
- border-right: none;
23
- }
24
-
25
- pnx-button-group[dir="row"] > :first-child::part(btn),
26
- pnx-button-group[dir="row"] > :first-child > ::part(btn) {
27
- border-top-right-radius: 0;
28
- border-bottom-right-radius: 0;
29
- border-right: none;
30
- }
31
-
32
- pnx-button-group[dir="row"] > :last-child::part(btn),
33
- pnx-button-group[dir="row"] > :last-child > ::part(btn) {
34
- border-top-left-radius: 0;
35
- border-bottom-left-radius: 0;
36
- border-left: none;
37
- }
38
-
39
- /* Column */
40
- pnx-button-group[dir="column"] > :not(:first-child):not(:last-child)::part(btn),
41
- pnx-button-group[dir="column"] > :not(:first-child):not(:last-child) > ::part(btn) {
42
- border-radius: 0;
43
- border-top: none;
44
- border-bottom: none;
45
- }
46
-
47
- pnx-button-group[dir="column"] > :first-child::part(btn),
48
- pnx-button-group[dir="column"] > :first-child > ::part(btn) {
49
- border-bottom-right-radius: 0;
50
- border-bottom-left-radius: 0;
51
- border-bottom: none;
52
- }
53
-
54
- pnx-button-group[dir="column"] > :last-child::part(btn),
55
- pnx-button-group[dir="column"] > :last-child > ::part(btn) {
56
- border-top-left-radius: 0;
57
- border-top-right-radius: 0;
58
- border-top: none;
59
- }
@@ -1,69 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
- import ButtonGroupStyles from "./ButtonGroup.css" with { type: "css" };
3
- document.adoptedStyleSheets.push(ButtonGroupStyles);
4
-
5
- /**
6
- * Button Group element allows to merge many button in a single bar.
7
- * @class Panoramax.components.ui.ButtonGroup
8
- * @element pnx-button-group
9
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
10
- * @example
11
- * ```html
12
- * <pnx-button-group id="pnx-widget-player" dir="row" size="xl" class="pnx-print-hidden">
13
- * <pnx-button>B1</pnx-button>
14
- * <pnx-button>B2</pnx-button>
15
- * </pnx-button-group>
16
- * ```
17
- */
18
- export default class ButtonGroup extends LitElement {
19
- /** @private */
20
- static styles = css`
21
- div {
22
- display: flex;
23
- flex-wrap: nowrap;
24
- align-items: stretch;
25
- align-content: stretch;
26
- justify-content: center;
27
- }
28
-
29
- div.row { flex-direction: row; }
30
- div.column { flex-direction: column; }
31
-
32
- div.xl { line-height: 38px; font-size: 20px; }
33
- div.row.xl { height: 38px; }
34
- div.column.xl { width: 38px; }
35
-
36
- div.row ::slotted(*) { height: 100%; min-width: 24px; }
37
- div.column ::slotted(*) { width: 100%; min-height: 24px; }
38
-
39
- div.row.xl ::slotted(*) { min-width: 38px; }
40
- div.column.xl ::slotted(*) { min-height: 38px; }
41
- `;
42
-
43
- /**
44
- * Component properties.
45
- * @memberof Panoramax.components.ui.ButtonGroup#
46
- * @type {Object}
47
- * @property {string} [dir] Group direction (row, column)
48
- * @property {string} [size] Group size (md, xl)
49
- */
50
- static properties = {
51
- dir: {type: String},
52
- size: {type: String},
53
- };
54
-
55
- constructor() {
56
- super();
57
- this.dir = "row";
58
- this.size = "md";
59
- }
60
-
61
- /** @private */
62
- render() {
63
- return html`<div class="${this.dir} ${this.size}" part="btn-group">
64
- <slot></slot>
65
- </div>`;
66
- }
67
- }
68
-
69
- customElements.define("pnx-button-group", ButtonGroup);
@@ -1,110 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
- import { fa } from "../../utils/widgets.js";
3
- import { faCheck, faCopy } from "@fortawesome/free-solid-svg-icons";
4
- import { btn, faSvg } from "../styles.js";
5
- import { classMap } from "lit/directives/class-map.js";
6
-
7
- /**
8
- * Copy Button element allows top copy in clipboard some text.
9
- * @class Panoramax.components.ui.CopyButton
10
- * @element pnx-copy-button
11
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
12
- * @slot `oncopy` The content to display after user click
13
- * @example
14
- * ```html
15
- * <pnx-copy-button text="content to copy" ._t=${viewer._t}>
16
- * Copy me !
17
- * <img src="success.jpg" slot="oncopy" />
18
- * </pnx-copy-button>
19
- * ```
20
- */
21
- export default class CopyButton extends LitElement {
22
- /** @private */
23
- static styles = [faSvg, btn, css`
24
- .pnx-btn-unstyled {
25
- border: none;
26
- background: none;
27
- font-family: var(--font-family);
28
- font-size: 1em;
29
- color: var(--widget-font);
30
- cursor: pointer;
31
- padding: 0;
32
- margin: 0;
33
- }
34
- `];
35
-
36
- /**
37
- * Component properties.
38
- * @memberof Panoramax.components.ui.CopyButton#
39
- * @type {Object}
40
- * @property {string} [text] Text to copy in clipboard on click (use either this parameter or input, not both)
41
- * @property {input} [input] ID of a HTML input field to copy content from in clipboard (use either this parameter or text, not both)
42
- * @property {string} [kind=full] The style variation of the button (full, fullwarn, fullsuccess, outline, flat, superflat, inline, superinline)
43
- * @property {string} [size=md] The size of the button (sm, md, l, xl, xxl)
44
- * @property {boolean} [unstyled=false] Disable all styling (for list group integration)
45
- * @property {string} [title] Tooltip text displayed when hovering over the button
46
- */
47
- static properties = {
48
- text: {type: String},
49
- input: {type: String},
50
- kind: {type: String},
51
- size: {type: String},
52
- unstyled: {type: Boolean},
53
- title: { type: String },
54
- _active: {state: true, type: Boolean},
55
- };
56
-
57
- constructor() {
58
- super();
59
- this.data = "";
60
- this.input = "";
61
- this.unstyled = false;
62
- this.kind = "full";
63
- this.size = "md";
64
- this._active = false;
65
- this.addEventListener("click", this._onClick);
66
- }
67
-
68
- /** @private */
69
- _onClick(e) {
70
- e.stopPropagation();
71
-
72
- let textToCopy;
73
- if(this.input !== "") {
74
- const inputField = document.getElementById(this.input);
75
- textToCopy = inputField.innerText || inputField.value;
76
- }
77
- else if(this.text !== "") {
78
- textToCopy = this.text;
79
- }
80
-
81
- if(!navigator?.clipboard) {
82
- alert("Clipboard is not available");
83
- }
84
- else {
85
- navigator.clipboard.writeText(textToCopy);
86
- this._active = true;
87
- setTimeout(() => this._active = false, 2000);
88
- }
89
- }
90
-
91
- /** @private */
92
- render() {
93
- const classes = {
94
- "pnx-btn": !this.unstyled,
95
- "pnx-btn-full": !this.unstyled,
96
- "pnx-btn-active": !this.unstyled && this._active,
97
- "pnx-btn-unstyled": this.unstyled,
98
- [`pnx-btn-${this.kind}`]: !this.unstyled,
99
- [`pnx-btn-${this.size}`]: !this.unstyled,
100
- };
101
- return html`<button title=${this.title} class=${classMap(classes)} part="btn">
102
- ${this._active ?
103
- html`<slot name="oncopy">${this._t?.pnx.copied || ""} ${fa(faCheck)}</slot>` :
104
- html`<slot>${fa(faCopy)} ${this._t?.pnx.copy || ""}</slot>`
105
- }
106
- </button>`;
107
- }
108
- }
109
-
110
- customElements.define("pnx-copy-button", CopyButton);
@@ -1,54 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
- import { fa } from "../../utils/widgets.js";
3
- import { faStar } from "@fortawesome/free-solid-svg-icons";
4
- import { faStar as farStar } from "@fortawesome/free-regular-svg-icons";
5
- import { faSvg } from "../styles.js";
6
-
7
- /**
8
- * Grade element displays a 5-star rating.
9
- * @class Panoramax.components.ui.Grade
10
- * @element pnx-grade
11
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
12
- * @example
13
- * ```html
14
- * <pnx-grade stars="5" .t=${viewer._t} />
15
- * ```
16
- */
17
- export default class Grade extends LitElement {
18
- /** @private */
19
- static styles = [ faSvg, css`
20
- span { color: var(--orange); }
21
- `];
22
-
23
- /**
24
- * Component properties.
25
- * @memberof Panoramax.components.ui.Grade#
26
- * @type {Object}
27
- * @property {number} [stars=0] 1 to 5 grade (or 0 for unknown value)
28
- */
29
- static properties = {
30
- stars: {type: Number},
31
- };
32
-
33
- constructor() {
34
- super();
35
- this.stars = 0;
36
- }
37
-
38
- /** @private */
39
- render() {
40
- const nbStars = this.stars || 0;
41
- const fastars = [];
42
- for(let i=1; i <= nbStars; i++) {
43
- fastars.push(fa(faStar));
44
- }
45
- for(let i=nbStars+1; i <= 5; i++) {
46
- fastars.push(fa(farStar));
47
- }
48
- return html`<span>
49
- ${fastars}
50
- </span> (${this.stars ? this.stars+"/5" : this._t?.pnx.metadata_quality_missing || "?"})`;
51
- }
52
- }
53
-
54
- customElements.define("pnx-grade", Grade);
@@ -1,122 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
- import { fa } from "../../utils/widgets.js";
3
- import { faStar } from "@fortawesome/free-solid-svg-icons";
4
-
5
- /**
6
- * Grade Filter allows to filter picture by their grade (for example, precision grade)
7
- * @class Panoramax.components.ui.GradeFilter
8
- * @element pnx-grade-filter
9
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
10
- * @fires Panoramax.components.ui.GradeFilter#change
11
- * @example
12
- * ```html
13
- * <pnx-grade-filter grade="5" input="pnx-g-input" @change=${() => alert('changed')} ._t=${viewer._t} />
14
- * ```
15
- */
16
- export default class GradeFilter extends LitElement {
17
- /** @private */
18
- static styles = css`
19
- :host {
20
- gap: 0;
21
- align-items: stretch;
22
- display: flex;
23
- }
24
- label {
25
- display: inline-flex;
26
- padding: 2px 7px;
27
- background: none;
28
- border: 1px solid var(--widget-border-btn);
29
- color: var(--widget-font-direct);
30
- cursor: pointer;
31
- font-size: 16px;
32
- text-decoration: none;
33
- border-left-width: 0px;
34
- }
35
- label:hover {
36
- background-color: var(--widget-bg-hover);
37
- }
38
- label:first-of-type {
39
- border-top-left-radius: 8px;
40
- border-bottom-left-radius: 8px;
41
- border-left-width: 1px;
42
- }
43
- label:last-of-type {
44
- border-top-right-radius: 8px;
45
- border-bottom-right-radius: 8px;
46
- }
47
- label svg {
48
- display: block;
49
- width: 0.8em;
50
- }
51
- input[type="checkbox"] { display: none; }
52
- input[type="checkbox"]:checked + label {
53
- background-color: var(--widget-bg-active);
54
- color: var(--widget-font-active);
55
- }
56
- input[type="checkbox"]:checked + label:first-of-type {
57
- border-right-color: white;
58
- }
59
- `;
60
-
61
- /**
62
- * Component properties.
63
- * @memberof Panoramax.components.ui.GradeFilter#
64
- * @type {Object}
65
- * @property {string} input ID prefix for input fields
66
- * @property {number|string} [grade=0] The grade (5 to 1 = precise grade, 0 = none selected), or a list of grades
67
- * @property {Object} labels Helper labels for each grade, as {"1": "L1", "2": "L2", ...}
68
- */
69
- static properties = {
70
- grade: {type: String},
71
- input: {type: String},
72
- labels: {type: Object},
73
- };
74
-
75
- constructor() {
76
- super();
77
- this.grade = 0;
78
- this.input = "";
79
- this.labels = {};
80
- }
81
-
82
- /** @private */
83
- _onInput() {
84
- // List all checked boxes
85
- const newgrade = [];
86
- for(let i of this.renderRoot.querySelectorAll("input")) {
87
- if(i.checked) { newgrade.push(i.value); }
88
- }
89
- this.grade = newgrade.join(",");
90
-
91
- /**
92
- * Event for grade change
93
- * @event Panoramax.components.ui.GradeFilter#change
94
- * @type {CustomEvent}
95
- */
96
- this.dispatchEvent(new CustomEvent("change", {bubbles: true, composed: true}));
97
- }
98
-
99
- /** @private */
100
- render() {
101
- const grades = `${this.grade}`.split(",").map(v => parseInt(v)).filter(v => !isNaN(v));
102
-
103
- return [5,4,3,2,1].map(v => html`
104
- <input
105
- id="${this.input}-${v}"
106
- type="checkbox"
107
- name=${this.input}
108
- value=${v}
109
- @change="${this._onInput}"
110
- .checked=${grades.includes(v)}
111
- />
112
- <label
113
- for="${this.input}-${v}"
114
- title=${this.labels?.[v] ? this.labels[v] : null}
115
- >
116
- ${v} ${fa(faStar)}
117
- </label>
118
- `);
119
- }
120
- }
121
-
122
- customElements.define("pnx-grade-filter", GradeFilter);
@@ -1,193 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
-
3
- /**
4
- * Icon Switch button, based on a native checkbox.
5
- * Checked state corresponds to "right" option selected, unchecked to "left".
6
- * @class Panoramax.components.ui.IconSwitch
7
- * @element pnx-icon-switch
8
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
9
- * @fires Panoramax.components.ui.IconSwitch#change
10
- * @example
11
- * ```html
12
- * <pnx-icon-switch
13
- * checked="true"
14
- * name="my-switch"
15
- * @change=${doSomething}
16
- * >
17
- * <img src="left.svg" slot="icon-left" />
18
- * <span slot="label-left">Left</span>
19
- * <img src="right.svg" slot="icon-right" />
20
- * <span slot="label-right">Right</span>
21
- * </pnx-icon-switch>
22
- * ```
23
- */
24
- export default class IconSwitch extends LitElement {
25
- static styles = css`
26
- .toggle {
27
- cursor: pointer;
28
- display: flex;
29
- align-items: flex-start;
30
- justify-content: center;
31
- }
32
-
33
- .toggle-switch {
34
- display: inline-block;
35
- background: var(--widget-option-left);
36
- border-radius: 11px;
37
- width: 42px;
38
- min-width: 42px;
39
- max-width: 42px;
40
- height: 22px;
41
- min-height: 22px;
42
- max-height: 22px;
43
- position: relative;
44
- vertical-align: middle;
45
- transition: background 0.25s;
46
- flex: 1;
47
- }
48
- .toggle-switch:before, .toggle-switch:after {
49
- content: "";
50
- }
51
- .toggle-switch:before {
52
- display: block;
53
- background: linear-gradient(to bottom, #fff 0%, #eee 100%);
54
- border-radius: 50%;
55
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
56
- width: 16px;
57
- height: 16px;
58
- position: absolute;
59
- top: 3px;
60
- left: 3px;
61
- transition: left 0.25s;
62
- }
63
- .toggle:hover .toggle-switch:before {
64
- background: linear-gradient(to bottom, #fff 0%, #fff 100%);
65
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
66
- }
67
- .toggle-checkbox:checked + .toggle-switch {
68
- background: var(--widget-option-right);
69
- }
70
- .toggle-checkbox:disabled + .toggle-switch:before,
71
- .toggle-checkbox:disabled:hover + .toggle-switch:before {
72
- background: var(--grey-pale);
73
- box-shadow: none;
74
- }
75
- .toggle-checkbox:disabled + .toggle-switch {
76
- background: var(--grey);
77
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
78
- }
79
- .toggle-checkbox:checked + .toggle-switch:before {
80
- left: 22px;
81
- }
82
-
83
- .toggle-icon {
84
- pointer-events: none;
85
- height: 22px;
86
- width: 22px;
87
- position: absolute;
88
- display: flex;
89
- justify-content: center;
90
- align-items: center;
91
- line-height: 11px;
92
- font-size: 11px;
93
- opacity: 1;
94
- transition: opacity 0.15s 0.1s;
95
- }
96
-
97
- .toggle-icon.icon-left {
98
- left: 0;
99
- color: var(--widget-option-left);
100
- }
101
- .toggle-icon.icon-right {
102
- right: 0;
103
- color: var(--widget-option-right);
104
- }
105
-
106
- .toggle-checkbox:checked + .toggle-switch .toggle-icon.icon-left,
107
- .toggle-checkbox:not(:checked) + .toggle-switch .toggle-icon.icon-right {
108
- opacity: 0;
109
- transition: opacity 0s;
110
- }
111
-
112
- .toggle-checkbox {
113
- position: absolute;
114
- visibility: hidden;
115
- }
116
-
117
- .toggle-label {
118
- margin-left: 5px;
119
- margin-right: 5px;
120
- position: relative;
121
- flex: 2;
122
- text-align: center;
123
- font-size: 0.9em;
124
- line-height: 22px;
125
- }
126
- `;
127
-
128
- /**
129
- * Component properties.
130
- * @memberof Panoramax.components.ui.IconSwitch#
131
- * @type {Object}
132
- * @property {boolean} checked True if checked
133
- * @property {boolean} disabled Inactive if true
134
- * @property {boolean} value The current switch value
135
- * @property {string} name The switch name (also serves as ID)
136
- */
137
- static properties = {
138
- checked: {type: Boolean, reflect: true},
139
- disabled: {type: Boolean, reflect: true},
140
- name: {type: String},
141
- };
142
-
143
- constructor() {
144
- super();
145
- this.checked = false;
146
- this.disabled = false;
147
- this.name = "pnx-icon-switch-1"; // Default name+ID to avoid issues
148
- }
149
-
150
- /** @private */
151
- _onChange(e) {
152
- this.checked = e.target.checked;
153
- /**
154
- * Event for switch status change
155
- * @event Panoramax.components.ui.IconSwitch#change
156
- * @type {Event}
157
- */
158
- this.dispatchEvent(new Event("change"));
159
- }
160
-
161
- /** @private */
162
- render() {
163
- return html`
164
- <label class="toggle" for=${this.name}>
165
- <span class="toggle-label">
166
- <slot name="label-left"></slot>
167
- </span>
168
- <input
169
- class="toggle-checkbox"
170
- type="checkbox"
171
- id=${this.name}
172
- name=${this.name}
173
- .checked=${this.checked}
174
- .disabled=${this.disabled}
175
- @change=${this._onChange.bind(this)}
176
- />
177
- <div class="toggle-switch">
178
- <span class="toggle-icon icon-left">
179
- <slot name="icon-left"></slot>
180
- </span>
181
- <span class="toggle-icon icon-right">
182
- <slot name="icon-right"></slot>
183
- </span>
184
- </div>
185
- <span class="toggle-label">
186
- <slot name="label-right"></slot>
187
- </span>
188
- </label>
189
- `;
190
- }
191
- }
192
-
193
- customElements.define("pnx-icon-switch", IconSwitch);