cmat 0.0.76 → 0.0.78
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/fesm2022/cmat-components-adapter.mjs +9 -9
- package/fesm2022/cmat-components-breadcrumb.mjs +9 -9
- package/fesm2022/cmat-components-card.mjs +4 -4
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +12 -12
- package/fesm2022/cmat-components-cascade.mjs +9 -9
- package/fesm2022/cmat-components-chip-input.mjs +3 -3
- package/fesm2022/cmat-components-code-editor.mjs +77 -0
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -0
- package/fesm2022/cmat-components-custom-formly.mjs +93 -129
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +3 -3
- package/fesm2022/cmat-components-date-time-display.mjs +47 -0
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -0
- package/fesm2022/cmat-components-drawer.mjs +6 -6
- package/fesm2022/cmat-components-empty-state.mjs +66 -0
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -0
- package/fesm2022/cmat-components-file-preview.mjs +60 -0
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -0
- package/fesm2022/cmat-components-filter-toolbar.mjs +125 -0
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -0
- package/fesm2022/cmat-components-form-actions.mjs +33 -0
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -0
- package/fesm2022/cmat-components-fullscreen.mjs +3 -3
- package/fesm2022/cmat-components-highlight.mjs +6 -6
- package/fesm2022/cmat-components-image-viewer.mjs +3 -3
- package/fesm2022/cmat-components-inline-loading.mjs +40 -0
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -0
- package/fesm2022/cmat-components-json-editor.mjs +99 -79
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +3 -3
- package/fesm2022/cmat-components-masonry.mjs +3 -3
- package/fesm2022/cmat-components-material-color-picker.mjs +3 -3
- package/fesm2022/cmat-components-material-datetimepicker.mjs +42 -42
- package/fesm2022/cmat-components-navigation.mjs +39 -39
- package/fesm2022/cmat-components-opt-input.mjs +3 -3
- package/fesm2022/cmat-components-org-chart.mjs +9 -9
- package/fesm2022/cmat-components-page-header.mjs +50 -0
- package/fesm2022/cmat-components-page-header.mjs.map +1 -0
- package/fesm2022/cmat-components-pagination.mjs +12 -12
- package/fesm2022/cmat-components-password-strength.mjs +9 -9
- package/fesm2022/cmat-components-popover.mjs +9 -9
- package/fesm2022/cmat-components-progress-bar.mjs +3 -3
- package/fesm2022/cmat-components-qrcode.mjs +3 -3
- package/fesm2022/cmat-components-rating.mjs +3 -3
- package/fesm2022/cmat-components-rich-text-editor.mjs +64 -0
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -0
- package/fesm2022/cmat-components-select-search.mjs +9 -9
- package/fesm2022/cmat-components-select-table.mjs +3 -3
- package/fesm2022/cmat-components-select-tree.mjs +3 -3
- package/fesm2022/cmat-components-skeleton.mjs +60 -0
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -0
- package/fesm2022/cmat-components-speed-dial.mjs +9 -9
- package/fesm2022/cmat-components-status-tag.mjs +67 -0
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -0
- package/fesm2022/cmat-components-table-toolbar.mjs +45 -0
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -0
- package/fesm2022/cmat-components-timeline.mjs +12 -12
- package/fesm2022/cmat-components-toast.mjs +9 -9
- package/fesm2022/cmat-components-transfer-picker.mjs +18 -18
- package/fesm2022/cmat-components-treetable.mjs +6 -6
- package/fesm2022/cmat-components-upload.mjs +9 -9
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -6
- package/fesm2022/cmat-directives-arrow-cursor.mjs +3 -3
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-data-exporter.mjs +21 -21
- package/fesm2022/cmat-directives-debounce.mjs +9 -9
- package/fesm2022/cmat-directives-digit-only.mjs +6 -6
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +3 -3
- package/fesm2022/cmat-lib-mock-api.mjs +6 -6
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -3
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-secure.mjs +3 -3
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-services-alert.mjs +3 -3
- package/fesm2022/cmat-services-config.mjs +6 -6
- package/fesm2022/cmat-services-confirmation.mjs +6 -6
- package/fesm2022/cmat-services-data.mjs +3 -3
- package/fesm2022/cmat-services-export-as.mjs +3 -3
- package/fesm2022/cmat-services-loading.mjs +6 -6
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-media-watcher.mjs +3 -3
- package/fesm2022/cmat-services-platform.mjs +3 -3
- package/fesm2022/cmat-services-splash-screen.mjs +3 -3
- package/fesm2022/cmat-services-title.mjs +3 -3
- package/fesm2022/cmat-services-translation.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs +3 -3
- package/fesm2022/cmat.mjs +18970 -0
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +68 -15
- package/types/cmat-components-code-editor.d.ts +36 -0
- package/types/cmat-components-custom-formly.d.ts +1 -11
- package/types/cmat-components-date-time-display.d.ts +28 -0
- package/types/cmat-components-empty-state.d.ts +37 -0
- package/types/cmat-components-file-preview.d.ts +32 -0
- package/types/cmat-components-filter-toolbar.d.ts +65 -0
- package/types/cmat-components-form-actions.d.ts +16 -0
- package/types/cmat-components-inline-loading.d.ts +20 -0
- package/types/cmat-components-json-editor.d.ts +9 -3
- package/types/cmat-components-page-header.d.ts +28 -0
- package/types/cmat-components-rich-text-editor.d.ts +38 -0
- package/types/cmat-components-skeleton.d.ts +33 -0
- package/types/cmat-components-status-tag.d.ts +29 -0
- package/types/cmat-components-table-toolbar.d.ts +24 -0
- package/types/cmat.d.ts +5150 -1
|
@@ -156,10 +156,10 @@ class CmatImageComponent {
|
|
|
156
156
|
const body = this._document.body;
|
|
157
157
|
body.style.overflow = this._originalOverflow ?? '';
|
|
158
158
|
}
|
|
159
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
160
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
159
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
160
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatImageComponent, isStandalone: true, selector: "cmat-image", inputs: { imageClass: "imageClass", imageStyle: "imageStyle", src: "src", srcSet: "srcSet", previewImageSrc: "previewImageSrc", previewImageSrcSet: "previewImageSrcSet", alt: "alt", width: "width", height: "height", loading: "loading", appendTo: "appendTo", preview: ["preview", "preview", booleanAttribute] }, outputs: { previewShowChange: "previewShowChange", imageErrorEvent: "imageErrorEvent" }, host: { listeners: { "document:keydown.escape": "onKeydownHandler($event)" } }, viewQueries: [{ propertyName: "mask", first: true, predicate: ["mask"], descendants: true }, { propertyName: "previewButton", first: true, predicate: ["previewButton"], descendants: true }, { propertyName: "closeButton", first: true, predicate: ["closeButton"], descendants: true }], ngImport: i0, template: "<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>", styles: [".cmat-image-mask{display:flex;align-items:center;justify-content:center}.cmat-image-preview-container{position:relative;display:inline-block;line-height:0}.cmat-image-preview-indicator{position:absolute;left:0;top:0;width:100%;height:100%;outline:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .3s}.cmat-image-preview-container:hover>.cmat-image-preview-indicator{opacity:1;cursor:pointer;background-color:#00000080}.cmat-image-preview-container>img{cursor:pointer}.cmat-image-toolbar{position:absolute;top:0;right:0;display:flex;z-index:1;padding:.5rem}.cmat-image-preview{transition:transform .15s;max-width:100vw;max-height:100vh}.cmat-image-preview-enter{animation:preview-enter-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-preview-leave{animation:preview-leave-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-overlay{background-color:#0006;transition-duration:.2s;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99}.cmat-image-overlay-enter{animation:image-overlay-enter-animation .15s}.cmat-image-overlay-leave{z-index:0;animation:image-overlay-leave-animation .15s}@keyframes preview-enter-animation{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}@keyframes preview-leave-animation{0%{transform:scale(1);opacity:1}to{transform:scale(.7);opacity:0}}@keyframes image-overlay-enter-animation{0%{background-color:transparent}to{background-color:#000000e6}}@keyframes image-overlay-leave-animation{0%{background-color:#000000e6}to{background-color:transparent}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
161
161
|
}
|
|
162
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatImageComponent, decorators: [{
|
|
163
163
|
type: Component,
|
|
164
164
|
args: [{ selector: 'cmat-image', imports: [CommonModule, MatButtonModule, MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>", styles: [".cmat-image-mask{display:flex;align-items:center;justify-content:center}.cmat-image-preview-container{position:relative;display:inline-block;line-height:0}.cmat-image-preview-indicator{position:absolute;left:0;top:0;width:100%;height:100%;outline:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .3s}.cmat-image-preview-container:hover>.cmat-image-preview-indicator{opacity:1;cursor:pointer;background-color:#00000080}.cmat-image-preview-container>img{cursor:pointer}.cmat-image-toolbar{position:absolute;top:0;right:0;display:flex;z-index:1;padding:.5rem}.cmat-image-preview{transition:transform .15s;max-width:100vw;max-height:100vh}.cmat-image-preview-enter{animation:preview-enter-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-preview-leave{animation:preview-leave-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-overlay{background-color:#0006;transition-duration:.2s;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99}.cmat-image-overlay-enter{animation:image-overlay-enter-animation .15s}.cmat-image-overlay-leave{z-index:0;animation:image-overlay-leave-animation .15s}@keyframes preview-enter-animation{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}@keyframes preview-leave-animation{0%{transform:scale(1);opacity:1}to{transform:scale(.7);opacity:0}}@keyframes image-overlay-enter-animation{0%{background-color:transparent}to{background-color:#000000e6}}@keyframes image-overlay-leave-animation{0%{background-color:#000000e6}to{background-color:transparent}}\n"] }]
|
|
165
165
|
}], propDecorators: { imageClass: [{
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/material/progress-spinner';
|
|
4
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
5
|
+
|
|
6
|
+
class CmatInlineLoadingComponent {
|
|
7
|
+
constructor() {
|
|
8
|
+
/**
|
|
9
|
+
* 说明文字。
|
|
10
|
+
*/
|
|
11
|
+
this.message = '加载中...';
|
|
12
|
+
/**
|
|
13
|
+
* 圆环大小。
|
|
14
|
+
*/
|
|
15
|
+
this.diameter = 20;
|
|
16
|
+
/**
|
|
17
|
+
* 是否显示文字。
|
|
18
|
+
*/
|
|
19
|
+
this.showText = true;
|
|
20
|
+
}
|
|
21
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatInlineLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
22
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatInlineLoadingComponent, isStandalone: true, selector: "cmat-inline-loading", inputs: { message: "message", diameter: "diameter", showText: "showText" }, ngImport: i0, template: "<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n", styles: [":host{display:inline-flex}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatInlineLoadingComponent, decorators: [{
|
|
25
|
+
type: Component,
|
|
26
|
+
args: [{ selector: 'cmat-inline-loading', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatProgressSpinnerModule], template: "<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n", styles: [":host{display:inline-flex}\n"] }]
|
|
27
|
+
}], propDecorators: { message: [{
|
|
28
|
+
type: Input
|
|
29
|
+
}], diameter: [{
|
|
30
|
+
type: Input
|
|
31
|
+
}], showText: [{
|
|
32
|
+
type: Input
|
|
33
|
+
}] } });
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Generated bundle index. Do not edit.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
export { CmatInlineLoadingComponent };
|
|
40
|
+
//# sourceMappingURL=cmat-components-inline-loading.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmat-components-inline-loading.mjs","sources":["../../../projects/cmat/components/inline-loading/inline-loading.component.ts","../../../projects/cmat/components/inline-loading/inline-loading.component.html","../../../projects/cmat/components/inline-loading/cmat-components-inline-loading.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\n\r\n@Component({\r\n selector: 'cmat-inline-loading',\r\n templateUrl: './inline-loading.component.html',\r\n styleUrls: ['./inline-loading.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [MatProgressSpinnerModule]\r\n})\r\nexport class CmatInlineLoadingComponent {\r\n /**\r\n * 说明文字。\r\n */\r\n @Input() message = '加载中...';\r\n\r\n /**\r\n * 圆环大小。\r\n */\r\n @Input() diameter = 20;\r\n\r\n /**\r\n * 是否显示文字。\r\n */\r\n @Input() showText = true;\r\n}\r\n","<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAUa,0BAA0B,CAAA;AAPvC,IAAA,WAAA,GAAA;AAQI;;AAEG;QACM,IAAA,CAAA,OAAO,GAAG,QAAQ;AAE3B;;AAEG;QACM,IAAA,CAAA,QAAQ,GAAG,EAAE;AAEtB;;AAEG;QACM,IAAA,CAAA,QAAQ,GAAG,IAAI;AAC3B,IAAA;8GAfY,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,UAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECVvC,sUAMA,EAAA,MAAA,EAAA,CAAA,8BAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDEc,wBAAwB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,kBAAA,EAAA,QAAA,EAAA,mCAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAAA,UAAA,EAAA,aAAA,CAAA,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAEzB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAPtC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,qBAAqB,mBAGd,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,wBAAwB,CAAC,EAAA,QAAA,EAAA,sUAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,CAAA,EAAA;;sBAMlC;;sBAKA;;sBAKA;;;AExBL;;AAEG;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, inject, ChangeDetectorRef, Output, Input,
|
|
3
|
-
import {
|
|
3
|
+
import { EventEmitter, inject, ChangeDetectorRef, ViewChild, HostBinding, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { createAjvValidator, parseJSONPath, createMultiSelection, isJSONContent, isKeySelection, stringifyJSONPath, isMultiSelection, createJSONEditor } from 'vanilla-jsoneditor';
|
|
4
5
|
|
|
5
6
|
class CmatJsonEditorComponent {
|
|
6
7
|
constructor() {
|
|
@@ -11,14 +12,96 @@ class CmatJsonEditorComponent {
|
|
|
11
12
|
text: undefined,
|
|
12
13
|
json: {}
|
|
13
14
|
};
|
|
15
|
+
this._destroyed = false;
|
|
16
|
+
this._document = inject(DOCUMENT);
|
|
14
17
|
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
15
18
|
}
|
|
19
|
+
get darkTheme() {
|
|
20
|
+
return this._isDarkTheme;
|
|
21
|
+
}
|
|
22
|
+
get _isDarkTheme() {
|
|
23
|
+
return this._document.documentElement.classList.contains('dark') || this._document.body.classList.contains('dark');
|
|
24
|
+
}
|
|
25
|
+
set jsonEditorContainer(value) {
|
|
26
|
+
this._jsonEditorContainer = value;
|
|
27
|
+
this._initializeEditor();
|
|
28
|
+
}
|
|
16
29
|
ngOnInit() {
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
this._initializeEditor();
|
|
31
|
+
}
|
|
32
|
+
ngOnChanges(changes) {
|
|
33
|
+
if (changes.data) {
|
|
34
|
+
this.content = {
|
|
35
|
+
text: undefined,
|
|
36
|
+
json: this.data
|
|
37
|
+
};
|
|
38
|
+
if (this._editor) {
|
|
39
|
+
void this._editor.update(this.content);
|
|
40
|
+
}
|
|
41
|
+
this._changeDetectorRef.markForCheck();
|
|
42
|
+
}
|
|
43
|
+
if (changes.options) {
|
|
44
|
+
if (this._editor) {
|
|
45
|
+
void this._editor?.updateProps(this.options);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
ngOnDestroy() {
|
|
50
|
+
this._destroyed = true;
|
|
51
|
+
void this._editor?.destroy();
|
|
52
|
+
}
|
|
53
|
+
setSchema(schema) {
|
|
54
|
+
const validator = createAjvValidator({ schema });
|
|
55
|
+
void this._editor?.updateProps({ validator: validator });
|
|
56
|
+
}
|
|
57
|
+
setSelectionToPath(pathString) {
|
|
58
|
+
const path = parseJSONPath(pathString);
|
|
59
|
+
const selection = createMultiSelection(path, path);
|
|
60
|
+
try {
|
|
61
|
+
void this._editor?.select(selection);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.warn('Set selection to path not possible:', pathString, error);
|
|
65
|
+
}
|
|
66
|
+
this.pathChanged.emit(pathString);
|
|
67
|
+
}
|
|
68
|
+
get() {
|
|
69
|
+
if (this._editor) {
|
|
70
|
+
const content = this._editor.get();
|
|
71
|
+
if (isJSONContent(content)) {
|
|
72
|
+
const j = this._editor.get().json;
|
|
73
|
+
return j;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const t = this._editor.get().text;
|
|
77
|
+
const j = JSON.parse(t);
|
|
78
|
+
return j;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
set(json) {
|
|
84
|
+
const value = {
|
|
85
|
+
json: json,
|
|
86
|
+
};
|
|
87
|
+
void this._editor?.set(value);
|
|
88
|
+
}
|
|
89
|
+
_onSelect(selection) {
|
|
90
|
+
if (isKeySelection(selection)) {
|
|
91
|
+
const st = stringifyJSONPath(selection.path);
|
|
92
|
+
this.pathChanged.emit(st);
|
|
93
|
+
}
|
|
94
|
+
else if (isMultiSelection(selection)) {
|
|
95
|
+
const st = stringifyJSONPath(selection.anchorPath);
|
|
96
|
+
this.pathChanged.emit(st);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
_initializeEditor() {
|
|
100
|
+
if (this._destroyed || this._editor || !this._jsonEditorContainer?.nativeElement) {
|
|
101
|
+
return;
|
|
19
102
|
}
|
|
20
103
|
this._editor = createJSONEditor({
|
|
21
|
-
target: this.
|
|
104
|
+
target: this._jsonEditorContainer.nativeElement,
|
|
22
105
|
props: {
|
|
23
106
|
...this.options,
|
|
24
107
|
content: this.content,
|
|
@@ -90,82 +173,13 @@ class CmatJsonEditorComponent {
|
|
|
90
173
|
},
|
|
91
174
|
});
|
|
92
175
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.content = {
|
|
96
|
-
text: undefined,
|
|
97
|
-
json: this.data
|
|
98
|
-
};
|
|
99
|
-
if (this._editor) {
|
|
100
|
-
void this._editor.update(this.content);
|
|
101
|
-
}
|
|
102
|
-
this._changeDetectorRef.markForCheck();
|
|
103
|
-
}
|
|
104
|
-
if (changes.options) {
|
|
105
|
-
if (this._editor) {
|
|
106
|
-
void this._editor?.updateProps(this.options);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
ngOnDestroy() {
|
|
111
|
-
void this._editor?.destroy();
|
|
112
|
-
}
|
|
113
|
-
setSchema(schema) {
|
|
114
|
-
const validator = createAjvValidator({ schema });
|
|
115
|
-
void this._editor?.updateProps({ validator: validator });
|
|
116
|
-
}
|
|
117
|
-
setSelectionToPath(pathString) {
|
|
118
|
-
const path = parseJSONPath(pathString);
|
|
119
|
-
const selection = createMultiSelection(path, path);
|
|
120
|
-
try {
|
|
121
|
-
void this._editor?.select(selection);
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
console.warn('Set selection to path not possible:', pathString, error);
|
|
125
|
-
}
|
|
126
|
-
this.pathChanged.emit(pathString);
|
|
127
|
-
}
|
|
128
|
-
get() {
|
|
129
|
-
if (this._editor) {
|
|
130
|
-
const content = this._editor.get();
|
|
131
|
-
if (isJSONContent(content)) {
|
|
132
|
-
const j = this._editor.get().json;
|
|
133
|
-
return j;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
const t = this._editor.get().text;
|
|
137
|
-
const j = JSON.parse(t);
|
|
138
|
-
return j;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return undefined;
|
|
142
|
-
}
|
|
143
|
-
set(json) {
|
|
144
|
-
const value = {
|
|
145
|
-
json: json,
|
|
146
|
-
};
|
|
147
|
-
void this._editor?.set(value);
|
|
148
|
-
}
|
|
149
|
-
_onSelect(selection) {
|
|
150
|
-
if (isKeySelection(selection)) {
|
|
151
|
-
const st = stringifyJSONPath(selection.path);
|
|
152
|
-
this.pathChanged.emit(st);
|
|
153
|
-
}
|
|
154
|
-
else if (isMultiSelection(selection)) {
|
|
155
|
-
const st = stringifyJSONPath(selection.anchorPath);
|
|
156
|
-
this.pathChanged.emit(st);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CmatJsonEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
160
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CmatJsonEditorComponent, isStandalone: true, selector: "cmat-json-editor", inputs: { options: "options", data: "data" }, outputs: { contentChanged: "contentChanged", pathChanged: "pathChanged" }, viewQueries: [{ propertyName: "jsonEditorContainer", first: true, predicate: ["jsonEditorContainer"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: '<div class="cmat-jsoneditor" [id]="id" #jsonEditorContainer></div>', isInline: true, styles: [".cmat-jsoneditor .jse-main.svelte-sxaskb{min-height:24rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatJsonEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
177
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatJsonEditorComponent, isStandalone: true, selector: "cmat-json-editor", inputs: { options: "options", data: "data" }, outputs: { contentChanged: "contentChanged", pathChanged: "pathChanged" }, host: { properties: { "class.jse-theme-dark": "this.darkTheme" } }, viewQueries: [{ propertyName: "jsonEditorContainer", first: true, predicate: ["jsonEditorContainer"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@defer (on viewport) {\r\n <div #jsonEditorContainer class=\"cmat-jsoneditor\" [id]=\"id\"></div>\r\n} @placeholder {\r\n <div class=\"flex min-h-64 items-center justify-center rounded-2xl border border-dashed border-default bg-card px-4 py-6 text-sm text-secondary shadow-sm\">\r\n JSON \u7F16\u8F91\u5668\u52A0\u8F7D\u4E2D...\r\n </div>\r\n}\r\n", styles: [".cmat-jsoneditor .jse-main.svelte-sxaskb{min-height:24rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
161
178
|
}
|
|
162
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatJsonEditorComponent, decorators: [{
|
|
163
180
|
type: Component,
|
|
164
|
-
args: [{ selector: 'cmat-json-editor', template:
|
|
165
|
-
}], propDecorators: {
|
|
166
|
-
type: ViewChild,
|
|
167
|
-
args: ['jsonEditorContainer', { static: true }]
|
|
168
|
-
}], options: [{
|
|
181
|
+
args: [{ selector: 'cmat-json-editor', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [], template: "@defer (on viewport) {\r\n <div #jsonEditorContainer class=\"cmat-jsoneditor\" [id]=\"id\"></div>\r\n} @placeholder {\r\n <div class=\"flex min-h-64 items-center justify-center rounded-2xl border border-dashed border-default bg-card px-4 py-6 text-sm text-secondary shadow-sm\">\r\n JSON \u7F16\u8F91\u5668\u52A0\u8F7D\u4E2D...\r\n </div>\r\n}\r\n", styles: [".cmat-jsoneditor .jse-main.svelte-sxaskb{min-height:24rem}\n"] }]
|
|
182
|
+
}], propDecorators: { options: [{
|
|
169
183
|
type: Input
|
|
170
184
|
}], data: [{
|
|
171
185
|
type: Input
|
|
@@ -173,6 +187,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
173
187
|
type: Output
|
|
174
188
|
}], pathChanged: [{
|
|
175
189
|
type: Output
|
|
190
|
+
}], darkTheme: [{
|
|
191
|
+
type: HostBinding,
|
|
192
|
+
args: ['class.jse-theme-dark']
|
|
193
|
+
}], jsonEditorContainer: [{
|
|
194
|
+
type: ViewChild,
|
|
195
|
+
args: ['jsonEditorContainer']
|
|
176
196
|
}] } });
|
|
177
197
|
|
|
178
198
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmat-components-json-editor.mjs","sources":["../../../projects/cmat/components/json-editor/json-editor.component.ts","../../../projects/cmat/components/json-editor/cmat-components-json-editor.ts"],"sourcesContent":["import { Component, ElementRef, Input, OnInit, OnDestroy, ViewChild, Output, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, OnChanges, SimpleChanges, ChangeDetectorRef, inject } from '@angular/core';\r\nimport {\r\n stringifyJSONPath,\r\n Content,\r\n MenuItem,\r\n createAjvValidator,\r\n parseJSONPath,\r\n JSONEditorSelection,\r\n isKeySelection,\r\n isJSONContent,\r\n JSONContent,\r\n isMultiSelection,\r\n createMultiSelection,\r\n MenuButton,\r\n TextContent,\r\n createJSONEditor,\r\n JsonEditor,\r\n} from 'vanilla-jsoneditor';\r\n\r\n@Component({\r\n selector: 'cmat-json-editor',\r\n template: '<div class=\"cmat-jsoneditor\" [id]=\"id\" #jsonEditorContainer></div>',\r\n preserveWhitespaces: false,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n styleUrls: ['./json-editor.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n imports: []\r\n})\r\nexport class CmatJsonEditorComponent implements OnInit, OnChanges, OnDestroy {\r\n @ViewChild('jsonEditorContainer', { static: true }) jsonEditorContainer!: ElementRef;\r\n @Input() options: any;\r\n @Input() data: any;\r\n\r\n @Output() contentChanged: EventEmitter<any> = new EventEmitter<any>();\r\n @Output() pathChanged: EventEmitter<string> = new EventEmitter<string>();\r\n\r\n public id = 'cmatjsoneditor' + Math.floor(Math.random() * 1000000);\r\n content: Content = {\r\n text: undefined,\r\n json: {}\r\n };\r\n\r\n private _editor: JsonEditor;\r\n private _changeDetectorRef = inject(ChangeDetectorRef);\r\n\r\n ngOnInit(): void {\r\n if (!this.jsonEditorContainer.nativeElement) {\r\n console.error('Can\\'t find the ElementRef reference for jsoneditor)');\r\n }\r\n this._editor = createJSONEditor({\r\n target: this.jsonEditorContainer.nativeElement,\r\n props: {\r\n ...this.options,\r\n content: this.content,\r\n onChange: (\r\n updatedContent: Content,\r\n previousContent: any,\r\n { contentErrors, patchResult }: any\r\n ): void => {\r\n console.log('onChange', {\r\n updatedContent,\r\n previousContent,\r\n contentErrors,\r\n patchResult,\r\n });\r\n this.content = updatedContent;\r\n this.contentChanged.emit(updatedContent);\r\n },\r\n onSelect: this._onSelect.bind(this),\r\n onRenderMenu(\r\n items: MenuItem[],\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n context: { mode: 'tree' | 'text' | 'table'; modal: boolean }\r\n ): MenuItem[] | undefined {\r\n // remove buttons for table-mode, transform, sort\r\n items.splice(\r\n items.findIndex(i => (i as MenuButton)['text'] === 'table'),\r\n 1\r\n );\r\n items.splice(\r\n items.findIndex(i => (i as MenuButton)['className'] === 'jse-sort'),\r\n 1\r\n );\r\n items.splice(\r\n items.findIndex(i => (i as MenuButton)['className'] === 'jse-transform'),\r\n 1\r\n );\r\n\r\n items.forEach((item) => {\r\n const button = item as MenuButton;\r\n switch (button['title']) {\r\n case 'Switch to text mode (current mode: text)':\r\n button.text = '文本';\r\n button.title = '切换到文本模式(当前模式:文本)';\r\n break;\r\n case 'Switch to tree mode (current mode: text)':\r\n button.text = '树';\r\n button.title = '切换到树模式(当前模式:文本)';\r\n break;\r\n case 'Switch to text mode (current mode: tree)':\r\n button.text = '文本';\r\n button.title = '切换到文本模式(当前模式:树)';\r\n break;\r\n case 'Switch to tree mode (current mode: tree)':\r\n button.text = '树';\r\n button.title = '切换到树模式(当前模式:树)';\r\n break;\r\n case 'Format JSON: add proper indentation and new lines (Ctrl+I)':\r\n button.title = 'JSON格式化: 添加适当的缩进和新行 (Ctrl+I)';\r\n break;\r\n case 'Compact JSON: remove all white spacing and new lines (Ctrl+Shift+I)':\r\n button.title = '压缩JSON: 删除所有白色间距和新行 (Ctrl+Shift+I)';\r\n break;\r\n case 'Search (Ctrl+F)':\r\n button.title = '搜索 (Ctrl+F)';\r\n break;\r\n case 'Undo (Ctrl+Z)':\r\n button.title = '撤回 (Ctrl+Z)';\r\n break;\r\n case 'Redo (Ctrl+Shift+Z)':\r\n button.title = '重试 (Ctrl+Shift+Z)';\r\n break;\r\n case 'Expand all':\r\n button.title = '全部展开';\r\n break;\r\n case 'Collapse all':\r\n button.title = '全部折叠';\r\n break;\r\n case 'Open context menu (Click here, right click on the selection, or use the context menu button or Ctrl+Q)':\r\n button.title = '打开内容菜单 (单击此处,右键单击所选内容,或使用内容菜单按钮或 Ctrl+Q)';\r\n break;\r\n }\r\n });\r\n return items;\r\n },\r\n },\r\n });\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n if (changes.data) {\r\n this.content = {\r\n text: undefined,\r\n json: this.data\r\n };\r\n\r\n if (this._editor) {\r\n void this._editor.update(this.content);\r\n }\r\n\r\n this._changeDetectorRef.markForCheck();\r\n }\r\n\r\n if (changes.options) {\r\n if (this._editor) {\r\n void this._editor?.updateProps(this.options);\r\n }\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n void this._editor?.destroy();\r\n }\r\n\r\n setSchema(schema: any): void {\r\n const validator = createAjvValidator({ schema });\r\n void this._editor?.updateProps({ validator: validator });\r\n }\r\n\r\n setSelectionToPath(pathString: string): void {\r\n const path = parseJSONPath(pathString);\r\n const selection = createMultiSelection(path, path);\r\n\r\n try {\r\n void this._editor?.select(selection);\r\n } catch (error) {\r\n console.warn('Set selection to path not possible:', pathString, error);\r\n }\r\n this.pathChanged.emit(pathString);\r\n }\r\n\r\n get(): JSON | undefined {\r\n if (this._editor) {\r\n const content: Content = this._editor.get();\r\n if (isJSONContent(content)) {\r\n const j: any = (this._editor.get() as JSONContent).json;\r\n return j;\r\n } else {\r\n const t: any = (this._editor.get() as TextContent).text;\r\n const j: JSON = JSON.parse(t);\r\n return j;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n set(json: any): void {\r\n const value: JSONContent = {\r\n json: json,\r\n };\r\n\r\n void this._editor?.set(value);\r\n }\r\n\r\n private _onSelect(selection: JSONEditorSelection | undefined): void {\r\n if (isKeySelection(selection)) {\r\n const st = stringifyJSONPath((selection as any).path);\r\n this.pathChanged.emit(st);\r\n } else if (isMultiSelection(selection)) {\r\n const st = stringifyJSONPath((selection as any).anchorPath);\r\n this.pathChanged.emit(st);\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MA4Ba,uBAAuB,CAAA;AATpC,IAAA,WAAA,GAAA;AAcc,QAAA,IAAA,CAAA,cAAc,GAAsB,IAAI,YAAY,EAAO;AAC3D,QAAA,IAAA,CAAA,WAAW,GAAyB,IAAI,YAAY,EAAU;AAEjE,QAAA,IAAA,CAAA,EAAE,GAAG,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;AAClE,QAAA,IAAA,CAAA,OAAO,GAAY;AACf,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,IAAI,EAAE;SACT;AAGO,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA0KzD,IAAA;IAxKG,QAAQ,GAAA;AACJ,QAAA,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE;AACzC,YAAA,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC;QACzE;AACA,QAAA,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC;AAC5B,YAAA,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,aAAa;AAC9C,YAAA,KAAK,EAAE;gBACH,GAAG,IAAI,CAAC,OAAO;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,gBAAA,QAAQ,EAAE,CACN,cAAuB,EACvB,eAAoB,EACpB,EAAE,aAAa,EAA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AAA,kBAAkB,EAAA,QAAA,EAClB,oEAAoE,EAAA,mBAAA,EACzD,KAAK,EAAA,eAAA,EACT,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAEhC,iBAAiB,CAAC,IAAI,WAC5B,EAAE,EAAA,MAAA,EAAA,CAAA,8DAAA,CAAA,EAAA;;sBAGV,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,qBAAqB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBACjD;;sBACA;;sBAEA;;sBACA;;;AClCL;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cmat-components-json-editor.mjs","sources":["../../../projects/cmat/components/json-editor/json-editor.component.ts","../../../projects/cmat/components/json-editor/json-editor.component.html","../../../projects/cmat/components/json-editor/cmat-components-json-editor.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\r\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation, inject } from '@angular/core';\r\nimport {\r\n stringifyJSONPath,\r\n Content,\r\n MenuItem,\r\n createAjvValidator,\r\n parseJSONPath,\r\n JSONEditorSelection,\r\n isKeySelection,\r\n isJSONContent,\r\n JSONContent,\r\n isMultiSelection,\r\n createMultiSelection,\r\n MenuButton,\r\n TextContent,\r\n createJSONEditor,\r\n JsonEditor,\r\n} from 'vanilla-jsoneditor';\r\n\r\n@Component({\r\n selector: 'cmat-json-editor',\r\n templateUrl: './json-editor.component.html',\r\n preserveWhitespaces: false,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n styleUrls: ['./json-editor.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n imports: []\r\n})\r\nexport class CmatJsonEditorComponent implements OnInit, OnChanges, OnDestroy {\r\n @Input() options: any;\r\n @Input() data: any;\r\n\r\n @Output() contentChanged: EventEmitter<any> = new EventEmitter<any>();\r\n @Output() pathChanged: EventEmitter<string> = new EventEmitter<string>();\r\n\r\n\r\n public id = 'cmatjsoneditor' + Math.floor(Math.random() * 1000000);\r\n content: Content = {\r\n text: undefined,\r\n json: {}\r\n };\r\n\r\n private _editor?: JsonEditor;\r\n private _jsonEditorContainer?: ElementRef;\r\n private _destroyed = false;\r\n private readonly _document = inject(DOCUMENT);\r\n private _changeDetectorRef = inject(ChangeDetectorRef);\r\n\r\n @HostBinding('class.jse-theme-dark')\r\n get darkTheme(): boolean {\r\n return this._isDarkTheme;\r\n }\r\n\r\n private get _isDarkTheme(): boolean {\r\n return this._document.documentElement.classList.contains('dark') || this._document.body.classList.contains('dark');\r\n }\r\n\r\n @ViewChild('jsonEditorContainer')\r\n set jsonEditorContainer(value: ElementRef | undefined) {\r\n this._jsonEditorContainer = value;\r\n this._initializeEditor();\r\n }\r\n\r\n ngOnInit(): void {\r\n this._initializeEditor();\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n if (changes.data) {\r\n this.content = {\r\n text: undefined,\r\n json: this.data\r\n };\r\n\r\n if (this._editor) {\r\n void this._editor.update(this.content);\r\n }\r\n\r\n this._changeDetectorRef.markForCheck();\r\n }\r\n\r\n if (changes.options) {\r\n if (this._editor) {\r\n void this._editor?.updateProps(this.options);\r\n }\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._destroyed = true;\r\n void this._editor?.destroy();\r\n }\r\n\r\n setSchema(schema: any): void {\r\n const validator = createAjvValidator({ schema });\r\n void this._editor?.updateProps({ validator: validator });\r\n }\r\n\r\n setSelectionToPath(pathString: string): void {\r\n const path = parseJSONPath(pathString);\r\n const selection = createMultiSelection(path, path);\r\n\r\n try {\r\n void this._editor?.select(selection);\r\n } catch (error) {\r\n console.warn('Set selection to path not possible:', pathString, error);\r\n }\r\n this.pathChanged.emit(pathString);\r\n }\r\n\r\n get(): JSON | undefined {\r\n if (this._editor) {\r\n const content: Content = this._editor.get();\r\n if (isJSONContent(content)) {\r\n const j: any = (this._editor.get() as JSONContent).json;\r\n return j;\r\n } else {\r\n const t: any = (this._editor.get() as TextContent).text;\r\n const j: JSON = JSON.parse(t);\r\n return j;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n set(json: any): void {\r\n const value: JSONContent = {\r\n json: json,\r\n };\r\n\r\n void this._editor?.set(value);\r\n }\r\n\r\n private _onSelect(selection: JSONEditorSelection | undefined): void {\r\n if (isKeySelection(selection)) {\r\n const st = stringifyJSONPath((selection as any).path);\r\n this.pathChanged.emit(st);\r\n } else if (isMultiSelection(selection)) {\r\n const st = stringifyJSONPath((selection as any).anchorPath);\r\n this.pathChanged.emit(st);\r\n }\r\n }\r\n\r\n private _initializeEditor(): void {\r\n if (this._destroyed || this._editor || !this._jsonEditorContainer?.nativeElement) {\r\n return;\r\n }\r\n\r\n this._editor = createJSONEditor({\r\n target: this._jsonEditorContainer.nativeElement,\r\n props: {\r\n ...this.options,\r\n content: this.content,\r\n onChange: (\r\n updatedContent: Content,\r\n previousContent: any,\r\n { contentErrors, patchResult }: any\r\n ): void => {\r\n console.log('onChange', {\r\n updatedContent,\r\n previousContent,\r\n contentErrors,\r\n patchResult,\r\n });\r\n this.content = updatedContent;\r\n this.contentChanged.emit(updatedContent);\r\n },\r\n onSelect: this._onSelect.bind(this),\r\n onRenderMenu(\r\n items: MenuItem[],\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n context: { mode: 'tree' | 'text' | 'table'; modal: boolean }\r\n ): MenuItem[] | undefined {\r\n // remove buttons for table-mode, transform, sort\r\n items.splice(\r\n items.findIndex(i => (i as MenuButton)['text'] === 'table'),\r\n 1\r\n );\r\n items.splice(\r\n items.findIndex(i => (i as MenuButton)['className'] === 'jse-sort'),\r\n 1\r\n );\r\n items.splice(\r\n items.findIndex(i => (i as MenuButton)['className'] === 'jse-transform'),\r\n 1\r\n );\r\n\r\n items.forEach((item) => {\r\n const button = item as MenuButton;\r\n switch (button['title']) {\r\n case 'Switch to text mode (current mode: text)':\r\n button.text = '文本';\r\n button.title = '切换到文本模式(当前模式:文本)';\r\n break;\r\n case 'Switch to tree mode (current mode: text)':\r\n button.text = '树';\r\n button.title = '切换到树模式(当前模式:文本)';\r\n break;\r\n case 'Switch to text mode (current mode: tree)':\r\n button.text = '文本';\r\n button.title = '切换到文本模式(当前模式:树)';\r\n break;\r\n case 'Switch to tree mode (current mode: tree)':\r\n button.text = '树';\r\n button.title = '切换到树模式(当前模式:树)';\r\n break;\r\n case 'Format JSON: add proper indentation and new lines (Ctrl+I)':\r\n button.title = 'JSON格式化: 添加适当的缩进和新行 (Ctrl+I)';\r\n break;\r\n case 'Compact JSON: remove all white spacing and new lines (Ctrl+Shift+I)':\r\n button.title = '压缩JSON: 删除所有白色间距和新行 (Ctrl+Shift+I)';\r\n break;\r\n case 'Search (Ctrl+F)':\r\n button.title = '搜索 (Ctrl+F)';\r\n break;\r\n case 'Undo (Ctrl+Z)':\r\n button.title = '撤回 (Ctrl+Z)';\r\n break;\r\n case 'Redo (Ctrl+Shift+Z)':\r\n button.title = '重试 (Ctrl+Shift+Z)';\r\n break;\r\n case 'Expand all':\r\n button.title = '全部展开';\r\n break;\r\n case 'Collapse all':\r\n button.title = '全部折叠';\r\n break;\r\n case 'Open context menu (Click here, right click on the selection, or use the context menu button or Ctrl+Q)':\r\n button.title = '打开内容菜单 (单击此处,右键单击所选内容,或使用内容菜单按钮或 Ctrl+Q)';\r\n break;\r\n }\r\n });\r\n return items;\r\n },\r\n },\r\n });\r\n }\r\n}\r\n","@defer (on viewport) {\r\n <div #jsonEditorContainer class=\"cmat-jsoneditor\" [id]=\"id\"></div>\r\n} @placeholder {\r\n <div class=\"flex min-h-64 items-center justify-center rounded-2xl border border-dashed border-default bg-card px-4 py-6 text-sm text-secondary shadow-sm\">\r\n JSON 编辑器加载中...\r\n </div>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MA6Ba,uBAAuB,CAAA;AATpC,IAAA,WAAA,GAAA;AAac,Q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AAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FDsBa,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBATnC,SAAS;+BACI,kBAAkB,EAAA,mBAAA,EAEP,KAAK,EAAA,eAAA,EACT,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAEhC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,EAAE,EAAA,QAAA,EAAA,6WAAA,EAAA,MAAA,EAAA,CAAA,8DAAA,CAAA,EAAA;;sBAGV;;sBACA;;sBAEA;;sBACA;;sBAeA,WAAW;uBAAC,sBAAsB;;sBASlC,SAAS;uBAAC,qBAAqB;;;AE1DpC;;AAEG;;;;"}
|
|
@@ -322,12 +322,12 @@ class CmatKnobInputComponent {
|
|
|
322
322
|
valueToDisplay() {
|
|
323
323
|
return this.valueTemplate.replace('{value}', this.value.toString());
|
|
324
324
|
}
|
|
325
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
326
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
325
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatKnobInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
326
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatKnobInputComponent, isStandalone: true, selector: "cmat-knob-input", inputs: { id: "id", valueColor: "valueColor", rangeColor: "rangeColor", textColor: "textColor", valueTemplate: "valueTemplate", name: "name", size: "size", step: "step", min: "min", max: "max", strokeWidth: "strokeWidth", showValue: "showValue", placeholder: "placeholder", value: "value", required: "required", disabled: "disabled" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "mousedown": "onMouseDown($event)", "mouseup": "onMouseUp($event)", "touchstart": "onTouchStart($event)", "touchend": "onTouchEnd($event)" }, properties: { "attr.id": "this.id" } }, providers: [
|
|
327
327
|
{ provide: MatFormFieldControl, useExisting: CmatKnobInputComponent }
|
|
328
328
|
], viewQueries: [{ propertyName: "_knobElementRef", first: true, predicate: ["knob"], descendants: true }], exportAs: ["cmatKnobInput"], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\r\n<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div #knob [class.cmat-knob-disabled]=\"disabled\" (focusin)=\"onFocusIn()\" (focusout)=\"onFocusOut($event)\">\r\n <svg viewBox=\"0 0 100 100\" role=\"slider\" [style.width]=\"size + 'px'\" [style.height]=\"size + 'px'\"\r\n [attr.aria-valuemin]=\"min\" [attr.aria-valuemax]=\"max\" [attr.aria-valuenow]=\"value\"\r\n [attr.tabindex]=\"disabled ? -1 : 0\" (click)=\"onClick($event)\">\r\n <path class=\"knob-range\" [attr.d]=\"rangePath()\" [attr.stroke-width]=\"strokeWidth\" [attr.stroke]=\"rangeColor\">\r\n </path>\r\n <path class=\"knob-value\" [attr.d]=\"valuePath()\" [attr.stroke-width]=\"strokeWidth\" [attr.stroke]=\"valueColor\">\r\n </path>\r\n @if(showValue){\r\n <text text-anchor=\"middle\" class=\"knob-text\" [attr.x]=\"50\" [attr.y]=\"57\" [attr.fill]=\"textColor\"\r\n [attr.name]=\"name\">{{ valueToDisplay() }}</text>\r\n }\r\n </svg>\r\n</div>", styles: ["cmat-knob-input .knob-range{fill:none;transition:stroke .1s ease-in}cmat-knob-input .knob-value{animation-name:dash-frame;animation-fill-mode:forwards;fill:none}cmat-knob-input .knob-text{font-size:1.3rem;text-align:center}cmat-knob-input .cmat-knob-disabled{opacity:.6}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
329
329
|
}
|
|
330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatKnobInputComponent, decorators: [{
|
|
331
331
|
type: Component,
|
|
332
332
|
args: [{ selector: 'cmat-knob-input', providers: [
|
|
333
333
|
{ provide: MatFormFieldControl, useExisting: CmatKnobInputComponent }
|
|
@@ -41,10 +41,10 @@ class CmatMasonryComponent {
|
|
|
41
41
|
this.distributedColumns = newDistributedColumns;
|
|
42
42
|
this._changeDetectorRef.markForCheck();
|
|
43
43
|
}
|
|
44
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
45
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatMasonryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
45
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.7", type: CmatMasonryComponent, isStandalone: true, selector: "cmat-masonry", inputs: { columnsTemplate: "columnsTemplate", columns: "columns", items: "items" }, exportAs: ["cmatMasonry"], usesOnChanges: true, ngImport: i0, template: "<div class=\"flex p-2\">\r\n <ng-container *ngTemplateOutlet=\"columnsTemplate; context: { $implicit: distributedColumns }\"></ng-container>\r\n</div>", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
46
46
|
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatMasonryComponent, decorators: [{
|
|
48
48
|
type: Component,
|
|
49
49
|
args: [{ selector: 'cmat-masonry', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatMasonry', imports: [NgTemplateOutlet], template: "<div class=\"flex p-2\">\r\n <ng-container *ngTemplateOutlet=\"columnsTemplate; context: { $implicit: distributedColumns }\"></ng-container>\r\n</div>" }]
|
|
50
50
|
}], propDecorators: { columnsTemplate: [{
|
|
@@ -153,10 +153,10 @@ class CmatMaterialColorPickerComponent {
|
|
|
153
153
|
this.view = 'hues';
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
157
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
156
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatMaterialColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
157
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatMaterialColorPickerComponent, isStandalone: true, selector: "cmat-material-color-picker", inputs: { color: "color", title: "title", readonly: "readonly" }, outputs: { colorChanged: "colorChanged" }, providers: [CMAT_MATERIAL_COLOR_PICKER_VALUE_ACCESSOR], exportAs: ["cmatMaterialColorPicker"], ngImport: i0, template: "<div class=\"rounded\" [ngClass]=\"selectedColor.color\">\r\n <mat-select value=\"init\" panelClass=\"min-w-64 overflow-hidden\" [disableOptionCentering]=\"true\" [hideSingleSelectionIndicator]=\"true\"\r\n [disabled]=\"readonly\" (openedChange)=\"onMenuOpen($event)\">\r\n <mat-select-trigger class=\"flex p-1\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:paint-brush'\"></mat-icon>\r\n </mat-select-trigger>\r\n\r\n <header class=\"border-b-2 flex flex-row content-between justify-between p-2\">\r\n <button type=\"button\" matIconButton class=\"secondary-text\" aria-label=\"\u8C03\u8272\u677F\"\r\n [class.invisible]=\"view === 'palettes'\" (click)=\"goToPalettesView()\">\r\n <mat-icon svgIcon=\"mat_outline:arrow_back\"></mat-icon>\r\n </button>\r\n <span class=\"align-middle leading-loose text-xl font-bold\">{{title}}</span>\r\n <button type=\"button\" matIconButton class=\"remove-color-button secondary-text\" aria-label=\"\u79FB\u9664\u989C\u8272\"\r\n matTooltip=\"\u79FB\u9664\u989C\u8272\" (click)=\"removeColor()\">\r\n <mat-icon color=\"warn\" [svgIcon]=\"'mat_outline:cleaning_services'\"></mat-icon>\r\n </button>\r\n </header>\r\n\r\n <div class=\"flex flex-wrap w-60 m-2\">\r\n <mat-option value=\"init\" class=\"hidden\">\u521D\u59CB\u5316</mat-option>\r\n <div>\r\n @switch (view) {\r\n @case ('palettes') {\r\n <div>\r\n <div class=\"flex flex-row flex-wrap justify-start content-start colors\">\r\n @for (palette of palettes; track $index) {\r\n <div role=\"presentation\" class=\"cursor-pointer hover:opacity-50\" (click)=\"selectPalette(palette)\">\r\n <mat-option class=\"relative flex w-12 h-12 p-0 pointer-events-none rounded-full bg-transparent \"\r\n [value]=\"selectedPalette\">\r\n @if (selectedColor.color===palette + '-' + selectedHue) {\r\n <mat-icon class=\"absolute m-3 text-white\" [svgIcon]=\"'heroicons_outline:check'\"></mat-icon>\r\n }\r\n <span class=\"flex w-10 h-10 m-1 rounded-full\" [ngClass]=\"palette + '-' + selectedHue\"></span>\r\n </mat-option>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n @case ('hues') {\r\n <div>\r\n <div class=\"flex flex-row flex-wrap justify-start content-start colors\">\r\n @for (hue of hues; track $index) {\r\n <div role=\"presentation\" class=\"cursor-pointer hover:opacity-50\" (click)=\"selectHue(hue)\">\r\n <mat-option class=\"relative flex w-12 h-12 p-0 pointer-events-none rounded-full bg-transparent \"\r\n [value]=\"selectedHue\">\r\n @if (selectedColor.color===selectedPalette + '-' + hue) {\r\n <mat-icon class=\"absolute m-3 text-white\" [svgIcon]=\"'heroicons_outline:check'\"></mat-icon>\r\n }\r\n <span class=\"flex w-10 h-10 m-1 rounded-full\" [ngClass]=\"selectedPalette + '-' + hue\"></span>\r\n </mat-option>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n </mat-select>\r\n</div>", styles: ["cmat-material-color-picker .mat-mdc-select-arrow-wrapper{display:none!important}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i1.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
158
158
|
}
|
|
159
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatMaterialColorPickerComponent, decorators: [{
|
|
160
160
|
type: Component,
|
|
161
161
|
args: [{ selector: 'cmat-material-color-picker', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatMaterialColorPicker', providers: [CMAT_MATERIAL_COLOR_PICKER_VALUE_ACCESSOR], imports: [NgClass, MatSelectModule, MatIconModule, MatButtonModule, MatTooltipModule], template: "<div class=\"rounded\" [ngClass]=\"selectedColor.color\">\r\n <mat-select value=\"init\" panelClass=\"min-w-64 overflow-hidden\" [disableOptionCentering]=\"true\" [hideSingleSelectionIndicator]=\"true\"\r\n [disabled]=\"readonly\" (openedChange)=\"onMenuOpen($event)\">\r\n <mat-select-trigger class=\"flex p-1\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:paint-brush'\"></mat-icon>\r\n </mat-select-trigger>\r\n\r\n <header class=\"border-b-2 flex flex-row content-between justify-between p-2\">\r\n <button type=\"button\" matIconButton class=\"secondary-text\" aria-label=\"\u8C03\u8272\u677F\"\r\n [class.invisible]=\"view === 'palettes'\" (click)=\"goToPalettesView()\">\r\n <mat-icon svgIcon=\"mat_outline:arrow_back\"></mat-icon>\r\n </button>\r\n <span class=\"align-middle leading-loose text-xl font-bold\">{{title}}</span>\r\n <button type=\"button\" matIconButton class=\"remove-color-button secondary-text\" aria-label=\"\u79FB\u9664\u989C\u8272\"\r\n matTooltip=\"\u79FB\u9664\u989C\u8272\" (click)=\"removeColor()\">\r\n <mat-icon color=\"warn\" [svgIcon]=\"'mat_outline:cleaning_services'\"></mat-icon>\r\n </button>\r\n </header>\r\n\r\n <div class=\"flex flex-wrap w-60 m-2\">\r\n <mat-option value=\"init\" class=\"hidden\">\u521D\u59CB\u5316</mat-option>\r\n <div>\r\n @switch (view) {\r\n @case ('palettes') {\r\n <div>\r\n <div class=\"flex flex-row flex-wrap justify-start content-start colors\">\r\n @for (palette of palettes; track $index) {\r\n <div role=\"presentation\" class=\"cursor-pointer hover:opacity-50\" (click)=\"selectPalette(palette)\">\r\n <mat-option class=\"relative flex w-12 h-12 p-0 pointer-events-none rounded-full bg-transparent \"\r\n [value]=\"selectedPalette\">\r\n @if (selectedColor.color===palette + '-' + selectedHue) {\r\n <mat-icon class=\"absolute m-3 text-white\" [svgIcon]=\"'heroicons_outline:check'\"></mat-icon>\r\n }\r\n <span class=\"flex w-10 h-10 m-1 rounded-full\" [ngClass]=\"palette + '-' + selectedHue\"></span>\r\n </mat-option>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n @case ('hues') {\r\n <div>\r\n <div class=\"flex flex-row flex-wrap justify-start content-start colors\">\r\n @for (hue of hues; track $index) {\r\n <div role=\"presentation\" class=\"cursor-pointer hover:opacity-50\" (click)=\"selectHue(hue)\">\r\n <mat-option class=\"relative flex w-12 h-12 p-0 pointer-events-none rounded-full bg-transparent \"\r\n [value]=\"selectedHue\">\r\n @if (selectedColor.color===selectedPalette + '-' + hue) {\r\n <mat-icon class=\"absolute m-3 text-white\" [svgIcon]=\"'heroicons_outline:check'\"></mat-icon>\r\n }\r\n <span class=\"flex w-10 h-10 m-1 rounded-full\" [ngClass]=\"selectedPalette + '-' + hue\"></span>\r\n </mat-option>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n </mat-select>\r\n</div>", styles: ["cmat-material-color-picker .mat-mdc-select-arrow-wrapper{display:none!important}\n"] }]
|
|
162
162
|
}], ctorParameters: () => [], propDecorators: { colorChanged: [{
|