@wavemaker-ai/app-ng-runtime 1.0.0-rc.317 → 1.0.0-rc.319
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/build-task/bundles/index.umd.js +16 -7
- package/build-task/fesm2022/index.mjs +16 -7
- package/build-task/fesm2022/index.mjs.map +1 -1
- package/components/base/bundles/index.umd.js +301 -4
- package/components/base/fesm2022/index.mjs +300 -4
- package/components/base/fesm2022/index.mjs.map +1 -1
- package/components/base/index.d.ts +106 -2
- package/components/basic/anchor/bundles/index.umd.js +4 -5
- package/components/basic/anchor/fesm2022/index.mjs +4 -5
- package/components/basic/anchor/fesm2022/index.mjs.map +1 -1
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/icon/bundles/index.umd.js +3 -3
- package/components/basic/icon/fesm2022/index.mjs +4 -4
- package/components/basic/icon/fesm2022/index.mjs.map +1 -1
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/search/bundles/index.umd.js +6 -3
- package/components/basic/search/fesm2022/index.mjs +7 -4
- package/components/basic/search/fesm2022/index.mjs.map +1 -1
- package/components/basic/search/index.d.ts +3 -0
- package/components/basic/spinner/bundles/index.umd.js +5 -3
- package/components/basic/spinner/fesm2022/index.mjs +6 -4
- package/components/basic/spinner/fesm2022/index.mjs.map +1 -1
- package/components/basic/spinner/index.d.ts +1 -0
- package/components/chart/bundles/index.umd.js +4 -3
- package/components/chart/fesm2022/index.mjs +5 -4
- package/components/chart/fesm2022/index.mjs.map +1 -1
- package/components/chart/index.d.ts +1 -0
- package/components/containers/accordion/bundles/index.umd.js +4 -3
- package/components/containers/accordion/fesm2022/index.mjs +5 -4
- package/components/containers/accordion/fesm2022/index.mjs.map +1 -1
- package/components/containers/accordion/index.d.ts +1 -0
- package/components/containers/panel/bundles/index.umd.js +3 -3
- package/components/containers/panel/fesm2022/index.mjs +4 -4
- package/components/containers/panel/fesm2022/index.mjs.map +1 -1
- package/components/containers/panel/index.d.ts +3 -0
- package/components/containers/tabs/bundles/index.umd.js +5 -4
- package/components/containers/tabs/fesm2022/index.mjs +6 -5
- package/components/containers/tabs/fesm2022/index.mjs.map +1 -1
- package/components/containers/wizard/bundles/index.umd.js +8 -6
- package/components/containers/wizard/fesm2022/index.mjs +9 -7
- package/components/containers/wizard/fesm2022/index.mjs.map +1 -1
- package/components/containers/wizard/index.d.ts +2 -0
- package/components/data/card/bundles/index.umd.js +3 -3
- package/components/data/card/fesm2022/index.mjs +4 -4
- package/components/data/card/fesm2022/index.mjs.map +1 -1
- package/components/data/form/bundles/index.umd.js +6 -3
- package/components/data/form/fesm2022/index.mjs +7 -4
- package/components/data/form/fesm2022/index.mjs.map +1 -1
- package/components/data/form/index.d.ts +2 -0
- package/components/data/list/bundles/index.umd.js +5 -3
- package/components/data/list/fesm2022/index.mjs +6 -4
- package/components/data/list/fesm2022/index.mjs.map +1 -1
- package/components/data/list/index.d.ts +2 -0
- package/components/data/table/bundles/index.umd.js +4 -3
- package/components/data/table/fesm2022/index.mjs +5 -4
- package/components/data/table/fesm2022/index.mjs.map +1 -1
- package/components/data/table/index.d.ts +1 -0
- package/components/dialogs/default/bundles/index.umd.js +2 -2
- package/components/dialogs/default/fesm2022/index.mjs +3 -3
- package/components/dialogs/default/fesm2022/index.mjs.map +1 -1
- package/components/input/button/bundles/index.umd.js +4 -5
- package/components/input/button/fesm2022/index.mjs +4 -5
- package/components/input/button/fesm2022/index.mjs.map +1 -1
- package/components/input/button/index.d.ts +3 -0
- package/components/input/checkbox/bundles/index.umd.js +6 -4
- package/components/input/checkbox/fesm2022/index.mjs +7 -5
- package/components/input/checkbox/fesm2022/index.mjs.map +1 -1
- package/components/input/checkbox/index.d.ts +2 -0
- package/components/input/file-upload/bundles/index.umd.js +5 -3
- package/components/input/file-upload/fesm2022/index.mjs +6 -4
- package/components/input/file-upload/fesm2022/index.mjs.map +1 -1
- package/components/input/file-upload/index.d.ts +3 -0
- package/components/input/rating/bundles/index.umd.js +9 -3
- package/components/input/rating/fesm2022/index.mjs +10 -4
- package/components/input/rating/fesm2022/index.mjs.map +1 -1
- package/components/input/rating/index.d.ts +6 -0
- package/components/input/slider/bundles/index.umd.js +5 -3
- package/components/input/slider/fesm2022/index.mjs +6 -4
- package/components/input/slider/fesm2022/index.mjs.map +1 -1
- package/components/input/slider/index.d.ts +2 -0
- package/components/input/switch/bundles/index.umd.js +6 -3
- package/components/input/switch/fesm2022/index.mjs +7 -4
- package/components/input/switch/fesm2022/index.mjs.map +1 -1
- package/components/input/switch/index.d.ts +2 -0
- package/components/input/text/bundles/index.umd.js +7 -5
- package/components/input/text/fesm2022/index.mjs +8 -6
- package/components/input/text/fesm2022/index.mjs.map +1 -1
- package/components/input/text/index.d.ts +2 -0
- package/components/navigation/menu/bundles/index.umd.js +4 -3
- package/components/navigation/menu/fesm2022/index.mjs +5 -4
- package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
- package/components/navigation/menu/index.d.ts +1 -0
- package/components/navigation/navbar/bundles/index.umd.js +5 -5
- package/components/navigation/navbar/fesm2022/index.mjs +5 -5
- package/components/navigation/navbar/fesm2022/index.mjs.map +1 -1
- package/components/navigation/navbar/index.d.ts +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/runtime/base/bundles/index.umd.js +23 -1
- package/runtime/base/fesm2022/index.mjs +23 -1
- package/runtime/base/fesm2022/index.mjs.map +1 -1
- package/runtime/base/index.d.ts +5 -0
- package/transpiler/bundles/index.umd.js +2 -0
- package/transpiler/fesm2022/index.mjs +2 -0
- package/transpiler/fesm2022/index.mjs.map +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@wm/core'), require('@angular/core'), require('@wavemaker/focus-trap'), require('lodash-es'), require('moment'), require('@angular/platform-browser'), require('rxjs'), require('@wm/security'), require('rxjs/operators'), require('@angular/forms'), require('@swipey'), require('@angular/common'), require('moment-timezone/moment-timezone'), require('tslib')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@wm/core', '@angular/core', '@wavemaker/focus-trap', 'lodash-es', 'moment', '@angular/platform-browser', 'rxjs', '@wm/security', 'rxjs/operators', '@angular/forms', '@swipey', '@angular/common', 'moment-timezone/moment-timezone', 'tslib'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.base = {}), global.wm.core, global.ng.core, global.focusTrap, global._, global.momentLib, global.ng.platformBrowser, global.rxjs, global.wm.security, global.rxjs.operators, global.ng.forms, global.swipey, global.ng.common, global.momentLib$1, global.tslib));
|
|
5
|
-
})(this, (function (exports, i1, i0, focusTrap, lodashEs, momentLib, i1$2, rxjs, security, operators, forms, _swipey, i1$1, momentLib$1, tslib) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@wm/core'), require('@angular/core'), require('@wavemaker/focus-trap'), require('lodash-es'), require('moment'), require('@angular/platform-browser'), require('rxjs'), require('@wm/security'), require('rxjs/operators'), require('@angular/forms'), require('@swipey'), require('@angular/common'), require('moment-timezone/moment-timezone'), require('tslib'), require('@angular/common/http')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@wm/core', '@angular/core', '@wavemaker/focus-trap', 'lodash-es', 'moment', '@angular/platform-browser', 'rxjs', '@wm/security', 'rxjs/operators', '@angular/forms', '@swipey', '@angular/common', 'moment-timezone/moment-timezone', 'tslib', '@angular/common/http'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.base = {}), global.wm.core, global.ng.core, global.focusTrap, global._, global.momentLib, global.ng.platformBrowser, global.rxjs, global.wm.security, global.rxjs.operators, global.ng.forms, global.swipey, global.ng.common, global.momentLib$1, global.tslib, global.ng.common.http));
|
|
5
|
+
})(this, (function (exports, i1, i0, focusTrap, lodashEs, momentLib, i1$2, rxjs, security, operators, forms, _swipey, i1$1, momentLib$1, tslib, http) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
var n = Object.create(null);
|
|
@@ -5910,6 +5910,300 @@
|
|
|
5910
5910
|
type: i0.Input
|
|
5911
5911
|
}] }); })();
|
|
5912
5912
|
|
|
5913
|
+
// check if the url is a svg icon url
|
|
5914
|
+
function isSvgIconUrl(url) {
|
|
5915
|
+
if (!url) {
|
|
5916
|
+
return false;
|
|
5917
|
+
}
|
|
5918
|
+
const path = url.split(/[?#]/)[0];
|
|
5919
|
+
return /\.svg$/i.test(path);
|
|
5920
|
+
}
|
|
5921
|
+
/**
|
|
5922
|
+
* Module-level cache for already-normalized SVG markup, keyed by the
|
|
5923
|
+
* pipe-transformed URL. Shared across every directive instance so repeated
|
|
5924
|
+
* usage of the same icon resolves synchronously without another network hit.
|
|
5925
|
+
*/
|
|
5926
|
+
const svgCache = new Map();
|
|
5927
|
+
/**
|
|
5928
|
+
* In-flight request cache. Multiple directives mounted at the same time and
|
|
5929
|
+
* pointing at the same URL share a single HTTP request.
|
|
5930
|
+
*/
|
|
5931
|
+
const inFlightRequests = new Map();
|
|
5932
|
+
/**
|
|
5933
|
+
* Renders the SVG fetched from `iconUrl` inline on the host element so the
|
|
5934
|
+
* markup behaves like a font icon - it can be sized via `font-size`, supports
|
|
5935
|
+
* `:hover` / transitions on the host, and (for SVGs authored with
|
|
5936
|
+
* `currentColor`) inherits `color` from CSS.
|
|
5937
|
+
*
|
|
5938
|
+
* Usage:
|
|
5939
|
+
* <i class="wm-icon" [iconUrl]="url"></i>
|
|
5940
|
+
*
|
|
5941
|
+
* The incoming URL is first run through `ImagePipe` (so relative project
|
|
5942
|
+
* paths, CDN rewrites, etc. work the same way as `<img [src]>`), then fetched
|
|
5943
|
+
* as text via `HttpClient`. The fetched markup is normalized so the root
|
|
5944
|
+
* `<svg>` gets `width="1em"` / `height="1em"` if not already specified (so
|
|
5945
|
+
* the icon scales with the host's `font-size`) and a root `fill="currentColor"`
|
|
5946
|
+
* fallback when no `fill` attribute is declared.
|
|
5947
|
+
*
|
|
5948
|
+
* Original `fill` / `stroke` values inside the SVG are preserved verbatim so
|
|
5949
|
+
* a multi-color SVG renders with its source colors. To make an SVG themeable
|
|
5950
|
+
* via the host's CSS `color`, author the source with `fill="currentColor"`
|
|
5951
|
+
* (the convention used by Material Icons, Heroicons, Font Awesome, etc.).
|
|
5952
|
+
*/
|
|
5953
|
+
class SvgIconDirective {
|
|
5954
|
+
constructor() {
|
|
5955
|
+
/**
|
|
5956
|
+
* Bound to the host's `innerHTML`. Set to a `SafeHtml` value produced by
|
|
5957
|
+
* `DomSanitizer.bypassSecurityTrustHtml` so Angular's renderer skips
|
|
5958
|
+
* re-sanitization and inlines the SVG as-is.
|
|
5959
|
+
*/
|
|
5960
|
+
this.hostInnerHtml = null;
|
|
5961
|
+
this.http = i0.inject(http.HttpClient);
|
|
5962
|
+
this.sanitizer = i0.inject(i1$2.DomSanitizer);
|
|
5963
|
+
this.imagePipe = i0.inject(ImagePipe);
|
|
5964
|
+
this.lastResolvedUrl = null;
|
|
5965
|
+
}
|
|
5966
|
+
ngOnChanges(changes) {
|
|
5967
|
+
if (changes['iconUrl']) {
|
|
5968
|
+
this.loadSvg(this.iconUrl);
|
|
5969
|
+
}
|
|
5970
|
+
}
|
|
5971
|
+
ngOnDestroy() {
|
|
5972
|
+
this.cancelInflight();
|
|
5973
|
+
}
|
|
5974
|
+
loadSvg(rawUrl) {
|
|
5975
|
+
this.cancelInflight();
|
|
5976
|
+
if (!rawUrl) {
|
|
5977
|
+
this.hostInnerHtml = null;
|
|
5978
|
+
this.lastResolvedUrl = null;
|
|
5979
|
+
return;
|
|
5980
|
+
}
|
|
5981
|
+
const url = this.imagePipe.transform(rawUrl);
|
|
5982
|
+
if (!url) {
|
|
5983
|
+
this.hostInnerHtml = null;
|
|
5984
|
+
this.lastResolvedUrl = null;
|
|
5985
|
+
return;
|
|
5986
|
+
}
|
|
5987
|
+
if (this.lastResolvedUrl === url && this.hostInnerHtml) {
|
|
5988
|
+
return;
|
|
5989
|
+
}
|
|
5990
|
+
const cached = svgCache.get(url);
|
|
5991
|
+
if (cached !== undefined) {
|
|
5992
|
+
this.applySvg(url, cached);
|
|
5993
|
+
return;
|
|
5994
|
+
}
|
|
5995
|
+
let request$ = inFlightRequests.get(url);
|
|
5996
|
+
if (!request$) {
|
|
5997
|
+
request$ = this.http.get(url, { responseType: 'text' }).pipe(operators.tap(svg => {
|
|
5998
|
+
svgCache.set(url, this.normalizeSvg(svg));
|
|
5999
|
+
inFlightRequests.delete(url);
|
|
6000
|
+
}), operators.shareReplay(1));
|
|
6001
|
+
inFlightRequests.set(url, request$);
|
|
6002
|
+
}
|
|
6003
|
+
this.sub = request$.subscribe({
|
|
6004
|
+
next: () => {
|
|
6005
|
+
const normalized = svgCache.get(url);
|
|
6006
|
+
if (normalized !== undefined) {
|
|
6007
|
+
this.applySvg(url, normalized);
|
|
6008
|
+
}
|
|
6009
|
+
},
|
|
6010
|
+
error: () => {
|
|
6011
|
+
inFlightRequests.delete(url);
|
|
6012
|
+
this.hostInnerHtml = null;
|
|
6013
|
+
this.lastResolvedUrl = null;
|
|
6014
|
+
}
|
|
6015
|
+
});
|
|
6016
|
+
}
|
|
6017
|
+
applySvg(url, svg) {
|
|
6018
|
+
this.lastResolvedUrl = url;
|
|
6019
|
+
this.hostInnerHtml = this.sanitizer.bypassSecurityTrustHtml(svg);
|
|
6020
|
+
}
|
|
6021
|
+
cancelInflight() {
|
|
6022
|
+
if (this.sub) {
|
|
6023
|
+
this.sub.unsubscribe();
|
|
6024
|
+
this.sub = undefined;
|
|
6025
|
+
}
|
|
6026
|
+
}
|
|
6027
|
+
/**
|
|
6028
|
+
* Make the fetched SVG behave like a font icon:
|
|
6029
|
+
* - replace any non-"none" fill/stroke attributes (single- or
|
|
6030
|
+
* double-quoted) with currentColor so CSS `color` controls the icon
|
|
6031
|
+
* - replace any non-"none" inline `fill:` / `stroke:` style values with
|
|
6032
|
+
* currentColor
|
|
6033
|
+
* - on the root <svg> tag, add `width="1em"`, `height="1em"`, and a
|
|
6034
|
+
* default `fill="currentColor"` if missing so the icon scales with
|
|
6035
|
+
* the host element's `font-size`
|
|
6036
|
+
*/
|
|
6037
|
+
normalizeSvg(svg) {
|
|
6038
|
+
if (!svg)
|
|
6039
|
+
return '';
|
|
6040
|
+
let out = svg;
|
|
6041
|
+
// ── Color ────────────────────────────────────────────────────────
|
|
6042
|
+
out = out
|
|
6043
|
+
.replace(/fill\s*=\s*"(?!\s*none\s*")[^"]*"/gi, 'fill="currentColor"')
|
|
6044
|
+
.replace(/fill\s*=\s*'(?!\s*none\s*')[^']*'/gi, "fill='currentColor'")
|
|
6045
|
+
.replace(/stroke\s*=\s*"(?!\s*none\s*")[^"]*"/gi, 'stroke="currentColor"')
|
|
6046
|
+
.replace(/stroke\s*=\s*'(?!\s*none\s*')[^']*'/gi, "stroke='currentColor'")
|
|
6047
|
+
.replace(/(fill|stroke)\s*:\s*(?!\s*none\b)[^;"']+/gi, '$1: currentColor');
|
|
6048
|
+
out = out.replace(/<svg\b([^>]*)>/i, (_match, attrs) => {
|
|
6049
|
+
let updated = attrs;
|
|
6050
|
+
updated = updated.replace(/\swidth\s*=\s*("[^"]*"|'[^']*')/gi, '')
|
|
6051
|
+
.replace(/\s+$/, '') + ' width="1em"';
|
|
6052
|
+
updated = updated.replace(/\sheight\s*=\s*("[^"]*"|'[^']*')/gi, '')
|
|
6053
|
+
.replace(/\s+$/, '') + ' height="1em"';
|
|
6054
|
+
updated += ' fill="currentColor"';
|
|
6055
|
+
return `<svg${updated}>`;
|
|
6056
|
+
});
|
|
6057
|
+
return out;
|
|
6058
|
+
}
|
|
6059
|
+
static { this.ɵfac = function SvgIconDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SvgIconDirective)(); }; }
|
|
6060
|
+
static { this.ɵdir = /*@__PURE__*/ i0__namespace.ɵɵdefineDirective({ type: SvgIconDirective, selectors: [["", "iconUrl", ""]], hostVars: 1, hostBindings: function SvgIconDirective_HostBindings(rf, ctx) { if (rf & 2) {
|
|
6061
|
+
i0__namespace.ɵɵdomProperty("innerHTML", ctx.hostInnerHtml, i0__namespace.ɵɵsanitizeHtml);
|
|
6062
|
+
} }, inputs: { iconUrl: "iconUrl" }, exportAs: ["svgIcon"], features: [i0__namespace.ɵɵNgOnChangesFeature] }); }
|
|
6063
|
+
}
|
|
6064
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(SvgIconDirective, [{
|
|
6065
|
+
type: i0.Directive,
|
|
6066
|
+
args: [{
|
|
6067
|
+
standalone: true,
|
|
6068
|
+
selector: '[iconUrl]',
|
|
6069
|
+
exportAs: 'svgIcon'
|
|
6070
|
+
}]
|
|
6071
|
+
}], null, { iconUrl: [{
|
|
6072
|
+
type: i0.Input
|
|
6073
|
+
}], hostInnerHtml: [{
|
|
6074
|
+
type: i0.HostBinding,
|
|
6075
|
+
args: ['innerHTML']
|
|
6076
|
+
}] }); })();
|
|
6077
|
+
|
|
6078
|
+
function WmAppIconComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
6079
|
+
i0__namespace.ɵɵelement(0, "i", 0);
|
|
6080
|
+
} if (rf & 2) {
|
|
6081
|
+
const ctx_r0 = i0__namespace.ɵɵnextContext();
|
|
6082
|
+
i0__namespace.ɵɵproperty("ngClass", ctx_r0._svgClasses)("ngStyle", ctx_r0.iconStyle)("iconUrl", ctx_r0.iconurl);
|
|
6083
|
+
} }
|
|
6084
|
+
function WmAppIconComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
6085
|
+
i0__namespace.ɵɵelement(0, "img", 1);
|
|
6086
|
+
i0__namespace.ɵɵpipe(1, "image");
|
|
6087
|
+
} if (rf & 2) {
|
|
6088
|
+
const ctx_r0 = i0__namespace.ɵɵnextContext();
|
|
6089
|
+
i0__namespace.ɵɵproperty("ngClass", ctx_r0._imageClasses)("src", i0__namespace.ɵɵpipeBind1(1, 4, ctx_r0.iconurl), i0__namespace.ɵɵsanitizeUrl)("ngStyle", ctx_r0.iconStyle);
|
|
6090
|
+
i0__namespace.ɵɵattribute("alt", ctx_r0.alt || "");
|
|
6091
|
+
} }
|
|
6092
|
+
function WmAppIconComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
6093
|
+
i0__namespace.ɵɵelement(0, "i", 2);
|
|
6094
|
+
} if (rf & 2) {
|
|
6095
|
+
const ctx_r0 = i0__namespace.ɵɵnextContext();
|
|
6096
|
+
i0__namespace.ɵɵproperty("ngClass", ctx_r0._fontClasses)("ngStyle", ctx_r0.iconStyle);
|
|
6097
|
+
} }
|
|
6098
|
+
/**
|
|
6099
|
+
* Single, reusable renderer for the SVG / image / font 3-way icon branch
|
|
6100
|
+
* that used to be duplicated across every widget that accepts an
|
|
6101
|
+
* `iconclass` + `iconurl` pair (anchor, button, panel header, card,
|
|
6102
|
+
* dialog-header, form, list, table, chart, accordion, file-upload,
|
|
6103
|
+
* rating, switch, menu, navbar, search, tabs, ...).
|
|
6104
|
+
*
|
|
6105
|
+
* Decision order:
|
|
6106
|
+
* 1. `iconurl` ending in `.svg` -> inline SVG via `[iconUrl]` directive
|
|
6107
|
+
* 2. `iconurl` (anything else) -> `<img [src]="url | image">`
|
|
6108
|
+
* 3. `iconclass` -> `<i class="app-icon {{iconclass}}">`
|
|
6109
|
+
* 4. `defaultIconClass` (if set) -> same as #3 with the fallback class
|
|
6110
|
+
* 5. otherwise -> nothing
|
|
6111
|
+
*
|
|
6112
|
+
* Notes:
|
|
6113
|
+
* - `iconurl` wins over `iconclass` when both are set: a widget owner that
|
|
6114
|
+
* bothered to configure a URL almost certainly wants it visible. Where the
|
|
6115
|
+
* old behavior was "render both" (anchor, button), use TWO `<wm-app-icon>`
|
|
6116
|
+
* elements - one with only `iconurl`, one with only `iconclass`.
|
|
6117
|
+
* - The host is `display: contents` so existing CSS selectors targeting
|
|
6118
|
+
* `.app-icon` directly inside the parent (e.g. `.btn .app-icon`) keep
|
|
6119
|
+
* working - the wrapper element is layout-transparent.
|
|
6120
|
+
*/
|
|
6121
|
+
class WmAppIconComponent {
|
|
6122
|
+
get _isSvg() {
|
|
6123
|
+
return isSvgIconUrl(this.iconurl);
|
|
6124
|
+
}
|
|
6125
|
+
get _isImage() {
|
|
6126
|
+
return !!this.iconurl && !this._isSvg;
|
|
6127
|
+
}
|
|
6128
|
+
get _fontClass() {
|
|
6129
|
+
return [this.defaultIconClass, this.iconclass]
|
|
6130
|
+
.filter(Boolean)
|
|
6131
|
+
.join(' ');
|
|
6132
|
+
}
|
|
6133
|
+
_extras() {
|
|
6134
|
+
const extras = this.defaultClasses;
|
|
6135
|
+
if (!extras) {
|
|
6136
|
+
return [];
|
|
6137
|
+
}
|
|
6138
|
+
if (Array.isArray(extras)) {
|
|
6139
|
+
return extras;
|
|
6140
|
+
}
|
|
6141
|
+
return extras.split(/\s+/).filter(Boolean);
|
|
6142
|
+
}
|
|
6143
|
+
get _svgClasses() {
|
|
6144
|
+
return ['app-icon app-icon-svg', ...this._extras()];
|
|
6145
|
+
}
|
|
6146
|
+
get _imageClasses() {
|
|
6147
|
+
return ['app-icon', ...this._extras()];
|
|
6148
|
+
}
|
|
6149
|
+
get _fontClasses() {
|
|
6150
|
+
return ['app-icon', ...this._extras(), ...this._fontClass.split(/\s+/).filter(Boolean)];
|
|
6151
|
+
}
|
|
6152
|
+
static { this.ɵfac = function WmAppIconComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || WmAppIconComponent)(); }; }
|
|
6153
|
+
static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: WmAppIconComponent, selectors: [["wm-app-icon"]], hostVars: 2, hostBindings: function WmAppIconComponent_HostBindings(rf, ctx) { if (rf & 2) {
|
|
6154
|
+
i0__namespace.ɵɵstyleProp("display", "contents");
|
|
6155
|
+
} }, inputs: { iconclass: "iconclass", iconurl: "iconurl", defaultIconClass: "defaultIconClass", defaultClasses: "defaultClasses", iconStyle: "iconStyle", alt: "alt" }, decls: 3, vars: 1, consts: [["role", "img", "aria-hidden", "true", "data-identifier", "svg", 3, "ngClass", "ngStyle", "iconUrl"], ["data-identifier", "img", 3, "ngClass", "src", "ngStyle"], ["aria-hidden", "true", 3, "ngClass", "ngStyle"]], template: function WmAppIconComponent_Template(rf, ctx) { if (rf & 1) {
|
|
6156
|
+
i0__namespace.ɵɵconditionalCreate(0, WmAppIconComponent_Conditional_0_Template, 1, 3, "i", 0)(1, WmAppIconComponent_Conditional_1_Template, 2, 6, "img", 1)(2, WmAppIconComponent_Conditional_2_Template, 1, 2, "i", 2);
|
|
6157
|
+
} if (rf & 2) {
|
|
6158
|
+
i0__namespace.ɵɵconditional(ctx._isSvg ? 0 : ctx._isImage ? 1 : ctx._fontClass ? 2 : -1);
|
|
6159
|
+
} }, dependencies: [i1$1.NgClass, i1$1.NgStyle, SvgIconDirective, ImagePipe], encapsulation: 2 }); }
|
|
6160
|
+
}
|
|
6161
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(WmAppIconComponent, [{
|
|
6162
|
+
type: i0.Component,
|
|
6163
|
+
args: [{
|
|
6164
|
+
standalone: true,
|
|
6165
|
+
selector: 'wm-app-icon',
|
|
6166
|
+
imports: [i1$1.NgClass, i1$1.NgStyle, SvgIconDirective, ImagePipe],
|
|
6167
|
+
encapsulation: i0.ViewEncapsulation.None,
|
|
6168
|
+
host: {
|
|
6169
|
+
'[style.display]': '"contents"'
|
|
6170
|
+
},
|
|
6171
|
+
template: `
|
|
6172
|
+
@if (_isSvg) {
|
|
6173
|
+
<i [ngClass]="_svgClasses"
|
|
6174
|
+
role="img"
|
|
6175
|
+
aria-hidden="true"
|
|
6176
|
+
data-identifier="svg"
|
|
6177
|
+
[ngStyle]="iconStyle"
|
|
6178
|
+
[iconUrl]="iconurl"></i>
|
|
6179
|
+
} @else if (_isImage) {
|
|
6180
|
+
<img [ngClass]="_imageClasses"
|
|
6181
|
+
data-identifier="img"
|
|
6182
|
+
[attr.alt]="alt || ''"
|
|
6183
|
+
[src]="iconurl | image"
|
|
6184
|
+
[ngStyle]="iconStyle"/>
|
|
6185
|
+
} @else if (_fontClass) {
|
|
6186
|
+
<i [ngClass]="_fontClasses"
|
|
6187
|
+
aria-hidden="true"
|
|
6188
|
+
[ngStyle]="iconStyle"></i>
|
|
6189
|
+
}
|
|
6190
|
+
`
|
|
6191
|
+
}]
|
|
6192
|
+
}], null, { iconclass: [{
|
|
6193
|
+
type: i0.Input
|
|
6194
|
+
}], iconurl: [{
|
|
6195
|
+
type: i0.Input
|
|
6196
|
+
}], defaultIconClass: [{
|
|
6197
|
+
type: i0.Input
|
|
6198
|
+
}], defaultClasses: [{
|
|
6199
|
+
type: i0.Input
|
|
6200
|
+
}], iconStyle: [{
|
|
6201
|
+
type: i0.Input
|
|
6202
|
+
}], alt: [{
|
|
6203
|
+
type: i0.Input
|
|
6204
|
+
}] }); })();
|
|
6205
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassDebugInfo(WmAppIconComponent, { className: "WmAppIconComponent", filePath: "widgets/common/base/app-icon-component.ts", lineNumber: 58 }); })();
|
|
6206
|
+
|
|
5913
6207
|
exports.ALLFIELDS = ALLFIELDS;
|
|
5914
6208
|
exports.AUTOCLOSE_TYPE = AUTOCLOSE_TYPE;
|
|
5915
6209
|
exports.AUTO_LAYOUT_PROPS = AUTO_LAYOUT_PROPS;
|
|
@@ -5958,6 +6252,7 @@
|
|
|
5958
6252
|
exports.StringToNumberPipe = StringToNumberPipe;
|
|
5959
6253
|
exports.StylableComponent = StylableComponent;
|
|
5960
6254
|
exports.SuffixPipe = SuffixPipe;
|
|
6255
|
+
exports.SvgIconDirective = SvgIconDirective;
|
|
5961
6256
|
exports.TemplateReplacePipe = TemplateReplacePipe;
|
|
5962
6257
|
exports.TextContentDirective = TextContentDirective;
|
|
5963
6258
|
exports.TimeFromNowPipe = TimeFromNowPipe;
|
|
@@ -5968,6 +6263,7 @@
|
|
|
5968
6263
|
exports.TrustAsPipe = TrustAsPipe;
|
|
5969
6264
|
exports.WidgetConfig = WidgetConfig;
|
|
5970
6265
|
exports.WidgetRef = WidgetRef;
|
|
6266
|
+
exports.WmAppIconComponent = WmAppIconComponent;
|
|
5971
6267
|
exports.applyFilterOnField = applyFilterOnField;
|
|
5972
6268
|
exports.configureDnD = configureDnD;
|
|
5973
6269
|
exports.convertDataToObject = convertDataToObject;
|
|
@@ -6015,6 +6311,7 @@
|
|
|
6015
6311
|
exports.isDataSetWidget = isDataSetWidget;
|
|
6016
6312
|
exports.isDimensionProp = isDimensionProp;
|
|
6017
6313
|
exports.isStyle = isStyle;
|
|
6314
|
+
exports.isSvgIconUrl = isSvgIconUrl;
|
|
6018
6315
|
exports.parseValueByType = parseValueByType;
|
|
6019
6316
|
exports.performDataOperation = performDataOperation;
|
|
6020
6317
|
exports.prepareFieldDefs = prepareFieldDefs;
|