@genesislcap/foundation-ui 14.139.0 → 14.139.2

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.
@@ -17,6 +17,7 @@ export declare class Combobox extends FASTComboBox {
17
17
  ignoreInputClick: boolean;
18
18
  get value(): string;
19
19
  set value(next: string);
20
+ slottedOptionsChanged(prev: Element[] | undefined, next: Element[]): void;
20
21
  filterOptions(): void;
21
22
  clickHandler(e: MouseEvent): boolean | void;
22
23
  keydownHandler(e: KeyboardEvent): boolean | void;
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/combobox/combobox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAWlE;;GAEG;AACH,qBAAa,QAAS,SAAQ,YAAY;;IACxC,OAAO,CAAC,SAAS,CAAS;IAGd,iBAAiB,EAAE,eAAe,CAAC;IACpB,KAAK,UAAS;IACnC,QAAQ,EAAE,MAAM,CAAiB;IACvC,eAAe,CAAC,QAAQ,KAAA,EAAE,QAAQ,EAAE,MAAM;IAG1C,qBAAqB,MAAC;IACtB,iFAAiF;IAE1E,aAAa,EAAE,OAAO,CAAS;IAEtC,wFAAwF;IAEjF,gBAAgB,EAAE,OAAO,CAAS;IAEzC,IAAW,KAAK,IAKO,MAAM,CAF5B;IAED,IAAW,KAAK,CAAC,IAAI,EAAE,MAAM,EAsB5B;IAEe,aAAa,IAAI,IAAI;IAoBrB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,IAAI;IAuB3C,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAiChD,YAAY,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAuB9D;;;;OAIG;IACH,SAAS,KAAK,SAAS,IAAI,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I;IAuB9D;;;;OAIG;IACH,SAAS,KAAK,SAAS,IAAI,OAAO,CAGjC;IAED;;;;;OAKG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAKhC,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,IAAI;IAQpD,cAAc;CAmBf;AAGD,eAAO,MAAM,+BAA+B,EAAE,cAG7C,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CAajC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,8SAM7B,CAAC"}
@@ -5,6 +5,7 @@ export declare class OptionsDatasource extends BaseDatasource {
5
5
  labelField: string;
6
6
  optionElement: string;
7
7
  valueField: string;
8
+ emptyDataLabel: string;
8
9
  labelFormatter: any;
9
10
  initialSelectedValue: string | number;
10
11
  initialSelectedValueChanged(oldValue: any, newValue: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"options-datasource.d.ts","sourceRoot":"","sources":["../../../src/options-datasource/options-datasource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,cAAc,EAAU,MAAM,UAAU,CAAC;AAGlD,qBAGa,iBAAkB,SAAQ,cAAc;IACf,UAAU,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IAC3C,cAAc,MAAC;IAEf,oBAAoB,EAAE,MAAM,GAAG,MAAM,CAAC;IAClD,2BAA2B,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IAI9C,8BAA8B,EAAE,OAAO,CAAS;IAEhD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAQ;IAElC,SAAS,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,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,mBAAmB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,IAAI;IAI7C,mBAAmB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,IAAI;CAG9C"}
@@ -53,6 +53,11 @@ export class Combobox extends FASTComboBox {
53
53
  Observable.notify(this, 'value');
54
54
  }
55
55
  }
56
+ slottedOptionsChanged(prev, next) {
57
+ const shouldEmit = this.async ? true : false;
58
+ super.slottedOptionsChanged(prev, next);
59
+ this['updateValue'](shouldEmit);
60
+ }
56
61
  filterOptions() {
57
62
  if (!this.autocomplete || this.autocomplete === ComboboxAutocomplete.none) {
58
63
  this['filter'] = '';
@@ -3,11 +3,12 @@ import { __awaiter, __decorate } from "tslib";
3
3
  import { ResourceType } from '@genesislcap/foundation-comms';
4
4
  import { attr, customElement, DOM, observable } from '@microsoft/fast-element';
5
5
  import { Combobox } from '../combobox';
6
- import { BaseDatasource, logger } from '../utils';
6
+ import { BaseDatasource, getPrefix, logger } from '../utils';
7
7
  import { dataserverCriteriaBuilder, requestServerCriteriaBuilder } from '../utils';
8
8
  let OptionsDatasource = OptionsDatasource_1 = class OptionsDatasource extends BaseDatasource {
9
9
  constructor() {
10
10
  super(...arguments);
11
+ this.emptyDataLabel = 'No matching records';
11
12
  this.initalSelectedValueInitialized = false;
12
13
  this.isSnapshot = true;
13
14
  }
@@ -19,13 +20,15 @@ let OptionsDatasource = OptionsDatasource_1 = class OptionsDatasource extends Ba
19
20
  const _super = Object.create(null, {
20
21
  connectedCallback: { get: () => super.connectedCallback }
21
22
  });
22
- var _a;
23
+ var _a, _b;
23
24
  return __awaiter(this, void 0, void 0, function* () {
24
25
  _super.connectedCallback.call(this);
25
26
  this.fields = this.labelField ? (_a = this.valueField) === null || _a === void 0 ? void 0 : _a.concat(' ', this.labelField) : this.valueField;
26
27
  this.select = this.parentElement;
28
+ this.optionElement = (_b = this.optionElement) !== null && _b !== void 0 ? _b : `${getPrefix(this.select)}-option`;
27
29
  this.select.addEventListener('change', (e) => {
28
- const selectedOption = this.options.find((option) => option.label === e.target.value);
30
+ var _a;
31
+ const selectedOption = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((option) => option.label === e.target.value);
29
32
  this.select.$emit('value-change', selectedOption);
30
33
  });
31
34
  if (this.select &&
@@ -67,27 +70,38 @@ let OptionsDatasource = OptionsDatasource_1 = class OptionsDatasource extends Ba
67
70
  syncComponentData(snapshotData) {
68
71
  var _a;
69
72
  const rowData = snapshotData !== null && snapshotData !== void 0 ? snapshotData : Array.from(this.rowsSyncedWithStream.values());
70
- this.options = rowData.map((row) => ({
71
- value: row[this.valueField],
72
- label: this.labelFormatter ? this.labelFormatter(row[this.labelField]) : row[this.labelField],
73
- }));
74
- const listboxOptions = this.options.map(({ value, label }) => {
75
- const option = document.createElement(this.optionElement);
76
- option.textContent = label ? label : value;
77
- option.value = value;
78
- return option;
79
- });
80
- listboxOptions.forEach((x) => {
81
- this.select.appendChild(x);
82
- });
83
- if (!this.initalSelectedValueInitialized) {
84
- const initialLabel = this.initialSelectedValue || this.initialSelectedValue === 0
85
- ? (_a = this.options.find((x) => x.value === this.initialSelectedValue)) === null || _a === void 0 ? void 0 : _a.label
86
- : '';
87
- DOM.queueUpdate(() => {
88
- this.select.value = initialLabel;
73
+ if (rowData.length > 0) {
74
+ this.options = rowData.map((row) => ({
75
+ value: row[this.valueField],
76
+ label: this.labelFormatter
77
+ ? this.labelFormatter(row[this.labelField])
78
+ : row[this.labelField],
79
+ }));
80
+ const listboxOptions = this.options.map(({ value, label }) => {
81
+ const option = document.createElement(this.optionElement);
82
+ option.textContent = label ? label : value;
83
+ option.value = value;
84
+ return option;
85
+ });
86
+ listboxOptions.forEach((x) => {
87
+ this.select.appendChild(x);
89
88
  });
90
- this.initalSelectedValueInitialized = true;
89
+ if (!this.initalSelectedValueInitialized) {
90
+ const initialLabel = this.initialSelectedValue || this.initialSelectedValue === 0
91
+ ? (_a = this.options.find((x) => x.value === this.initialSelectedValue)) === null || _a === void 0 ? void 0 : _a.label
92
+ : '';
93
+ DOM.queueUpdate(() => {
94
+ this.select.value = initialLabel;
95
+ });
96
+ this.initalSelectedValueInitialized = true;
97
+ }
98
+ }
99
+ else {
100
+ const option = document.createElement(this.optionElement);
101
+ option.textContent = this.emptyDataLabel;
102
+ option.value = '';
103
+ option.disabled = true;
104
+ this.select.appendChild(option);
91
105
  }
92
106
  }
93
107
  handleStreamInserts(insertedRows) {
@@ -109,6 +123,9 @@ __decorate([
109
123
  __decorate([
110
124
  attr({ attribute: 'value-field' })
111
125
  ], OptionsDatasource.prototype, "valueField", void 0);
126
+ __decorate([
127
+ attr({ attribute: 'empty-data-label' })
128
+ ], OptionsDatasource.prototype, "emptyDataLabel", void 0);
112
129
  __decorate([
113
130
  observable
114
131
  ], OptionsDatasource.prototype, "labelFormatter", void 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ui",
3
3
  "description": "Genesis Foundation UI",
4
- "version": "14.139.0",
4
+ "version": "14.139.2",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -74,8 +74,8 @@
74
74
  "test:debug": "genx test --debug"
75
75
  },
76
76
  "devDependencies": {
77
- "@genesislcap/foundation-testing": "14.139.0",
78
- "@genesislcap/genx": "14.139.0",
77
+ "@genesislcap/foundation-testing": "14.139.2",
78
+ "@genesislcap/genx": "14.139.2",
79
79
  "copyfiles": "^2.4.1",
80
80
  "rimraf": "^3.0.2",
81
81
  "rxjs": "^7.5.4"
@@ -86,12 +86,12 @@
86
86
  "@fortawesome/free-regular-svg-icons": "^6.2.1",
87
87
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
88
88
  "@genesiscommunitysuccess/analyzer-import-alias-plugin": "^4.0.0",
89
- "@genesislcap/foundation-comms": "14.139.0",
90
- "@genesislcap/foundation-criteria": "14.139.0",
91
- "@genesislcap/foundation-errors": "14.139.0",
92
- "@genesislcap/foundation-logger": "14.139.0",
93
- "@genesislcap/foundation-notifications": "14.139.0",
94
- "@genesislcap/foundation-utils": "14.139.0",
89
+ "@genesislcap/foundation-comms": "14.139.2",
90
+ "@genesislcap/foundation-criteria": "14.139.2",
91
+ "@genesislcap/foundation-errors": "14.139.2",
92
+ "@genesislcap/foundation-logger": "14.139.2",
93
+ "@genesislcap/foundation-notifications": "14.139.2",
94
+ "@genesislcap/foundation-utils": "14.139.2",
95
95
  "@microsoft/fast-colors": "^5.3.1",
96
96
  "@microsoft/fast-components": "^2.30.6",
97
97
  "@microsoft/fast-element": "^1.12.0",
@@ -113,5 +113,5 @@
113
113
  "access": "public"
114
114
  },
115
115
  "customElements": "dist/custom-elements.json",
116
- "gitHead": "403107fcfb26a335c8db254a3327663e60e7af78"
116
+ "gitHead": "945af0dd1cf6327fd8d38b7a336fa7a873da4211"
117
117
  }