@piying-lib/angular-core 1.2.0 → 1.2.2
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.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { computed, Component, viewChild, input, inject, TemplateRef, forwardRef } from '@angular/core';
|
|
2
|
+
import { computed, Component, viewChild, input, inject, TemplateRef, forwardRef, Injector, resource, runInInjectionContext, ChangeDetectionStrategy } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { MatIcon } from '@angular/material/icon';
|
|
5
5
|
import { SelectorlessOutlet } from '@cyia/ngx-common/directive';
|
|
6
6
|
import { PurePipe } from '@cyia/ngx-common/pipe';
|
|
7
7
|
import { BaseControl, PiyingView, PI_INPUT_OPTIONS_TOKEN, AttributesDirective, InsertFieldDirective, EventsDirective } from '@piying/view-angular';
|
|
8
8
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
import { ActivatedRoute } from '@angular/router';
|
|
9
10
|
|
|
10
11
|
const DefaultOptionConvert = {
|
|
11
12
|
label: (item) => (typeof item !== 'object' ? item : item.label),
|
|
@@ -64,6 +65,18 @@ function isSchema(input) {
|
|
|
64
65
|
return (input && typeof input === 'object' && '~run' in input && 'kind' in input && 'type' in input);
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
/**
|
|
69
|
+
* 通用容器组件
|
|
70
|
+
*
|
|
71
|
+
* 一个基础的 div 容器组件,用于在表单中创建通用的容器元素。
|
|
72
|
+
* 该组件本身不提供任何交互功能,主要用作布局容器或包裹其他组件。
|
|
73
|
+
*
|
|
74
|
+
* **使用场景**:
|
|
75
|
+
* - 需要对表单元素进行分组和布局时
|
|
76
|
+
* - 需要添加样式容器时
|
|
77
|
+
* - 需要创建空白占位区域时
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
67
80
|
class DivNFCC {
|
|
68
81
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: DivNFCC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
69
82
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.14", type: DivNFCC, isStandalone: true, selector: "div", ngImport: i0, template: ``, isInline: true });
|
|
@@ -80,7 +93,9 @@ class StrOrTemplateComponent extends BaseControl {
|
|
|
80
93
|
static __version = 2;
|
|
81
94
|
PiyingView = PiyingView;
|
|
82
95
|
templateRef = viewChild.required('templateRef');
|
|
96
|
+
/** 内容 */
|
|
83
97
|
content = input(...(ngDevMode ? [undefined, { debugName: "content" }] : []));
|
|
98
|
+
/** 上下文数据 */
|
|
84
99
|
context = input(...(ngDevMode ? [undefined, { debugName: "context" }] : []));
|
|
85
100
|
content$$ = computed(() => {
|
|
86
101
|
return this.content() ?? this.value$();
|
|
@@ -129,6 +144,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
129
144
|
], template: "<ng-template #templateRef>\n @let data = $any(content$$());\n @if (isString | pure: data) {\n {{ data }}\n } @else if (isTemplateRef | pure: data) {\n <ng-container *ngTemplateOutlet=\"$any(data)\"></ng-container>\n } @else if (isSchema | pure: data) {\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"piyingInput | pure: content$$ : schemaOptions$$\"\n ></ng-container>\n } @else if (isObject | pure: data) {\n @if (data['image']; as image) {\n <img [src]=\"image.src\" [alt]=\"image.alt\" />\n }\n @if (data['icon']; as icon) {\n <mat-icon\n [inline]=\"icon.inline\"\n [fontIcon]=\"icon.fontIcon\"\n [fontSet]=\"icon.fontSet\"\n [svgIcon]=\"icon.svgIcon\"\n ></mat-icon>\n }\n @if (data['title']) {\n <span>\n {{ data['title'] }}\n </span>\n }\n }\n</ng-template>\n" }]
|
|
130
145
|
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
|
|
131
146
|
|
|
147
|
+
const defaultValue = Promise.resolve(undefined);
|
|
148
|
+
class SchemaViewPage {
|
|
149
|
+
#route = inject(ActivatedRoute);
|
|
150
|
+
#injector = inject(Injector);
|
|
151
|
+
PiyingView = PiyingView;
|
|
152
|
+
#schema = this.#route.snapshot.data['schema']();
|
|
153
|
+
#model = resource({
|
|
154
|
+
loader: async () => runInInjectionContext(this.#injector, () => this.#route.snapshot.data['model']?.() || defaultValue),
|
|
155
|
+
});
|
|
156
|
+
#options = this.#route.snapshot.data['options']();
|
|
157
|
+
inputs = {
|
|
158
|
+
schema: this.#schema,
|
|
159
|
+
options: this.#options,
|
|
160
|
+
model: this.#model.value,
|
|
161
|
+
selectorless: true,
|
|
162
|
+
};
|
|
163
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SchemaViewPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
164
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.14", type: SchemaViewPage, isStandalone: true, selector: "div[pi-schema-view-page]", ngImport: i0, template: "<ng-template [selectlessOutlet]=\"PiyingView\" [selectlessOutletInputs]=\"inputs\"></ng-template>\n", dependencies: [{ kind: "directive", type: SelectorlessOutlet, selector: "[selectlessOutlet]", inputs: ["selectlessOutlet", "selectlessOutletInputs", "selectlessOutletOutputs", "selectlessOutletDirectives", "selectlessOutletInjector", "selectlessOutletEnvironmentInjector"], exportAs: ["selectlessOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
165
|
+
}
|
|
166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SchemaViewPage, decorators: [{
|
|
167
|
+
type: Component,
|
|
168
|
+
args: [{ selector: 'div[pi-schema-view-page]', standalone: true, imports: [SelectorlessOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template [selectlessOutlet]=\"PiyingView\" [selectlessOutletInputs]=\"inputs\"></ng-template>\n" }]
|
|
169
|
+
}] });
|
|
170
|
+
|
|
132
171
|
class DivWC {
|
|
133
172
|
static __version = 2;
|
|
134
173
|
templateRef = viewChild.required('templateRef');
|
|
@@ -152,5 +191,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
152
191
|
* Generated bundle index. Do not edit.
|
|
153
192
|
*/
|
|
154
193
|
|
|
155
|
-
export { DefaultOptionConvert, DivNFCC, DivWC, StrOrTemplateComponent, computedWithPrev, isSchema, transformOption, transformOptions };
|
|
194
|
+
export { DefaultOptionConvert, DivNFCC, DivWC, SchemaViewPage, StrOrTemplateComponent, computedWithPrev, isSchema, transformOption, transformOptions };
|
|
156
195
|
//# sourceMappingURL=piying-lib-angular-core.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piying-lib-angular-core.mjs","sources":["../../../projects/core/util/options.ts","../../../projects/core/util/computed-with-prev.ts","../../../projects/core/util/is.ts","../../../projects/core/component/div/component.ts","../../../projects/core/component/str-template/component.ts","../../../projects/core/component/str-template/component.html","../../../projects/core/wrapper/div/component.ts","../../../projects/core/piying-lib-angular-core.ts"],"sourcesContent":["export interface Option1 {\n label: string;\n value: any;\n disabled?: boolean;\n type?: 'option';\n description?: string;\n}\nexport interface OptionGroup {\n disabled?: boolean;\n label: string;\n children: Option1[];\n type: 'group';\n description?: string;\n}\nexport interface ResolvedOption {\n label: string;\n value: any;\n disabled?: boolean;\n type: 'option' | 'group' | (string & {});\n children?: ResolvedOption[];\n description?: string;\n origin: any;\n}\nexport interface OptionConvert {\n label: (input: any) => string;\n description: (input: any) => string;\n value: (input: any) => any;\n isGroup: (input: any) => boolean;\n children?: (input: any) => any[];\n disabled?: (input: any) => boolean;\n type?: (input: any) => string;\n}\nexport type Option2 = string;\n\nexport const DefaultOptionConvert: OptionConvert = {\n label: (item) => (typeof item !== 'object' ? item : item.label),\n description: (item) => item.description,\n value: (item) => (typeof item !== 'object' ? item : item.value),\n disabled: (item) => typeof item === 'object' && item.disabled,\n isGroup: (item) => typeof item === 'object' && item.type === 'group',\n type: (item) => (typeof item === 'object' ? item.type : 'option'),\n children: (item) => item.children,\n};\n\nexport function transformOptions(options: any[], optionConvert: OptionConvert): ResolvedOption[] {\n return options.map((option) => {\n const resolvedItem: ResolvedOption = {\n label: optionConvert.label(option),\n value: optionConvert.value(option),\n disabled: optionConvert.disabled?.(option) ?? false,\n type: 'option',\n description: optionConvert.description(option),\n origin: option,\n };\n if (optionConvert.isGroup(option)) {\n resolvedItem.type = 'group';\n resolvedItem.children = transformOptions(optionConvert.children!(option), optionConvert);\n return resolvedItem;\n }\n return resolvedItem;\n });\n}\nexport function transformOption(option: any, optionConvert: OptionConvert): ResolvedOption {\n const resolvedItem: ResolvedOption = {\n label: optionConvert.label(option),\n value: optionConvert.value(option),\n disabled: optionConvert.disabled?.(option) ?? false,\n type: optionConvert.type?.(option) ?? 'option',\n description: optionConvert.description(option),\n origin: option,\n };\n if (optionConvert.isGroup(option)) {\n resolvedItem.type = 'group';\n resolvedItem.children = transformOptions(optionConvert.children!(option), optionConvert);\n return resolvedItem;\n }\n return resolvedItem;\n}\n\nexport interface SelectOption {\n readonly label?: string;\n readonly value: any;\n readonly description?: string;\n readonly disabled?: boolean;\n /** 样式代替label */\n readonly style?: any;\n}\n","import { computed, CreateComputedOptions, Signal } from '@angular/core';\n\nexport function computedWithPrev<T>(\n computation: (prev: T | undefined) => T,\n options?: CreateComputedOptions<T>,\n): Signal<T> {\n let previous: T | undefined;\n return computed(() => {\n const newValue = computation(previous);\n previous = newValue;\n return newValue;\n }, options);\n}\n","export function isSchema(input: any) {\n return (\n input && typeof input === 'object' && '~run' in input && 'kind' in input && 'type' in input\n );\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'div',\n template: ``,\n})\nexport class DivNFCC {}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n computed,\n forwardRef,\n inject,\n input,\n TemplateRef,\n viewChild,\n} from '@angular/core';\nimport { MatIcon } from '@angular/material/icon';\nimport { SelectorlessOutlet } from '@cyia/ngx-common/directive';\nimport { PurePipe } from '@cyia/ngx-common/pipe';\nimport { BaseControl, PI_INPUT_OPTIONS_TOKEN, PiyingView } from '@piying/view-angular';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { isSchema } from '../../util';\n\n@Component({\n selector: 'app-str-or-template',\n templateUrl: './component.html',\n imports: [PurePipe, NgTemplateOutlet, MatIcon, SelectorlessOutlet],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => StrOrTemplateComponent),\n multi: true,\n },\n ],\n})\nexport class StrOrTemplateComponent extends BaseControl {\n static __version = 2;\n readonly PiyingView = PiyingView;\n templateRef = viewChild.required('templateRef');\n content = input();\n context = input();\n content$$ = computed(() => {\n return this.content() ?? this.value$();\n });\n parentPyOptions = inject(PI_INPUT_OPTIONS_TOKEN, { optional: true });\n schemaOptions$$ = computed(() => {\n return {\n ...this.parentPyOptions!(),\n context: { ...this.parentPyOptions!().context, ...(this.context() as any) },\n };\n });\n\n isString(input: any) {\n return typeof input === 'string' || typeof input === 'number' || typeof input === 'boolean';\n }\n isTemplateRef(input: any) {\n return input instanceof TemplateRef;\n }\n isObject(input: any) {\n return typeof input === 'object';\n }\n isSchema = isSchema;\n piyingInput = (schema: any, options: any) => {\n return {\n schema,\n options,\n selectorless: true,\n };\n };\n}\n","<ng-template #templateRef>\n @let data = $any(content$$());\n @if (isString | pure: data) {\n {{ data }}\n } @else if (isTemplateRef | pure: data) {\n <ng-container *ngTemplateOutlet=\"$any(data)\"></ng-container>\n } @else if (isSchema | pure: data) {\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"piyingInput | pure: content$$ : schemaOptions$$\"\n ></ng-container>\n } @else if (isObject | pure: data) {\n @if (data['image']; as image) {\n <img [src]=\"image.src\" [alt]=\"image.alt\" />\n }\n @if (data['icon']; as icon) {\n <mat-icon\n [inline]=\"icon.inline\"\n [fontIcon]=\"icon.fontIcon\"\n [fontSet]=\"icon.fontSet\"\n [svgIcon]=\"icon.svgIcon\"\n ></mat-icon>\n }\n @if (data['title']) {\n <span>\n {{ data['title'] }}\n </span>\n }\n }\n</ng-template>\n","import { Component, viewChild } from '@angular/core';\nimport { AttributesDirective, EventsDirective, InsertFieldDirective } from '@piying/view-angular';\n\n@Component({\n selector: 'app-div-wrapper',\n template: `<ng-template #templateRef let-attr=\"attributes\" let-events=\"events\">\n <div [attributes]=\"attr()\" [events]=\"events()\"><ng-container insertField></ng-container></div>\n </ng-template>`,\n imports: [AttributesDirective, InsertFieldDirective, EventsDirective],\n})\nexport class DivWC {\n static __version = 2;\n templateRef = viewChild.required('templateRef');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAkCO,MAAM,oBAAoB,GAAkB;IACjD,KAAK,EAAE,CAAC,IAAI,MAAM,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;IAC/D,WAAW,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,WAAW;IACvC,KAAK,EAAE,CAAC,IAAI,MAAM,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;AAC/D,IAAA,QAAQ,EAAE,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ;AAC7D,IAAA,OAAO,EAAE,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;IACpE,IAAI,EAAE,CAAC,IAAI,MAAM,OAAO,I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A,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;ACZhD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"piying-lib-angular-core.mjs","sources":["../../../projects/core/util/options.ts","../../../projects/core/util/computed-with-prev.ts","../../../projects/core/util/is.ts","../../../projects/core/component/div/component.ts","../../../projects/core/component/str-template/component.ts","../../../projects/core/component/str-template/component.html","../../../projects/core/component/schema-view-page/component.ts","../../../projects/core/component/schema-view-page/component.html","../../../projects/core/wrapper/div/component.ts","../../../projects/core/piying-lib-angular-core.ts"],"sourcesContent":["export interface Option1 {\n label: string;\n value: any;\n disabled?: boolean;\n type?: 'option';\n description?: string;\n}\nexport interface OptionGroup {\n disabled?: boolean;\n label: string;\n children: Option1[];\n type: 'group';\n description?: string;\n}\nexport interface ResolvedOption {\n label: string;\n value: any;\n disabled?: boolean;\n type: 'option' | 'group' | (string & {});\n children?: ResolvedOption[];\n description?: string;\n origin: any;\n}\nexport interface OptionConvert {\n label: (input: any) => string;\n description: (input: any) => string;\n value: (input: any) => any;\n isGroup: (input: any) => boolean;\n children?: (input: any) => any[];\n disabled?: (input: any) => boolean;\n type?: (input: any) => string;\n}\nexport type Option2 = string;\n\nexport const DefaultOptionConvert: OptionConvert = {\n label: (item) => (typeof item !== 'object' ? item : item.label),\n description: (item) => item.description,\n value: (item) => (typeof item !== 'object' ? item : item.value),\n disabled: (item) => typeof item === 'object' && item.disabled,\n isGroup: (item) => typeof item === 'object' && item.type === 'group',\n type: (item) => (typeof item === 'object' ? item.type : 'option'),\n children: (item) => item.children,\n};\n\nexport function transformOptions(options: any[], optionConvert: OptionConvert): ResolvedOption[] {\n return options.map((option) => {\n const resolvedItem: ResolvedOption = {\n label: optionConvert.label(option),\n value: optionConvert.value(option),\n disabled: optionConvert.disabled?.(option) ?? false,\n type: 'option',\n description: optionConvert.description(option),\n origin: option,\n };\n if (optionConvert.isGroup(option)) {\n resolvedItem.type = 'group';\n resolvedItem.children = transformOptions(optionConvert.children!(option), optionConvert);\n return resolvedItem;\n }\n return resolvedItem;\n });\n}\nexport function transformOption(option: any, optionConvert: OptionConvert): ResolvedOption {\n const resolvedItem: ResolvedOption = {\n label: optionConvert.label(option),\n value: optionConvert.value(option),\n disabled: optionConvert.disabled?.(option) ?? false,\n type: optionConvert.type?.(option) ?? 'option',\n description: optionConvert.description(option),\n origin: option,\n };\n if (optionConvert.isGroup(option)) {\n resolvedItem.type = 'group';\n resolvedItem.children = transformOptions(optionConvert.children!(option), optionConvert);\n return resolvedItem;\n }\n return resolvedItem;\n}\n\nexport interface SelectOption {\n readonly label?: string;\n readonly value: any;\n readonly description?: string;\n readonly disabled?: boolean;\n /** 样式代替label */\n readonly style?: any;\n}\n","import { computed, CreateComputedOptions, Signal } from '@angular/core';\n\nexport function computedWithPrev<T>(\n computation: (prev: T | undefined) => T,\n options?: CreateComputedOptions<T>,\n): Signal<T> {\n let previous: T | undefined;\n return computed(() => {\n const newValue = computation(previous);\n previous = newValue;\n return newValue;\n }, options);\n}\n","export function isSchema(input: any) {\n return (\n input && typeof input === 'object' && '~run' in input && 'kind' in input && 'type' in input\n );\n}\n","import { Component } from '@angular/core';\n\n/**\n * 通用容器组件\n *\n * 一个基础的 div 容器组件,用于在表单中创建通用的容器元素。\n * 该组件本身不提供任何交互功能,主要用作布局容器或包裹其他组件。\n *\n * **使用场景**:\n * - 需要对表单元素进行分组和布局时\n * - 需要添加样式容器时\n * - 需要创建空白占位区域时\n *\n */\n@Component({\n selector: 'div',\n template: ``,\n})\nexport class DivNFCC {}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n computed,\n forwardRef,\n inject,\n input,\n TemplateRef,\n viewChild,\n} from '@angular/core';\n\n/**\n * 字符串或模板渲染组件\n *\n * 一个智能渲染组件,能够根据传入的内容自动判断类型并选择合适的渲染方式。\n * 支持字符串、数字、布尔值、TemplateRef 模板、Schema 对象以及包含 image/icon/title 的对象。\n *\n * **功能特性**:\n * - 自动识别字符串类型并直接渲染\n * - 支持 Angular TemplateRef 模板渲染\n * - 支持 PiyingView Schema 渲染\n * - 支持特殊对象格式(image、icon、title)的渲染\n * - 支持上下文数据传递\n *\n * **使用场景**:\n * - 需要动态渲染不同类型的 content 内容时\n * - 需要在表单中嵌入复杂内容(模板、Schema)时\n * - 需要统一处理多种数据类型显示时\n *\n */\nimport { MatIcon } from '@angular/material/icon';\nimport { SelectorlessOutlet } from '@cyia/ngx-common/directive';\nimport { PurePipe } from '@cyia/ngx-common/pipe';\nimport { BaseControl, PI_INPUT_OPTIONS_TOKEN, PiyingView } from '@piying/view-angular';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { isSchema } from '../../util';\n\n@Component({\n selector: 'app-str-or-template',\n templateUrl: './component.html',\n imports: [PurePipe, NgTemplateOutlet, MatIcon, SelectorlessOutlet],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => StrOrTemplateComponent),\n multi: true,\n },\n ],\n})\nexport class StrOrTemplateComponent extends BaseControl {\n static __version = 2;\n readonly PiyingView = PiyingView;\n templateRef = viewChild.required('templateRef');\n /** 内容 */\n content = input();\n /** 上下文数据 */\n context = input();\n content$$ = computed(() => {\n return this.content() ?? this.value$();\n });\n parentPyOptions = inject(PI_INPUT_OPTIONS_TOKEN, { optional: true });\n schemaOptions$$ = computed(() => {\n return {\n ...this.parentPyOptions!(),\n context: { ...this.parentPyOptions!().context, ...(this.context() as any) },\n };\n });\n\n isString(input: any) {\n return typeof input === 'string' || typeof input === 'number' || typeof input === 'boolean';\n }\n isTemplateRef(input: any) {\n return input instanceof TemplateRef;\n }\n isObject(input: any) {\n return typeof input === 'object';\n }\n isSchema = isSchema;\n piyingInput = (schema: any, options: any) => {\n return {\n schema,\n options,\n selectorless: true,\n };\n };\n}\n","<ng-template #templateRef>\n @let data = $any(content$$());\n @if (isString | pure: data) {\n {{ data }}\n } @else if (isTemplateRef | pure: data) {\n <ng-container *ngTemplateOutlet=\"$any(data)\"></ng-container>\n } @else if (isSchema | pure: data) {\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"piyingInput | pure: content$$ : schemaOptions$$\"\n ></ng-container>\n } @else if (isObject | pure: data) {\n @if (data['image']; as image) {\n <img [src]=\"image.src\" [alt]=\"image.alt\" />\n }\n @if (data['icon']; as icon) {\n <mat-icon\n [inline]=\"icon.inline\"\n [fontIcon]=\"icon.fontIcon\"\n [fontSet]=\"icon.fontSet\"\n [svgIcon]=\"icon.svgIcon\"\n ></mat-icon>\n }\n @if (data['title']) {\n <span>\n {{ data['title'] }}\n </span>\n }\n }\n</ng-template>\n","import {\n ChangeDetectionStrategy,\n Component,\n inject,\n Injector,\n resource,\n runInInjectionContext,\n} from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { PiyingView } from '@piying/view-angular';\nimport { SelectorlessOutlet } from '@cyia/ngx-common/directive';\nconst defaultValue = Promise.resolve(undefined);\n@Component({\n selector: 'div[pi-schema-view-page]',\n templateUrl: './component.html',\n standalone: true,\n imports: [SelectorlessOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SchemaViewPage {\n #route = inject(ActivatedRoute);\n #injector = inject(Injector);\n\n readonly PiyingView = PiyingView;\n #schema = this.#route.snapshot.data['schema']();\n #model = resource({\n loader: async () =>\n runInInjectionContext(\n this.#injector,\n () => this.#route.snapshot.data['model']?.() || defaultValue,\n ),\n });\n #options = this.#route.snapshot.data['options']();\n inputs = {\n schema: this.#schema,\n options: this.#options,\n model: this.#model.value,\n selectorless: true,\n };\n}\n","<ng-template [selectlessOutlet]=\"PiyingView\" [selectlessOutletInputs]=\"inputs\"></ng-template>\n","import { Component, viewChild } from '@angular/core';\nimport { AttributesDirective, EventsDirective, InsertFieldDirective } from '@piying/view-angular';\n\n@Component({\n selector: 'app-div-wrapper',\n template: `<ng-template #templateRef let-attr=\"attributes\" let-events=\"events\">\n <div [attributes]=\"attr()\" [events]=\"events()\"><ng-container insertField></ng-container></div>\n </ng-template>`,\n imports: [AttributesDirective, InsertFieldDirective, EventsDirective],\n})\nexport class DivWC {\n static __version = 2;\n templateRef = viewChild.required('templateRef');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAkCO,MAAM,oBAAoB,GAAkB;IACjD,KAAK,EAAE,CAAC,IAAI,MAAM,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;IAC/D,WAAW,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,WAAW;IACvC,KAAK,EAAE,CAAC,IAAI,MAAM,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;AAC/D,IAAA,QAAQ,EAAE,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ;AAC7D,IAAA,OAAO,EAAE,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;IACpE,IAAI,EAAE,CAAC,IAAI,MAAM,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;IACjE,QAAQ,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ;;AAG7B,SAAU,gBAAgB,CAAC,OAAc,EAAE,aAA4B,EAAA;AAC3E,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAI;AAC5B,QAAA,MAAM,YAAY,GAAmB;AACnC,YAAA,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;AAClC,YAAA,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;YAClC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,KAAK;AACnD,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,WAAW,E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
declare function isSchema(input: any): any;
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* 通用容器组件
|
|
70
|
+
*
|
|
71
|
+
* 一个基础的 div 容器组件,用于在表单中创建通用的容器元素。
|
|
72
|
+
* 该组件本身不提供任何交互功能,主要用作布局容器或包裹其他组件。
|
|
73
|
+
*
|
|
74
|
+
* **使用场景**:
|
|
75
|
+
* - 需要对表单元素进行分组和布局时
|
|
76
|
+
* - 需要添加样式容器时
|
|
77
|
+
* - 需要创建空白占位区域时
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
68
80
|
declare class DivNFCC {
|
|
69
81
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DivNFCC, never>;
|
|
70
82
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DivNFCC, "div", never, {}, {}, never, never, true, never>;
|
|
@@ -74,7 +86,9 @@ declare class StrOrTemplateComponent extends BaseControl {
|
|
|
74
86
|
static __version: number;
|
|
75
87
|
readonly PiyingView: typeof PiyingView;
|
|
76
88
|
templateRef: _angular_core.Signal<unknown>;
|
|
89
|
+
/** 内容 */
|
|
77
90
|
content: _angular_core.InputSignal<unknown>;
|
|
91
|
+
/** 上下文数据 */
|
|
78
92
|
context: _angular_core.InputSignal<unknown>;
|
|
79
93
|
content$$: _angular_core.Signal<any>;
|
|
80
94
|
parentPyOptions: _angular_core.Signal<Omit<_piying_view_angular_core.SetOptional<Omit<_piying_valibot_visit.ConvertOptions<typeof _piying_view_angular_core.CoreSchemaHandle>, "handle"> & Partial<Pick<_piying_valibot_visit.ConvertOptions<typeof _piying_view_angular_core.CoreSchemaHandle>, "handle">> & {
|
|
@@ -105,6 +119,19 @@ declare class StrOrTemplateComponent extends BaseControl {
|
|
|
105
119
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrOrTemplateComponent, "app-str-or-template", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
106
120
|
}
|
|
107
121
|
|
|
122
|
+
declare class SchemaViewPage {
|
|
123
|
+
#private;
|
|
124
|
+
readonly PiyingView: typeof PiyingView;
|
|
125
|
+
inputs: {
|
|
126
|
+
schema: any;
|
|
127
|
+
options: any;
|
|
128
|
+
model: _angular_core.WritableSignal<any>;
|
|
129
|
+
selectorless: boolean;
|
|
130
|
+
};
|
|
131
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SchemaViewPage, never>;
|
|
132
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SchemaViewPage, "div[pi-schema-view-page]", never, {}, {}, never, never, true, never>;
|
|
133
|
+
}
|
|
134
|
+
|
|
108
135
|
declare class DivWC {
|
|
109
136
|
static __version: number;
|
|
110
137
|
templateRef: _angular_core.Signal<unknown>;
|
|
@@ -112,5 +139,5 @@ declare class DivWC {
|
|
|
112
139
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DivWC, "app-div-wrapper", never, {}, {}, never, never, true, never>;
|
|
113
140
|
}
|
|
114
141
|
|
|
115
|
-
export { DefaultOptionConvert, DivNFCC, DivWC, StrOrTemplateComponent, computedWithPrev, isSchema, transformOption, transformOptions };
|
|
142
|
+
export { DefaultOptionConvert, DivNFCC, DivWC, SchemaViewPage, StrOrTemplateComponent, computedWithPrev, isSchema, transformOption, transformOptions };
|
|
116
143
|
export type { AlertColor, Color, IconConfig, Option1, Option2, OptionConvert, OptionGroup, ResolvedOption, SelectOption, Size };
|