@apform-ui/core 1.10.26 → 1.10.29
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/dist/__tests__/propertyPanel.spec.d.ts +1 -0
- package/dist/apform-ui.css +1 -1
- package/dist/apform-ui.js +7238 -6582
- package/dist/apform-ui.umd.cjs +57 -57
- package/dist/components/PropertyField/PropertyField.vue.d.ts +48 -0
- package/dist/components/PropertyField/doc.d.ts +3 -0
- package/dist/components/PropertyField/index.d.ts +1 -0
- package/dist/components/PropertyPanel/PropertyPanel.vue.d.ts +34 -0
- package/dist/components/PropertyPanel/doc.d.ts +3 -0
- package/dist/components/PropertyPanel/editors/ArrayListEditor.vue.d.ts +19 -0
- package/dist/components/PropertyPanel/editors/NumberArrayEditor.vue.d.ts +17 -0
- package/dist/components/PropertyPanel/editors/OptionsListEditor.vue.d.ts +14 -0
- package/dist/components/PropertyPanel/index.d.ts +3 -0
- package/dist/components/PropertyPanel/types.d.ts +79 -0
- package/dist/components/PropertyPanel/visibleOn.d.ts +20 -0
- package/dist/docs/index.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/package.json +1 -1
- package/src/docs/index.ts +6 -0
- package/src/tokens/tokens.css +14 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FetchRemoteOptionsFn, PropertyArrayEditorMode, PropertyFieldType, PropertySelectOption } from '../PropertyPanel/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 字段键 */
|
|
4
|
+
keyName: string;
|
|
5
|
+
/** 标签 */
|
|
6
|
+
label: string;
|
|
7
|
+
/** 控件类型 */
|
|
8
|
+
type: PropertyFieldType;
|
|
9
|
+
/** 当前值 */
|
|
10
|
+
value: unknown;
|
|
11
|
+
/** 提示 */
|
|
12
|
+
desc?: string;
|
|
13
|
+
/** 占位 */
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/** 静态选项 */
|
|
16
|
+
options?: PropertySelectOption[];
|
|
17
|
+
/** 远程 URL */
|
|
18
|
+
remoteUrl?: string;
|
|
19
|
+
labelField?: string;
|
|
20
|
+
valueField?: string;
|
|
21
|
+
min?: number;
|
|
22
|
+
max?: number;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/** array-editor 行模式 */
|
|
25
|
+
arrayMode?: PropertyArrayEditorMode;
|
|
26
|
+
/** 覆盖 inject 的远程拉取 */
|
|
27
|
+
fetchRemoteOptions?: FetchRemoteOptionsFn;
|
|
28
|
+
};
|
|
29
|
+
declare var __VLS_6: {};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
default?: (props: typeof __VLS_6) => any;
|
|
32
|
+
};
|
|
33
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
34
|
+
update: (value: unknown) => any;
|
|
35
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
36
|
+
onUpdate?: ((value: unknown) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
labelField: string;
|
|
39
|
+
valueField: string;
|
|
40
|
+
arrayMode: PropertyArrayEditorMode;
|
|
41
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PropertyField } from './PropertyField.vue';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FetchRemoteOptionsFn, PropertyItem, PropertySection, PropertyUpdatePayload } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 分区列表 */
|
|
4
|
+
sections: PropertySection[];
|
|
5
|
+
/** 远程下拉拉取(可选) */
|
|
6
|
+
fetchRemoteOptions?: FetchRemoteOptionsFn;
|
|
7
|
+
/** 空态文案 */
|
|
8
|
+
emptyText?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 当前属性值字典;传入后按各 item 的 visibleOn 过滤
|
|
11
|
+
* (键可与字段 key 对齐,也支持点路径读取)
|
|
12
|
+
*/
|
|
13
|
+
values?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
declare var __VLS_10: `field-${string & {}}`, __VLS_11: {
|
|
16
|
+
item: PropertyItem;
|
|
17
|
+
section: PropertySection;
|
|
18
|
+
update: (value: unknown) => void;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {} & {
|
|
21
|
+
[K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
|
+
update: (payload: PropertyUpdatePayload) => any;
|
|
25
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
+
onUpdate?: ((payload: PropertyUpdatePayload) => any) | undefined;
|
|
27
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ArrayListMode = 'string' | 'label-value';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 当前数组 */
|
|
4
|
+
value: unknown;
|
|
5
|
+
/**
|
|
6
|
+
* 行模式:
|
|
7
|
+
* - string:字符串列表
|
|
8
|
+
* - label-value:{ label, value } 对象列表
|
|
9
|
+
*/
|
|
10
|
+
mode?: ArrayListMode;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
update: (value: unknown[]) => any;
|
|
14
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
onUpdate?: ((value: unknown[]) => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
mode: ArrayListMode;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** 当前数值数组 */
|
|
3
|
+
value: unknown;
|
|
4
|
+
/** 下限 */
|
|
5
|
+
min?: number;
|
|
6
|
+
/** 上限 */
|
|
7
|
+
max?: number;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
|
+
update: (value: number[]) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onUpdate?: ((value: number[]) => any) | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface OptionDictItem {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string | number;
|
|
4
|
+
}
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
/** 当前选项数组 */
|
|
7
|
+
value: unknown;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
|
+
update: (value: OptionDictItem[]) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onUpdate?: ((value: OptionDictItem[]) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PropertyPanel / PropertyField 共享类型与尺寸常量
|
|
3
|
+
*
|
|
4
|
+
* 独立于 editor widget / Pinia;消费方自行映射业务对象为 sections。
|
|
5
|
+
*/
|
|
6
|
+
/** 库内属性控件统一尺寸,避免各处 size 不一致(对齐 CSS `--apf-control-size`) */
|
|
7
|
+
export declare const PROPERTY_CONTROL_SIZE: "small";
|
|
8
|
+
/** 内置字段类型 */
|
|
9
|
+
export type BuiltinPropertyFieldType = 'text' | 'textarea' | 'number' | 'switch' | 'color' | 'select' | 'remote-select' | 'json' | 'color-array' | 'options' | 'number-array' | 'array-editor';
|
|
10
|
+
/** array-editor 行模式 */
|
|
11
|
+
export type PropertyArrayEditorMode = 'string' | 'label-value';
|
|
12
|
+
/** 字段类型:内置 + 自定义(自定义走 slot) */
|
|
13
|
+
export type PropertyFieldType = BuiltinPropertyFieldType | (string & {});
|
|
14
|
+
/** 下拉选项 */
|
|
15
|
+
export interface PropertySelectOption {
|
|
16
|
+
label: string;
|
|
17
|
+
value: string | number | boolean;
|
|
18
|
+
}
|
|
19
|
+
/** 单行属性项 */
|
|
20
|
+
export interface PropertyItem {
|
|
21
|
+
/** 字段键 */
|
|
22
|
+
key: string;
|
|
23
|
+
/** 标签 */
|
|
24
|
+
label: string;
|
|
25
|
+
/** 控件类型 */
|
|
26
|
+
type: PropertyFieldType;
|
|
27
|
+
/** 当前值 */
|
|
28
|
+
value: unknown;
|
|
29
|
+
/** 提示(label tooltip) */
|
|
30
|
+
desc?: string;
|
|
31
|
+
/** 占位文案 */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
/** select 选项 */
|
|
34
|
+
options?: PropertySelectOption[];
|
|
35
|
+
/** remote-select URL(由 fetchRemoteOptions 消费) */
|
|
36
|
+
remoteUrl?: string;
|
|
37
|
+
/** remote 标签字段名 */
|
|
38
|
+
labelField?: string;
|
|
39
|
+
/** remote 值字段名 */
|
|
40
|
+
valueField?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 可见条件(可由 `evalVisibleOn` / `filterVisiblePropertyItems` 求值;
|
|
43
|
+
* PropertyPanel 传入 `values` 时自动过滤)
|
|
44
|
+
*/
|
|
45
|
+
visibleOn?: string;
|
|
46
|
+
/** number / number-array 下限 */
|
|
47
|
+
min?: number;
|
|
48
|
+
/** number / number-array 上限 */
|
|
49
|
+
max?: number;
|
|
50
|
+
/** 必填标记 */
|
|
51
|
+
required?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* array-editor 行模式:
|
|
54
|
+
* - `string`(默认):字符串列表
|
|
55
|
+
* - `label-value`:{ label, value } 对象列表
|
|
56
|
+
*/
|
|
57
|
+
arrayMode?: PropertyArrayEditorMode;
|
|
58
|
+
}
|
|
59
|
+
/** 属性分区 */
|
|
60
|
+
export interface PropertySection {
|
|
61
|
+
/** 分区键 */
|
|
62
|
+
key: string;
|
|
63
|
+
/** 分区标题 */
|
|
64
|
+
label: string;
|
|
65
|
+
/** 字段列表 */
|
|
66
|
+
items: PropertyItem[];
|
|
67
|
+
/** 默认是否展开 */
|
|
68
|
+
defaultOpen?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** PropertyPanel update 载荷 */
|
|
71
|
+
export interface PropertyUpdatePayload {
|
|
72
|
+
sectionKey: string;
|
|
73
|
+
key: string;
|
|
74
|
+
value: unknown;
|
|
75
|
+
}
|
|
76
|
+
/** 远程选项拉取函数 */
|
|
77
|
+
export type FetchRemoteOptionsFn = (url: string, labelField: string, valueField: string) => Promise<PropertySelectOption[]>;
|
|
78
|
+
/** provide/inject key:远程选项 */
|
|
79
|
+
export declare const PROPERTY_FETCH_REMOTE_KEY: "apfPropertyFetchRemote";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropertyItem, PropertySection } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 安全求值 visibleOn 表达式
|
|
4
|
+
* @param expr 表达式;空则视为可见
|
|
5
|
+
* @param values 当前属性值字典
|
|
6
|
+
* @returns 是否可见;无法识别的表达式默认可见
|
|
7
|
+
*/
|
|
8
|
+
export declare function evalVisibleOn(expr: string | undefined | null, values: Record<string, unknown>): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 按 visibleOn 过滤属性项
|
|
11
|
+
* @param items 属性项列表
|
|
12
|
+
* @param values 当前值字典
|
|
13
|
+
*/
|
|
14
|
+
export declare function filterVisiblePropertyItems(items: PropertyItem[], values: Record<string, unknown>): PropertyItem[];
|
|
15
|
+
/**
|
|
16
|
+
* 按 visibleOn 过滤分区(空分区会剔除)
|
|
17
|
+
* @param sections 分区列表
|
|
18
|
+
* @param values 当前值字典
|
|
19
|
+
*/
|
|
20
|
+
export declare function filterVisiblePropertySections(sections: PropertySection[], values: Record<string, unknown>): PropertySection[];
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ export { EmptyStateDoc } from '../components/EmptyState/doc';
|
|
|
58
58
|
export { ErrorBoundaryDoc } from '../components/ErrorBoundary/doc';
|
|
59
59
|
export { ExcelPreviewCardDoc } from '../components/ExcelPreviewCard/doc';
|
|
60
60
|
export { FieldRowDoc } from '../components/FieldRow/doc';
|
|
61
|
+
export { PropertyFieldDoc } from '../components/PropertyField/doc';
|
|
62
|
+
export { PropertyPanelDoc } from '../components/PropertyPanel/doc';
|
|
61
63
|
export { FilterBarDoc } from '../components/FilterBar/doc';
|
|
62
64
|
export { FilterTabsDoc } from '../components/FilterTabs/doc';
|
|
63
65
|
export { FormDialogDoc } from '../components/FormDialog/doc';
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,10 @@ export { HintText } from './components/HintText';
|
|
|
56
56
|
export { SectionToggle } from './components/SectionToggle';
|
|
57
57
|
export { TruncatedTooltipText } from './components/TruncatedTooltipText';
|
|
58
58
|
export { LoadingDots } from './components/LoadingDots';
|
|
59
|
+
export { PropertyField } from './components/PropertyField';
|
|
60
|
+
export { PropertyPanel } from './components/PropertyPanel';
|
|
61
|
+
export type { BuiltinPropertyFieldType, FetchRemoteOptionsFn, PropertyArrayEditorMode, PropertyFieldType, PropertyItem, PropertySection, PropertySelectOption, PropertyUpdatePayload, } from './components/PropertyPanel';
|
|
62
|
+
export { PROPERTY_CONTROL_SIZE, PROPERTY_FETCH_REMOTE_KEY, evalVisibleOn, filterVisiblePropertyItems, filterVisiblePropertySections, } from './components/PropertyPanel';
|
|
59
63
|
export { JsonCard } from './components/JsonCard';
|
|
60
64
|
export { JsonDetailDialog } from './components/JsonDetailDialog';
|
|
61
65
|
export { SchemaLitePreview } from './components/SchemaLitePreview';
|
package/package.json
CHANGED
package/src/docs/index.ts
CHANGED
|
@@ -58,6 +58,8 @@ export { EmptyStateDoc } from '../components/EmptyState/doc'
|
|
|
58
58
|
export { ErrorBoundaryDoc } from '../components/ErrorBoundary/doc'
|
|
59
59
|
export { ExcelPreviewCardDoc } from '../components/ExcelPreviewCard/doc'
|
|
60
60
|
export { FieldRowDoc } from '../components/FieldRow/doc'
|
|
61
|
+
export { PropertyFieldDoc } from '../components/PropertyField/doc'
|
|
62
|
+
export { PropertyPanelDoc } from '../components/PropertyPanel/doc'
|
|
61
63
|
export { FilterBarDoc } from '../components/FilterBar/doc'
|
|
62
64
|
export { FilterTabsDoc } from '../components/FilterTabs/doc'
|
|
63
65
|
export { FormDialogDoc } from '../components/FormDialog/doc'
|
|
@@ -149,6 +151,8 @@ import { EmptyStateDoc } from '../components/EmptyState/doc'
|
|
|
149
151
|
import { ErrorBoundaryDoc } from '../components/ErrorBoundary/doc'
|
|
150
152
|
import { ExcelPreviewCardDoc } from '../components/ExcelPreviewCard/doc'
|
|
151
153
|
import { FieldRowDoc } from '../components/FieldRow/doc'
|
|
154
|
+
import { PropertyFieldDoc } from '../components/PropertyField/doc'
|
|
155
|
+
import { PropertyPanelDoc } from '../components/PropertyPanel/doc'
|
|
152
156
|
import { FilterBarDoc } from '../components/FilterBar/doc'
|
|
153
157
|
import { FilterTabsDoc } from '../components/FilterTabs/doc'
|
|
154
158
|
import { FormDialogDoc } from '../components/FormDialog/doc'
|
|
@@ -241,6 +245,8 @@ export const componentDocs: Record<string, ComponentDoc> = {
|
|
|
241
245
|
ErrorBoundary: ErrorBoundaryDoc,
|
|
242
246
|
ExcelPreviewCard: ExcelPreviewCardDoc,
|
|
243
247
|
FieldRow: FieldRowDoc,
|
|
248
|
+
PropertyField: PropertyFieldDoc,
|
|
249
|
+
PropertyPanel: PropertyPanelDoc,
|
|
244
250
|
FilterBar: FilterBarDoc,
|
|
245
251
|
FilterTabs: FilterTabsDoc,
|
|
246
252
|
FormDialog: FormDialogDoc,
|
package/src/tokens/tokens.css
CHANGED
|
@@ -141,6 +141,15 @@
|
|
|
141
141
|
--apf-overlay-bg: rgba(0, 0, 0, 0.4);
|
|
142
142
|
|
|
143
143
|
/* ---------- 尺寸 ---------- */
|
|
144
|
+
/*
|
|
145
|
+
* 控件尺寸语义 token(与 JS 常量 PROPERTY_CONTROL_SIZE = 'small' 对齐)
|
|
146
|
+
* Element Plus size 枚举:small / default / large;默认库内属性面板用 small。
|
|
147
|
+
*/
|
|
148
|
+
--apf-control-size: small;
|
|
149
|
+
--apf-control-size-sm: small;
|
|
150
|
+
--apf-control-size-md: default;
|
|
151
|
+
--apf-control-size-lg: large;
|
|
152
|
+
|
|
144
153
|
--apf-control-height-xs: 24px;
|
|
145
154
|
--apf-control-height-sm: 28px;
|
|
146
155
|
--apf-control-height-md: 32px;
|
|
@@ -332,6 +341,11 @@
|
|
|
332
341
|
--shadow-lg: var(--apf-shadow-lg);
|
|
333
342
|
--overlay-bg: var(--apf-overlay-bg);
|
|
334
343
|
|
|
344
|
+
--control-size: var(--apf-control-size);
|
|
345
|
+
--control-size-sm: var(--apf-control-size-sm);
|
|
346
|
+
--control-size-md: var(--apf-control-size-md);
|
|
347
|
+
--control-size-lg: var(--apf-control-size-lg);
|
|
348
|
+
|
|
335
349
|
--control-height-xs: var(--apf-control-height-xs);
|
|
336
350
|
--control-height-sm: var(--apf-control-height-sm);
|
|
337
351
|
--control-height-md: var(--apf-control-height-md);
|