@dignite-ng/expand.core 0.0.3 → 0.0.6
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/README.md +24 -24
- package/esm2022/lib/directives/index.mjs +2 -0
- package/esm2022/lib/directives/keydown-prevent-default.directive.mjs +22 -0
- package/esm2022/lib/expand/image-preview.component.mjs +250 -0
- package/esm2022/lib/expand/index.mjs +2 -0
- package/esm2022/lib/pipes/get-now-domain.pipe.mjs +53 -0
- package/esm2022/lib/pipes/get-tenant-img.pipe.mjs +27 -0
- package/esm2022/lib/pipes/index.mjs +4 -0
- package/esm2022/lib/pipes/slug-normalizer.pipe.mjs +39 -0
- package/esm2022/lib/services/index.mjs +3 -2
- package/esm2022/lib/services/update-list.service.mjs +50 -0
- package/esm2022/lib/services/validators.service.mjs +84 -0
- package/esm2022/lib/strategies/index.mjs +2 -0
- package/esm2022/lib/strategies/simple-reuse-strategy.mjs +84 -0
- package/esm2022/public-api.mjs +5 -4
- package/fesm2022/dignite-ng-expand.core.mjs +578 -97
- package/fesm2022/dignite-ng-expand.core.mjs.map +1 -1
- package/lib/directives/index.d.ts +1 -0
- package/lib/directives/keydown-prevent-default.directive.d.ts +7 -0
- package/lib/expand/image-preview.component.d.ts +40 -0
- package/lib/expand/index.d.ts +1 -0
- package/lib/pipes/get-now-domain.pipe.d.ts +19 -0
- package/lib/pipes/get-tenant-img.pipe.d.ts +9 -0
- package/lib/pipes/index.d.ts +3 -0
- package/lib/pipes/slug-normalizer.pipe.d.ts +8 -0
- package/lib/services/index.d.ts +2 -1
- package/lib/services/update-list.service.d.ts +37 -0
- package/lib/services/validators.service.d.ts +16 -0
- package/lib/strategies/index.d.ts +1 -0
- package/lib/strategies/simple-reuse-strategy.d.ts +33 -0
- package/package.json +3 -3
- package/public-api.d.ts +4 -3
- package/esm2022/lib/constants/index.mjs +0 -2
- package/esm2022/lib/constants/styles.mjs +0 -24
- package/esm2022/lib/core.module.mjs +0 -26
- package/esm2022/lib/providers/appent-content.providers.mjs +0 -16
- package/esm2022/lib/providers/index.mjs +0 -2
- package/esm2022/lib/services/appent-content.service.mjs +0 -54
- package/lib/constants/index.d.ts +0 -1
- package/lib/constants/styles.d.ts +0 -2
- package/lib/core.module.d.ts +0 -8
- package/lib/providers/appent-content.providers.d.ts +0 -11
- package/lib/providers/index.d.ts +0 -1
- package/lib/services/appent-content.service.d.ts +0 -28
|
@@ -1,116 +1,597 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
2
|
+
import { EventEmitter, Injectable, inject, Pipe, Component, Input, Output, Directive, HostListener } from '@angular/core';
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
|
+
import * as i3 from '@abp/ng.core';
|
|
5
|
+
import { LocalizationService, EnvironmentService, ConfigStateService, CoreModule } from '@abp/ng.core';
|
|
6
|
+
import { ToasterService, ThemeSharedModule } from '@abp/ng.theme.shared';
|
|
7
|
+
import { FormBuilder, FormGroup, FormControl, FormArray } from '@angular/forms';
|
|
8
|
+
import { PageModule } from '@abp/ng.components/page';
|
|
9
|
+
import * as i2 from '@angular/common';
|
|
10
|
+
import { CommonModule } from '@angular/common';
|
|
11
|
+
import * as i1 from '@ng-bootstrap/ng-bootstrap';
|
|
3
12
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.lpx-content-container .lpx-content {
|
|
23
|
-
min-height: calc(100vh - 34px);
|
|
24
|
-
padding: 1.25em 2em 1.25em;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
13
|
+
/**
|
|
14
|
+
* 路由复用策略
|
|
15
|
+
*
|
|
16
|
+
* 1. 实现shouldReuseRoute方法,判断是否同一路由时复用路由
|
|
17
|
+
* 2. 实现retrieve方法,获取存储路由
|
|
18
|
+
* 3. 实现shouldDetach方法,判断是否有路由存储
|
|
19
|
+
* 4. 实现store方法,存储路由
|
|
20
|
+
* 5. 实现shouldAttach方法,判断是否有路由存储
|
|
21
|
+
* 6. 实现retrieve方法,获取存储路由
|
|
22
|
+
* 7. 实现destroy方法,销毁路由
|
|
23
|
+
*
|
|
24
|
+
* *使用方法
|
|
25
|
+
@NgModule({
|
|
26
|
+
providers: [
|
|
27
|
+
{ provide: RouteReuseStrategy, useClass: SimpleReuseStrategy }
|
|
28
|
+
],
|
|
29
|
+
})
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
31
|
+
data: { keep: true }
|
|
32
|
+
*/
|
|
33
|
+
class SimpleReuseStrategy {
|
|
34
|
+
static { this.cacheRouters = new Map(); }
|
|
35
|
+
static deleteRouteCache(url) {
|
|
36
|
+
if (SimpleReuseStrategy.cacheRouters.has(url)) {
|
|
37
|
+
const handle = SimpleReuseStrategy.cacheRouters.get(url);
|
|
38
|
+
try {
|
|
39
|
+
handle.componentRef.destory();
|
|
40
|
+
}
|
|
41
|
+
catch (e) { }
|
|
42
|
+
SimpleReuseStrategy.cacheRouters.delete(url);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static deleteAllRouteCache() {
|
|
46
|
+
SimpleReuseStrategy.cacheRouters.forEach((handle, key) => {
|
|
47
|
+
SimpleReuseStrategy.deleteRouteCache(key);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// one 进入路由触发,是否同一路由时复用路由
|
|
51
|
+
shouldReuseRoute(future, curr) {
|
|
52
|
+
return (future.routeConfig === curr.routeConfig &&
|
|
53
|
+
JSON.stringify(future.params) === JSON.stringify(curr.params));
|
|
54
|
+
}
|
|
55
|
+
// 获取存储路由
|
|
56
|
+
retrieve(route) {
|
|
57
|
+
const url = this.getFullRouteURL(route);
|
|
58
|
+
if (route.data.keep && SimpleReuseStrategy.cacheRouters.has(url)) {
|
|
59
|
+
return SimpleReuseStrategy.cacheRouters.get(url);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Whether to allow multiplexing routes
|
|
66
|
+
shouldDetach(route) {
|
|
67
|
+
return Boolean(route.data.keep);
|
|
68
|
+
}
|
|
69
|
+
//It is triggered when the route leaves. The route is stored
|
|
70
|
+
store(route, handle) {
|
|
71
|
+
const url = this.getFullRouteURL(route);
|
|
72
|
+
// 先把之前缓存的删除,
|
|
73
|
+
SimpleReuseStrategy.cacheRouters.forEach((handle, key) => {
|
|
74
|
+
SimpleReuseStrategy.deleteRouteCache(key);
|
|
75
|
+
});
|
|
76
|
+
SimpleReuseStrategy.cacheRouters.set(url, handle);
|
|
77
|
+
}
|
|
78
|
+
// Whether to allow route restoration
|
|
79
|
+
shouldAttach(route) {
|
|
80
|
+
const url = this.getFullRouteURL(route);
|
|
81
|
+
return Boolean(route.data.keep) && SimpleReuseStrategy.cacheRouters.has(url);
|
|
82
|
+
}
|
|
83
|
+
// Gets the current route url
|
|
84
|
+
getFullRouteURL(route) {
|
|
85
|
+
const { pathFromRoot } = route;
|
|
86
|
+
let fullRouteUrlPath = [];
|
|
87
|
+
pathFromRoot.forEach((item) => {
|
|
88
|
+
fullRouteUrlPath = fullRouteUrlPath.concat(this.getRouteUrlPath(item));
|
|
89
|
+
});
|
|
90
|
+
return `/${fullRouteUrlPath.join('/')}`;
|
|
91
|
+
}
|
|
92
|
+
getRouteUrlPath(route) {
|
|
93
|
+
return route.url.map(urlSegment => urlSegment.path);
|
|
94
|
+
}
|
|
71
95
|
}
|
|
72
|
-
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 子页面更新父级列表服务
|
|
99
|
+
*
|
|
100
|
+
* 父页面:
|
|
101
|
+
*
|
|
102
|
+
private _UpdateListService=inject(UpdateListService)
|
|
103
|
+
|
|
104
|
+
this._UpdateListService.updateListEvent.subscribe(() => {
|
|
105
|
+
this.list.get()
|
|
106
|
+
});
|
|
107
|
+
*
|
|
108
|
+
* 子页面:
|
|
109
|
+
*
|
|
110
|
+
private _UpdateListService=inject(UpdateListService)
|
|
111
|
+
this._UpdateListService.updateList();
|
|
112
|
+
*/
|
|
113
|
+
class UpdateListService {
|
|
114
|
+
constructor() {
|
|
115
|
+
this.updateListEvent = new EventEmitter();
|
|
116
|
+
/**
|
|
117
|
+
* 使用发起数据
|
|
118
|
+
* this.dataSubject.next(res);
|
|
119
|
+
*
|
|
120
|
+
* 接收数据产生回调
|
|
121
|
+
this._UpdateLogoService.userInfo$.subscribe((res) => {
|
|
122
|
+
this.getData();
|
|
123
|
+
});
|
|
124
|
+
*/
|
|
125
|
+
this.dataSubject = new BehaviorSubject(null);
|
|
126
|
+
this.data$ = this.dataSubject.asObservable();
|
|
127
|
+
}
|
|
128
|
+
updateList() {
|
|
129
|
+
this.updateListEvent.emit();
|
|
130
|
+
}
|
|
131
|
+
updatedata(newdata) {
|
|
132
|
+
this.dataSubject.next(newdata);
|
|
133
|
+
}
|
|
134
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: UpdateListService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
135
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: UpdateListService, providedIn: 'root' }); }
|
|
136
|
+
}
|
|
137
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: UpdateListService, decorators: [{
|
|
73
138
|
type: Injectable,
|
|
74
139
|
args: [{
|
|
75
|
-
providedIn: 'root'
|
|
140
|
+
providedIn: 'root',
|
|
76
141
|
}]
|
|
77
|
-
}], ctorParameters:
|
|
142
|
+
}], ctorParameters: () => [] });
|
|
78
143
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
144
|
+
class ValidatorsService {
|
|
145
|
+
constructor() {
|
|
146
|
+
this.fb = inject(FormBuilder);
|
|
147
|
+
this.toaster = inject(ToasterService);
|
|
148
|
+
this._LocalizationService = inject(LocalizationService);
|
|
149
|
+
}
|
|
150
|
+
/**检查表单- */
|
|
151
|
+
isCheckForm(input, module = 'AbpValidation') {
|
|
152
|
+
let keys = Object.keys(input);
|
|
153
|
+
for (let i = 0; i < keys.length; i++) {
|
|
154
|
+
const element = keys[i];
|
|
155
|
+
if (input[element] == false) {
|
|
156
|
+
let info = `"${this._LocalizationService.instant(`${module}::${element}`)}" `;
|
|
157
|
+
if (element.includes('.') && !element.includes('].')) {
|
|
158
|
+
let arr = element.split('.');
|
|
159
|
+
info = `"${this._LocalizationService.instant(`${module}::${arr[0]}`)}.${this._LocalizationService.instant(`${module}::${arr[1]}`)}"`;
|
|
160
|
+
}
|
|
161
|
+
if (element.includes('].')) {
|
|
162
|
+
let arr = element.split('].');
|
|
163
|
+
let arrStart = arr[0].split('[');
|
|
164
|
+
info = `"${this._LocalizationService.instant(`${module}::${arrStart[0]}`)}[${arrStart[1]}].${this._LocalizationService.instant(`${module}::${arr[1]}`)}"`;
|
|
165
|
+
}
|
|
166
|
+
info = info + this._LocalizationService.instant(`AbpValidation::ThisFieldIsNotValid.`);
|
|
167
|
+
//使用abp多语言提示
|
|
168
|
+
this.toaster.warn(info);
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
/**获取表单所有字段是否通过验证 */
|
|
175
|
+
getFormValidationStatus(formEntity) {
|
|
176
|
+
let validationStatus = {};
|
|
177
|
+
// 递归遍历表单组和表单控件集合
|
|
178
|
+
const traverseForm = (form, prefix = '') => {
|
|
179
|
+
if (form instanceof FormGroup) {
|
|
180
|
+
Object.keys(form.controls).forEach(key => {
|
|
181
|
+
const control = form.controls[key];
|
|
182
|
+
let displayName = key.charAt(0).toUpperCase() + key.slice(1);
|
|
183
|
+
const fullKey = prefix ? `${prefix}.${displayName}` : displayName;
|
|
184
|
+
if (control instanceof FormControl) {
|
|
185
|
+
validationStatus[fullKey] = control.valid;
|
|
186
|
+
}
|
|
187
|
+
else if (control instanceof FormArray) {
|
|
188
|
+
traverseForm(control, fullKey);
|
|
189
|
+
}
|
|
190
|
+
else if (control instanceof FormGroup) {
|
|
191
|
+
traverseForm(control, fullKey);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
else if (form instanceof FormArray) {
|
|
196
|
+
form.controls.forEach((control, index) => {
|
|
197
|
+
const fullKey = prefix ? `${prefix}[${index}]` : `[${index}]`;
|
|
198
|
+
if (control instanceof FormControl) {
|
|
199
|
+
validationStatus[fullKey] = control.valid;
|
|
200
|
+
}
|
|
201
|
+
else if (control instanceof FormArray) {
|
|
202
|
+
traverseForm(control, fullKey);
|
|
203
|
+
}
|
|
204
|
+
else if (control instanceof FormGroup) {
|
|
205
|
+
traverseForm(control, fullKey);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
traverseForm(formEntity);
|
|
211
|
+
return validationStatus;
|
|
212
|
+
}
|
|
213
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
214
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, providedIn: 'root' }); }
|
|
215
|
+
}
|
|
216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, decorators: [{
|
|
217
|
+
type: Injectable,
|
|
218
|
+
args: [{
|
|
219
|
+
providedIn: 'root',
|
|
220
|
+
}]
|
|
221
|
+
}], ctorParameters: () => [] });
|
|
222
|
+
|
|
223
|
+
/**获取当前窗口域名
|
|
224
|
+
* 需要将environment.ts页面配置
|
|
225
|
+
application: {
|
|
226
|
+
baseUrl,
|
|
227
|
+
name: 'Travely',
|
|
228
|
+
webUrl:'https://localhost:44374',
|
|
229
|
+
},
|
|
230
|
+
*
|
|
82
231
|
*/
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
232
|
+
class GetNowDomainPipe {
|
|
233
|
+
constructor() {
|
|
234
|
+
this.environment = inject(EnvironmentService);
|
|
235
|
+
}
|
|
236
|
+
transform(value, ...args) {
|
|
237
|
+
let production = this.environment.getEnvironment()?.production;
|
|
238
|
+
let application = this.environment.getEnvironment()?.application;
|
|
239
|
+
let webUrl = application?.webUrl;
|
|
240
|
+
if (!production)
|
|
241
|
+
return webUrl + value;
|
|
242
|
+
return this.get(value);
|
|
243
|
+
}
|
|
244
|
+
/**获取当前域名并重定向链接 */
|
|
245
|
+
get(value) {
|
|
246
|
+
const baseUrl = (function () {
|
|
247
|
+
let extractDomain = (url) => {
|
|
248
|
+
const regex = /^(https?:\/\/)?([^\/]+)(?:[\/?].*)?$/;
|
|
249
|
+
const match = url.match(regex);
|
|
250
|
+
if (match) {
|
|
251
|
+
const protocol = match[1] || '';
|
|
252
|
+
const domain = `${protocol}${match[2]}`;
|
|
253
|
+
return `${domain}`;
|
|
254
|
+
}
|
|
255
|
+
return url;
|
|
256
|
+
};
|
|
257
|
+
let url = window.location.href;
|
|
258
|
+
return `${extractDomain(url)}` + value;
|
|
259
|
+
})();
|
|
260
|
+
return baseUrl;
|
|
261
|
+
}
|
|
262
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: GetNowDomainPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
263
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.5", ngImport: i0, type: GetNowDomainPipe, isStandalone: true, name: "getNowDomain" }); }
|
|
90
264
|
}
|
|
265
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: GetNowDomainPipe, decorators: [{
|
|
266
|
+
type: Pipe,
|
|
267
|
+
args: [{
|
|
268
|
+
name: 'getNowDomain',
|
|
269
|
+
standalone: true
|
|
270
|
+
}]
|
|
271
|
+
}] });
|
|
91
272
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
273
|
+
//pipe下新建:get-tenant-img.pipe.ts,
|
|
274
|
+
//如何引用见:独立管道的使用
|
|
275
|
+
class GetTenantImgPipe {
|
|
276
|
+
constructor() {
|
|
277
|
+
this.configState = inject(ConfigStateService);
|
|
278
|
+
this.environment = inject(EnvironmentService);
|
|
279
|
+
}
|
|
280
|
+
transform(value, ...args) {
|
|
281
|
+
let tenantId = this.configState.getDeep('currentUser.tenantId');
|
|
282
|
+
const environment = this.environment.getEnvironment();
|
|
283
|
+
let imgUrl = `${environment.apis.default.url}/api/file-explorer/files/${args}/${value}?__tenant=${tenantId}`;
|
|
284
|
+
return value ? imgUrl : '';
|
|
285
|
+
}
|
|
286
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: GetTenantImgPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
287
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.5", ngImport: i0, type: GetTenantImgPipe, isStandalone: true, name: "getTenantImg" }); }
|
|
288
|
+
}
|
|
289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: GetTenantImgPipe, decorators: [{
|
|
290
|
+
type: Pipe,
|
|
291
|
+
args: [{
|
|
292
|
+
name: 'getTenantImg',
|
|
293
|
+
standalone: true,
|
|
294
|
+
}]
|
|
295
|
+
}] });
|
|
296
|
+
|
|
297
|
+
class SlugNormalizerPipe {
|
|
298
|
+
transform(value, ...args) {
|
|
299
|
+
return this.normalize(value);
|
|
300
|
+
}
|
|
301
|
+
normalize(value) {
|
|
302
|
+
// Convert to lowercase
|
|
303
|
+
value = value.toLowerCase();
|
|
304
|
+
// Replace special characters with hyphen
|
|
305
|
+
const invalidChars = ['\\', '/', '?', '&', '=', '+', '%', '#', '@', '!', '$', '\'', '"', ':', ';', '>', '<', '*', '(', ')', '[', '],', '{', '}', '|', '^', '`', '~'];
|
|
306
|
+
for (let c of invalidChars) {
|
|
307
|
+
value = value.replaceAll(c, '-');
|
|
308
|
+
}
|
|
309
|
+
// Convert spaces to hyphens
|
|
310
|
+
value = value.replaceAll(" ", "-");
|
|
311
|
+
// Remove multiple consecutive hyphens
|
|
312
|
+
while (value.includes("--")) {
|
|
313
|
+
value = value.replaceAll("--", "-");
|
|
314
|
+
}
|
|
315
|
+
// Trim hyphens from start and end
|
|
316
|
+
value = value.trim('-');
|
|
317
|
+
// URL encode the remaining string (handles UTF-8 characters)
|
|
318
|
+
//部分编码-保留语义
|
|
319
|
+
//return encodeURI(value);
|
|
320
|
+
//全部编码
|
|
321
|
+
return encodeURIComponent(value);
|
|
100
322
|
}
|
|
101
|
-
static
|
|
102
|
-
static
|
|
103
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CoreExpandModule });
|
|
323
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SlugNormalizerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
324
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.5", ngImport: i0, type: SlugNormalizerPipe, isStandalone: true, name: "slugNormalizer" }); }
|
|
104
325
|
}
|
|
105
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
106
|
-
type:
|
|
326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SlugNormalizerPipe, decorators: [{
|
|
327
|
+
type: Pipe,
|
|
107
328
|
args: [{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
exports: [],
|
|
329
|
+
name: 'slugNormalizer',
|
|
330
|
+
standalone: true
|
|
111
331
|
}]
|
|
112
332
|
}] });
|
|
113
333
|
|
|
334
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
335
|
+
class ImagePreviewComponent {
|
|
336
|
+
set src(v) {
|
|
337
|
+
this._src = v;
|
|
338
|
+
}
|
|
339
|
+
constructor(modalService) {
|
|
340
|
+
this.modalService = modalService;
|
|
341
|
+
/**图片链接 */
|
|
342
|
+
this._src = '';
|
|
343
|
+
/**是否预览 */
|
|
344
|
+
this.preview = true;
|
|
345
|
+
/**宽 */
|
|
346
|
+
this.width = 90;
|
|
347
|
+
/**高 */
|
|
348
|
+
this.height = 90;
|
|
349
|
+
this.rounded = '';
|
|
350
|
+
this.id = '';
|
|
351
|
+
/**放大倍数 */
|
|
352
|
+
this.zoom = 10;
|
|
353
|
+
/**旋转 */
|
|
354
|
+
this.rotate = 0;
|
|
355
|
+
// private modalService = inject(NgbModal);
|
|
356
|
+
this.deleteChange = new EventEmitter();
|
|
357
|
+
this.checkChange = new EventEmitter();
|
|
358
|
+
}
|
|
359
|
+
/**选择图片的事件,返回父组件是否选中 */
|
|
360
|
+
checkImage(event) {
|
|
361
|
+
this.checkChange.emit(event.target.checked);
|
|
362
|
+
}
|
|
363
|
+
/**删除图片 */
|
|
364
|
+
deletecoverPics() {
|
|
365
|
+
this.deleteChange.emit();
|
|
366
|
+
}
|
|
367
|
+
/**打开预览弹窗 */
|
|
368
|
+
OpenPreviewImage(content) {
|
|
369
|
+
this.modalRef = this.modalService.open(content, {
|
|
370
|
+
fullscreen: true,
|
|
371
|
+
modalDialogClass: 'dignite-preview',
|
|
372
|
+
});
|
|
373
|
+
this.modalRef.result.then(result => { }, reason => {
|
|
374
|
+
this.zoom = 10;
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/**放大图像 */
|
|
378
|
+
zoomIn() {
|
|
379
|
+
let zoom = this.zoom;
|
|
380
|
+
if (zoom == 20)
|
|
381
|
+
return;
|
|
382
|
+
zoom++;
|
|
383
|
+
this.zoom = zoom;
|
|
384
|
+
}
|
|
385
|
+
/**缩小图像 */
|
|
386
|
+
zoomOut() {
|
|
387
|
+
let zoom = this.zoom;
|
|
388
|
+
if (zoom == 3)
|
|
389
|
+
return;
|
|
390
|
+
zoom--;
|
|
391
|
+
this.zoom = zoom;
|
|
392
|
+
}
|
|
393
|
+
/**右旋转 */
|
|
394
|
+
RotateRight() {
|
|
395
|
+
if (this.rotate == 360)
|
|
396
|
+
return (this.rotate = 0);
|
|
397
|
+
this.rotate += 90;
|
|
398
|
+
}
|
|
399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ImagePreviewComponent, deps: [{ token: i1.NgbModal }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
400
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: ImagePreviewComponent, isStandalone: true, selector: "app-image-preview", inputs: { src: "src", preview: "preview", width: "width", height: "height", rounded: "rounded", id: "id" }, outputs: { deleteChange: "deleteChange", checkChange: "checkChange" }, ngImport: i0, template: `
|
|
401
|
+
<div
|
|
402
|
+
[id]="id"
|
|
403
|
+
*ngIf="_src"
|
|
404
|
+
class="image-preview imagehove border position-relative m-1 overflow-hidden "
|
|
405
|
+
[style]="{'width': width+'px','height': height+'px',borderRadius:rounded}" [ngClass]="{'rounded-4': !rounded}"
|
|
406
|
+
>
|
|
407
|
+
<img [src]="_src" alt="" class="w-100 h-100 object-fit-cover" />
|
|
408
|
+
<input
|
|
409
|
+
type="checkbox"
|
|
410
|
+
class="form-check-input position-absolute top-0 end-0 m-1"
|
|
411
|
+
*ngIf="checkChange.observed"
|
|
412
|
+
(change)="checkImage($event)"
|
|
413
|
+
style="z-index: 10;"
|
|
414
|
+
/>
|
|
415
|
+
<div
|
|
416
|
+
class="w-100 h-100 text-white position-absolute top-0 start-0"
|
|
417
|
+
style="background-color: #00000050;"
|
|
418
|
+
*ngIf="preview || deleteChange.observed"
|
|
419
|
+
>
|
|
420
|
+
<i
|
|
421
|
+
type="button"
|
|
422
|
+
class="fa fa-eye p-2"
|
|
423
|
+
*ngIf="preview"
|
|
424
|
+
(click.stop)="OpenPreviewImage(content)"
|
|
425
|
+
></i>
|
|
426
|
+
<i
|
|
427
|
+
type="button"
|
|
428
|
+
class="fa fa-times p-2"
|
|
429
|
+
*ngIf="deleteChange.observed"
|
|
430
|
+
(click.stop)="deletecoverPics()"
|
|
431
|
+
></i>
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
|
|
435
|
+
<ng-template #content let-modal>
|
|
436
|
+
<div class="modal-header">
|
|
437
|
+
<div class="d-flex justify-content-end w-100 fs-3 text-white">
|
|
438
|
+
<i
|
|
439
|
+
class="mx-2 fa fa fa-repeat"
|
|
440
|
+
aria-hidden="true"
|
|
441
|
+
title="右旋转"
|
|
442
|
+
role="button"
|
|
443
|
+
(click)="RotateRight()"
|
|
444
|
+
></i>
|
|
445
|
+
<i
|
|
446
|
+
class="mx-2 fa fa-search-minus"
|
|
447
|
+
aria-hidden="true"
|
|
448
|
+
title="缩小"
|
|
449
|
+
role="button"
|
|
450
|
+
(click)="zoomOut()"
|
|
451
|
+
></i>
|
|
452
|
+
<i
|
|
453
|
+
class="mx-2 fa fa-search-plus"
|
|
454
|
+
aria-hidden="true"
|
|
455
|
+
title="放大"
|
|
456
|
+
role="button"
|
|
457
|
+
(click)="zoomIn()"
|
|
458
|
+
></i>
|
|
459
|
+
<i
|
|
460
|
+
class="mx-2 fa fa-times"
|
|
461
|
+
aria-hidden="true"
|
|
462
|
+
role="button"
|
|
463
|
+
(click)="modal.dismiss('Cross click')"
|
|
464
|
+
></i>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
<div class="modal-body d-flex justify-content-center align-items-center ">
|
|
468
|
+
<img
|
|
469
|
+
width="400"
|
|
470
|
+
class="modal-body-preview"
|
|
471
|
+
[src]="_src"
|
|
472
|
+
[style.transform]="'scale(' + zoom / 10 + ') rotate(' + rotate + 'deg)'"
|
|
473
|
+
/>
|
|
474
|
+
</div>
|
|
475
|
+
</ng-template>
|
|
476
|
+
`, isInline: true, styles: [".image-preview.imagehove>div{display:none}.image-preview.imagehove:hover div{display:flex;align-items:center;justify-content:center}::ng-deep .dignite-preview .modal-content{background-color:transparent!important}.object-fit-cover{object-fit:cover}\n"], dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "ngmodule", type: ThemeSharedModule }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: PageModule }] }); }
|
|
477
|
+
}
|
|
478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ImagePreviewComponent, decorators: [{
|
|
479
|
+
type: Component,
|
|
480
|
+
args: [{ selector: 'app-image-preview', template: `
|
|
481
|
+
<div
|
|
482
|
+
[id]="id"
|
|
483
|
+
*ngIf="_src"
|
|
484
|
+
class="image-preview imagehove border position-relative m-1 overflow-hidden "
|
|
485
|
+
[style]="{'width': width+'px','height': height+'px',borderRadius:rounded}" [ngClass]="{'rounded-4': !rounded}"
|
|
486
|
+
>
|
|
487
|
+
<img [src]="_src" alt="" class="w-100 h-100 object-fit-cover" />
|
|
488
|
+
<input
|
|
489
|
+
type="checkbox"
|
|
490
|
+
class="form-check-input position-absolute top-0 end-0 m-1"
|
|
491
|
+
*ngIf="checkChange.observed"
|
|
492
|
+
(change)="checkImage($event)"
|
|
493
|
+
style="z-index: 10;"
|
|
494
|
+
/>
|
|
495
|
+
<div
|
|
496
|
+
class="w-100 h-100 text-white position-absolute top-0 start-0"
|
|
497
|
+
style="background-color: #00000050;"
|
|
498
|
+
*ngIf="preview || deleteChange.observed"
|
|
499
|
+
>
|
|
500
|
+
<i
|
|
501
|
+
type="button"
|
|
502
|
+
class="fa fa-eye p-2"
|
|
503
|
+
*ngIf="preview"
|
|
504
|
+
(click.stop)="OpenPreviewImage(content)"
|
|
505
|
+
></i>
|
|
506
|
+
<i
|
|
507
|
+
type="button"
|
|
508
|
+
class="fa fa-times p-2"
|
|
509
|
+
*ngIf="deleteChange.observed"
|
|
510
|
+
(click.stop)="deletecoverPics()"
|
|
511
|
+
></i>
|
|
512
|
+
</div>
|
|
513
|
+
</div>
|
|
514
|
+
|
|
515
|
+
<ng-template #content let-modal>
|
|
516
|
+
<div class="modal-header">
|
|
517
|
+
<div class="d-flex justify-content-end w-100 fs-3 text-white">
|
|
518
|
+
<i
|
|
519
|
+
class="mx-2 fa fa fa-repeat"
|
|
520
|
+
aria-hidden="true"
|
|
521
|
+
title="右旋转"
|
|
522
|
+
role="button"
|
|
523
|
+
(click)="RotateRight()"
|
|
524
|
+
></i>
|
|
525
|
+
<i
|
|
526
|
+
class="mx-2 fa fa-search-minus"
|
|
527
|
+
aria-hidden="true"
|
|
528
|
+
title="缩小"
|
|
529
|
+
role="button"
|
|
530
|
+
(click)="zoomOut()"
|
|
531
|
+
></i>
|
|
532
|
+
<i
|
|
533
|
+
class="mx-2 fa fa-search-plus"
|
|
534
|
+
aria-hidden="true"
|
|
535
|
+
title="放大"
|
|
536
|
+
role="button"
|
|
537
|
+
(click)="zoomIn()"
|
|
538
|
+
></i>
|
|
539
|
+
<i
|
|
540
|
+
class="mx-2 fa fa-times"
|
|
541
|
+
aria-hidden="true"
|
|
542
|
+
role="button"
|
|
543
|
+
(click)="modal.dismiss('Cross click')"
|
|
544
|
+
></i>
|
|
545
|
+
</div>
|
|
546
|
+
</div>
|
|
547
|
+
<div class="modal-body d-flex justify-content-center align-items-center ">
|
|
548
|
+
<img
|
|
549
|
+
width="400"
|
|
550
|
+
class="modal-body-preview"
|
|
551
|
+
[src]="_src"
|
|
552
|
+
[style.transform]="'scale(' + zoom / 10 + ') rotate(' + rotate + 'deg)'"
|
|
553
|
+
/>
|
|
554
|
+
</div>
|
|
555
|
+
</ng-template>
|
|
556
|
+
`, standalone: true, imports: [CoreModule, ThemeSharedModule, CommonModule, PageModule], styles: [".image-preview.imagehove>div{display:none}.image-preview.imagehove:hover div{display:flex;align-items:center;justify-content:center}::ng-deep .dignite-preview .modal-content{background-color:transparent!important}.object-fit-cover{object-fit:cover}\n"] }]
|
|
557
|
+
}], ctorParameters: () => [{ type: i1.NgbModal }], propDecorators: { src: [{
|
|
558
|
+
type: Input
|
|
559
|
+
}], preview: [{
|
|
560
|
+
type: Input
|
|
561
|
+
}], width: [{
|
|
562
|
+
type: Input
|
|
563
|
+
}], height: [{
|
|
564
|
+
type: Input
|
|
565
|
+
}], rounded: [{
|
|
566
|
+
type: Input
|
|
567
|
+
}], id: [{
|
|
568
|
+
type: Input
|
|
569
|
+
}], deleteChange: [{
|
|
570
|
+
type: Output
|
|
571
|
+
}], checkChange: [{
|
|
572
|
+
type: Output
|
|
573
|
+
}] } });
|
|
574
|
+
|
|
575
|
+
/* eslint-disable @angular-eslint/directive-selector */
|
|
576
|
+
class KeydownPreventDefaultDirective {
|
|
577
|
+
constructor() { }
|
|
578
|
+
onKeyDown(event) {
|
|
579
|
+
event.preventDefault();
|
|
580
|
+
}
|
|
581
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: KeydownPreventDefaultDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
582
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.5", type: KeydownPreventDefaultDirective, isStandalone: true, selector: "[KeydownPreventDefault]", host: { listeners: { "keydown.enter": "onKeyDown($event)" } }, ngImport: i0 }); }
|
|
583
|
+
}
|
|
584
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: KeydownPreventDefaultDirective, decorators: [{
|
|
585
|
+
type: Directive,
|
|
586
|
+
args: [{
|
|
587
|
+
selector: '[KeydownPreventDefault]',
|
|
588
|
+
standalone: true,
|
|
589
|
+
}]
|
|
590
|
+
}], ctorParameters: () => [], propDecorators: { onKeyDown: [{
|
|
591
|
+
type: HostListener,
|
|
592
|
+
args: ['keydown.enter', ['$event']]
|
|
593
|
+
}] } });
|
|
594
|
+
|
|
114
595
|
/*
|
|
115
596
|
* Public API Surface of core
|
|
116
597
|
*/
|
|
@@ -119,5 +600,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
119
600
|
* Generated bundle index. Do not edit.
|
|
120
601
|
*/
|
|
121
602
|
|
|
122
|
-
export {
|
|
603
|
+
export { GetNowDomainPipe, GetTenantImgPipe, ImagePreviewComponent, KeydownPreventDefaultDirective, SimpleReuseStrategy, SlugNormalizerPipe, UpdateListService, ValidatorsService };
|
|
123
604
|
//# sourceMappingURL=dignite-ng-expand.core.mjs.map
|