ember-ebau-gwr 7.4.5 → 7.5.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 CHANGED
@@ -1,3 +1,23 @@
1
+ # [7.5.0](https://github.com/inosca/ember-ebau-gwr/compare/v7.4.6...v7.5.0) (2024-03-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * initial setup of canton to local storage ([cfdba83](https://github.com/inosca/ember-ebau-gwr/commit/cfdba83e5bb84504154b94ab918c9c631df853fe))
7
+ * **search-street:** improve contrast for hovered item ESID ([73e1785](https://github.com/inosca/ember-ebau-gwr/commit/73e1785a490b315677ed79decf88f4795de065a9))
8
+
9
+
10
+ ### Features
11
+
12
+ * **street-search:** replace linkStreet sub-form with street select ([3db3d70](https://github.com/inosca/ember-ebau-gwr/commit/3db3d7074c81203b17bd45b0391f0e92f06fe203))
13
+
14
+ ## [7.4.6](https://github.com/inosca/ember-ebau-gwr/compare/v7.4.5...v7.4.6) (2024-02-08)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * add SO municipalities ([9605a79](https://github.com/inosca/ember-ebau-gwr/commit/9605a79cb251f9b2dde358262fd3d903f479d37f))
20
+
1
21
  ## [7.4.5](https://github.com/inosca/ember-ebau-gwr/compare/v7.4.4...v7.4.5) (2024-01-30)
2
22
 
3
23
 
@@ -0,0 +1,38 @@
1
+ <div class="uk-margin">
2
+ <label class="uk-form-label" for={{this.guid}}>{{t
3
+ "ember-gwr.buildingEntrance.fields.street.description.descriptionLong"
4
+ }}{{if @required " *"}}
5
+ </label>
6
+ <PowerSelect
7
+ @disabled={{@disabled}}
8
+ @renderInPlace={{true}}
9
+ @tabIndex={{"0"}}
10
+ @triggerClass="uk-select"
11
+ @searchEnabled={{true}}
12
+ @search={{perform this.search}}
13
+ @selected={{@street}}
14
+ @onChange={{@onChange}}
15
+ @onFocus={{this.handleFocus}}
16
+ @searchMessage={{t "ember-gwr.components.linkStreet.search"}}
17
+ @noMatchesMessage={{t "ember-gwr.components.search.noResults"}}
18
+ @loadingMessage={{t "ember-gwr.components.search.loading"}}
19
+ id={{this.guid}}
20
+ class="uk-overflow-hidden"
21
+ ...attributes
22
+ as |streetList|
23
+ >
24
+ {{streetList.description.descriptionLong}}{{#if
25
+ streetList.description.descriptionLong
26
+ }}
27
+ <small
28
+ data-test-street-esid
29
+ class="uk-text-muted uk-text-right uk-text-italic uk-margin-small-left"
30
+ >{{t "ember-gwr.street.ESID"}}: {{streetList.ESID}}</small>
31
+ {{/if}}
32
+ </PowerSelect>
33
+ {{#if @disabled}}
34
+ <small data-test-hint class="uk-text-muted">{{t
35
+ "ember-gwr.components.streetSearch.requiredInputs"
36
+ }}</small>
37
+ {{/if}}
38
+ </div>
@@ -0,0 +1,86 @@
1
+ import { action } from "@ember/object";
2
+ import { guidFor } from "@ember/object/internals";
3
+ import { inject as service } from "@ember/service";
4
+ import { isBlank } from "@ember/utils";
5
+ import Component from "@glimmer/component";
6
+ import { tracked } from "@glimmer/tracking";
7
+ import { task, timeout } from "ember-concurrency";
8
+
9
+ export default class SearchStreetComponent extends Component {
10
+ @service("street") streetAPI;
11
+ @service notification;
12
+ @service intl;
13
+
14
+ @tracked searchTerm = "";
15
+
16
+ constructor(...args) {
17
+ super(...args);
18
+
19
+ this.guid = guidFor(this);
20
+ }
21
+
22
+ get localityName() {
23
+ return this.args.locality.name.nameLong;
24
+ }
25
+
26
+ get swissZipCode() {
27
+ return this.args.locality.swissZipCode;
28
+ }
29
+
30
+ get swissZipCodeAddOn() {
31
+ return this.args.locality.swissZipCodeAddOn;
32
+ }
33
+
34
+ get query() {
35
+ return {
36
+ description: {
37
+ // '*' enable fuzzy search
38
+ descriptionLong: `*${this.searchTerm}*`,
39
+ },
40
+ locality: {
41
+ swissZipCode: this.swissZipCode,
42
+ swissZipCodeAddOn: this.swissZipCodeAddOn,
43
+ name: {
44
+ nameLong: this.localityName,
45
+ },
46
+ },
47
+ language: this.streetAPI.language,
48
+ };
49
+ }
50
+
51
+ search = task(this, { restartable: true }, async (nameLong) => {
52
+ await timeout(500);
53
+
54
+ this.searchTerm = nameLong;
55
+
56
+ if (nameLong.length < 2) {
57
+ return;
58
+ }
59
+
60
+ try {
61
+ return await this.streetAPI.search(this.query);
62
+ } catch (error) {
63
+ console.error(error);
64
+ this.notification.danger(
65
+ this.intl.t("ember-gwr.generalErrors.searchError"),
66
+ );
67
+ }
68
+ });
69
+
70
+ @action
71
+ handleFocus(select, e) {
72
+ if (this.focusComesFromOutside(e)) {
73
+ select.actions.open();
74
+ }
75
+ }
76
+
77
+ // copied from ember-power-select documentation
78
+ // https://github.com/cibernox/ember-power-select/blob/master/docs/app/components/snippets/action-handling-5.js
79
+ focusComesFromOutside(e) {
80
+ const blurredEl = e.relatedTarget;
81
+ if (isBlank(blurredEl)) {
82
+ return false;
83
+ }
84
+ return !blurredEl.classList.contains("ember-power-select-search-input");
85
+ }
86
+ }
@@ -1,4 +1,112 @@
1
1
  export default {
2
+ SO: [
3
+ { id: 2401, name: "Egerkingen" },
4
+ { id: 2402, name: "Härkingen" },
5
+ { id: 2403, name: "Kestenholz" },
6
+ { id: 2404, name: "Neuendorf" },
7
+ { id: 2405, name: "Niederbuchsiten" },
8
+ { id: 2406, name: "Oberbuchsiten" },
9
+ { id: 2407, name: "Oensingen" },
10
+ { id: 2408, name: "Wolfwil" },
11
+ { id: 2421, name: "Aedermannsdorf" },
12
+ { id: 2422, name: "Balsthal" },
13
+ { id: 2424, name: "Herbetswil" },
14
+ { id: 2425, name: "Holderbank (SO)" },
15
+ { id: 2426, name: "Laupersdorf" },
16
+ { id: 2427, name: "Matzendorf" },
17
+ { id: 2428, name: "Mümliswil-Ramiswil" },
18
+ { id: 2430, name: "Welschenrohr-Gänsbrunnen" },
19
+ { id: 2445, name: "Biezwil" },
20
+ { id: 2455, name: "Lüterkofen-Ichertswil" },
21
+ { id: 2457, name: "Messen" },
22
+ { id: 2461, name: "Schnottwil" },
23
+ { id: 2463, name: "Unterramsern" },
24
+ { id: 2464, name: "Lüsslingen-Nennigkofen" },
25
+ { id: 2465, name: "Buchegg" },
26
+ { id: 2471, name: "Bättwil" },
27
+ { id: 2472, name: "Büren (SO)" },
28
+ { id: 2473, name: "Dornach" },
29
+ { id: 2474, name: "Gempen" },
30
+ { id: 2475, name: "Hochwald" },
31
+ { id: 2476, name: "Hofstetten-Flüh" },
32
+ { id: 2477, name: "Metzerlen-Mariastein" },
33
+ { id: 2478, name: "Nuglar-St. Pantaleon" },
34
+ { id: 2479, name: "Rodersdorf" },
35
+ { id: 2480, name: "Seewen" },
36
+ { id: 2481, name: "Witterswil" },
37
+ { id: 2491, name: "Hauenstein-Ifenthal" },
38
+ { id: 2492, name: "Kienberg" },
39
+ { id: 2493, name: "Lostorf" },
40
+ { id: 2495, name: "Niedergösgen" },
41
+ { id: 2497, name: "Obergösgen" },
42
+ { id: 2499, name: "Stüsslingen" },
43
+ { id: 2500, name: "Trimbach" },
44
+ { id: 2501, name: "Winznau" },
45
+ { id: 2502, name: "Wisen (SO)" },
46
+ { id: 2503, name: "Erlinsbach (SO)" },
47
+ { id: 2511, name: "Aeschi (SO)" },
48
+ { id: 2513, name: "Biberist" },
49
+ { id: 2514, name: "Bolken" },
50
+ { id: 2516, name: "Deitingen" },
51
+ { id: 2517, name: "Derendingen" },
52
+ { id: 2518, name: "Etziken" },
53
+ { id: 2519, name: "Gerlafingen" },
54
+ { id: 2520, name: "Halten" },
55
+ { id: 2523, name: "Horriwil" },
56
+ { id: 2524, name: "Hüniken" },
57
+ { id: 2525, name: "Kriegstetten" },
58
+ { id: 2526, name: "Lohn-Ammannsegg" },
59
+ { id: 2527, name: "Luterbach" },
60
+ { id: 2528, name: "Obergerlafingen" },
61
+ { id: 2529, name: "Oekingen" },
62
+ { id: 2530, name: "Recherswil" },
63
+ { id: 2532, name: "Subingen" },
64
+ { id: 2534, name: "Zuchwil" },
65
+ { id: 2535, name: "Drei Höfe" },
66
+ { id: 2541, name: "Balm bei Günsberg" },
67
+ { id: 2542, name: "Bellach" },
68
+ { id: 2543, name: "Bettlach" },
69
+ { id: 2544, name: "Feldbrunnen-St. Niklaus" },
70
+ { id: 2545, name: "Flumenthal" },
71
+ { id: 2546, name: "Grenchen" },
72
+ { id: 2547, name: "Günsberg" },
73
+ { id: 2548, name: "Hubersdorf" },
74
+ { id: 2549, name: "Kammersrohr" },
75
+ { id: 2550, name: "Langendorf" },
76
+ { id: 2551, name: "Lommiswil" },
77
+ { id: 2553, name: "Oberdorf (SO)" },
78
+ { id: 2554, name: "Riedholz" },
79
+ { id: 2555, name: "Rüttenen" },
80
+ { id: 2556, name: "Selzach" },
81
+ { id: 2571, name: "Boningen" },
82
+ { id: 2572, name: "Däniken" },
83
+ { id: 2573, name: "Dulliken" },
84
+ { id: 2574, name: "Eppenberg-Wöschnau" },
85
+ { id: 2575, name: "Fulenbach" },
86
+ { id: 2576, name: "Gretzenbach" },
87
+ { id: 2578, name: "Gunzgen" },
88
+ { id: 2579, name: "Hägendorf" },
89
+ { id: 2580, name: "Kappel (SO)" },
90
+ { id: 2581, name: "Olten" },
91
+ { id: 2582, name: "Rickenbach (SO)" },
92
+ { id: 2583, name: "Schönenwerd" },
93
+ { id: 2584, name: "Starrkirch-Wil" },
94
+ { id: 2585, name: "Walterswil (SO)" },
95
+ { id: 2586, name: "Wangen bei Olten" },
96
+ { id: 2601, name: "Solothurn" },
97
+ { id: 2611, name: "Bärschwil" },
98
+ { id: 2612, name: "Beinwil (SO)" },
99
+ { id: 2613, name: "Breitenbach" },
100
+ { id: 2614, name: "Büsserach" },
101
+ { id: 2615, name: "Erschwil" },
102
+ { id: 2616, name: "Fehren" },
103
+ { id: 2617, name: "Grindel" },
104
+ { id: 2618, name: "Himmelried" },
105
+ { id: 2619, name: "Kleinlützel" },
106
+ { id: 2620, name: "Meltingen" },
107
+ { id: 2621, name: "Nunningen" },
108
+ { id: 2622, name: "Zullwil" },
109
+ ],
2
110
  GR: [
3
111
  { id: 3506, name: "Vaz/Obervaz" },
4
112
  { id: 3513, name: "Lantsch/Lenz" },
@@ -19,7 +19,7 @@
19
19
  @showImport={{this.showImport}}
20
20
  @importIndex={{this.importIndex}}
21
21
  @disabled={{this.hasNoStreet}}
22
- as |Field|
22
+ as |Field changeset|
23
23
  >
24
24
  {{#unless this.buildingEntrance.isNew}}
25
25
  <Field @attr="EDID" @type="number" @disabled={{true}} />
@@ -36,13 +36,26 @@
36
36
  @disabled={{not this.buildingEntrance.isNew}}
37
37
  @required={{true}}
38
38
  />
39
- {{#unless this.buildingEntrance.isNew}}
39
+ {{#if this.buildingEntrance.isNew}}
40
+ <SearchStreet
41
+ @locality={{changeset-get changeset "locality"}}
42
+ @street={{changeset-get changeset "street"}}
43
+ @disabled={{not
44
+ (and
45
+ (changeset-get changeset "locality.swissZipCode")
46
+ (changeset-get changeset "locality.name.nameLong")
47
+ )
48
+ }}
49
+ @required={{true}}
50
+ @onChange={{fn (mut this.buildingEntrance.street)}}
51
+ />
52
+ {{else}}
40
53
  <Field
41
54
  @attr="locality.swissZipCodeAddOn"
42
55
  @type="number"
43
56
  @disabled={{not this.buildingEntrance.isNew}}
44
57
  />
45
- {{/unless}}
58
+ {{/if}}
46
59
  {{! API rejects any modification of the buildingEntranceNo or isOfficial
47
60
  fields on building entrances that are not linked to a street. }}
48
61
  <div
@@ -160,6 +160,18 @@
160
160
  @label="ember-gwr.buildingEntrance.fields.locality.swissZipCode"
161
161
  @required={{true}}
162
162
  />
163
+ <SearchStreet
164
+ @locality={{changeset-get changeset "building.buildingEntrance.locality"}}
165
+ @street={{changeset-get changeset "building.buildingEntrance.street"}}
166
+ @disabled={{not
167
+ (and
168
+ (changeset-get changeset "building.buildingEntrance.locality.swissZipCode")
169
+ (changeset-get changeset "building.buildingEntrance.locality.name.nameLong")
170
+ )
171
+ }}
172
+ @required={{true}}
173
+ @onChange={{fn (changeset-set changeset "building.buildingEntrance.street")}}
174
+ />
163
175
  <Field
164
176
  @attr="building.buildingEntrance.buildingEntranceNo"
165
177
  @label="ember-gwr.buildingEntrance.fields.buildingEntranceNo"
@@ -1,3 +1,5 @@
1
+ $ember-power-select-trigger-icon-color: transparent;
2
+
1
3
  @import "ember-uikit/variables-theme";
2
4
  @import "validated-form";
3
5
  @import "ember-power-select";
@@ -6,6 +8,10 @@
6
8
  .ember-ebau-gwr-login .ember-power-select-status-icon {
7
9
  @extend .uk-invisible;
8
10
  }
11
+
12
+ .ember-power-select-option:hover > small {
13
+ mix-blend-mode: multiply;
14
+ }
9
15
  }
10
16
 
11
17
  $ember-ebau-gwr-required-color: $alert-danger-color !default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-ebau-gwr",
3
- "version": "7.4.5",
3
+ "version": "7.5.0",
4
4
  "description": "Ember engine to integrate ebau-gwr into an ember app.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -93,7 +93,7 @@
93
93
  "eslint": "8.55.0",
94
94
  "eslint-config-prettier": "9.1.0",
95
95
  "eslint-plugin-ember": "11.11.1",
96
- "eslint-plugin-import": "2.29.0",
96
+ "eslint-plugin-import": "2.29.1",
97
97
  "eslint-plugin-n": "16.4.0",
98
98
  "eslint-plugin-prettier": "5.0.1",
99
99
  "eslint-plugin-qunit": "8.0.1",
@@ -329,7 +329,7 @@ ember-gwr:
329
329
  change: Strasse ändern
330
330
  link: Strasse verknüpfen
331
331
  heading: Strasse verknüpfen
332
- search: Strasse suchen
332
+ search: Strasse suchen...
333
333
  linkSuccess: Strasse erfolgreich verknüpft.
334
334
  linkError: Bei der Verknüpfung der Strasse ist ein Fehler aufgetreten.
335
335
  streetHint: Um einen Eingang zu erfassen müssen Sie eine Strasse verknüpfen.
@@ -344,3 +344,6 @@ ember-gwr:
344
344
 
345
345
  modelErrors:
346
346
  empty: Keine offenen Pendenzen
347
+
348
+ streetSearch:
349
+ requiredInputs: Bitte geben Sie zuerst Ortsname und PLZ an.
@@ -329,7 +329,7 @@ ember-gwr:
329
329
  change: Changer la rue
330
330
  link: Lier une rue
331
331
  heading: Lier une rue
332
- search: Chercher une rue
332
+ search: Chercher une rue...
333
333
  linkSuccess: La rue est liée avec succès.
334
334
  linkError: Une erreur est survenue lors de la liaison de la rue.
335
335
  streetHint: Pour saisir une entrée, vous devez associer une rue.
@@ -344,3 +344,6 @@ ember-gwr:
344
344
 
345
345
  modelErrors:
346
346
  empty: Pas de dossiers/ cas en suspens
347
+
348
+ streetSearch:
349
+ requiredInputs: Veuillez d'abord indiquer le nom de la ville et le code postal.