ember-ebau-gwr 7.4.6 → 7.5.1

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.1](https://github.com/inosca/ember-ebau-gwr/compare/v7.5.0...v7.5.1) (2024-03-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **readme:** node compatibility ([0a32ea8](https://github.com/inosca/ember-ebau-gwr/commit/0a32ea836cf482277102ee0e81944f8e3722d93a))
7
+
8
+ # [7.5.0](https://github.com/inosca/ember-ebau-gwr/compare/v7.4.6...v7.5.0) (2024-03-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * initial setup of canton to local storage ([cfdba83](https://github.com/inosca/ember-ebau-gwr/commit/cfdba83e5bb84504154b94ab918c9c631df853fe))
14
+ * **search-street:** improve contrast for hovered item ESID ([73e1785](https://github.com/inosca/ember-ebau-gwr/commit/73e1785a490b315677ed79decf88f4795de065a9))
15
+
16
+
17
+ ### Features
18
+
19
+ * **street-search:** replace linkStreet sub-form with street select ([3db3d70](https://github.com/inosca/ember-ebau-gwr/commit/3db3d7074c81203b17bd45b0391f0e92f06fe203))
20
+
1
21
  ## [7.4.6](https://github.com/inosca/ember-ebau-gwr/compare/v7.4.5...v7.4.6) (2024-02-08)
2
22
 
3
23
 
package/README.md CHANGED
@@ -15,7 +15,7 @@ pnpm start
15
15
 
16
16
  - Ember.js v4.4 or above
17
17
  - Ember CLI v4.4 or above
18
- - Node.js v14 or above
18
+ - Node.js v18 or above
19
19
 
20
20
  ## Installation
21
21
 
@@ -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
+ }
@@ -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.6",
3
+ "version": "7.5.1",
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",
@@ -109,7 +109,7 @@
109
109
  "stylelint-config-standard-scss": "12.0.0",
110
110
  "stylelint-prettier": "5.0.0",
111
111
  "stylelint-scss": "6.0.0",
112
- "uikit": "3.17.11",
112
+ "uikit": "3.19.2",
113
113
  "webpack": "5.89.0"
114
114
  },
115
115
  "engines": {
@@ -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 entrer le nom de votre ville et votre code postal.