@airpower/web 1.9.5 → 1.9.7
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.
|
@@ -6,7 +6,6 @@ import { RootEntity } from '../../model/RootEntity';
|
|
|
6
6
|
declare const _default: <E extends RootEntity>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
7
7
|
props: __VLS_PrettifyLocal<Pick<Partial<{
|
|
8
8
|
disabled: boolean;
|
|
9
|
-
list: IEnum<number>[];
|
|
10
9
|
entity: ITransformerConstructor<E>;
|
|
11
10
|
modelValue: [{
|
|
12
11
|
type: PropType<E>;
|
|
@@ -17,6 +16,7 @@ declare const _default: <E extends RootEntity>(__VLS_props: NonNullable<Awaited<
|
|
|
17
16
|
};
|
|
18
17
|
readonly: boolean;
|
|
19
18
|
disabledValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
19
|
+
list: IEnum<number>[];
|
|
20
20
|
tree: (ITree & E)[];
|
|
21
21
|
}> & Omit<{
|
|
22
22
|
readonly disabled: boolean;
|
|
@@ -30,15 +30,15 @@ declare const _default: <E extends RootEntity>(__VLS_props: NonNullable<Awaited<
|
|
|
30
30
|
default: null;
|
|
31
31
|
}, undefined>;
|
|
32
32
|
readonly readonly: boolean;
|
|
33
|
-
readonly list?: IEnum<number>[] | undefined;
|
|
34
33
|
readonly disabledValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
|
|
34
|
+
readonly list?: IEnum<number>[] | undefined;
|
|
35
35
|
readonly tree?: (ITree & E)[] | undefined;
|
|
36
36
|
readonly onClear?: (() => any) | undefined;
|
|
37
37
|
readonly onBlur?: (() => any) | undefined;
|
|
38
38
|
readonly onChange?: ((value: E) => any) | undefined;
|
|
39
39
|
readonly "onUpdate:modelValue"?: ((value: E) => any) | undefined;
|
|
40
40
|
readonly onFocus?: (() => any) | undefined;
|
|
41
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "
|
|
41
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree">, "onFocus" | "onBlur" | "onChange" | "field" | "onClear" | "onUpdate:modelValue" | ("disabled" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree")> & {} & Partial<{}>> & import('vue').PublicProps;
|
|
42
42
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
43
43
|
attrs: any;
|
|
44
44
|
slots: {
|
|
@@ -6,12 +6,12 @@ declare const _default: <F extends IFile & RootEntity>(__VLS_props: NonNullable<
|
|
|
6
6
|
width: number;
|
|
7
7
|
placeholder: string;
|
|
8
8
|
data: IJson<any>;
|
|
9
|
-
headers: IJson<any>;
|
|
10
9
|
clearable: boolean;
|
|
11
10
|
height: number;
|
|
12
11
|
entity: ITransformerConstructor<F>;
|
|
13
12
|
src: string;
|
|
14
13
|
upload: boolean;
|
|
14
|
+
headers: IJson<any>;
|
|
15
15
|
showTips: boolean;
|
|
16
16
|
limit: number;
|
|
17
17
|
extensions: unknown[];
|
|
@@ -20,10 +20,10 @@ declare const _default: <F extends IFile & RootEntity>(__VLS_props: NonNullable<
|
|
|
20
20
|
}> & Omit<{
|
|
21
21
|
readonly width: number;
|
|
22
22
|
readonly data: IJson<any>;
|
|
23
|
-
readonly headers: IJson<any>;
|
|
24
23
|
readonly clearable: boolean;
|
|
25
24
|
readonly height: number;
|
|
26
25
|
readonly upload: boolean;
|
|
26
|
+
readonly headers: IJson<any>;
|
|
27
27
|
readonly showTips: boolean;
|
|
28
28
|
readonly limit: number;
|
|
29
29
|
readonly extensions: unknown[];
|
|
@@ -34,7 +34,7 @@ declare const _default: <F extends IFile & RootEntity>(__VLS_props: NonNullable<
|
|
|
34
34
|
readonly src?: string | undefined;
|
|
35
35
|
readonly onUpload?: ((file: F) => any) | undefined;
|
|
36
36
|
readonly onRemove?: (() => any) | undefined;
|
|
37
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "width" | "placeholder" | "data" | "
|
|
37
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "width" | "placeholder" | "data" | "clearable" | "height" | "entity" | "src" | "upload" | "headers" | "showTips" | "limit" | "extensions" | "uploadUrl" | "uploadFileName">, "onUpload" | "onRemove" | ("width" | "placeholder" | "data" | "clearable" | "height" | "entity" | "src" | "upload" | "headers" | "showTips" | "limit" | "extensions" | "uploadUrl" | "uploadFileName")> & {} & Partial<{}>> & import('vue').PublicProps;
|
|
38
38
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
39
39
|
attrs: any;
|
|
40
40
|
slots: {};
|
|
@@ -6,12 +6,12 @@ declare const _default: <E extends RootEntity, T extends ITree & E, EM extends I
|
|
|
6
6
|
props: __VLS_PrettifyLocal<Pick<Partial<{
|
|
7
7
|
disabled: boolean;
|
|
8
8
|
placeholder: string;
|
|
9
|
-
list: EM[];
|
|
10
9
|
dateShowFormatter: string;
|
|
11
10
|
entity: ITransformerConstructor<E>;
|
|
12
11
|
modelValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
13
12
|
readonly: boolean;
|
|
14
13
|
disabledValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
14
|
+
list: EM[];
|
|
15
15
|
tree: T[];
|
|
16
16
|
modelModifiers: Record<string, any>;
|
|
17
17
|
modifier: string;
|
|
@@ -24,11 +24,11 @@ declare const _default: <E extends RootEntity, T extends ITree & E, EM extends I
|
|
|
24
24
|
readonly modelModifiers: Record<string, any>;
|
|
25
25
|
readonly showClear: boolean;
|
|
26
26
|
readonly onSearch: Function;
|
|
27
|
-
readonly list?: EM[] | undefined;
|
|
28
27
|
readonly dateShowFormatter?: string | undefined;
|
|
29
28
|
readonly entity?: ITransformerConstructor<E> | undefined;
|
|
30
29
|
readonly modelValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
|
|
31
30
|
readonly disabledValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
|
|
31
|
+
readonly list?: EM[] | undefined;
|
|
32
32
|
readonly tree?: T[] | undefined;
|
|
33
33
|
readonly modifier?: string | undefined;
|
|
34
34
|
readonly onClear?: ((...args: any[]) => any) | undefined;
|
|
@@ -36,7 +36,7 @@ declare const _default: <E extends RootEntity, T extends ITree & E, EM extends I
|
|
|
36
36
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
37
37
|
readonly "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
38
38
|
readonly onFocus?: ((...args: any[]) => any) | undefined;
|
|
39
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "placeholder" | "
|
|
39
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "placeholder" | "dateShowFormatter" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree" | "modelModifiers" | "modifier" | "showClear" | "onSearch">, "onFocus" | "onBlur" | "onChange" | "onClear" | "onUpdate:modelValue" | ("disabled" | "placeholder" | "dateShowFormatter" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree" | "modelModifiers" | "modifier" | "showClear" | "onSearch")> & {} & Partial<{}>> & import('vue').PublicProps;
|
|
40
40
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
41
41
|
attrs: any;
|
|
42
42
|
slots: Partial<Record<NonNullable<string | number | symbol>, (_: {}) => any>>;
|
package/dist/main.js
CHANGED
|
@@ -13481,9 +13481,6 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13481
13481
|
const props = __props;
|
|
13482
13482
|
const emits = __emit;
|
|
13483
13483
|
const value = ref(props.modelValue);
|
|
13484
|
-
function emitChange() {
|
|
13485
|
-
emits("change", value.value);
|
|
13486
|
-
}
|
|
13487
13484
|
function emitBlur() {
|
|
13488
13485
|
emits("blur");
|
|
13489
13486
|
}
|
|
@@ -13580,10 +13577,6 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13580
13577
|
value.value = Number.parseFloat(value.value?.toString() || "0");
|
|
13581
13578
|
}
|
|
13582
13579
|
}
|
|
13583
|
-
function onClear() {
|
|
13584
|
-
emitClear();
|
|
13585
|
-
emitChange();
|
|
13586
|
-
}
|
|
13587
13580
|
function emitValue() {
|
|
13588
13581
|
if (formConfig.value && value.value) {
|
|
13589
13582
|
switch (formConfig.value.trim) {
|
|
@@ -13602,6 +13595,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13602
13595
|
emitChange();
|
|
13603
13596
|
}
|
|
13604
13597
|
function onKeyDown(event) {
|
|
13598
|
+
checkNumberValue();
|
|
13605
13599
|
switch (event.code) {
|
|
13606
13600
|
case "KeyE":
|
|
13607
13601
|
if (formConfig.value?.number) {
|
|
@@ -13616,10 +13610,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13616
13610
|
break;
|
|
13617
13611
|
}
|
|
13618
13612
|
}
|
|
13619
|
-
function
|
|
13620
|
-
|
|
13621
|
-
emitValue();
|
|
13622
|
-
emitBlur();
|
|
13613
|
+
function emitChange() {
|
|
13614
|
+
emits("change", value.value);
|
|
13623
13615
|
}
|
|
13624
13616
|
watch(value, () => {
|
|
13625
13617
|
emitValue();
|
|
@@ -13675,7 +13667,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13675
13667
|
type: formConfig.value.dateType,
|
|
13676
13668
|
"value-format": formConfig.value.dateFormatter ? formConfig.value.dateFormatter.key : unref(DateTimeFormatter).TIMESTAMP.key,
|
|
13677
13669
|
style: { "width": "100%" },
|
|
13678
|
-
onClear,
|
|
13670
|
+
onClear: emitClear,
|
|
13679
13671
|
onFocus: emitFocus,
|
|
13680
13672
|
onKeydown: onKeyDown
|
|
13681
13673
|
}, null, 8, ["modelValue", "clearable", "disabled", "format", "placeholder", "prefix-icon", "readonly", "suffix-icon", "type", "value-format"])) : (openBlock(), createBlock(_component_el_time_picker, {
|
|
@@ -13691,7 +13683,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13691
13683
|
"suffix-icon": formConfig.value?.suffixIcon,
|
|
13692
13684
|
"value-format": formConfig.value.dateFormatter ? formConfig.value.dateFormatter.key : unref(DateTimeFormatter).TIMESTAMP.key,
|
|
13693
13685
|
style: { "width": "100%" },
|
|
13694
|
-
onClear,
|
|
13686
|
+
onClear: emitClear,
|
|
13695
13687
|
onFocus: emitFocus,
|
|
13696
13688
|
onKeydown: onKeyDown
|
|
13697
13689
|
}, null, 8, ["modelValue", "clearable", "disabled", "format", "placeholder", "prefix-icon", "readonly", "suffix-icon", "value-format"]))
|
|
@@ -13765,7 +13757,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13765
13757
|
"suffix-icon": formConfig.value?.suffixIcon,
|
|
13766
13758
|
"collapse-tags-tooltip": "",
|
|
13767
13759
|
"fit-input-width": "",
|
|
13768
|
-
|
|
13760
|
+
onChange: emitChange,
|
|
13761
|
+
onClear: emitClear,
|
|
13769
13762
|
onFocus: emitFocus,
|
|
13770
13763
|
onKeydown: onKeyDown
|
|
13771
13764
|
}, {
|
|
@@ -13813,7 +13806,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13813
13806
|
class: "a-input-cascader",
|
|
13814
13807
|
"collapse-tags-tooltip": "",
|
|
13815
13808
|
"popper-class": "a-input-cascader-popper",
|
|
13816
|
-
onClear,
|
|
13809
|
+
onClear: emitClear,
|
|
13817
13810
|
onFocus: emitFocus,
|
|
13818
13811
|
onKeydown: onKeyDown
|
|
13819
13812
|
}, null, 8, ["modelValue", "clearable", "collapse-tags", "disabled", "options", "placeholder", "props", "readonly", "show-all-levels"])) : (openBlock(), createBlock(_component_el_input, {
|
|
@@ -13833,9 +13826,9 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13833
13826
|
"show-word-limit": formConfig.value?.showLimit !== false,
|
|
13834
13827
|
"suffix-icon": formConfig.value?.suffixIcon,
|
|
13835
13828
|
type: getInputType.value,
|
|
13836
|
-
onBlur,
|
|
13837
|
-
onChange:
|
|
13838
|
-
onClear,
|
|
13829
|
+
onBlur: emitBlur,
|
|
13830
|
+
onChange: emitChange,
|
|
13831
|
+
onClear: emitClear,
|
|
13839
13832
|
onFocus: emitFocus,
|
|
13840
13833
|
onKeydown: onKeyDown
|
|
13841
13834
|
}, createSlots({ _: 2 }, [
|
|
@@ -13850,7 +13843,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13850
13843
|
name === "suffix" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
13851
13844
|
isClearButtonShow.value ? (openBlock(), createBlock(_component_el_icon, {
|
|
13852
13845
|
key: 0,
|
|
13853
|
-
onClick: _cache[7] || (_cache[7] = ($event) =>
|
|
13846
|
+
onClick: _cache[7] || (_cache[7] = ($event) => emitClear())
|
|
13854
13847
|
}, {
|
|
13855
13848
|
default: withCtx(() => [
|
|
13856
13849
|
createVNode(unref(circle_close_default))
|
|
@@ -18606,12 +18599,12 @@ class WebValidator {
|
|
|
18606
18599
|
}
|
|
18607
18600
|
/**
|
|
18608
18601
|
* ### 创建验证器
|
|
18609
|
-
* @param
|
|
18602
|
+
* @param entityClass 接口服务对象
|
|
18610
18603
|
* @param rules `可选` 表单验证规则
|
|
18611
18604
|
*/
|
|
18612
|
-
static createRules(
|
|
18605
|
+
static createRules(entityClass, rules = {}) {
|
|
18613
18606
|
const formRules = rules;
|
|
18614
|
-
const formFieldList = getFormConfigList(
|
|
18607
|
+
const formFieldList = getFormConfigList(entityClass);
|
|
18615
18608
|
for (let i = 0; i < formFieldList.length; i += 1) {
|
|
18616
18609
|
const config = formFieldList[i];
|
|
18617
18610
|
const fieldKey = config.key;
|
|
@@ -19087,7 +19080,7 @@ class WebValidator {
|
|
|
19087
19080
|
function useEditor(props, ServiceClass, option = {}) {
|
|
19088
19081
|
const result = useDetail(props, ServiceClass, option);
|
|
19089
19082
|
const title = computed(() => result.formData.value.id ? WebI18n.get().Update : WebI18n.get().Add);
|
|
19090
|
-
const rules = WebValidator.createRules(new ServiceClass(), option.customRules || {});
|
|
19083
|
+
const rules = WebValidator.createRules(new ServiceClass().entityClass, option.customRules || {});
|
|
19091
19084
|
const formRef = ref();
|
|
19092
19085
|
async function onSubmit() {
|
|
19093
19086
|
let postData = result.formData.value.copy();
|
|
@@ -19455,7 +19448,7 @@ class AbstractCurdService extends AbstractService {
|
|
|
19455
19448
|
* @param moreRule `可选` 更多的验证规则
|
|
19456
19449
|
*/
|
|
19457
19450
|
static createValidator(moreRule = {}) {
|
|
19458
|
-
return WebValidator.createRules(new this(), moreRule);
|
|
19451
|
+
return WebValidator.createRules(new this().entityClass, moreRule);
|
|
19459
19452
|
}
|
|
19460
19453
|
/**
|
|
19461
19454
|
* ### 查询分页数据列表
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ITransformerConstructor } from '@airpower/transformer';
|
|
1
2
|
import { RootEntity } from '../model/RootEntity';
|
|
2
|
-
import { AbstractCurdService } from '../service/AbstractCurdService';
|
|
3
3
|
import { WebValidateRule, WebValidatorCallback, WebValidatorTarget, WebValidatorTrigger, WebValidatorType } from './type';
|
|
4
4
|
/**
|
|
5
5
|
* ### 表单验证
|
|
@@ -43,10 +43,10 @@ export declare class WebValidator {
|
|
|
43
43
|
static create<E extends RootEntity = RootEntity>(rule: WebValidateRule<E>): WebValidateRule<E>;
|
|
44
44
|
/**
|
|
45
45
|
* ### 创建验证器
|
|
46
|
-
* @param
|
|
46
|
+
* @param entityClass 接口服务对象
|
|
47
47
|
* @param rules `可选` 表单验证规则
|
|
48
48
|
*/
|
|
49
|
-
static createRules<E extends RootEntity
|
|
49
|
+
static createRules<E extends RootEntity>(entityClass: ITransformerConstructor<E>, rules?: WebValidateRule<E>): WebValidateRule<E>;
|
|
50
50
|
/**
|
|
51
51
|
* ### 获取一个验证器
|
|
52
52
|
* @param configValue 验证器配置的值
|