@wavemaker/app-ng-runtime 11.8.0-next.139432 → 11.8.0-next.1417112

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.
@@ -9,7 +9,7 @@ import { IMaskDirective, IMaskModule } from 'angular-imask';
9
9
  import * as i2 from '@wm/components/base';
10
10
  import { PROP_STRING, PROP_ANY, PROP_BOOLEAN, PROP_NUMBER, register, DISPLAY_TYPE, StylableComponent, styler, provideAsWidgetRef, APPLY_STYLES_TYPE, WidgetConfig, registerFormWidget, provideAs, extractDataAsArray, ToDatePipe, ALLFIELDS, convertDataToObject, getOrderedDataset, transformDataWithKeys, transformFormData, getUniqObjsByDataField, groupData, handleHeaderClick, toggleAllHeaders, WidgetRef, INPUTMODE, TrailingZeroDecimalPipe, WmComponentsModule } from '@wm/components/base';
11
11
  import * as i1$1 from '@wm/core';
12
- import { DataSource, FormWidgetType, isDefined, toggleClass, AppDefaults, $appDigest, debounce, noop, isEqualWithFields, toBoolean, setListClass, switchClass, addForIdAttributes, addClass, AbstractI18nService, setAttr, removeAttr, isIos, setCSS } from '@wm/core';
12
+ import { DataSource, FormWidgetType, isDefined, toggleClass, AppDefaults, $appDigest, debounce, noop, isEqualWithFields, toBoolean, setListClass, switchClass, addForIdAttributes, addClass, AbstractI18nService, setAttr, removeAttr, setCSS } from '@wm/core';
13
13
  import { Subject } from 'rxjs';
14
14
  import { __param, __metadata, __decorate } from 'tslib';
15
15
 
@@ -2111,51 +2111,45 @@ const registerProps$7 = () => {
2111
2111
 
2112
2112
  const _c0$7 = ["select"];
2113
2113
  const _c1$6 = a0 => ["app-select form-control", a0];
2114
- function SelectComponent_option_2_Template(rf, ctx) { if (rf & 1) {
2115
- i0.ɵɵelement(0, "option", 4);
2116
- } if (rf & 2) {
2117
- const ctx_r1 = i0.ɵɵnextContext();
2118
- i0.ɵɵproperty("textContent", ctx_r1.placeholder)("hidden", !ctx_r1.placeholder);
2119
- } }
2120
2114
  function SelectComponent_ng_container_3_optgroup_1_option_1_Template(rf, ctx) { if (rf & 1) {
2121
- i0.ɵɵelement(0, "option", 8);
2115
+ i0.ɵɵelement(0, "option", 7);
2122
2116
  } if (rf & 2) {
2123
- const item_r3 = ctx.$implicit;
2124
- i0.ɵɵproperty("value", item_r3.key)("selected", item_r3.selected)("textContent", item_r3.label);
2117
+ const item_r2 = ctx.$implicit;
2118
+ i0.ɵɵproperty("value", item_r2.key)("selected", item_r2.selected)("textContent", item_r2.label);
2125
2119
  } }
2126
2120
  function SelectComponent_ng_container_3_optgroup_1_Template(rf, ctx) { if (rf & 1) {
2127
- i0.ɵɵelementStart(0, "optgroup", 6);
2128
- i0.ɵɵtemplate(1, SelectComponent_ng_container_3_optgroup_1_option_1_Template, 1, 3, "option", 7);
2121
+ i0.ɵɵelementStart(0, "optgroup", 5);
2122
+ i0.ɵɵtemplate(1, SelectComponent_ng_container_3_optgroup_1_option_1_Template, 1, 3, "option", 6);
2129
2123
  i0.ɵɵelementEnd();
2130
2124
  } if (rf & 2) {
2131
- const groupObj_r4 = ctx.$implicit;
2132
- i0.ɵɵproperty("label", groupObj_r4.key);
2125
+ const groupObj_r3 = ctx.$implicit;
2126
+ i0.ɵɵproperty("label", groupObj_r3.key);
2133
2127
  i0.ɵɵadvance();
2134
- i0.ɵɵproperty("ngForOf", groupObj_r4.data);
2128
+ i0.ɵɵproperty("ngForOf", groupObj_r3.data);
2135
2129
  } }
2136
2130
  function SelectComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) {
2137
2131
  i0.ɵɵelementContainerStart(0);
2138
- i0.ɵɵtemplate(1, SelectComponent_ng_container_3_optgroup_1_Template, 2, 2, "optgroup", 5);
2132
+ i0.ɵɵtemplate(1, SelectComponent_ng_container_3_optgroup_1_Template, 2, 2, "optgroup", 4);
2139
2133
  i0.ɵɵelementContainerEnd();
2140
2134
  } if (rf & 2) {
2141
- const ctx_r1 = i0.ɵɵnextContext();
2135
+ const ctx_r3 = i0.ɵɵnextContext();
2142
2136
  i0.ɵɵadvance();
2143
- i0.ɵɵproperty("ngForOf", ctx_r1.groupedData);
2137
+ i0.ɵɵproperty("ngForOf", ctx_r3.groupedData);
2144
2138
  } }
2145
2139
  function SelectComponent_ng_container_4_option_1_Template(rf, ctx) { if (rf & 1) {
2146
- i0.ɵɵelement(0, "option", 8);
2140
+ i0.ɵɵelement(0, "option", 7);
2147
2141
  } if (rf & 2) {
2148
2142
  const item_r5 = ctx.$implicit;
2149
2143
  i0.ɵɵproperty("value", item_r5.key)("selected", item_r5.selected)("textContent", item_r5.label);
2150
2144
  } }
2151
2145
  function SelectComponent_ng_container_4_Template(rf, ctx) { if (rf & 1) {
2152
2146
  i0.ɵɵelementContainerStart(0);
2153
- i0.ɵɵtemplate(1, SelectComponent_ng_container_4_option_1_Template, 1, 3, "option", 7);
2147
+ i0.ɵɵtemplate(1, SelectComponent_ng_container_4_option_1_Template, 1, 3, "option", 6);
2154
2148
  i0.ɵɵelementContainerEnd();
2155
2149
  } if (rf & 2) {
2156
- const ctx_r1 = i0.ɵɵnextContext();
2150
+ const ctx_r3 = i0.ɵɵnextContext();
2157
2151
  i0.ɵɵadvance();
2158
- i0.ɵɵproperty("ngForOf", ctx_r1.datasetItems);
2152
+ i0.ɵɵproperty("ngForOf", ctx_r3.datasetItems);
2159
2153
  } }
2160
2154
  const WIDGET_CONFIG$7 = { widgetType: 'wm-select', hostClass: 'app-select-wrapper' };
2161
2155
  class SelectComponent extends DatasetAwareFormComponent {
@@ -2173,9 +2167,6 @@ class SelectComponent extends DatasetAwareFormComponent {
2173
2167
  ngAfterViewInit() {
2174
2168
  super.ngAfterViewInit();
2175
2169
  styler(this.selectEl.nativeElement, this);
2176
- setTimeout(() => {
2177
- this.checkForFloatingLabel(null);
2178
- }, 10);
2179
2170
  }
2180
2171
  // Change event is registered from the template, Prevent the framework from registering one more event
2181
2172
  handleEvent(node, eventName, eventCallback, locals) {
@@ -2222,16 +2213,6 @@ class SelectComponent extends DatasetAwareFormComponent {
2222
2213
  }
2223
2214
  super.onPropertyChange(key, nv, ov);
2224
2215
  }
2225
- isSafariBrowser() {
2226
- var reg = {
2227
- MAC: /Mac/i,
2228
- MACINTEL: /MacIntel/i
2229
- };
2230
- return reg.MAC.test(window.navigator.platform) || reg.MACINTEL.test(window.navigator.platform);
2231
- }
2232
- isIosPlatform() {
2233
- return isIos() || this.isSafariBrowser();
2234
- }
2235
2216
  /**
2236
2217
  * When caption floating is enabled and placeholder is given, do not show placeholder until user focuses on the field
2237
2218
  * When focused add the placeholder to the option which is selected
@@ -2241,23 +2222,33 @@ class SelectComponent extends DatasetAwareFormComponent {
2241
2222
  checkForFloatingLabel($event) {
2242
2223
  const captionEl = $(this.selectEl.nativeElement).closest('.app-composite-widget.caption-floating');
2243
2224
  if (captionEl.length > 0) {
2244
- if ((!$event || $event.type === 'focus') && (($(this.selectEl).find('select option:selected').text() === '' && (this.placeholder || (this.datavalue || this.binddatavalue) || this.isIosPlatform())))) {
2245
- if (!$event && (this.placeholder || this.datavalue || this.binddatavalue || this.isIosPlatform())) {
2246
- this.app.notify('captionPositionAnimate', { isSelect: true, nativeEl: captionEl });
2225
+ if ($event.type === 'focus' && (!this.datavalue || (this.datavalue && $(this.selectEl).find('select option:selected').text() === '' && this.placeholder))) {
2226
+ if (!(this.datavalue || this.placeholder)) {
2227
+ this.removePlaceholderOption();
2247
2228
  }
2248
- if (this.placeholder) {
2229
+ else {
2249
2230
  $(this.selectEl.nativeElement).find('option:first').text(this.placeholder);
2250
2231
  }
2251
2232
  }
2252
2233
  else if (!this.datavalue) {
2253
- if (!this.placeholder) {
2254
- // $(this.selectEl.nativeElement).find('option:first').text('');
2255
- if (!this.isIosPlatform()) {
2256
- captionEl.removeClass('float-active');
2257
- }
2258
- }
2234
+ $(this.selectEl.nativeElement).find('option:selected').text('');
2235
+ captionEl.removeClass('float-active');
2259
2236
  }
2260
2237
  }
2238
+ else if (!(this.datavalue || this.placeholder)) {
2239
+ this.removePlaceholderOption();
2240
+ }
2241
+ }
2242
+ /*
2243
+ * Removing the placeholder option if no placeholder is provided.
2244
+ * In html we are hiding the placeholder option using css but in apple devices and safari option is showing.
2245
+ * */
2246
+ removePlaceholderOption() {
2247
+ const hiddenEle = $(this.selectEl.nativeElement).find('#placeholderOption');
2248
+ if (hiddenEle.length) {
2249
+ hiddenEle.remove();
2250
+ this.selectEl.nativeElement.value = '';
2251
+ }
2261
2252
  }
2262
2253
  static { this.ɵfac = function SelectComponent_Factory(t) { return new (t || SelectComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i1$1.App), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
2263
2254
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SelectComponent, selectors: [["wm-select"]], viewQuery: function SelectComponent_Query(rf, ctx) { if (rf & 1) {
@@ -2269,20 +2260,21 @@ class SelectComponent extends DatasetAwareFormComponent {
2269
2260
  provideAs(SelectComponent, NG_VALUE_ACCESSOR, true),
2270
2261
  provideAs(SelectComponent, NG_VALIDATORS, true),
2271
2262
  provideAsWidgetRef(SelectComponent)
2272
- ]), i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 15, consts: [["select", ""], ["role", "listbox", "aria-haspopup", "true", "aria-expanded", "false", "focus-target", "", 3, "ngModelChange", "change", "focus", "blur", "ngClass", "disabled", "required", "tabindex", "ngModel", "multiple", "autofocus"], ["value", "undefined", 3, "textContent", "hidden", 4, "ngIf"], [4, "ngIf"], ["value", "undefined", 3, "textContent", "hidden"], [3, "label", 4, "ngFor", "ngForOf"], [3, "label"], ["role", "option", 3, "value", "selected", "textContent", 4, "ngFor", "ngForOf"], ["role", "option", 3, "value", "selected", "textContent"]], template: function SelectComponent_Template(rf, ctx) { if (rf & 1) {
2263
+ ]), i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 16, consts: [["select", ""], ["role", "listbox", "aria-haspopup", "true", "aria-expanded", "false", "focus-target", "", 3, "ngModelChange", "change", "focus", "blur", "ngClass", "disabled", "required", "tabindex", "ngModel", "multiple", "autofocus"], ["selected", "", "value", "undefined", "id", "placeholderOption", 3, "textContent", "hidden"], [4, "ngIf"], [3, "label", 4, "ngFor", "ngForOf"], [3, "label"], ["role", "option", 3, "value", "selected", "textContent", 4, "ngFor", "ngForOf"], ["role", "option", 3, "value", "selected", "textContent"]], template: function SelectComponent_Template(rf, ctx) { if (rf & 1) {
2273
2264
  const _r1 = i0.ɵɵgetCurrentView();
2274
2265
  i0.ɵɵelementStart(0, "select", 1, 0);
2275
2266
  i0.ɵɵtwoWayListener("ngModelChange", function SelectComponent_Template_select_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r1); i0.ɵɵtwoWayBindingSet(ctx.modelByKey, $event) || (ctx.modelByKey = $event); return i0.ɵɵresetView($event); });
2276
2267
  i0.ɵɵlistener("change", function SelectComponent_Template_select_change_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onSelectValueChange($event)); })("focus", function SelectComponent_Template_select_focus_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.checkForFloatingLabel($event)); })("blur", function SelectComponent_Template_select_blur_0_listener($event) { i0.ɵɵrestoreView(_r1); ctx.invokeOnTouched($event); return i0.ɵɵresetView(ctx.checkForFloatingLabel($event)); });
2277
- i0.ɵɵtemplate(2, SelectComponent_option_2_Template, 1, 2, "option", 2)(3, SelectComponent_ng_container_3_Template, 2, 1, "ng-container", 3)(4, SelectComponent_ng_container_4_Template, 2, 1, "ng-container", 3);
2268
+ i0.ɵɵelement(2, "option", 2);
2269
+ i0.ɵɵtemplate(3, SelectComponent_ng_container_3_Template, 2, 1, "ng-container", 3)(4, SelectComponent_ng_container_4_Template, 2, 1, "ng-container", 3);
2278
2270
  i0.ɵɵelementEnd();
2279
2271
  } if (rf & 2) {
2280
- i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(13, _c1$6, ctx.class))("disabled", ctx.disabled)("required", ctx.required)("tabindex", ctx.tabindex);
2272
+ i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(14, _c1$6, ctx.class))("disabled", ctx.disabled)("required", ctx.required)("tabindex", ctx.tabindex);
2281
2273
  i0.ɵɵtwoWayProperty("ngModel", ctx.modelByKey);
2282
2274
  i0.ɵɵproperty("multiple", ctx.multiple)("autofocus", ctx.autofocus);
2283
2275
  i0.ɵɵattribute("name", ctx.name)("aria-label", ctx.hint)("aria-multiselectable", ctx.multiple);
2284
2276
  i0.ɵɵadvance(2);
2285
- i0.ɵɵproperty("ngIf", !ctx.isIosPlatform() || !!ctx.placeholder);
2277
+ i0.ɵɵproperty("textContent", ctx.placeholder)("hidden", !ctx.placeholder);
2286
2278
  i0.ɵɵadvance();
2287
2279
  i0.ɵɵproperty("ngIf", ctx.groupby);
2288
2280
  i0.ɵɵadvance();
@@ -2295,7 +2287,7 @@ class SelectComponent extends DatasetAwareFormComponent {
2295
2287
  provideAs(SelectComponent, NG_VALUE_ACCESSOR, true),
2296
2288
  provideAs(SelectComponent, NG_VALIDATORS, true),
2297
2289
  provideAsWidgetRef(SelectComponent)
2298
- ], template: "<select role=\"listbox\" aria-haspopup=\"true\" aria-expanded=\"false\" #select\n focus-target\n [ngClass]=\"['app-select form-control', class]\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n [(ngModel)]=\"modelByKey\"\n [multiple]=\"multiple\"\n (change)=\"onSelectValueChange($event)\"\n (focus)=\"checkForFloatingLabel($event)\"\n (blur)=\"invokeOnTouched($event); checkForFloatingLabel($event)\"\n [attr.name]=\"name\"\n [attr.aria-label]=\"hint\"\n [attr.aria-multiselectable]=\"multiple\"\n [autofocus]=\"autofocus\"\n>\n <option\n value=\"undefined\"\n [textContent]=\"placeholder\"\n *ngIf=\"!isIosPlatform() || !!placeholder\"\n [hidden]=\"!placeholder\"></option>\n\n <ng-container *ngIf=\"groupby\">\n <optgroup *ngFor=\"let groupObj of groupedData\"\n [label]=\"groupObj.key\">\n <option *ngFor=\"let item of groupObj.data;\"\n [value]=\"item.key\"\n [selected]=\"item.selected\"\n [textContent]=\"item.label\"\n role=\"option\"></option>\n </optgroup>\n </ng-container>\n\n <ng-container *ngIf=\"!groupby\">\n <option *ngFor=\"let item of datasetItems\"\n [value]=\"item.key\"\n [selected]=\"item.selected\"\n [textContent]=\"item.label\"\n role=\"option\"></option>\n </ng-container>\n</select>\n" }]
2290
+ ], template: "<select role=\"listbox\" aria-haspopup=\"true\" aria-expanded=\"false\" #select\n focus-target\n [ngClass]=\"['app-select form-control', class]\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n [(ngModel)]=\"modelByKey\"\n [multiple]=\"multiple\"\n (change)=\"onSelectValueChange($event)\"\n (focus)=\"checkForFloatingLabel($event)\"\n (blur)=\"invokeOnTouched($event); checkForFloatingLabel($event)\"\n [attr.name]=\"name\"\n [attr.aria-label]=\"hint\"\n [attr.aria-multiselectable]=\"multiple\"\n [autofocus]=\"autofocus\">\n\n <option selected\n value=\"undefined\"\n [textContent]=\"placeholder\"\n id=\"placeholderOption\"\n [hidden]=\"!placeholder\"></option>\n\n <ng-container *ngIf=\"groupby\">\n <optgroup *ngFor=\"let groupObj of groupedData\"\n [label]=\"groupObj.key\">\n <option *ngFor=\"let item of groupObj.data;\"\n [value]=\"item.key\"\n [selected]=\"item.selected\"\n [textContent]=\"item.label\"\n role=\"option\"></option>\n </optgroup>\n </ng-container>\n\n <ng-container *ngIf=\"!groupby\">\n <option *ngFor=\"let item of datasetItems\"\n [value]=\"item.key\"\n [selected]=\"item.selected\"\n [textContent]=\"item.label\"\n role=\"option\"></option>\n </ng-container>\n</select>\n" }]
2299
2291
  }], () => [{ type: i0.Injector }, { type: i1$1.App }, { type: undefined, decorators: [{
2300
2292
  type: Inject,
2301
2293
  args: ['EXPLICIT_CONTEXT']
@@ -3249,8 +3241,7 @@ class CaptionPositionDirective {
3249
3241
  // isSelectMultiple is set to true when for select widget, multiple option is enabled
3250
3242
  // Checking inputEl focus - when form is represented as dialog and the first field is automatically in focus
3251
3243
  const isInputElFocused = this.inputEl && this.inputEl.is(':focus');
3252
- const localName = this.inputEl && this.inputEl.length && this.inputEl[0].localName;
3253
- if ((data.isSelect && localName == 'select') || data.displayVal || data.isFocused || data.isSelectMultiple || isInputElFocused) {
3244
+ if (data.displayVal || data.isFocused || data.isSelectMultiple || isInputElFocused) {
3254
3245
  data.nativeEl.addClass('float-active');
3255
3246
  if (!data.displayVal && isInputElFocused) {
3256
3247
  this.inputEl.attr('placeholder', this.placeholder);