@ng-nest/ui 19.0.3 → 19.0.4
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/color-picker/color-picker-portal.component.d.ts +3 -2
- package/color-picker/color-picker.component.d.ts +1 -2
- package/core/interfaces/identify.type.d.ts +5 -0
- package/fesm2022/ng-nest-ui-color-picker.mjs +7 -8
- package/fesm2022/ng-nest-ui-color-picker.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-comment.mjs +7 -8
- package/fesm2022/ng-nest-ui-comment.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-core.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-icon.mjs +33 -65
- package/fesm2022/ng-nest-ui-icon.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tree.mjs +26 -9
- package/fesm2022/ng-nest-ui-tree.mjs.map +1 -1
- package/icon/icon.component.d.ts +3 -8
- package/icon/icon.service.d.ts +6 -2
- package/package.json +46 -46
- package/tree/tree.property.d.ts +28 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, Component, inject, SecurityContext, Injectable, ElementRef, Renderer2, ChangeDetectorRef, computed, effect, ViewEncapsulation, ChangeDetectionStrategy, HostBinding, NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
import { XPropertyFunction, XToBoolean, XHasIn, XIsEmpty, XWarnIconTypeNotFound, XWarnSVGTagNotFound } from '@ng-nest/ui/core';
|
|
3
|
+
import { XPropertyFunction, XToBoolean, XHasIn, XIsEmpty, XWarnIconTypeNotFound } from '@ng-nest/ui/core';
|
|
5
4
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
6
5
|
import { HttpClient } from '@angular/common/http';
|
|
7
6
|
import { Observable } from 'rxjs';
|
|
@@ -77,6 +76,7 @@ class XIconService {
|
|
|
77
76
|
this.limit = 10;
|
|
78
77
|
this.sanitizer = inject(DomSanitizer);
|
|
79
78
|
this.http = inject(HttpClient, { optional: true });
|
|
79
|
+
this.customIcon = {};
|
|
80
80
|
if (!this.http) {
|
|
81
81
|
throw new Error(`${XIconPrefix}: Not found 'HttpClient', You can import 'HttpClientModule' in your root module.`);
|
|
82
82
|
}
|
|
@@ -120,7 +120,7 @@ class XIconService {
|
|
|
120
120
|
this.execute(task);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
getSvg(root, icon) {
|
|
123
|
+
getSvg(root, icon, isCustom = false) {
|
|
124
124
|
return new Observable((subscriber) => {
|
|
125
125
|
if (XIsEmpty(icon)) {
|
|
126
126
|
subscriber.next('');
|
|
@@ -129,7 +129,7 @@ class XIconService {
|
|
|
129
129
|
}
|
|
130
130
|
this.addTask({
|
|
131
131
|
name: icon,
|
|
132
|
-
observable: this.getSvgElement(root, icon),
|
|
132
|
+
observable: this.getSvgElement(root, icon, isCustom),
|
|
133
133
|
callback: (svg) => {
|
|
134
134
|
subscriber.next(svg);
|
|
135
135
|
subscriber.complete();
|
|
@@ -137,11 +137,14 @@ class XIconService {
|
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
getSvgElement(root, icon) {
|
|
141
|
-
const url = `${root}${icon}.svg`;
|
|
140
|
+
getSvgElement(root, icon, isCustom = false) {
|
|
141
|
+
const url = isCustom ? `${root}${icon}` : `${root}${icon}.svg`;
|
|
142
142
|
const safeUrl = this.sanitizer.sanitize(SecurityContext.URL, url);
|
|
143
143
|
return this.http.get(safeUrl, { responseType: 'text' });
|
|
144
144
|
}
|
|
145
|
+
register(icon, url) {
|
|
146
|
+
this.customIcon[icon] = url;
|
|
147
|
+
}
|
|
145
148
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: XIconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
146
149
|
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: XIconService, providedIn: 'root' }); }
|
|
147
150
|
}
|
|
@@ -181,19 +184,26 @@ class XIconComponent extends XIconProperty {
|
|
|
181
184
|
}
|
|
182
185
|
constructor() {
|
|
183
186
|
super();
|
|
184
|
-
this.document = inject(DOCUMENT);
|
|
185
187
|
this.elementRef = inject(ElementRef);
|
|
186
188
|
this.renderer = inject(Renderer2);
|
|
187
189
|
this.cdr = inject(ChangeDetectorRef);
|
|
188
190
|
this.iconService = inject(XIconService);
|
|
189
|
-
this.
|
|
191
|
+
this.inSource = computed(() => {
|
|
190
192
|
const type = this.type();
|
|
191
193
|
if (typeof type === 'undefined' || type === '')
|
|
192
|
-
return
|
|
194
|
+
return false;
|
|
193
195
|
const split = type.split('-');
|
|
194
196
|
const souce = split.shift();
|
|
195
197
|
if (typeof souce === 'undefined')
|
|
198
|
+
return false;
|
|
199
|
+
const souceUrl = XSouceUrl[souce];
|
|
200
|
+
return souceUrl ? true : false;
|
|
201
|
+
});
|
|
202
|
+
this.sourceUrl = computed(() => {
|
|
203
|
+
if (!this.inSource())
|
|
196
204
|
return '';
|
|
205
|
+
const split = this.type().split('-');
|
|
206
|
+
const souce = split.shift();
|
|
197
207
|
const souceUrl = XSouceUrl[souce];
|
|
198
208
|
const fileName = split.join('-');
|
|
199
209
|
if (!souceUrl || !fileName) {
|
|
@@ -201,16 +211,28 @@ class XIconComponent extends XIconProperty {
|
|
|
201
211
|
}
|
|
202
212
|
return `${souceUrl}${fileName}`;
|
|
203
213
|
});
|
|
204
|
-
|
|
214
|
+
this.isCustom = computed(() => {
|
|
215
|
+
return !this.inSource() && XHasIn(this.iconService.customIcon, this.type());
|
|
216
|
+
});
|
|
217
|
+
effect(() => {
|
|
218
|
+
if (this.isCustom()) {
|
|
219
|
+
this.iconService.getSvg('', this.iconService.customIcon[this.type()], true).subscribe((x) => this.setSvgs(x));
|
|
220
|
+
}
|
|
221
|
+
else if (this.inSource()) {
|
|
222
|
+
this.iconService.getSvg(this.href(), this.sourceUrl()).subscribe((x) => this.setSvgs(x));
|
|
223
|
+
}
|
|
224
|
+
});
|
|
205
225
|
}
|
|
206
226
|
setSvgs(svg) {
|
|
207
227
|
if (XIsEmpty(svg))
|
|
208
228
|
return;
|
|
229
|
+
const parser = new DOMParser();
|
|
230
|
+
const svgDoc = parser.parseFromString(svg, 'image/svg+xml');
|
|
209
231
|
let firstChild = this.elementRef.nativeElement.firstChild;
|
|
210
232
|
if (firstChild) {
|
|
211
233
|
this.renderer.removeChild(this.elementRef.nativeElement, firstChild);
|
|
212
234
|
}
|
|
213
|
-
this.svgElement =
|
|
235
|
+
this.svgElement = svgDoc.documentElement;
|
|
214
236
|
this.setAttributes(this.svgElement);
|
|
215
237
|
this.renderer.appendChild(this.elementRef.nativeElement, this.svgElement);
|
|
216
238
|
// TODO: use zoneless, renderer removeChild will not take effect immediately
|
|
@@ -222,40 +244,6 @@ class XIconComponent extends XIconProperty {
|
|
|
222
244
|
this.renderer.setAttribute(svgEle, 'height', '1em');
|
|
223
245
|
}
|
|
224
246
|
}
|
|
225
|
-
buildSvg(svgStr) {
|
|
226
|
-
const result = this.document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
227
|
-
const svg = this.createSvg(svgStr);
|
|
228
|
-
if (!svg)
|
|
229
|
-
return;
|
|
230
|
-
svg.children.forEach((x) => {
|
|
231
|
-
x.removeAttribute('class');
|
|
232
|
-
if (x.tagName === 'rect') {
|
|
233
|
-
x.setAttribute('fill', 'none');
|
|
234
|
-
}
|
|
235
|
-
result.appendChild(x);
|
|
236
|
-
});
|
|
237
|
-
this.setAttribute(result, svg.ele, 'viewBox');
|
|
238
|
-
this.setAttribute(result, svg.ele, 'fill', 'currentColor');
|
|
239
|
-
this.setAttribute(result, svg.ele, 'stroke');
|
|
240
|
-
this.setAttribute(result, svg.ele, 'stroke-width');
|
|
241
|
-
this.setAttribute(result, svg.ele, 'stroke-linecap');
|
|
242
|
-
this.setAttribute(result, svg.ele, 'stroke-linejoin');
|
|
243
|
-
if (!result) {
|
|
244
|
-
XWarnSVGTagNotFound();
|
|
245
|
-
}
|
|
246
|
-
return result;
|
|
247
|
-
}
|
|
248
|
-
createSvg(svgStr) {
|
|
249
|
-
const div = this.document.createElement('div');
|
|
250
|
-
div.innerHTML = svgStr;
|
|
251
|
-
let svgEle = div.querySelector('svg');
|
|
252
|
-
if (!svgEle)
|
|
253
|
-
return null;
|
|
254
|
-
return {
|
|
255
|
-
ele: svgEle,
|
|
256
|
-
children: svgEle.querySelectorAll('path, polyline, polygon, circle, line, rect')
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
247
|
setAttribute(svg, svgEle, attribute, def) {
|
|
260
248
|
let attr = svgEle.getAttribute(attribute);
|
|
261
249
|
if (attr) {
|
|
@@ -265,26 +253,6 @@ class XIconComponent extends XIconProperty {
|
|
|
265
253
|
svg.setAttribute(attribute, def);
|
|
266
254
|
}
|
|
267
255
|
}
|
|
268
|
-
//<animate begin="mouseenter" dur="500ms" repeatCount="1" attributeName="d" from="M86.425,13.204l5.648,12.741H0.55 l0.125-12.616L0.55,0.544h91.523L86.425,13.204z" to="M92.725,13.521l0.044,12.887H1.245 l7-12.616l-7-12.785h91.523L92.725,13.521z" fill="freeze"></animate>
|
|
269
|
-
setAnimates(svgs) {
|
|
270
|
-
if (svgs?.length > 0) {
|
|
271
|
-
let svg = this.createSvg(svgs.shift());
|
|
272
|
-
for (let i = 0; i < this.svgElement.children.length; i++) {
|
|
273
|
-
let child = this.svgElement.children[i];
|
|
274
|
-
let toChild = svg?.children[i];
|
|
275
|
-
if (child?.nodeName === 'path' && toChild?.nodeName === 'path') {
|
|
276
|
-
let toAnimate = this.document.createElement('animate');
|
|
277
|
-
toAnimate.setAttribute('dur', '500ms');
|
|
278
|
-
toAnimate.setAttribute('repeatCount', '1');
|
|
279
|
-
toAnimate.setAttribute('attributeName', 'd');
|
|
280
|
-
toAnimate.setAttribute('fill', 'freeze');
|
|
281
|
-
toAnimate.setAttribute('from', child.getAttribute('d'));
|
|
282
|
-
toAnimate.setAttribute('to', toChild.getAttribute('d'));
|
|
283
|
-
this.renderer.appendChild(child, toAnimate);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
256
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: XIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
289
257
|
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.1", type: XIconComponent, isStandalone: true, selector: "x-icon", host: { properties: { "class": "this.className", "class.x-icon-spin": "this.getSpin", "style.color": "this.getColor" } }, usesInheritance: true, ngImport: i0, template: "\r\n", styles: ["@keyframes x-icon-spin{to{transform:rotate(360deg)}}.x-icon{margin:0;padding:0}.x-icon{display:inline-block;line-height:0;text-align:center;vertical-align:-.125em}.x-icon-spin{animation:1s linear infinite x-icon-spin}.x-icon[left]{margin-right:.25rem}.x-icon[right]{margin-left:.25rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
290
258
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-nest-ui-icon.mjs","sources":["../../../../lib/ng-nest/ui/icon/icon.property.ts","../../../../lib/ng-nest/ui/icon/icon.service.ts","../../../../lib/ng-nest/ui/icon/icon.component.ts","../../../../lib/ng-nest/ui/icon/icon.component.html","../../../../lib/ng-nest/ui/icon/icon.module.ts","../../../../lib/ng-nest/ui/icon/ng-nest-ui-icon.ts"],"sourcesContent":["import { XPropertyFunction, XToBoolean } from '@ng-nest/ui/core';\r\nimport { Component, input } from '@angular/core';\r\nimport type { XBoolean } from '@ng-nest/ui/core';\r\n\r\n/**\r\n * Icon\r\n * @selector x-icon\r\n * @decorator component\r\n */\r\nexport const XIconPrefix = 'x-icon';\r\nconst X_ICON_CONFIG_NAME = 'icon';\r\n\r\n/**\r\n * Icon Property\r\n */\r\n@Component({ selector: `${XIconPrefix}-property`, template: '' })\r\nexport class XIconProperty extends XPropertyFunction(X_ICON_CONFIG_NAME) {\r\n /**\r\n * @zh_CN SVG 图标根路径地址,可以通过全局只配置一次,所有图标资源在 github 上的 ng-nest-icon 中\r\n * @en_US The root address of the SVG icon can be configured only once globally. All icon resources are in ng-nest-icon on github\r\n */\r\n readonly href = input<string>(this.config?.href ?? 'https://ngnest.com/static/icons/');\r\n /**\r\n * @zh_CN 图标类型\r\n * @en_US Icon type\r\n * @example\r\n *\r\n * ```html\r\n * <x-icon type=\"fto-activity\"></x-icon>\r\n * <x-icon type=\"fto-airplay\"></x-icon>\r\n * <x-icon type=\"fto-anchor\"></x-icon>\r\n * ```\r\n *\r\n */\r\n readonly type = input<string>();\r\n /**\r\n * @zh_CN 图标颜色\r\n * @en_US Icon color\r\n * @example\r\n *\r\n * ```html\r\n * <x-icon color=\"red\" type=\"fto-activity\"></x-icon>\r\n * ```\r\n *\r\n */\r\n readonly color = input<string>();\r\n /**\r\n * @zh_CN loading效果(图标一直旋转)\r\n * @en_US Loading effect (icon keeps rotating)\r\n * @example\r\n *\r\n * ```html\r\n * <x-icon spin=\"true\" type=\"fto-loader\"></x-icon>\r\n * ```\r\n *\r\n */\r\n readonly spin = input<boolean, XBoolean>(false, { transform: XToBoolean });\r\n}\r\n\r\n/**\r\n * @zh_CN 图标来源\r\n * @en_US Icon source\r\n */\r\nexport type XIconSource = 'ant-design' | 'eva' | 'feather' | 'font-awesome' | 'material-design';\r\n","import { Injectable, SecurityContext, inject } from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { Observable, Subscriber } from 'rxjs';\r\nimport { XHasIn, XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XIconPrefix } from './icon.property';\r\n\r\ntype Task<T> = {\r\n name: string;\r\n observable: Observable<T>;\r\n callback: Function;\r\n};\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XIconService {\r\n caches: { [property: string]: any } = {};\r\n queue: Task<any>[] = [];\r\n activeTaskXm: number = 0;\r\n isRunningTask = false;\r\n limit: number = 10;\r\n sanitizer = inject(DomSanitizer);\r\n http = inject(HttpClient, { optional: true })!;\r\n\r\n constructor() {\r\n if (!this.http) {\r\n throw new Error(`${XIconPrefix}: Not found 'HttpClient', You can import 'HttpClientModule' in your root module.`);\r\n }\r\n }\r\n\r\n public addTask<T>(task: Task<T>) {\r\n this.queue.push(task);\r\n this.runTask();\r\n }\r\n\r\n private execute<T>(task: Task<T>) {\r\n this.isRunningTask = true;\r\n if (XHasIn(this.caches, task.name)) {\r\n task.callback(this.caches[task.name]);\r\n this.activeTaskXm--;\r\n this.isRunningTask = false;\r\n this.runTask();\r\n return;\r\n }\r\n return task.observable.subscribe({\r\n next: (result) => {\r\n this.caches[task.name] = result;\r\n task.callback(result);\r\n return result;\r\n },\r\n error: (error) => {\r\n console.error(error);\r\n this.activeTaskXm--;\r\n this.isRunningTask = false;\r\n this.runTask();\r\n },\r\n complete: () => {\r\n this.activeTaskXm--;\r\n this.isRunningTask = false;\r\n this.runTask();\r\n }\r\n });\r\n }\r\n\r\n private runTask() {\r\n if (!this.isRunningTask && this.activeTaskXm < this.limit && this.queue.length > 0) {\r\n const task = this.queue.shift();\r\n this.activeTaskXm++;\r\n this.execute(task!);\r\n }\r\n }\r\n\r\n getSvg(root: string, icon: string): Observable<string> {\r\n return new Observable((subscriber: Subscriber<string>) => {\r\n if (XIsEmpty(icon)) {\r\n subscriber.next('');\r\n subscriber.complete();\r\n return;\r\n }\r\n this.addTask({\r\n name: icon,\r\n observable: this.getSvgElement(root, icon),\r\n callback: (svg: string) => {\r\n subscriber.next(svg);\r\n subscriber.complete();\r\n }\r\n });\r\n });\r\n }\r\n\r\n getSvgElement(root: string, icon: string): Observable<string> {\r\n const url = `${root}${icon}.svg`;\r\n const safeUrl = this.sanitizer.sanitize(SecurityContext.URL, url);\r\n return this.http.get(safeUrl as string, { responseType: 'text' });\r\n }\r\n}\r\n","import {\r\n Component,\r\n ViewEncapsulation,\r\n ChangeDetectionStrategy,\r\n ElementRef,\r\n Renderer2,\r\n HostBinding,\r\n inject,\r\n effect,\r\n computed,\r\n ChangeDetectorRef\r\n} from '@angular/core';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { XIconPrefix, XIconProperty } from './icon.property';\r\nimport { XIconService } from './icon.service';\r\nimport { XWarnIconTypeNotFound, XWarnSVGTagNotFound, XIsEmpty } from '@ng-nest/ui/core';\r\n\r\n// 来源路径对应\r\nexport const XSouceUrl: { [property: string]: string } = {\r\n adf: `ant-design/fill/`,\r\n ado: `ant-design/outline/`,\r\n adt: `ant-design/twotone/`,\r\n eaf: `eva/fill/`,\r\n eao: `eva/outline/`,\r\n fto: `feather/`,\r\n fab: `font-awesome/brands/`,\r\n far: `font-awesome/regular/`,\r\n fas: `font-awesome/solid/`,\r\n mdf: `material-design/fill/`,\r\n mdo: `material-design/outline/`\r\n};\r\n\r\nexport const XViewBox = [\r\n // { souces: [\"adf\", \"ado\", \"adt\"], value: \"0 0 1024 1024\" },\r\n // { souces: [\"eaf\", \"eao\"], value: \"0 0 24 24\" },\r\n // { souces: [\"fto\"], value: \"0 0 24 24\" }\r\n];\r\n\r\n@Component({\r\n selector: `${XIconPrefix}`,\r\n templateUrl: './icon.component.html',\r\n styleUrls: ['./style/index.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XIconComponent extends XIconProperty {\r\n @HostBinding('class') get className() {\r\n return `${XIconPrefix} ${this.type()}`;\r\n }\r\n private svgElement!: SVGElement;\r\n private document = inject(DOCUMENT);\r\n private elementRef = inject(ElementRef);\r\n private renderer = inject(Renderer2);\r\n private cdr = inject(ChangeDetectorRef);\r\n private iconService = inject(XIconService);\r\n\r\n @HostBinding('class.x-icon-spin') get getSpin() {\r\n return this.spin();\r\n }\r\n\r\n @HostBinding('style.color') get getColor() {\r\n return this.color();\r\n }\r\n\r\n sourceUrl = computed(() => {\r\n const type = this.type();\r\n if (typeof type === 'undefined' || type === '') return '';\r\n const split = type.split('-');\r\n const souce = split.shift();\r\n if (typeof souce === 'undefined') return '';\r\n const souceUrl = XSouceUrl[souce];\r\n const fileName = split.join('-');\r\n if (!souceUrl || !fileName) {\r\n XWarnIconTypeNotFound();\r\n }\r\n return `${souceUrl}${fileName}`;\r\n });\r\n\r\n constructor() {\r\n super();\r\n effect(() => this.iconService.getSvg(this.href(), this.sourceUrl()).subscribe((x) => this.setSvgs(x)));\r\n }\r\n\r\n setSvgs(svg: string) {\r\n if (XIsEmpty(svg)) return;\r\n let firstChild = this.elementRef.nativeElement.firstChild;\r\n if (firstChild) {\r\n this.renderer.removeChild(this.elementRef.nativeElement, firstChild);\r\n }\r\n this.svgElement = this.buildSvg(svg)!;\r\n this.setAttributes(this.svgElement);\r\n this.renderer.appendChild(this.elementRef.nativeElement, this.svgElement);\r\n // TODO: use zoneless, renderer removeChild will not take effect immediately\r\n this.cdr.markForCheck();\r\n }\r\n\r\n setAttributes(svgEle: SVGElement) {\r\n if (svgEle) {\r\n this.renderer.setAttribute(svgEle, 'width', '1em');\r\n this.renderer.setAttribute(svgEle, 'height', '1em');\r\n }\r\n }\r\n\r\n buildSvg(svgStr: string): SVGSVGElement | undefined {\r\n const result = this.document.createElementNS('http://www.w3.org/2000/svg', 'svg') as SVGSVGElement;\r\n const svg = this.createSvg(svgStr);\r\n if (!svg) return;\r\n svg.children.forEach((x) => {\r\n x.removeAttribute('class');\r\n if (x.tagName === 'rect') {\r\n x.setAttribute('fill', 'none');\r\n }\r\n result.appendChild(x);\r\n });\r\n this.setAttribute(result, svg.ele, 'viewBox');\r\n this.setAttribute(result, svg.ele, 'fill', 'currentColor');\r\n this.setAttribute(result, svg.ele, 'stroke');\r\n this.setAttribute(result, svg.ele, 'stroke-width');\r\n this.setAttribute(result, svg.ele, 'stroke-linecap');\r\n this.setAttribute(result, svg.ele, 'stroke-linejoin');\r\n if (!result) {\r\n XWarnSVGTagNotFound();\r\n }\r\n\r\n return result;\r\n }\r\n\r\n createSvg(svgStr: string) {\r\n const div = this.document.createElement('div');\r\n div.innerHTML = svgStr;\r\n let svgEle = div.querySelector('svg') as SVGElement;\r\n if (!svgEle) return null;\r\n return {\r\n ele: svgEle,\r\n children: svgEle.querySelectorAll('path, polyline, polygon, circle, line, rect')\r\n };\r\n }\r\n\r\n setAttribute(svg: SVGElement, svgEle: SVGElement, attribute: string, def?: string) {\r\n let attr = svgEle.getAttribute(attribute);\r\n if (attr) {\r\n svg.setAttribute(attribute, attr);\r\n } else if (def) {\r\n svg.setAttribute(attribute, def);\r\n }\r\n }\r\n\r\n //<animate begin=\"mouseenter\" dur=\"500ms\" repeatCount=\"1\" attributeName=\"d\" from=\"M86.425,13.204l5.648,12.741H0.55 l0.125-12.616L0.55,0.544h91.523L86.425,13.204z\" to=\"M92.725,13.521l0.044,12.887H1.245 l7-12.616l-7-12.785h91.523L92.725,13.521z\" fill=\"freeze\"></animate>\r\n\r\n setAnimates(svgs: string[]) {\r\n if (svgs?.length > 0) {\r\n let svg = this.createSvg(svgs.shift() as string);\r\n for (let i = 0; i < this.svgElement.children.length; i++) {\r\n let child = this.svgElement.children[i];\r\n let toChild = svg?.children[i];\r\n if (child?.nodeName === 'path' && toChild?.nodeName === 'path') {\r\n let toAnimate = this.document.createElement('animate');\r\n toAnimate.setAttribute('dur', '500ms');\r\n toAnimate.setAttribute('repeatCount', '1');\r\n toAnimate.setAttribute('attributeName', 'd');\r\n toAnimate.setAttribute('fill', 'freeze');\r\n toAnimate.setAttribute('from', child.getAttribute('d') as string);\r\n toAnimate.setAttribute('to', toChild.getAttribute('d') as string);\r\n this.renderer.appendChild(child, toAnimate);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","\r\n","import { NgModule } from '@angular/core';\r\nimport { XIconComponent } from './icon.component';\r\n\r\n@NgModule({\r\n exports: [XIconComponent],\r\n imports: [XIconComponent]\r\n})\r\nexport class XIconModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAIA;;;;AAIG;AACI,MAAM,WAAW,GAAG;AAC3B,MAAM,kBAAkB,GAAG,MAAM;AAEjC;;AAEG;MAEU,aAAc,SAAQ,iBAAiB,CAAC,kBAAkB,CAAC,CAAA;AADxE,IAAA,WAAA,GAAA;;AAEE;;;AAGG;QACM,IAAI,CAAA,IAAA,GAAG,KAAK,CAAS,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,kCAAkC,CAAC;AACtF;;;;;;;;;;;AAWG;QACM,IAAI,CAAA,IAAA,GAAG,KAAK,EAAU;AAC/B;;;;;;;;;AASG;QACM,IAAK,CAAA,KAAA,GAAG,KAAK,EAAU;AAChC;;;;;;;;;AASG;QACM,IAAI,CAAA,IAAA,GAAG,KAAK,CAAoB,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAC3E;iIAzCY,aAAa,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAb,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,qkBADkC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;2FACjD,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,SAAS;mBAAC,EAAE,QAAQ,EAAE,CAAG,EAAA,WAAW,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE;;;MCDnD,YAAY,CAAA;AASvB,IAAA,WAAA,GAAA;QARA,IAAM,CAAA,MAAA,GAAgC,EAAE;QACxC,IAAK,CAAA,KAAA,GAAgB,EAAE;QACvB,IAAY,CAAA,YAAA,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AA,UAAA,EAAA,CAAA;kBAJvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,OAAO,EAAE,CAAC,cAAc;AACzB,iBAAA;;;ACND;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-nest-ui-icon.mjs","sources":["../../../../lib/ng-nest/ui/icon/icon.property.ts","../../../../lib/ng-nest/ui/icon/icon.service.ts","../../../../lib/ng-nest/ui/icon/icon.component.ts","../../../../lib/ng-nest/ui/icon/icon.component.html","../../../../lib/ng-nest/ui/icon/icon.module.ts","../../../../lib/ng-nest/ui/icon/ng-nest-ui-icon.ts"],"sourcesContent":["import { XPropertyFunction, XToBoolean } from '@ng-nest/ui/core';\r\nimport { Component, input } from '@angular/core';\r\nimport type { XBoolean } from '@ng-nest/ui/core';\r\n\r\n/**\r\n * Icon\r\n * @selector x-icon\r\n * @decorator component\r\n */\r\nexport const XIconPrefix = 'x-icon';\r\nconst X_ICON_CONFIG_NAME = 'icon';\r\n\r\n/**\r\n * Icon Property\r\n */\r\n@Component({ selector: `${XIconPrefix}-property`, template: '' })\r\nexport class XIconProperty extends XPropertyFunction(X_ICON_CONFIG_NAME) {\r\n /**\r\n * @zh_CN SVG 图标根路径地址,可以通过全局只配置一次,所有图标资源在 github 上的 ng-nest-icon 中\r\n * @en_US The root address of the SVG icon can be configured only once globally. All icon resources are in ng-nest-icon on github\r\n */\r\n readonly href = input<string>(this.config?.href ?? 'https://ngnest.com/static/icons/');\r\n /**\r\n * @zh_CN 图标类型\r\n * @en_US Icon type\r\n * @example\r\n *\r\n * ```html\r\n * <x-icon type=\"fto-activity\"></x-icon>\r\n * <x-icon type=\"fto-airplay\"></x-icon>\r\n * <x-icon type=\"fto-anchor\"></x-icon>\r\n * ```\r\n *\r\n */\r\n readonly type = input<string>();\r\n /**\r\n * @zh_CN 图标颜色\r\n * @en_US Icon color\r\n * @example\r\n *\r\n * ```html\r\n * <x-icon color=\"red\" type=\"fto-activity\"></x-icon>\r\n * ```\r\n *\r\n */\r\n readonly color = input<string>();\r\n /**\r\n * @zh_CN loading效果(图标一直旋转)\r\n * @en_US Loading effect (icon keeps rotating)\r\n * @example\r\n *\r\n * ```html\r\n * <x-icon spin=\"true\" type=\"fto-loader\"></x-icon>\r\n * ```\r\n *\r\n */\r\n readonly spin = input<boolean, XBoolean>(false, { transform: XToBoolean });\r\n}\r\n\r\n/**\r\n * @zh_CN 图标来源\r\n * @en_US Icon source\r\n */\r\nexport type XIconSource = 'ant-design' | 'eva' | 'feather' | 'font-awesome' | 'material-design';\r\n","import { Injectable, SecurityContext, inject } from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { Observable, Subscriber } from 'rxjs';\r\nimport { XHasIn, XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XIconPrefix } from './icon.property';\r\n\r\ntype Task<T> = {\r\n name: string;\r\n observable: Observable<T>;\r\n callback: Function;\r\n};\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XIconService {\r\n caches: { [property: string]: any } = {};\r\n queue: Task<any>[] = [];\r\n activeTaskXm: number = 0;\r\n isRunningTask = false;\r\n limit: number = 10;\r\n sanitizer = inject(DomSanitizer);\r\n http = inject(HttpClient, { optional: true })!;\r\n customIcon: { [property: string]: string } = {};\r\n\r\n constructor() {\r\n if (!this.http) {\r\n throw new Error(`${XIconPrefix}: Not found 'HttpClient', You can import 'HttpClientModule' in your root module.`);\r\n }\r\n }\r\n\r\n public addTask<T>(task: Task<T>) {\r\n this.queue.push(task);\r\n this.runTask();\r\n }\r\n\r\n private execute<T>(task: Task<T>) {\r\n this.isRunningTask = true;\r\n if (XHasIn(this.caches, task.name)) {\r\n task.callback(this.caches[task.name]);\r\n this.activeTaskXm--;\r\n this.isRunningTask = false;\r\n this.runTask();\r\n return;\r\n }\r\n return task.observable.subscribe({\r\n next: (result) => {\r\n this.caches[task.name] = result;\r\n task.callback(result);\r\n return result;\r\n },\r\n error: (error) => {\r\n console.error(error);\r\n this.activeTaskXm--;\r\n this.isRunningTask = false;\r\n this.runTask();\r\n },\r\n complete: () => {\r\n this.activeTaskXm--;\r\n this.isRunningTask = false;\r\n this.runTask();\r\n }\r\n });\r\n }\r\n\r\n private runTask() {\r\n if (!this.isRunningTask && this.activeTaskXm < this.limit && this.queue.length > 0) {\r\n const task = this.queue.shift();\r\n this.activeTaskXm++;\r\n this.execute(task!);\r\n }\r\n }\r\n\r\n getSvg(root: string, icon: string, isCustom = false): Observable<string> {\r\n return new Observable((subscriber: Subscriber<string>) => {\r\n if (XIsEmpty(icon)) {\r\n subscriber.next('');\r\n subscriber.complete();\r\n return;\r\n }\r\n this.addTask({\r\n name: icon,\r\n observable: this.getSvgElement(root, icon, isCustom),\r\n callback: (svg: string) => {\r\n subscriber.next(svg);\r\n subscriber.complete();\r\n }\r\n });\r\n });\r\n }\r\n\r\n getSvgElement(root: string, icon: string, isCustom = false): Observable<string> {\r\n const url = isCustom ? `${root}${icon}` : `${root}${icon}.svg`;\r\n const safeUrl = this.sanitizer.sanitize(SecurityContext.URL, url);\r\n return this.http.get(safeUrl as string, { responseType: 'text' });\r\n }\r\n\r\n register(icon: string, url: string) {\r\n this.customIcon[icon] = url;\r\n }\r\n}\r\n","import {\r\n Component,\r\n ViewEncapsulation,\r\n ChangeDetectionStrategy,\r\n ElementRef,\r\n Renderer2,\r\n HostBinding,\r\n inject,\r\n effect,\r\n computed,\r\n ChangeDetectorRef\r\n} from '@angular/core';\r\nimport { XIconPrefix, XIconProperty } from './icon.property';\r\nimport { XIconService } from './icon.service';\r\nimport { XWarnIconTypeNotFound, XIsEmpty, XHasIn } from '@ng-nest/ui/core';\r\n\r\n// 来源路径对应\r\nexport const XSouceUrl: { [property: string]: string } = {\r\n adf: `ant-design/fill/`,\r\n ado: `ant-design/outline/`,\r\n adt: `ant-design/twotone/`,\r\n eaf: `eva/fill/`,\r\n eao: `eva/outline/`,\r\n fto: `feather/`,\r\n fab: `font-awesome/brands/`,\r\n far: `font-awesome/regular/`,\r\n fas: `font-awesome/solid/`,\r\n mdf: `material-design/fill/`,\r\n mdo: `material-design/outline/`\r\n};\r\n\r\nexport const XViewBox = [\r\n // { souces: [\"adf\", \"ado\", \"adt\"], value: \"0 0 1024 1024\" },\r\n // { souces: [\"eaf\", \"eao\"], value: \"0 0 24 24\" },\r\n // { souces: [\"fto\"], value: \"0 0 24 24\" }\r\n];\r\n\r\n@Component({\r\n selector: `${XIconPrefix}`,\r\n templateUrl: './icon.component.html',\r\n styleUrls: ['./style/index.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XIconComponent extends XIconProperty {\r\n @HostBinding('class') get className() {\r\n return `${XIconPrefix} ${this.type()}`;\r\n }\r\n private svgElement!: HTMLElement;\r\n private elementRef = inject(ElementRef);\r\n private renderer = inject(Renderer2);\r\n private cdr = inject(ChangeDetectorRef);\r\n private iconService = inject(XIconService);\r\n\r\n @HostBinding('class.x-icon-spin') get getSpin() {\r\n return this.spin();\r\n }\r\n\r\n @HostBinding('style.color') get getColor() {\r\n return this.color();\r\n }\r\n\r\n inSource = computed(() => {\r\n const type = this.type();\r\n if (typeof type === 'undefined' || type === '') return false;\r\n const split = type.split('-');\r\n const souce = split.shift();\r\n if (typeof souce === 'undefined') return false;\r\n const souceUrl = XSouceUrl[souce];\r\n return souceUrl ? true : false;\r\n });\r\n\r\n sourceUrl = computed(() => {\r\n if (!this.inSource()) return '';\r\n const split = this.type()!.split('-');\r\n const souce = split.shift();\r\n const souceUrl = XSouceUrl[souce!];\r\n const fileName = split.join('-');\r\n if (!souceUrl || !fileName) {\r\n XWarnIconTypeNotFound();\r\n }\r\n return `${souceUrl}${fileName}`;\r\n });\r\n\r\n isCustom = computed(() => {\r\n return !this.inSource() && XHasIn(this.iconService.customIcon, this.type()!);\r\n });\r\n\r\n constructor() {\r\n super();\r\n effect(() => {\r\n if (this.isCustom()) {\r\n this.iconService.getSvg('', this.iconService.customIcon[this.type()!], true).subscribe((x) => this.setSvgs(x));\r\n } else if (this.inSource()) {\r\n this.iconService.getSvg(this.href(), this.sourceUrl()).subscribe((x) => this.setSvgs(x));\r\n }\r\n });\r\n }\r\n\r\n setSvgs(svg: string) {\r\n if (XIsEmpty(svg)) return;\r\n const parser = new DOMParser();\r\n const svgDoc = parser.parseFromString(svg, 'image/svg+xml');\r\n\r\n let firstChild = this.elementRef.nativeElement.firstChild;\r\n if (firstChild) {\r\n this.renderer.removeChild(this.elementRef.nativeElement, firstChild);\r\n }\r\n this.svgElement = svgDoc.documentElement;\r\n this.setAttributes(this.svgElement);\r\n this.renderer.appendChild(this.elementRef.nativeElement, this.svgElement);\r\n // TODO: use zoneless, renderer removeChild will not take effect immediately\r\n this.cdr.markForCheck();\r\n }\r\n\r\n setAttributes(svgEle: HTMLElement) {\r\n if (svgEle) {\r\n this.renderer.setAttribute(svgEle, 'width', '1em');\r\n this.renderer.setAttribute(svgEle, 'height', '1em');\r\n }\r\n }\r\n\r\n setAttribute(svg: SVGElement, svgEle: SVGElement, attribute: string, def?: string) {\r\n let attr = svgEle.getAttribute(attribute);\r\n if (attr) {\r\n svg.setAttribute(attribute, attr);\r\n } else if (def) {\r\n svg.setAttribute(attribute, def);\r\n }\r\n }\r\n}\r\n","\r\n","import { NgModule } from '@angular/core';\r\nimport { XIconComponent } from './icon.component';\r\n\r\n@NgModule({\r\n exports: [XIconComponent],\r\n imports: [XIconComponent]\r\n})\r\nexport class XIconModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAIA;;;;AAIG;AACI,MAAM,WAAW,GAAG;AAC3B,MAAM,kBAAkB,GAAG,MAAM;AAEjC;;AAEG;MAEU,aAAc,SAAQ,iBAAiB,CAAC,kBAAkB,CAAC,CAAA;AADxE,IAAA,WAAA,GAAA;;AAEE;;;AAGG;QACM,IAAI,CAA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A,EAAA,CAAA,iSAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FD2Ca,cAAc,EAAA,UAAA,EAAA,CAAA;kBAP1B,SAAS;+BACE,CAAG,EAAA,WAAW,EAAE,EAGX,aAAA,EAAA,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,MAAA,EAAA,MAAA,EAAA,CAAA,iSAAA,CAAA,EAAA;wDAGrB,SAAS,EAAA,CAAA;sBAAlC,WAAW;uBAAC,OAAO;gBASkB,OAAO,EAAA,CAAA;sBAA5C,WAAW;uBAAC,mBAAmB;gBAIA,QAAQ,EAAA,CAAA;sBAAvC,WAAW;uBAAC,aAAa;;;MEnDf,WAAW,CAAA;iIAAX,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAX,WAAW,EAAA,OAAA,EAAA,CAFZ,cAAc,CAAA,EAAA,OAAA,EAAA,CADd,cAAc,CAAA,EAAA,CAAA,CAAA;kIAGb,WAAW,EAAA,CAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAJvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,OAAO,EAAE,CAAC,cAAc;AACzB,iBAAA;;;ACND;;AAEG;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, model, output, Component, Injectable, inject, computed, signal, ChangeDetectorRef, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, HostBinding, HostListener, viewChild, viewChildren, effect, NgModule } from '@angular/core';
|
|
3
|
-
import { XPropertyFunction, XToBoolean, XToNumber, XToCssPixelValue, XProperty, XIsEmpty, XRemove, XComputedStyle, XToCssPx, XIsObjectArray, XIsArray, XIsChange, XResize, XIsFunction, XSetData, XIsUndefined } from '@ng-nest/ui/core';
|
|
3
|
+
import { XPropertyFunction, XToBoolean, XToNumber, XToCssPixelValue, XProperty, XIsEmpty, XRemove, XComputedStyle, XToCssPx, XIsObjectArray, XIsArray, XIsChange, XResize, XIsFunction, XSetData, XIsUndefined, XOrderBy } from '@ng-nest/ui/core';
|
|
4
4
|
import { Subject, debounceTime, map } from 'rxjs';
|
|
5
5
|
import * as i3 from '@angular/cdk/scrolling';
|
|
6
6
|
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
|
@@ -22,6 +22,14 @@ import { CdkDropList, DragDropModule } from '@angular/cdk/drag-drop';
|
|
|
22
22
|
*/
|
|
23
23
|
const XTreePrefix = 'x-tree';
|
|
24
24
|
const X_TREE_CONFIG_NAME = 'tree';
|
|
25
|
+
/**
|
|
26
|
+
* @zh_CN Tree 节点排序默认值
|
|
27
|
+
* @en_US Tree node order default value
|
|
28
|
+
*/
|
|
29
|
+
const X_TREE_ORDER_DEFAULT = [
|
|
30
|
+
{ property: 'sort', order: 'asc' },
|
|
31
|
+
{ property: 'label', order: 'asc' }
|
|
32
|
+
];
|
|
25
33
|
/**
|
|
26
34
|
* Tree Property
|
|
27
35
|
*/
|
|
@@ -205,6 +213,11 @@ class XTreeProperty extends XPropertyFunction(X_TREE_CONFIG_NAME) {
|
|
|
205
213
|
* @en_US Show line
|
|
206
214
|
*/
|
|
207
215
|
this.showLine = input(this.config?.showLine ?? false, { transform: XToBoolean });
|
|
216
|
+
/**
|
|
217
|
+
* @zh_CN 排序属性
|
|
218
|
+
* @en_US Order property
|
|
219
|
+
*/
|
|
220
|
+
this.order = input(X_TREE_ORDER_DEFAULT);
|
|
208
221
|
/**
|
|
209
222
|
* @zh_CN 节点点击事件
|
|
210
223
|
* @en_US Node click event
|
|
@@ -227,7 +240,7 @@ class XTreeProperty extends XPropertyFunction(X_TREE_CONFIG_NAME) {
|
|
|
227
240
|
this.nodeDragMoved = output();
|
|
228
241
|
}
|
|
229
242
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: XTreeProperty, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
230
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.1", type: XTreeProperty, isStandalone: true, selector: "x-tree-property", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, checkbox: { classPropertyName: "checkbox", publicName: "checkbox", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, activatedId: { classPropertyName: "activatedId", publicName: "activatedId", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, expandedAll: { classPropertyName: "expandedAll", publicName: "expandedAll", isSignal: true, isRequired: false, transformFunction: null }, expandedLevel: { classPropertyName: "expandedLevel", publicName: "expandedLevel", isSignal: true, isRequired: false, transformFunction: null }, nodeOpen: { classPropertyName: "nodeOpen", publicName: "nodeOpen", isSignal: true, isRequired: false, transformFunction: null }, spacing: { classPropertyName: "spacing", publicName: "spacing", isSignal: true, isRequired: false, transformFunction: null }, labelTpl: { classPropertyName: "labelTpl", publicName: "labelTpl", isSignal: true, isRequired: false, transformFunction: null }, nodeHeight: { classPropertyName: "nodeHeight", publicName: "nodeHeight", isSignal: true, isRequired: false, transformFunction: null }, allowManyActivated: { classPropertyName: "allowManyActivated", publicName: "allowManyActivated", isSignal: true, isRequired: false, transformFunction: null }, drag: { classPropertyName: "drag", publicName: "drag", isSignal: true, isRequired: false, transformFunction: null }, manual: { classPropertyName: "manual", publicName: "manual", isSignal: true, isRequired: false, transformFunction: null }, levelCheck: { classPropertyName: "levelCheck", publicName: "levelCheck", isSignal: true, isRequired: false, transformFunction: null }, nodeNowrap: { classPropertyName: "nodeNowrap", publicName: "nodeNowrap", isSignal: true, isRequired: false, transformFunction: null }, nodeAlignItems: { classPropertyName: "nodeAlignItems", publicName: "nodeAlignItems", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, scrollElement: { classPropertyName: "scrollElement", publicName: "scrollElement", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollHeight: { classPropertyName: "virtualScrollHeight", publicName: "virtualScrollHeight", isSignal: true, isRequired: false, transformFunction: null }, heightAdaption: { classPropertyName: "heightAdaption", publicName: "heightAdaption", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, minBufferPx: { classPropertyName: "minBufferPx", publicName: "minBufferPx", isSignal: true, isRequired: false, transformFunction: null }, maxBufferPx: { classPropertyName: "maxBufferPx", publicName: "maxBufferPx", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, objectArray: { classPropertyName: "objectArray", publicName: "objectArray", isSignal: true, isRequired: false, transformFunction: null }, keywordText: { classPropertyName: "keywordText", publicName: "keywordText", isSignal: true, isRequired: false, transformFunction: null }, caseSensitive: { classPropertyName: "caseSensitive", publicName: "caseSensitive", isSignal: true, isRequired: false, transformFunction: null }, onlyLeaf: { classPropertyName: "onlyLeaf", publicName: "onlyLeaf", isSignal: true, isRequired: false, transformFunction: null }, expandedIcon: { classPropertyName: "expandedIcon", publicName: "expandedIcon", isSignal: true, isRequired: false, transformFunction: null }, showLine: { classPropertyName: "showLine", publicName: "showLine", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activatedId: "activatedIdChange", expanded: "expandedChange", checked: "checkedChange", activatedChange: "activatedChange", checkboxChange: "checkboxChange", manual: "manualChange", nodeClick: "nodeClick", nodeDragStarted: "nodeDragStarted", nodeDragEnded: "nodeDragEnded", nodeDragMoved: "nodeDragMoved" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
243
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.1", type: XTreeProperty, isStandalone: true, selector: "x-tree-property", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, checkbox: { classPropertyName: "checkbox", publicName: "checkbox", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, activatedId: { classPropertyName: "activatedId", publicName: "activatedId", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, expandedAll: { classPropertyName: "expandedAll", publicName: "expandedAll", isSignal: true, isRequired: false, transformFunction: null }, expandedLevel: { classPropertyName: "expandedLevel", publicName: "expandedLevel", isSignal: true, isRequired: false, transformFunction: null }, nodeOpen: { classPropertyName: "nodeOpen", publicName: "nodeOpen", isSignal: true, isRequired: false, transformFunction: null }, spacing: { classPropertyName: "spacing", publicName: "spacing", isSignal: true, isRequired: false, transformFunction: null }, labelTpl: { classPropertyName: "labelTpl", publicName: "labelTpl", isSignal: true, isRequired: false, transformFunction: null }, nodeHeight: { classPropertyName: "nodeHeight", publicName: "nodeHeight", isSignal: true, isRequired: false, transformFunction: null }, allowManyActivated: { classPropertyName: "allowManyActivated", publicName: "allowManyActivated", isSignal: true, isRequired: false, transformFunction: null }, drag: { classPropertyName: "drag", publicName: "drag", isSignal: true, isRequired: false, transformFunction: null }, manual: { classPropertyName: "manual", publicName: "manual", isSignal: true, isRequired: false, transformFunction: null }, levelCheck: { classPropertyName: "levelCheck", publicName: "levelCheck", isSignal: true, isRequired: false, transformFunction: null }, nodeNowrap: { classPropertyName: "nodeNowrap", publicName: "nodeNowrap", isSignal: true, isRequired: false, transformFunction: null }, nodeAlignItems: { classPropertyName: "nodeAlignItems", publicName: "nodeAlignItems", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, scrollElement: { classPropertyName: "scrollElement", publicName: "scrollElement", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollHeight: { classPropertyName: "virtualScrollHeight", publicName: "virtualScrollHeight", isSignal: true, isRequired: false, transformFunction: null }, heightAdaption: { classPropertyName: "heightAdaption", publicName: "heightAdaption", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, minBufferPx: { classPropertyName: "minBufferPx", publicName: "minBufferPx", isSignal: true, isRequired: false, transformFunction: null }, maxBufferPx: { classPropertyName: "maxBufferPx", publicName: "maxBufferPx", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, objectArray: { classPropertyName: "objectArray", publicName: "objectArray", isSignal: true, isRequired: false, transformFunction: null }, keywordText: { classPropertyName: "keywordText", publicName: "keywordText", isSignal: true, isRequired: false, transformFunction: null }, caseSensitive: { classPropertyName: "caseSensitive", publicName: "caseSensitive", isSignal: true, isRequired: false, transformFunction: null }, onlyLeaf: { classPropertyName: "onlyLeaf", publicName: "onlyLeaf", isSignal: true, isRequired: false, transformFunction: null }, expandedIcon: { classPropertyName: "expandedIcon", publicName: "expandedIcon", isSignal: true, isRequired: false, transformFunction: null }, showLine: { classPropertyName: "showLine", publicName: "showLine", isSignal: true, isRequired: false, transformFunction: null }, order: { classPropertyName: "order", publicName: "order", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activatedId: "activatedIdChange", expanded: "expandedChange", checked: "checkedChange", activatedChange: "activatedChange", checkboxChange: "checkboxChange", manual: "manualChange", nodeClick: "nodeClick", nodeDragStarted: "nodeDragStarted", nodeDragEnded: "nodeDragEnded", nodeDragMoved: "nodeDragMoved" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
231
244
|
}
|
|
232
245
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: XTreeProperty, decorators: [{
|
|
233
246
|
type: Component,
|
|
@@ -711,7 +724,7 @@ class XTreeNodeComponent extends XTreeNodeProperty {
|
|
|
711
724
|
return item.id;
|
|
712
725
|
}
|
|
713
726
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: XTreeNodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
714
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.1", type: XTreeNodeComponent, isStandalone: true, selector: "x-tree-node, [x-tree-node]", outputs: { nodeMouseenter: "nodeMouseenter" }, host: { listeners: { "mouseenter": "onMouseenter($event)", "mouseleave": "onMouseleave()" }, properties: { "class.x-tree-node": "this.rootClass" } }, usesInheritance: true, ngImport: i0, template: "<div\r\n class=\"x-tree-node-content\"\r\n [class.x-activated]=\"activated()\"\r\n [class.x-disabled]=\"disabled()\"\r\n [class.x-tree-node-sub]=\"!leaf()\"\r\n [class.x-tree-node-last]=\"isChildrenLast()\"\r\n [style.padding-left.px]=\"paddingLeft() + fontSize() / 2\"\r\n [style.height]=\"height() ? height() : nodeHeight() ? nodeHeight() : ''\"\r\n [style.align-items]=\"alignItems() ? alignItems() : nodeAlignItems()\"\r\n (click)=\"!disabled() && onActivate($event, node())\"\r\n>\r\n @if (tree.showLine() && level()! > 0) {\r\n <div class=\"x-tree-node-line\" [style.width.px]=\"paddingLeft()\">\r\n @for (i of verticalLevel(); track i) {\r\n <div\r\n class=\"x-tree-node-line-vertical\"\r\n [hidden]=\"isParentLast()[i - 1]\"\r\n [class.is-last]=\"i === verticalLevel().length\"\r\n [style.left.px]=\"getVerticalLeft(i)\"\r\n ></div>\r\n }\r\n <div\r\n class=\"x-tree-node-line-horizontal\"\r\n [style.width.px]=\"verticalWidth()\"\r\n [style.left.px]=\"getVerticalLeft(verticalLevel().length)\"\r\n ></div>\r\n </div>\r\n }\r\n @if (showDragIndicator()) {\r\n <div class=\"x-tree-node-drag-indicator\" [style.width]=\"indicatorWidth()\" [ngStyle]=\"indicatorStyle()\"></div>\r\n }\r\n @if (loading()) {\r\n <x-icon class=\"x-tree-node-loading\" type=\"fto-loader\" [spin]=\"loading()!\"></x-icon>\r\n } @else {\r\n <div\r\n class=\"x-tree-node-right\"\r\n [class.is-leaf]=\"leaf()\"\r\n [class.is-open]=\"open()\"\r\n [class.is-template]=\"tree.expandedIcon()\"\r\n [style.width.px]=\"verticalWidth() * 2\"\r\n (click)=\"!tree.nodeOpen() && onToggle($event, node())\"\r\n >\r\n @if (!leaf()) {\r\n @if (tree.expandedIcon()) {\r\n <ng-container *xOutlet=\"tree.expandedIcon(); context: { $node: node() }\"></ng-container>\r\n } @else {\r\n <x-icon type=\"fto-chevron-right\"></x-icon>\r\n }\r\n }\r\n </div>\r\n }\r\n @if (tree.checkbox()) {\r\n <x-checkbox\r\n [data]=\"[{ label: '', id: id() }]\"\r\n [(ngModel)]=\"checked\"\r\n (ngModelChange)=\"onCheckboxChange()\"\r\n [indeterminate]=\"indeterminate()!\"\r\n [disabled]=\"disabled()!\"\r\n (click)=\"$event.stopPropagation()\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!tree.labelTpl()) {\r\n <span\r\n class=\"x-tree-node-label\"\r\n [class.nowrap]=\"nowrap() === false || nowrap() === true ? nowrap() : nodeNowrap()\"\r\n [title]=\"label()\"\r\n x-keyword\r\n [text]=\"tree.keywordText()\"\r\n [caseSensitive]=\"tree.caseSensitive()\"\r\n >{{ label() }}</span\r\n >\r\n } @else {\r\n <ng-container *xOutlet=\"tree.labelTpl(); context: { $node: node() }\"></ng-container>\r\n }\r\n <span class=\"x-tree-node-operations\">\r\n @for (action of actions(); track action.id) {\r\n <x-link [icon]=\"action.icon\" [title]=\"action.label\" (click)=\"onAction($event, action, node())\">{{\r\n action.label\r\n }}</x-link>\r\n }\r\n </span>\r\n @if (tree.multiple() && activated()) {\r\n <x-icon class=\"x-tree-node-checked\" type=\"fto-check\"></x-icon>\r\n }\r\n</div>\r\n", styles: ["x-tree-node{display:block}.x-tree-node{display:block}.x-tree-node{margin:0;padding:0}.x-tree-node-content{position:relative;display:flex;border-radius:var(--x-border-radius);margin:.125rem 0;padding-right:.5rem;line-height:var(--x-height-small);cursor:pointer}.x-tree-node-content x-icon{padding:.25rem;font-size:1.25rem;transition:var(--x-animation-duration-base)}.x-tree-node-content x-icon:hover{color:var(--x-text-200)}.x-tree-node-content x-checkbox{margin-right:.325rem;padding:.25rem 0}.x-tree-node-content.x-disabled{color:var(--x-text-400)}.x-tree-node-content:not(.x-disabled):hover{background-color:var(--x-background-a200)}.x-tree-node-content:not(.x-disabled):hover .x-tree-node-operations{display:flex;align-items:center}.x-tree-node-content:not(.x-disabled).x-activated{background-color:var(--x-primary-900);color:var(--x-primary)}.x-tree-node-content:not(.x-disabled).x-tree-node-checked{color:var(--x-primary)}.x-tree-node-right,.x-tree-node-loading{color:var(--x-text-300);margin-right:.125rem}.x-tree-node-right{display:flex;align-items:center;justify-content:center}.x-tree-node-right.is-leaf{visibility:hidden}.x-tree-node-right.is-open:not(.is-template) x-icon{transform:rotate(90deg)}.x-tree-node-line{position:absolute;left:.5rem;height:calc(100% + .25rem);display:flex;align-items:center;justify-content:space-between}.x-tree-node-line-vertical{position:absolute;height:100%;border-right:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-tree-node-line-horizontal{position:absolute;border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-tree-node-last .x-tree-node-line-vertical.is-last{height:50%;top:0}.x-tree-node-operations{display:none}.x-tree-node-operations .x-link{padding:0 .125rem}.x-tree-node-label{flex:1;-webkit-user-select:none;user-select:none}.x-tree-node-label.nowrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.x-tree-node-drag-indicator{position:absolute;height:.0625rem;border-radius:var(--x-border-radius);background-color:var(--x-primary);right:0;z-index:1}.x-tree-node-drag-indicator:before{position:absolute;top:-.125rem;left:-.2625rem;width:.325rem;height:.325rem;background-color:transparent;border-color:var(--x-primary);border-style:solid;border-width:.0625rem .0625rem 0 0;content:\" \";transform:rotate(45deg)}body>x-tree-node{display:block}body>x-tree-node.cdk-drag-preview .x-tree-node-content{position:relative;display:flex;border-radius:var(--x-border-radius);margin:.125rem 0;padding-right:.5rem;line-height:var(--x-height-small);cursor:pointer}body>x-tree-node.cdk-drag-preview .x-tree-node-content x-icon{padding:.25rem;font-size:1.25rem;transition:var(--x-animation-duration-base)}body>x-tree-node.cdk-drag-preview .x-tree-node-content x-icon:hover{color:var(--x-text-200)}body>x-tree-node.cdk-drag-preview .x-tree-node-content x-checkbox{margin-right:.325rem;padding:.25rem 0}body>x-tree-node.cdk-drag-preview .x-tree-node-content.x-disabled{color:var(--x-text-400)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled):hover{background-color:var(--x-background-a200)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled):hover .x-tree-node-operations{display:flex;align-items:center}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled).x-activated{background-color:var(--x-primary-900);color:var(--x-primary)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled).x-tree-node-checked{color:var(--x-primary)}body>x-tree-node.cdk-drag-preview .x-tree-node-right,body>x-tree-node.cdk-drag-preview .x-tree-node-loading{color:var(--x-text-300);margin-right:.125rem}body>x-tree-node.cdk-drag-preview .x-tree-node-right{display:flex;align-items:center;justify-content:center}body>x-tree-node.cdk-drag-preview .x-tree-node-right.is-leaf{visibility:hidden}body>x-tree-node.cdk-drag-preview .x-tree-node-right.is-open:not(.is-template) x-icon{transform:rotate(90deg)}body>x-tree-node.cdk-drag-preview .x-tree-node-line{position:absolute;left:.5rem;height:calc(100% + .25rem);display:flex;align-items:center;justify-content:space-between}body>x-tree-node.cdk-drag-preview .x-tree-node-line-vertical{position:absolute;height:100%;border-right:var(--x-border-width) var(--x-border-style) var(--x-border)}body>x-tree-node.cdk-drag-preview .x-tree-node-line-horizontal{position:absolute;border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border)}body>x-tree-node.cdk-drag-preview .x-tree-node-last .x-tree-node-line-vertical.is-last{height:50%;top:0}body>x-tree-node.cdk-drag-preview .x-tree-node-operations{display:none}body>x-tree-node.cdk-drag-preview .x-tree-node-operations .x-link{padding:0 .125rem}body>x-tree-node.cdk-drag-preview .x-tree-node-label{flex:1;-webkit-user-select:none;user-select:none}body>x-tree-node.cdk-drag-preview .x-tree-node-label.nowrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}body>x-tree-node.cdk-drag-preview .x-tree-node-drag-indicator{position:absolute;height:.0625rem;border-radius:var(--x-border-radius);background-color:var(--x-primary);right:0;z-index:1}body>x-tree-node.cdk-drag-preview .x-tree-node-drag-indicator:before{position:absolute;top:-.125rem;left:-.2625rem;width:.325rem;height:.325rem;background-color:transparent;border-color:var(--x-primary);border-style:solid;border-width:.0625rem .0625rem 0 0;content:\" \";transform:rotate(45deg)}body>x-tree-node.cdk-drag-preview .x-tree-node-content{border-color:var(--x-border);color:var(--x-text-400);background-color:var(--x-background-a100);opacity:.5}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: XIconComponent, selector: "x-icon" }, { kind: "component", type: XCheckboxComponent, selector: "x-checkbox" }, { kind: "directive", type: XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { kind: "component", type: XLinkComponent, selector: "x-link" }, { kind: "directive", type: XKeywordDirective, selector: "[x-keyword]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
727
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.1", type: XTreeNodeComponent, isStandalone: true, selector: "x-tree-node, [x-tree-node]", outputs: { nodeMouseenter: "nodeMouseenter" }, host: { listeners: { "mouseenter": "onMouseenter($event)", "mouseleave": "onMouseleave()" }, properties: { "class.x-tree-node": "this.rootClass" } }, usesInheritance: true, ngImport: i0, template: "<div\r\n class=\"x-tree-node-content\"\r\n [class.x-activated]=\"activated()\"\r\n [class.x-disabled]=\"disabled()\"\r\n [class.x-tree-node-sub]=\"!leaf()\"\r\n [class.x-tree-node-last]=\"isChildrenLast()\"\r\n [style.padding-left.px]=\"paddingLeft() + fontSize() / 2\"\r\n [style.height]=\"height() ? height() : nodeHeight() ? nodeHeight() : ''\"\r\n [style.align-items]=\"alignItems() ? alignItems() : nodeAlignItems()\"\r\n (click)=\"!disabled() && onActivate($event, node())\"\r\n>\r\n @if (tree.showLine() && level()! > 0) {\r\n <div class=\"x-tree-node-line\" [style.width.px]=\"paddingLeft()\">\r\n @for (i of verticalLevel(); track i) {\r\n <div\r\n class=\"x-tree-node-line-vertical\"\r\n [hidden]=\"isParentLast()[i - 1]\"\r\n [class.is-last]=\"i === verticalLevel().length\"\r\n [style.left.px]=\"getVerticalLeft(i)\"\r\n ></div>\r\n }\r\n <div\r\n class=\"x-tree-node-line-horizontal\"\r\n [style.width.px]=\"verticalWidth()\"\r\n [style.left.px]=\"getVerticalLeft(verticalLevel().length)\"\r\n ></div>\r\n </div>\r\n }\r\n @if (showDragIndicator()) {\r\n <div class=\"x-tree-node-drag-indicator\" [style.width]=\"indicatorWidth()\" [ngStyle]=\"indicatorStyle()\"></div>\r\n }\r\n @if (loading()) {\r\n <x-icon class=\"x-tree-node-loading\" type=\"fto-loader\" [spin]=\"loading()!\"></x-icon>\r\n } @else {\r\n <div\r\n class=\"x-tree-node-right\"\r\n [class.is-leaf]=\"leaf()\"\r\n [class.is-open]=\"open()\"\r\n [class.is-template]=\"tree.expandedIcon()\"\r\n [style.width.px]=\"verticalWidth() * 2\"\r\n (click)=\"!tree.nodeOpen() && onToggle($event, node())\"\r\n >\r\n @if (!leaf()) {\r\n @if (tree.expandedIcon()) {\r\n <ng-container *xOutlet=\"tree.expandedIcon(); context: { $node: node() }\"></ng-container>\r\n } @else {\r\n <x-icon class=\"x-tree-node-icon\" type=\"fto-chevron-right\"></x-icon>\r\n }\r\n }\r\n </div>\r\n }\r\n @if (tree.checkbox()) {\r\n <x-checkbox\r\n class=\"x-tree-node-checkbox\"\r\n [data]=\"[{ label: '', id: id() }]\"\r\n [(ngModel)]=\"checked\"\r\n (ngModelChange)=\"onCheckboxChange()\"\r\n [indeterminate]=\"indeterminate()!\"\r\n [disabled]=\"disabled()!\"\r\n (click)=\"$event.stopPropagation()\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!tree.labelTpl()) {\r\n <span\r\n class=\"x-tree-node-label\"\r\n [class.nowrap]=\"nowrap() === false || nowrap() === true ? nowrap() : nodeNowrap()\"\r\n [title]=\"label()\"\r\n x-keyword\r\n [text]=\"tree.keywordText()\"\r\n [caseSensitive]=\"tree.caseSensitive()\"\r\n >{{ label() }}</span\r\n >\r\n } @else {\r\n <ng-container *xOutlet=\"tree.labelTpl(); context: { $node: node() }\"></ng-container>\r\n }\r\n <span class=\"x-tree-node-operations\">\r\n @for (action of actions(); track action.id) {\r\n <x-link [icon]=\"action.icon\" [title]=\"action.label\" (click)=\"onAction($event, action, node())\">{{\r\n action.label\r\n }}</x-link>\r\n }\r\n </span>\r\n @if (tree.multiple() && activated()) {\r\n <x-icon class=\"x-tree-node-checked\" type=\"fto-check\"></x-icon>\r\n }\r\n</div>\r\n", styles: ["x-tree-node{display:block}.x-tree-node{display:block}.x-tree-node{margin:0;padding:0}.x-tree-node-content{position:relative;display:flex;border-radius:var(--x-border-radius);margin:.125rem 0;padding-right:.5rem;line-height:var(--x-height-small);cursor:pointer}.x-tree-node-content .x-tree-node-icon,.x-tree-node-content .x-tree-node-right x-icon{padding:.25rem;font-size:1.25rem;transition:var(--x-animation-duration-base)}.x-tree-node-content .x-tree-node-icon:hover,.x-tree-node-content .x-tree-node-right x-icon:hover{color:var(--x-text-200)}.x-tree-node-content .x-tree-node-checkbox{margin-right:.325rem;padding:.25rem 0}.x-tree-node-content.x-disabled{color:var(--x-text-400)}.x-tree-node-content:not(.x-disabled):hover{background-color:var(--x-background-a200)}.x-tree-node-content:not(.x-disabled):hover .x-tree-node-operations{display:flex;align-items:center}.x-tree-node-content:not(.x-disabled).x-activated{background-color:var(--x-primary-900);color:var(--x-primary)}.x-tree-node-content:not(.x-disabled).x-tree-node-checked{color:var(--x-primary)}.x-tree-node x-icon.x-tree-node-loading{padding:.2rem;font-size:1.25rem;color:var(--x-text-300)}.x-tree-node-right{display:flex;align-items:center;justify-content:center;margin-right:.125rem}.x-tree-node-right.is-leaf{visibility:hidden}.x-tree-node-right.is-open:not(.is-template) x-icon{transform:rotate(90deg)}.x-tree-node-line{position:absolute;left:.5rem;height:calc(100% + .25rem);display:flex;align-items:center;justify-content:space-between}.x-tree-node-line-vertical{position:absolute;height:100%;border-right:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-tree-node-line-horizontal{position:absolute;border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-tree-node-last .x-tree-node-line-vertical.is-last{height:50%;top:0}.x-tree-node-operations{display:none}.x-tree-node-operations .x-link{padding:0 .125rem}.x-tree-node-label{flex:1;-webkit-user-select:none;user-select:none}.x-tree-node-label.nowrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.x-tree-node-drag-indicator{position:absolute;height:.0625rem;border-radius:var(--x-border-radius);background-color:var(--x-primary);right:0;z-index:1}.x-tree-node-drag-indicator:before{position:absolute;top:-.125rem;left:-.2625rem;width:.325rem;height:.325rem;background-color:transparent;border-color:var(--x-primary);border-style:solid;border-width:.0625rem .0625rem 0 0;content:\" \";transform:rotate(45deg)}body>x-tree-node{display:block}body>x-tree-node.cdk-drag-preview .x-tree-node-content{position:relative;display:flex;border-radius:var(--x-border-radius);margin:.125rem 0;padding-right:.5rem;line-height:var(--x-height-small);cursor:pointer}body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-icon,body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-right x-icon{padding:.25rem;font-size:1.25rem;transition:var(--x-animation-duration-base)}body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-icon:hover,body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-right x-icon:hover{color:var(--x-text-200)}body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-checkbox{margin-right:.325rem;padding:.25rem 0}body>x-tree-node.cdk-drag-preview .x-tree-node-content.x-disabled{color:var(--x-text-400)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled):hover{background-color:var(--x-background-a200)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled):hover .x-tree-node-operations{display:flex;align-items:center}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled).x-activated{background-color:var(--x-primary-900);color:var(--x-primary)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled).x-tree-node-checked{color:var(--x-primary)}body>x-tree-node.cdk-drag-preview .x-tree-node x-icon.x-tree-node-loading{padding:.2rem;font-size:1.25rem;color:var(--x-text-300)}body>x-tree-node.cdk-drag-preview .x-tree-node-right{display:flex;align-items:center;justify-content:center;margin-right:.125rem}body>x-tree-node.cdk-drag-preview .x-tree-node-right.is-leaf{visibility:hidden}body>x-tree-node.cdk-drag-preview .x-tree-node-right.is-open:not(.is-template) x-icon{transform:rotate(90deg)}body>x-tree-node.cdk-drag-preview .x-tree-node-line{position:absolute;left:.5rem;height:calc(100% + .25rem);display:flex;align-items:center;justify-content:space-between}body>x-tree-node.cdk-drag-preview .x-tree-node-line-vertical{position:absolute;height:100%;border-right:var(--x-border-width) var(--x-border-style) var(--x-border)}body>x-tree-node.cdk-drag-preview .x-tree-node-line-horizontal{position:absolute;border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border)}body>x-tree-node.cdk-drag-preview .x-tree-node-last .x-tree-node-line-vertical.is-last{height:50%;top:0}body>x-tree-node.cdk-drag-preview .x-tree-node-operations{display:none}body>x-tree-node.cdk-drag-preview .x-tree-node-operations .x-link{padding:0 .125rem}body>x-tree-node.cdk-drag-preview .x-tree-node-label{flex:1;-webkit-user-select:none;user-select:none}body>x-tree-node.cdk-drag-preview .x-tree-node-label.nowrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}body>x-tree-node.cdk-drag-preview .x-tree-node-drag-indicator{position:absolute;height:.0625rem;border-radius:var(--x-border-radius);background-color:var(--x-primary);right:0;z-index:1}body>x-tree-node.cdk-drag-preview .x-tree-node-drag-indicator:before{position:absolute;top:-.125rem;left:-.2625rem;width:.325rem;height:.325rem;background-color:transparent;border-color:var(--x-primary);border-style:solid;border-width:.0625rem .0625rem 0 0;content:\" \";transform:rotate(45deg)}body>x-tree-node.cdk-drag-preview .x-tree-node-content{border-color:var(--x-border);color:var(--x-text-400);background-color:var(--x-background-a100);opacity:.5}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: XIconComponent, selector: "x-icon" }, { kind: "component", type: XCheckboxComponent, selector: "x-checkbox" }, { kind: "directive", type: XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { kind: "component", type: XLinkComponent, selector: "x-link" }, { kind: "directive", type: XKeywordDirective, selector: "[x-keyword]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
715
728
|
}
|
|
716
729
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: XTreeNodeComponent, decorators: [{
|
|
717
730
|
type: Component,
|
|
@@ -723,7 +736,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
723
736
|
XOutletDirective,
|
|
724
737
|
XLinkComponent,
|
|
725
738
|
XKeywordDirective
|
|
726
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n class=\"x-tree-node-content\"\r\n [class.x-activated]=\"activated()\"\r\n [class.x-disabled]=\"disabled()\"\r\n [class.x-tree-node-sub]=\"!leaf()\"\r\n [class.x-tree-node-last]=\"isChildrenLast()\"\r\n [style.padding-left.px]=\"paddingLeft() + fontSize() / 2\"\r\n [style.height]=\"height() ? height() : nodeHeight() ? nodeHeight() : ''\"\r\n [style.align-items]=\"alignItems() ? alignItems() : nodeAlignItems()\"\r\n (click)=\"!disabled() && onActivate($event, node())\"\r\n>\r\n @if (tree.showLine() && level()! > 0) {\r\n <div class=\"x-tree-node-line\" [style.width.px]=\"paddingLeft()\">\r\n @for (i of verticalLevel(); track i) {\r\n <div\r\n class=\"x-tree-node-line-vertical\"\r\n [hidden]=\"isParentLast()[i - 1]\"\r\n [class.is-last]=\"i === verticalLevel().length\"\r\n [style.left.px]=\"getVerticalLeft(i)\"\r\n ></div>\r\n }\r\n <div\r\n class=\"x-tree-node-line-horizontal\"\r\n [style.width.px]=\"verticalWidth()\"\r\n [style.left.px]=\"getVerticalLeft(verticalLevel().length)\"\r\n ></div>\r\n </div>\r\n }\r\n @if (showDragIndicator()) {\r\n <div class=\"x-tree-node-drag-indicator\" [style.width]=\"indicatorWidth()\" [ngStyle]=\"indicatorStyle()\"></div>\r\n }\r\n @if (loading()) {\r\n <x-icon class=\"x-tree-node-loading\" type=\"fto-loader\" [spin]=\"loading()!\"></x-icon>\r\n } @else {\r\n <div\r\n class=\"x-tree-node-right\"\r\n [class.is-leaf]=\"leaf()\"\r\n [class.is-open]=\"open()\"\r\n [class.is-template]=\"tree.expandedIcon()\"\r\n [style.width.px]=\"verticalWidth() * 2\"\r\n (click)=\"!tree.nodeOpen() && onToggle($event, node())\"\r\n >\r\n @if (!leaf()) {\r\n @if (tree.expandedIcon()) {\r\n <ng-container *xOutlet=\"tree.expandedIcon(); context: { $node: node() }\"></ng-container>\r\n } @else {\r\n <x-icon type=\"fto-chevron-right\"></x-icon>\r\n }\r\n }\r\n </div>\r\n }\r\n @if (tree.checkbox()) {\r\n <x-checkbox\r\n [data]=\"[{ label: '', id: id() }]\"\r\n [(ngModel)]=\"checked\"\r\n (ngModelChange)=\"onCheckboxChange()\"\r\n [indeterminate]=\"indeterminate()!\"\r\n [disabled]=\"disabled()!\"\r\n (click)=\"$event.stopPropagation()\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!tree.labelTpl()) {\r\n <span\r\n class=\"x-tree-node-label\"\r\n [class.nowrap]=\"nowrap() === false || nowrap() === true ? nowrap() : nodeNowrap()\"\r\n [title]=\"label()\"\r\n x-keyword\r\n [text]=\"tree.keywordText()\"\r\n [caseSensitive]=\"tree.caseSensitive()\"\r\n >{{ label() }}</span\r\n >\r\n } @else {\r\n <ng-container *xOutlet=\"tree.labelTpl(); context: { $node: node() }\"></ng-container>\r\n }\r\n <span class=\"x-tree-node-operations\">\r\n @for (action of actions(); track action.id) {\r\n <x-link [icon]=\"action.icon\" [title]=\"action.label\" (click)=\"onAction($event, action, node())\">{{\r\n action.label\r\n }}</x-link>\r\n }\r\n </span>\r\n @if (tree.multiple() && activated()) {\r\n <x-icon class=\"x-tree-node-checked\" type=\"fto-check\"></x-icon>\r\n }\r\n</div>\r\n", styles: ["x-tree-node{display:block}.x-tree-node{display:block}.x-tree-node{margin:0;padding:0}.x-tree-node-content{position:relative;display:flex;border-radius:var(--x-border-radius);margin:.125rem 0;padding-right:.5rem;line-height:var(--x-height-small);cursor:pointer}.x-tree-node-content x-icon{padding:.25rem;font-size:1.25rem;transition:var(--x-animation-duration-base)}.x-tree-node-content x-icon:hover{color:var(--x-text-200)}.x-tree-node-content x-checkbox{margin-right:.325rem;padding:.25rem 0}.x-tree-node-content.x-disabled{color:var(--x-text-400)}.x-tree-node-content:not(.x-disabled):hover{background-color:var(--x-background-a200)}.x-tree-node-content:not(.x-disabled):hover .x-tree-node-operations{display:flex;align-items:center}.x-tree-node-content:not(.x-disabled).x-activated{background-color:var(--x-primary-900);color:var(--x-primary)}.x-tree-node-content:not(.x-disabled).x-tree-node-checked{color:var(--x-primary)}.x-tree-node-
|
|
739
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n class=\"x-tree-node-content\"\r\n [class.x-activated]=\"activated()\"\r\n [class.x-disabled]=\"disabled()\"\r\n [class.x-tree-node-sub]=\"!leaf()\"\r\n [class.x-tree-node-last]=\"isChildrenLast()\"\r\n [style.padding-left.px]=\"paddingLeft() + fontSize() / 2\"\r\n [style.height]=\"height() ? height() : nodeHeight() ? nodeHeight() : ''\"\r\n [style.align-items]=\"alignItems() ? alignItems() : nodeAlignItems()\"\r\n (click)=\"!disabled() && onActivate($event, node())\"\r\n>\r\n @if (tree.showLine() && level()! > 0) {\r\n <div class=\"x-tree-node-line\" [style.width.px]=\"paddingLeft()\">\r\n @for (i of verticalLevel(); track i) {\r\n <div\r\n class=\"x-tree-node-line-vertical\"\r\n [hidden]=\"isParentLast()[i - 1]\"\r\n [class.is-last]=\"i === verticalLevel().length\"\r\n [style.left.px]=\"getVerticalLeft(i)\"\r\n ></div>\r\n }\r\n <div\r\n class=\"x-tree-node-line-horizontal\"\r\n [style.width.px]=\"verticalWidth()\"\r\n [style.left.px]=\"getVerticalLeft(verticalLevel().length)\"\r\n ></div>\r\n </div>\r\n }\r\n @if (showDragIndicator()) {\r\n <div class=\"x-tree-node-drag-indicator\" [style.width]=\"indicatorWidth()\" [ngStyle]=\"indicatorStyle()\"></div>\r\n }\r\n @if (loading()) {\r\n <x-icon class=\"x-tree-node-loading\" type=\"fto-loader\" [spin]=\"loading()!\"></x-icon>\r\n } @else {\r\n <div\r\n class=\"x-tree-node-right\"\r\n [class.is-leaf]=\"leaf()\"\r\n [class.is-open]=\"open()\"\r\n [class.is-template]=\"tree.expandedIcon()\"\r\n [style.width.px]=\"verticalWidth() * 2\"\r\n (click)=\"!tree.nodeOpen() && onToggle($event, node())\"\r\n >\r\n @if (!leaf()) {\r\n @if (tree.expandedIcon()) {\r\n <ng-container *xOutlet=\"tree.expandedIcon(); context: { $node: node() }\"></ng-container>\r\n } @else {\r\n <x-icon class=\"x-tree-node-icon\" type=\"fto-chevron-right\"></x-icon>\r\n }\r\n }\r\n </div>\r\n }\r\n @if (tree.checkbox()) {\r\n <x-checkbox\r\n class=\"x-tree-node-checkbox\"\r\n [data]=\"[{ label: '', id: id() }]\"\r\n [(ngModel)]=\"checked\"\r\n (ngModelChange)=\"onCheckboxChange()\"\r\n [indeterminate]=\"indeterminate()!\"\r\n [disabled]=\"disabled()!\"\r\n (click)=\"$event.stopPropagation()\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!tree.labelTpl()) {\r\n <span\r\n class=\"x-tree-node-label\"\r\n [class.nowrap]=\"nowrap() === false || nowrap() === true ? nowrap() : nodeNowrap()\"\r\n [title]=\"label()\"\r\n x-keyword\r\n [text]=\"tree.keywordText()\"\r\n [caseSensitive]=\"tree.caseSensitive()\"\r\n >{{ label() }}</span\r\n >\r\n } @else {\r\n <ng-container *xOutlet=\"tree.labelTpl(); context: { $node: node() }\"></ng-container>\r\n }\r\n <span class=\"x-tree-node-operations\">\r\n @for (action of actions(); track action.id) {\r\n <x-link [icon]=\"action.icon\" [title]=\"action.label\" (click)=\"onAction($event, action, node())\">{{\r\n action.label\r\n }}</x-link>\r\n }\r\n </span>\r\n @if (tree.multiple() && activated()) {\r\n <x-icon class=\"x-tree-node-checked\" type=\"fto-check\"></x-icon>\r\n }\r\n</div>\r\n", styles: ["x-tree-node{display:block}.x-tree-node{display:block}.x-tree-node{margin:0;padding:0}.x-tree-node-content{position:relative;display:flex;border-radius:var(--x-border-radius);margin:.125rem 0;padding-right:.5rem;line-height:var(--x-height-small);cursor:pointer}.x-tree-node-content .x-tree-node-icon,.x-tree-node-content .x-tree-node-right x-icon{padding:.25rem;font-size:1.25rem;transition:var(--x-animation-duration-base)}.x-tree-node-content .x-tree-node-icon:hover,.x-tree-node-content .x-tree-node-right x-icon:hover{color:var(--x-text-200)}.x-tree-node-content .x-tree-node-checkbox{margin-right:.325rem;padding:.25rem 0}.x-tree-node-content.x-disabled{color:var(--x-text-400)}.x-tree-node-content:not(.x-disabled):hover{background-color:var(--x-background-a200)}.x-tree-node-content:not(.x-disabled):hover .x-tree-node-operations{display:flex;align-items:center}.x-tree-node-content:not(.x-disabled).x-activated{background-color:var(--x-primary-900);color:var(--x-primary)}.x-tree-node-content:not(.x-disabled).x-tree-node-checked{color:var(--x-primary)}.x-tree-node x-icon.x-tree-node-loading{padding:.2rem;font-size:1.25rem;color:var(--x-text-300)}.x-tree-node-right{display:flex;align-items:center;justify-content:center;margin-right:.125rem}.x-tree-node-right.is-leaf{visibility:hidden}.x-tree-node-right.is-open:not(.is-template) x-icon{transform:rotate(90deg)}.x-tree-node-line{position:absolute;left:.5rem;height:calc(100% + .25rem);display:flex;align-items:center;justify-content:space-between}.x-tree-node-line-vertical{position:absolute;height:100%;border-right:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-tree-node-line-horizontal{position:absolute;border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-tree-node-last .x-tree-node-line-vertical.is-last{height:50%;top:0}.x-tree-node-operations{display:none}.x-tree-node-operations .x-link{padding:0 .125rem}.x-tree-node-label{flex:1;-webkit-user-select:none;user-select:none}.x-tree-node-label.nowrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.x-tree-node-drag-indicator{position:absolute;height:.0625rem;border-radius:var(--x-border-radius);background-color:var(--x-primary);right:0;z-index:1}.x-tree-node-drag-indicator:before{position:absolute;top:-.125rem;left:-.2625rem;width:.325rem;height:.325rem;background-color:transparent;border-color:var(--x-primary);border-style:solid;border-width:.0625rem .0625rem 0 0;content:\" \";transform:rotate(45deg)}body>x-tree-node{display:block}body>x-tree-node.cdk-drag-preview .x-tree-node-content{position:relative;display:flex;border-radius:var(--x-border-radius);margin:.125rem 0;padding-right:.5rem;line-height:var(--x-height-small);cursor:pointer}body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-icon,body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-right x-icon{padding:.25rem;font-size:1.25rem;transition:var(--x-animation-duration-base)}body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-icon:hover,body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-right x-icon:hover{color:var(--x-text-200)}body>x-tree-node.cdk-drag-preview .x-tree-node-content .x-tree-node-checkbox{margin-right:.325rem;padding:.25rem 0}body>x-tree-node.cdk-drag-preview .x-tree-node-content.x-disabled{color:var(--x-text-400)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled):hover{background-color:var(--x-background-a200)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled):hover .x-tree-node-operations{display:flex;align-items:center}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled).x-activated{background-color:var(--x-primary-900);color:var(--x-primary)}body>x-tree-node.cdk-drag-preview .x-tree-node-content:not(.x-disabled).x-tree-node-checked{color:var(--x-primary)}body>x-tree-node.cdk-drag-preview .x-tree-node x-icon.x-tree-node-loading{padding:.2rem;font-size:1.25rem;color:var(--x-text-300)}body>x-tree-node.cdk-drag-preview .x-tree-node-right{display:flex;align-items:center;justify-content:center;margin-right:.125rem}body>x-tree-node.cdk-drag-preview .x-tree-node-right.is-leaf{visibility:hidden}body>x-tree-node.cdk-drag-preview .x-tree-node-right.is-open:not(.is-template) x-icon{transform:rotate(90deg)}body>x-tree-node.cdk-drag-preview .x-tree-node-line{position:absolute;left:.5rem;height:calc(100% + .25rem);display:flex;align-items:center;justify-content:space-between}body>x-tree-node.cdk-drag-preview .x-tree-node-line-vertical{position:absolute;height:100%;border-right:var(--x-border-width) var(--x-border-style) var(--x-border)}body>x-tree-node.cdk-drag-preview .x-tree-node-line-horizontal{position:absolute;border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border)}body>x-tree-node.cdk-drag-preview .x-tree-node-last .x-tree-node-line-vertical.is-last{height:50%;top:0}body>x-tree-node.cdk-drag-preview .x-tree-node-operations{display:none}body>x-tree-node.cdk-drag-preview .x-tree-node-operations .x-link{padding:0 .125rem}body>x-tree-node.cdk-drag-preview .x-tree-node-label{flex:1;-webkit-user-select:none;user-select:none}body>x-tree-node.cdk-drag-preview .x-tree-node-label.nowrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}body>x-tree-node.cdk-drag-preview .x-tree-node-drag-indicator{position:absolute;height:.0625rem;border-radius:var(--x-border-radius);background-color:var(--x-primary);right:0;z-index:1}body>x-tree-node.cdk-drag-preview .x-tree-node-drag-indicator:before{position:absolute;top:-.125rem;left:-.2625rem;width:.325rem;height:.325rem;background-color:transparent;border-color:var(--x-primary);border-style:solid;border-width:.0625rem .0625rem 0 0;content:\" \";transform:rotate(45deg)}body>x-tree-node.cdk-drag-preview .x-tree-node-content{border-color:var(--x-border);color:var(--x-text-400);background-color:var(--x-background-a100);opacity:.5}\n"] }]
|
|
727
740
|
}], propDecorators: { rootClass: [{
|
|
728
741
|
type: HostBinding,
|
|
729
742
|
args: ['class.x-tree-node']
|
|
@@ -918,7 +931,7 @@ class XTreeComponent extends XTreeProperty {
|
|
|
918
931
|
node.childrenLoaded = node.open;
|
|
919
932
|
}
|
|
920
933
|
if (XIsUndefined(node.children) || regetChildren) {
|
|
921
|
-
node.children = value.filter((y) => y.pid === node.id);
|
|
934
|
+
node.children = XOrderBy(value.filter((y) => y.pid === node.id), this.order().map((x) => x.property), this.order().map((x) => x.order));
|
|
922
935
|
if (this.levelCheck() && node.children && node.checked) {
|
|
923
936
|
for (let nd of node.children) {
|
|
924
937
|
nd.checked = true;
|
|
@@ -937,7 +950,7 @@ class XTreeComponent extends XTreeProperty {
|
|
|
937
950
|
return node;
|
|
938
951
|
};
|
|
939
952
|
this.treeData.set(value);
|
|
940
|
-
this.nodes.set(value.filter((x) => XIsEmpty(x.pid)).map((x) => getChildren(x, 0)));
|
|
953
|
+
this.nodes.set(XOrderBy(value.filter((x) => XIsEmpty(x.pid)), this.order().map((x) => x.property), this.order().map((x) => x.order)).map((x) => getChildren(x, 0)));
|
|
941
954
|
if (parentOpen) {
|
|
942
955
|
for (let item of value) {
|
|
943
956
|
if (!item.leaf && item.open) {
|
|
@@ -1036,7 +1049,7 @@ class XTreeComponent extends XTreeProperty {
|
|
|
1036
1049
|
};
|
|
1037
1050
|
setChildren(this.nodes());
|
|
1038
1051
|
if (this.expandedAll() === false) {
|
|
1039
|
-
this.nodes.set(this.treeData().filter((x) => XIsEmpty(x.pid)));
|
|
1052
|
+
this.nodes.set(XOrderBy(this.treeData().filter((x) => XIsEmpty(x.pid)), this.order().map((x) => x.property), this.order().map((x) => x.order)));
|
|
1040
1053
|
}
|
|
1041
1054
|
else {
|
|
1042
1055
|
if (this.virtualNodes().length === 0) {
|
|
@@ -1240,7 +1253,8 @@ class XTreeComponent extends XTreeProperty {
|
|
|
1240
1253
|
node.level = 0;
|
|
1241
1254
|
node.leaf = true;
|
|
1242
1255
|
this.treeData.set([...this.treeData(), node]);
|
|
1243
|
-
this.
|
|
1256
|
+
this.setParentOpen(this.treeData(), node);
|
|
1257
|
+
this.setDataChange(this.treeData(), true, false, false);
|
|
1244
1258
|
this.setActivatedId(node);
|
|
1245
1259
|
this.setActivatedNode(this.nodes(), true, false);
|
|
1246
1260
|
node.change && node.change();
|
|
@@ -1292,6 +1306,9 @@ class XTreeComponent extends XTreeProperty {
|
|
|
1292
1306
|
}
|
|
1293
1307
|
updateNode(node, nowNode) {
|
|
1294
1308
|
Object.assign(node, nowNode);
|
|
1309
|
+
this.setDataChange(this.treeData(), true, false, false);
|
|
1310
|
+
this.setActivatedId(node);
|
|
1311
|
+
this.setActivatedNode(this.nodes(), true, false);
|
|
1295
1312
|
node.change && node.change();
|
|
1296
1313
|
}
|
|
1297
1314
|
trackByItem(_index, item) {
|
|
@@ -1322,5 +1339,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
1322
1339
|
* Generated bundle index. Do not edit.
|
|
1323
1340
|
*/
|
|
1324
1341
|
|
|
1325
|
-
export { XTreeComponent, XTreeModule, XTreeNodeComponent, XTreeNodePrefix, XTreeNodeProperty, XTreePrefix, XTreeProperty };
|
|
1342
|
+
export { XTreeComponent, XTreeModule, XTreeNodeComponent, XTreeNodePrefix, XTreeNodeProperty, XTreePrefix, XTreeProperty, X_TREE_ORDER_DEFAULT };
|
|
1326
1343
|
//# sourceMappingURL=ng-nest-ui-tree.mjs.map
|