ll-plus 2.2.15 → 2.2.16
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/es/components/key-value/index.d.ts +93 -6
- package/es/components/key-value/src/components/key-value-item.vue.d.ts +69 -1
- package/es/components/key-value/src/components/key-value-item.vue2.mjs +14 -5
- package/es/components/key-value/src/components/key-value-item.vue2.mjs.map +1 -1
- package/es/components/key-value/src/config/key-value-item.d.ts +31 -1
- package/es/components/key-value/src/config/key-value-item.mjs +16 -0
- package/es/components/key-value/src/config/key-value-item.mjs.map +1 -1
- package/es/components/key-value/src/config/key-value.d.ts +12 -1
- package/es/components/key-value/src/config/key-value.mjs +20 -2
- package/es/components/key-value/src/config/key-value.mjs.map +1 -1
- package/es/components/key-value/src/key-value.vue.d.ts +112 -24
- package/es/components/key-value/src/key-value.vue2.mjs +22 -7
- package/es/components/key-value/src/key-value.vue2.mjs.map +1 -1
- package/index.full.js +72 -14
- package/index.full.min.js +18 -18
- package/index.full.min.js.map +1 -1
- package/index.full.min.mjs +15 -15
- package/index.full.min.mjs.map +1 -1
- package/index.full.mjs +72 -14
- package/lib/components/key-value/index.d.ts +93 -6
- package/lib/components/key-value/src/components/key-value-item.vue.d.ts +69 -1
- package/lib/components/key-value/src/components/key-value-item.vue2.js +14 -5
- package/lib/components/key-value/src/components/key-value-item.vue2.js.map +1 -1
- package/lib/components/key-value/src/config/key-value-item.d.ts +31 -1
- package/lib/components/key-value/src/config/key-value-item.js +16 -0
- package/lib/components/key-value/src/config/key-value-item.js.map +1 -1
- package/lib/components/key-value/src/config/key-value.d.ts +12 -1
- package/lib/components/key-value/src/config/key-value.js +20 -2
- package/lib/components/key-value/src/config/key-value.js.map +1 -1
- package/lib/components/key-value/src/key-value.vue.d.ts +112 -24
- package/lib/components/key-value/src/key-value.vue2.js +22 -7
- package/lib/components/key-value/src/key-value.vue2.js.map +1 -1
- package/package.json +1 -1
- package/types/packages/components/key-value/index.d.ts +93 -6
- package/types/packages/components/key-value/src/components/key-value-item.vue.d.ts +69 -1
- package/types/packages/components/key-value/src/config/key-value-item.d.ts +31 -1
- package/types/packages/components/key-value/src/config/key-value.d.ts +12 -1
- package/types/packages/components/key-value/src/key-value.vue.d.ts +112 -24
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type KeyValueItem } from './config';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
readonly value: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) =>
|
|
3
|
+
readonly value: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => KeyValueItem[]) | (() => KeyValueItem[]) | ((new (...args: any[]) => KeyValueItem[]) | (() => KeyValueItem[]))[], unknown, unknown, () => {
|
|
3
4
|
key: string;
|
|
4
5
|
value: string;
|
|
5
6
|
}[], boolean>;
|
|
@@ -34,9 +35,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
34
35
|
type: string;
|
|
35
36
|
placeholder: string;
|
|
36
37
|
}, boolean>;
|
|
38
|
+
readonly disabledValue: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => never[], boolean>;
|
|
39
|
+
readonly disabledKey: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => never[], boolean>;
|
|
40
|
+
readonly disabledDelete: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => never[], boolean>;
|
|
41
|
+
readonly disabledAdd: import("ll-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
37
42
|
}, {
|
|
38
43
|
props: import("@vue/shared").LooseRequired<{
|
|
39
|
-
readonly value:
|
|
44
|
+
readonly value: KeyValueItem[];
|
|
40
45
|
readonly disabled: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
41
46
|
readonly loading: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
42
47
|
readonly keyLabel: string;
|
|
@@ -46,11 +51,16 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
46
51
|
readonly keyType: any;
|
|
47
52
|
readonly keyTypes: import("./config").KeyType[];
|
|
48
53
|
readonly valueType: any;
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
54
|
+
readonly disabledValue: number[];
|
|
55
|
+
readonly disabledKey: number[];
|
|
56
|
+
readonly disabledDelete: number[];
|
|
57
|
+
readonly disabledAdd: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
58
|
+
readonly onChange?: ((value: KeyValueItem[]) => any) | undefined;
|
|
59
|
+
readonly "onUpdate:value"?: ((value: KeyValueItem[]) => any) | undefined;
|
|
60
|
+
readonly onDelete?: ((index: number) => any) | undefined;
|
|
61
|
+
readonly onAdd?: ((params: import("./config").KeyValueAddEmits) => any) | undefined;
|
|
52
62
|
} & {}>;
|
|
53
|
-
emits: ((event: "
|
|
63
|
+
emits: ((event: "delete", index: number) => void) & ((event: "add", params: import("./config").KeyValueAddEmits) => void) & ((event: "change", value: KeyValueItem[]) => void) & ((event: "update:value", value: KeyValueItem[]) => void);
|
|
54
64
|
bem: {
|
|
55
65
|
b: (blockSuffix?: string) => string;
|
|
56
66
|
e: (element?: string) => string;
|
|
@@ -62,7 +72,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
62
72
|
is: (name?: string) => string;
|
|
63
73
|
};
|
|
64
74
|
innerValue: import("vue").Ref<{
|
|
65
|
-
key:
|
|
75
|
+
key: any;
|
|
66
76
|
value: any;
|
|
67
77
|
}[]>;
|
|
68
78
|
keyValueItems: import("vue").Ref<any[]>;
|
|
@@ -71,22 +81,57 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
71
81
|
handleDelete: (idx: number) => void;
|
|
72
82
|
handleChange: () => void;
|
|
73
83
|
keyValueItem: import("vue").DefineComponent<{
|
|
74
|
-
readonly
|
|
84
|
+
readonly disabled: {
|
|
85
|
+
readonly type: import("vue").PropType<import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
86
|
+
readonly required: false;
|
|
87
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
88
|
+
__epPropKey: true;
|
|
89
|
+
};
|
|
90
|
+
readonly disabledValue: {
|
|
91
|
+
readonly type: import("vue").PropType<number[]>;
|
|
92
|
+
readonly required: false;
|
|
93
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
94
|
+
__epPropKey: true;
|
|
95
|
+
};
|
|
96
|
+
readonly disabledKey: {
|
|
97
|
+
readonly type: import("vue").PropType<number[]>;
|
|
98
|
+
readonly required: false;
|
|
99
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
100
|
+
__epPropKey: true;
|
|
101
|
+
};
|
|
102
|
+
readonly disabledDelete: {
|
|
103
|
+
readonly type: import("vue").PropType<number[]>;
|
|
104
|
+
readonly required: false;
|
|
105
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
106
|
+
__epPropKey: true;
|
|
107
|
+
};
|
|
108
|
+
readonly value: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => KeyValueItem) | (() => KeyValueItem) | ((new (...args: any[]) => KeyValueItem) | (() => KeyValueItem))[], unknown, unknown, () => {
|
|
75
109
|
key: string;
|
|
76
110
|
value: string;
|
|
77
111
|
}, boolean>;
|
|
112
|
+
readonly idx: {
|
|
113
|
+
readonly type: import("vue").PropType<number>;
|
|
114
|
+
readonly required: true;
|
|
115
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
116
|
+
__epPropKey: true;
|
|
117
|
+
};
|
|
78
118
|
readonly keyValueTypeDict: import("ll-plus/es/utils").EpPropFinalized<ObjectConstructor, unknown, unknown, () => {}, boolean>;
|
|
79
119
|
readonly showDelete: import("ll-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
80
120
|
}, {
|
|
81
121
|
props: import("@vue/shared").LooseRequired<{
|
|
82
|
-
readonly value:
|
|
122
|
+
readonly value: KeyValueItem;
|
|
123
|
+
readonly idx: number;
|
|
83
124
|
readonly keyValueTypeDict: Record<string, any>;
|
|
84
125
|
readonly showDelete: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
126
|
+
readonly disabled?: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown> | undefined;
|
|
127
|
+
readonly disabledValue?: number[] | undefined;
|
|
128
|
+
readonly disabledKey?: number[] | undefined;
|
|
129
|
+
readonly disabledDelete?: number[] | undefined;
|
|
85
130
|
readonly onChange?: (() => any) | undefined;
|
|
86
|
-
readonly "onUpdate:value"?: ((value:
|
|
131
|
+
readonly "onUpdate:value"?: ((value: KeyValueItem) => any) | undefined;
|
|
87
132
|
readonly onDelete?: (() => any) | undefined;
|
|
88
133
|
} & {}>;
|
|
89
|
-
emits: ((event: "delete") => void) & ((event: "change") => void) & ((event: "update:value", value:
|
|
134
|
+
emits: ((event: "delete") => void) & ((event: "change") => void) & ((event: "update:value", value: KeyValueItem) => void);
|
|
90
135
|
attrs: {
|
|
91
136
|
[x: string]: unknown;
|
|
92
137
|
};
|
|
@@ -101,11 +146,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
101
146
|
is: (name?: string) => string;
|
|
102
147
|
};
|
|
103
148
|
innerValue: import("vue").Ref<{
|
|
104
|
-
key:
|
|
149
|
+
key: any;
|
|
105
150
|
value: any;
|
|
106
151
|
}>;
|
|
107
152
|
getKeyType: import("vue").ComputedRef<any>;
|
|
108
153
|
getValueType: import("vue").ComputedRef<any>;
|
|
154
|
+
getKeyDisabled: import("vue").ComputedRef<any>;
|
|
155
|
+
getValueDisabled: import("vue").ComputedRef<any>;
|
|
156
|
+
getDeleteDisabled: import("vue").ComputedRef<import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown> | undefined>;
|
|
109
157
|
handleDelete: () => void;
|
|
110
158
|
handleChange: () => void;
|
|
111
159
|
readonly isEmpty: {
|
|
@@ -351,29 +399,60 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
351
399
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
352
400
|
delete: () => boolean;
|
|
353
401
|
change: () => boolean;
|
|
354
|
-
'update:value': (value:
|
|
402
|
+
'update:value': (value: KeyValueItem) => boolean;
|
|
355
403
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
356
|
-
readonly
|
|
404
|
+
readonly disabled: {
|
|
405
|
+
readonly type: import("vue").PropType<import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
406
|
+
readonly required: false;
|
|
407
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
408
|
+
__epPropKey: true;
|
|
409
|
+
};
|
|
410
|
+
readonly disabledValue: {
|
|
411
|
+
readonly type: import("vue").PropType<number[]>;
|
|
412
|
+
readonly required: false;
|
|
413
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
414
|
+
__epPropKey: true;
|
|
415
|
+
};
|
|
416
|
+
readonly disabledKey: {
|
|
417
|
+
readonly type: import("vue").PropType<number[]>;
|
|
418
|
+
readonly required: false;
|
|
419
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
420
|
+
__epPropKey: true;
|
|
421
|
+
};
|
|
422
|
+
readonly disabledDelete: {
|
|
423
|
+
readonly type: import("vue").PropType<number[]>;
|
|
424
|
+
readonly required: false;
|
|
425
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
426
|
+
__epPropKey: true;
|
|
427
|
+
};
|
|
428
|
+
readonly value: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => KeyValueItem) | (() => KeyValueItem) | ((new (...args: any[]) => KeyValueItem) | (() => KeyValueItem))[], unknown, unknown, () => {
|
|
357
429
|
key: string;
|
|
358
430
|
value: string;
|
|
359
431
|
}, boolean>;
|
|
432
|
+
readonly idx: {
|
|
433
|
+
readonly type: import("vue").PropType<number>;
|
|
434
|
+
readonly required: true;
|
|
435
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
436
|
+
__epPropKey: true;
|
|
437
|
+
};
|
|
360
438
|
readonly keyValueTypeDict: import("ll-plus/es/utils").EpPropFinalized<ObjectConstructor, unknown, unknown, () => {}, boolean>;
|
|
361
439
|
readonly showDelete: import("ll-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
362
440
|
}>> & {
|
|
363
441
|
onChange?: (() => any) | undefined;
|
|
364
|
-
"onUpdate:value"?: ((value:
|
|
442
|
+
"onUpdate:value"?: ((value: KeyValueItem) => any) | undefined;
|
|
365
443
|
onDelete?: (() => any) | undefined;
|
|
366
444
|
}, {
|
|
367
|
-
readonly value:
|
|
445
|
+
readonly value: KeyValueItem;
|
|
368
446
|
readonly keyValueTypeDict: Record<string, any>;
|
|
369
447
|
readonly showDelete: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
370
448
|
}, {}>;
|
|
371
449
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
372
|
-
change: (value:
|
|
373
|
-
add: () => boolean;
|
|
374
|
-
|
|
450
|
+
change: (value: KeyValueItem[]) => boolean;
|
|
451
|
+
add: (params: import("./config").KeyValueAddEmits) => boolean;
|
|
452
|
+
delete: (index: number) => boolean;
|
|
453
|
+
'update:value': (value: KeyValueItem[]) => boolean;
|
|
375
454
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
376
|
-
readonly value: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) =>
|
|
455
|
+
readonly value: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => KeyValueItem[]) | (() => KeyValueItem[]) | ((new (...args: any[]) => KeyValueItem[]) | (() => KeyValueItem[]))[], unknown, unknown, () => {
|
|
377
456
|
key: string;
|
|
378
457
|
value: string;
|
|
379
458
|
}[], boolean>;
|
|
@@ -408,12 +487,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
408
487
|
type: string;
|
|
409
488
|
placeholder: string;
|
|
410
489
|
}, boolean>;
|
|
490
|
+
readonly disabledValue: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => never[], boolean>;
|
|
491
|
+
readonly disabledKey: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => never[], boolean>;
|
|
492
|
+
readonly disabledDelete: import("ll-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => never[], boolean>;
|
|
493
|
+
readonly disabledAdd: import("ll-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
411
494
|
}>> & {
|
|
412
|
-
onChange?: ((value:
|
|
413
|
-
"onUpdate:value"?: ((value:
|
|
414
|
-
|
|
495
|
+
onChange?: ((value: KeyValueItem[]) => any) | undefined;
|
|
496
|
+
"onUpdate:value"?: ((value: KeyValueItem[]) => any) | undefined;
|
|
497
|
+
onDelete?: ((index: number) => any) | undefined;
|
|
498
|
+
onAdd?: ((params: import("./config").KeyValueAddEmits) => any) | undefined;
|
|
415
499
|
}, {
|
|
416
|
-
readonly value:
|
|
500
|
+
readonly value: KeyValueItem[];
|
|
417
501
|
readonly disabled: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
418
502
|
readonly loading: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
419
503
|
readonly keyLabel: string;
|
|
@@ -423,5 +507,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
423
507
|
readonly keyType: any;
|
|
424
508
|
readonly keyTypes: import("./config").KeyType[];
|
|
425
509
|
readonly valueType: any;
|
|
510
|
+
readonly disabledValue: number[];
|
|
511
|
+
readonly disabledKey: number[];
|
|
512
|
+
readonly disabledDelete: number[];
|
|
513
|
+
readonly disabledAdd: import("ll-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
426
514
|
}, {}>;
|
|
427
515
|
export default _default;
|
|
@@ -28,14 +28,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
});
|
|
29
29
|
const handleAddItem = () => {
|
|
30
30
|
innerValue.value.push(getKeyValueItem());
|
|
31
|
-
emits("add"
|
|
31
|
+
emits("add", {
|
|
32
|
+
index: innerValue.value.length - 1,
|
|
33
|
+
item: innerValue.value[innerValue.value.length - 1],
|
|
34
|
+
value: innerValue.value
|
|
35
|
+
});
|
|
36
|
+
handleChange();
|
|
32
37
|
};
|
|
33
38
|
const handleDelete = (idx) => {
|
|
34
39
|
innerValue.value.splice(idx, 1);
|
|
40
|
+
emits("delete", idx);
|
|
41
|
+
handleChange();
|
|
35
42
|
};
|
|
36
43
|
const handleChange = () => {
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
const arr = innerValue.value.map((e) => {
|
|
45
|
+
return { key: e.key, value: e.value };
|
|
46
|
+
});
|
|
47
|
+
emits("change", arr);
|
|
48
|
+
emits("update:value", arr);
|
|
39
49
|
};
|
|
40
50
|
watch(
|
|
41
51
|
() => props.value,
|
|
@@ -43,7 +53,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
43
53
|
innerValue.value = n && n.length > 0 ? n : [{ key: null, value: null }];
|
|
44
54
|
},
|
|
45
55
|
{
|
|
46
|
-
immediate: true
|
|
56
|
+
immediate: true,
|
|
57
|
+
deep: true
|
|
47
58
|
}
|
|
48
59
|
);
|
|
49
60
|
return (_ctx, _cache) => {
|
|
@@ -65,11 +76,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
65
76
|
null,
|
|
66
77
|
renderList(innerValue.value, (_item, idx) => {
|
|
67
78
|
return openBlock(), createBlock(keyValueItem, {
|
|
68
|
-
key: idx,
|
|
79
|
+
key: idx + +/* @__PURE__ */ new Date(),
|
|
69
80
|
ref_for: true,
|
|
70
81
|
ref: (el) => keyValueItems.value[idx] = el,
|
|
71
82
|
value: innerValue.value[idx],
|
|
72
83
|
"onUpdate:value": ($event) => innerValue.value[idx] = $event,
|
|
84
|
+
idx,
|
|
73
85
|
"key-label": props.keyLabel,
|
|
74
86
|
"value-label": props.valueLabel,
|
|
75
87
|
"key-value-type-dict": keyValueTypeDict.value,
|
|
@@ -79,6 +91,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
79
91
|
"key-types": props.keyTypes,
|
|
80
92
|
"value-type": props.valueType,
|
|
81
93
|
disabled: props.disabled,
|
|
94
|
+
"disabled-value": props.disabledValue,
|
|
95
|
+
"disabled-key": props.disabledKey,
|
|
96
|
+
"disabled-delete": props.disabledDelete,
|
|
82
97
|
onDelete: ($event) => handleDelete(idx),
|
|
83
98
|
onChange: handleChange
|
|
84
99
|
}, createSlots({
|
|
@@ -93,7 +108,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
93
108
|
])
|
|
94
109
|
};
|
|
95
110
|
})
|
|
96
|
-
]), 1032, ["value", "onUpdate:value", "key-label", "value-label", "key-value-type-dict", "show-delete", "key-value-type", "key-type", "key-types", "value-type", "disabled", "onDelete"]);
|
|
111
|
+
]), 1032, ["value", "onUpdate:value", "idx", "key-label", "value-label", "key-value-type-dict", "show-delete", "key-value-type", "key-type", "key-types", "value-type", "disabled", "disabled-value", "disabled-key", "disabled-delete", "onDelete"]);
|
|
97
112
|
}),
|
|
98
113
|
128
|
|
99
114
|
/* KEYED_FRAGMENT */
|
|
@@ -101,7 +116,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
101
116
|
createVNode(_component_ll_button, {
|
|
102
117
|
class: normalizeClass(unref(bem).e("add")),
|
|
103
118
|
loading: _ctx.loading,
|
|
104
|
-
disabled: props.disabled,
|
|
119
|
+
disabled: props.disabled || props.disabledAdd,
|
|
105
120
|
onClick: handleAddItem
|
|
106
121
|
}, {
|
|
107
122
|
default: withCtx(() => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-value.vue2.mjs","sources":["../../../../../packages/components/key-value/src/key-value.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\">\n <a-spin :spinning=\"props.loading\">\n <key-value-item\n v-for=\"(_item, idx) in innerValue\"\n :key=\"idx\"\n :ref=\"el => (keyValueItems[idx] = el)\"\n v-model:value=\"innerValue[idx]\"\n :key-label=\"props.keyLabel\"\n :value-label=\"props.valueLabel\"\n :key-value-type-dict=\"keyValueTypeDict\"\n :show-delete=\"idx > 0\"\n :key-value-type=\"props.keyValueType\"\n :key-type=\"props.keyType\"\n :key-types=\"props.keyTypes\"\n :value-type=\"props.valueType\"\n :disabled=\"props.disabled\"\n @delete=\"handleDelete(idx)\"\n @change=\"handleChange\"\n >\n <template\n v-for=\"item in Object.keys($slots)\"\n :key=\"item\"\n #[item]=\"data\"\n >\n <slot :name=\"item\" v-bind=\"data || {}\" :index=\"idx\"></slot>\n </template>\n </key-value-item>\n <ll-button\n :class=\"bem.e('add')\"\n :loading=\"loading\"\n :disabled=\"props.disabled\"\n @click=\"handleAddItem\"\n >\n <div :class=\"bem.e('plus')\">\n <ll-icon\n v-if=\"!loading\"\n icon-name=\"icon-add\"\n :class=\"bem.e('icon-add')\"\n />\n {{ props.addText }}\n </div>\n </ll-button>\n </a-spin>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch } from 'vue'\
|
|
1
|
+
{"version":3,"file":"key-value.vue2.mjs","sources":["../../../../../packages/components/key-value/src/key-value.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\">\n <a-spin :spinning=\"props.loading\">\n <key-value-item\n v-for=\"(_item, idx) in innerValue\"\n :key=\"idx + +new Date()\"\n :ref=\"el => (keyValueItems[idx] = el)\"\n v-model:value=\"innerValue[idx]\"\n :idx=\"idx\"\n :key-label=\"props.keyLabel\"\n :value-label=\"props.valueLabel\"\n :key-value-type-dict=\"keyValueTypeDict\"\n :show-delete=\"idx > 0\"\n :key-value-type=\"props.keyValueType\"\n :key-type=\"props.keyType\"\n :key-types=\"props.keyTypes\"\n :value-type=\"props.valueType\"\n :disabled=\"props.disabled\"\n :disabled-value=\"props.disabledValue\"\n :disabled-key=\"props.disabledKey\"\n :disabled-delete=\"props.disabledDelete\"\n @delete=\"handleDelete(idx)\"\n @change=\"handleChange\"\n >\n <template\n v-for=\"item in Object.keys($slots)\"\n :key=\"item\"\n #[item]=\"data\"\n >\n <slot :name=\"item\" v-bind=\"data || {}\" :index=\"idx\"></slot>\n </template>\n </key-value-item>\n <ll-button\n :class=\"bem.e('add')\"\n :loading=\"loading\"\n :disabled=\"props.disabled || props.disabledAdd\"\n @click=\"handleAddItem\"\n >\n <div :class=\"bem.e('plus')\">\n <ll-icon\n v-if=\"!loading\"\n icon-name=\"icon-add\"\n :class=\"bem.e('icon-add')\"\n />\n {{ props.addText }}\n </div>\n </ll-button>\n </a-spin>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch } from 'vue'\nimport { createNamespace } from '@ll-plus/utils'\nimport {\n keyValueProps,\n keyValueEmits,\n getKeyValueItem,\n type KeyValueItem\n} from './config'\nimport keyValueItem from './components/key-value-item.vue'\n\ndefineOptions({ name: 'LlKeyValue' })\n\nconst props = defineProps(keyValueProps)\nconst emits = defineEmits(keyValueEmits)\nconst bem = createNamespace('key-value')\n\nconst innerValue = ref<KeyValueItem[]>(\n props.value && props.value.length > 0\n ? props.value\n : [{ key: null, value: null }]\n)\n\nconst keyValueItems = ref<any[]>([])\n\nconst keyValueTypeDict = computed(() => {\n const obj = {}\n props.keyTypes.map(e => {\n obj[e.value] = e.option\n })\n return obj\n})\n\nconst handleAddItem = () => {\n innerValue.value.push(getKeyValueItem())\n emits('add', {\n index: innerValue.value.length - 1,\n item: innerValue.value[innerValue.value.length - 1],\n value: innerValue.value\n })\n handleChange()\n}\n\nconst handleDelete = (idx: number) => {\n innerValue.value.splice(idx, 1)\n emits('delete', idx)\n handleChange()\n}\n\nconst handleChange = () => {\n const arr = innerValue.value.map(e => {\n return { key: e.key, value: e.value }\n })\n emits('change', arr)\n emits('update:value', arr)\n}\n\nwatch(\n () => props.value,\n n => {\n innerValue.value = n && n.length > 0 ? n : [{ key: null, value: null }]\n },\n {\n immediate: true,\n deep: true\n }\n)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgEA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AACd,IAAM,MAAA,GAAA,GAAM,gBAAgB,WAAW,CAAA,CAAA;AAEvC,IAAA,MAAM,UAAa,GAAA,GAAA;AAAA,MACjB,KAAM,CAAA,KAAA,IAAS,KAAM,CAAA,KAAA,CAAM,SAAS,CAChC,GAAA,KAAA,CAAM,KACN,GAAA,CAAC,EAAE,GAAA,EAAK,IAAM,EAAA,KAAA,EAAO,MAAM,CAAA;AAAA,KACjC,CAAA;AAEA,IAAM,MAAA,aAAA,GAAgB,GAAW,CAAA,EAAE,CAAA,CAAA;AAEnC,IAAM,MAAA,gBAAA,GAAmB,SAAS,MAAM;AACtC,MAAA,MAAM,MAAM,EAAC,CAAA;AACb,MAAM,KAAA,CAAA,QAAA,CAAS,IAAI,CAAK,CAAA,KAAA;AACtB,QAAI,GAAA,CAAA,CAAA,CAAE,KAAK,CAAA,GAAI,CAAE,CAAA,MAAA,CAAA;AAAA,OAClB,CAAA,CAAA;AACD,MAAO,OAAA,GAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAA,MAAM,gBAAgB,MAAM;AAC1B,MAAW,UAAA,CAAA,KAAA,CAAM,IAAK,CAAA,eAAA,EAAiB,CAAA,CAAA;AACvC,MAAA,KAAA,CAAM,KAAO,EAAA;AAAA,QACX,KAAA,EAAO,UAAW,CAAA,KAAA,CAAM,MAAS,GAAA,CAAA;AAAA,QACjC,MAAM,UAAW,CAAA,KAAA,CAAM,UAAW,CAAA,KAAA,CAAM,SAAS,CAAC,CAAA;AAAA,QAClD,OAAO,UAAW,CAAA,KAAA;AAAA,OACnB,CAAA,CAAA;AACD,MAAa,YAAA,EAAA,CAAA;AAAA,KACf,CAAA;AAEA,IAAM,MAAA,YAAA,GAAe,CAAC,GAAgB,KAAA;AACpC,MAAW,UAAA,CAAA,KAAA,CAAM,MAAO,CAAA,GAAA,EAAK,CAAC,CAAA,CAAA;AAC9B,MAAA,KAAA,CAAM,UAAU,GAAG,CAAA,CAAA;AACnB,MAAa,YAAA,EAAA,CAAA;AAAA,KACf,CAAA;AAEA,IAAA,MAAM,eAAe,MAAM;AACzB,MAAA,MAAM,GAAM,GAAA,UAAA,CAAW,KAAM,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA;AACpC,QAAA,OAAO,EAAE,GAAK,EAAA,CAAA,CAAE,GAAK,EAAA,KAAA,EAAO,EAAE,KAAM,EAAA,CAAA;AAAA,OACrC,CAAA,CAAA;AACD,MAAA,KAAA,CAAM,UAAU,GAAG,CAAA,CAAA;AACnB,MAAA,KAAA,CAAM,gBAAgB,GAAG,CAAA,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAA,KAAA;AAAA,MACE,MAAM,KAAM,CAAA,KAAA;AAAA,MACZ,CAAK,CAAA,KAAA;AACH,QAAA,UAAA,CAAW,KAAQ,GAAA,CAAA,IAAK,CAAE,CAAA,MAAA,GAAS,CAAI,GAAA,CAAA,GAAI,CAAC,EAAE,GAAK,EAAA,IAAA,EAAM,KAAO,EAAA,IAAA,EAAM,CAAA,CAAA;AAAA,OACxE;AAAA,MACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,QACX,IAAM,EAAA,IAAA;AAAA,OACR;AAAA,KACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/index.full.js
CHANGED
|
@@ -58062,7 +58062,8 @@
|
|
|
58062
58062
|
|
|
58063
58063
|
const getKeyValueItem = () => ({
|
|
58064
58064
|
key: null,
|
|
58065
|
-
value: null
|
|
58065
|
+
value: null,
|
|
58066
|
+
_timestamp: +/* @__PURE__ */ new Date()
|
|
58066
58067
|
});
|
|
58067
58068
|
const keyValueProps = buildProps({
|
|
58068
58069
|
value: {
|
|
@@ -58110,11 +58111,28 @@
|
|
|
58110
58111
|
type: "input",
|
|
58111
58112
|
placeholder: "\u8BF7\u8F93\u5165key"
|
|
58112
58113
|
})
|
|
58114
|
+
},
|
|
58115
|
+
disabledValue: {
|
|
58116
|
+
type: definePropType(Array),
|
|
58117
|
+
default: () => []
|
|
58118
|
+
},
|
|
58119
|
+
disabledKey: {
|
|
58120
|
+
type: definePropType(Array),
|
|
58121
|
+
default: () => []
|
|
58122
|
+
},
|
|
58123
|
+
disabledDelete: {
|
|
58124
|
+
type: definePropType(Array),
|
|
58125
|
+
default: () => []
|
|
58126
|
+
},
|
|
58127
|
+
disabledAdd: {
|
|
58128
|
+
type: Boolean,
|
|
58129
|
+
default: false
|
|
58113
58130
|
}
|
|
58114
58131
|
});
|
|
58115
58132
|
const keyValueEmits = {
|
|
58116
58133
|
change: (value) => !!value,
|
|
58117
|
-
add: () =>
|
|
58134
|
+
add: (params) => !!params,
|
|
58135
|
+
delete: (index) => typeof index === "number",
|
|
58118
58136
|
"update:value": (value) => !!value
|
|
58119
58137
|
};
|
|
58120
58138
|
|
|
@@ -58144,6 +58162,18 @@
|
|
|
58144
58162
|
}
|
|
58145
58163
|
];
|
|
58146
58164
|
const keyValueItemProps = buildProps({
|
|
58165
|
+
disabled: {
|
|
58166
|
+
type: Boolean
|
|
58167
|
+
},
|
|
58168
|
+
disabledValue: {
|
|
58169
|
+
type: definePropType(Array)
|
|
58170
|
+
},
|
|
58171
|
+
disabledKey: {
|
|
58172
|
+
type: definePropType(Array)
|
|
58173
|
+
},
|
|
58174
|
+
disabledDelete: {
|
|
58175
|
+
type: definePropType(Array)
|
|
58176
|
+
},
|
|
58147
58177
|
value: {
|
|
58148
58178
|
type: definePropType(Object),
|
|
58149
58179
|
default: () => ({
|
|
@@ -58151,6 +58181,10 @@
|
|
|
58151
58181
|
value: ""
|
|
58152
58182
|
})
|
|
58153
58183
|
},
|
|
58184
|
+
idx: {
|
|
58185
|
+
type: Number,
|
|
58186
|
+
required: true
|
|
58187
|
+
},
|
|
58154
58188
|
keyValueTypeDict: {
|
|
58155
58189
|
type: Object,
|
|
58156
58190
|
default: () => ({})
|
|
@@ -58198,6 +58232,15 @@
|
|
|
58198
58232
|
}
|
|
58199
58233
|
return option;
|
|
58200
58234
|
});
|
|
58235
|
+
const getKeyDisabled = require$$0.computed(() => {
|
|
58236
|
+
return props.disabledKey?.includes(props.idx) || props.disabled || getKeyType.value?.disabled;
|
|
58237
|
+
});
|
|
58238
|
+
const getValueDisabled = require$$0.computed(() => {
|
|
58239
|
+
return props.disabledValue?.includes(props.idx) || props.disabled || getValueType.value?.disabled;
|
|
58240
|
+
});
|
|
58241
|
+
const getDeleteDisabled = require$$0.computed(() => {
|
|
58242
|
+
return props.disabledDelete?.includes(props.idx) || props.disabled;
|
|
58243
|
+
});
|
|
58201
58244
|
const handleDelete = () => {
|
|
58202
58245
|
emits("delete");
|
|
58203
58246
|
};
|
|
@@ -58257,16 +58300,16 @@
|
|
|
58257
58300
|
value: innerValue.value["key"],
|
|
58258
58301
|
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => innerValue.value["key"] = $event),
|
|
58259
58302
|
options: require$$0.unref(attrs)["key-types"],
|
|
58260
|
-
disabled:
|
|
58303
|
+
disabled: getKeyDisabled.value,
|
|
58261
58304
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
58262
58305
|
"allow-clear": "",
|
|
58263
58306
|
onChange: handleChange
|
|
58264
58307
|
}, null, 8, ["value", "options", "disabled"])) : (require$$0.openBlock(), require$$0.createBlock(require$$0.resolveDynamicComponent(`ll-${getKeyType.value.type}`), require$$0.mergeProps({
|
|
58265
58308
|
key: 1,
|
|
58266
58309
|
value: innerValue.value["key"],
|
|
58267
|
-
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => innerValue.value["key"] = $event)
|
|
58268
|
-
disabled: require$$0.unref(attrs).disabled
|
|
58310
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => innerValue.value["key"] = $event)
|
|
58269
58311
|
}, getKeyType.value, {
|
|
58312
|
+
disabled: getKeyDisabled.value,
|
|
58270
58313
|
style: { "width": "100%" },
|
|
58271
58314
|
onChange: handleChange
|
|
58272
58315
|
}), require$$0.createSlots({
|
|
@@ -58327,7 +58370,7 @@
|
|
|
58327
58370
|
(require$$0.openBlock(), require$$0.createBlock(require$$0.resolveDynamicComponent(`ll-${getValueType.value.type}`), require$$0.mergeProps({
|
|
58328
58371
|
value: innerValue.value["value"],
|
|
58329
58372
|
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => innerValue.value["value"] = $event),
|
|
58330
|
-
disabled:
|
|
58373
|
+
disabled: getValueDisabled.value,
|
|
58331
58374
|
style: { "width": "100%" }
|
|
58332
58375
|
}, getValueType.value), require$$0.createSlots({
|
|
58333
58376
|
_: 2
|
|
@@ -58372,7 +58415,7 @@
|
|
|
58372
58415
|
[
|
|
58373
58416
|
require$$0.createVNode(_component_ll_button, {
|
|
58374
58417
|
type: "link",
|
|
58375
|
-
disabled:
|
|
58418
|
+
disabled: getDeleteDisabled.value
|
|
58376
58419
|
}, {
|
|
58377
58420
|
default: require$$0.withCtx(() => [
|
|
58378
58421
|
require$$0.renderSlot(_ctx.$slots, "delete-icon", {}, () => [
|
|
@@ -58429,14 +58472,24 @@
|
|
|
58429
58472
|
});
|
|
58430
58473
|
const handleAddItem = () => {
|
|
58431
58474
|
innerValue.value.push(getKeyValueItem());
|
|
58432
|
-
emits("add"
|
|
58475
|
+
emits("add", {
|
|
58476
|
+
index: innerValue.value.length - 1,
|
|
58477
|
+
item: innerValue.value[innerValue.value.length - 1],
|
|
58478
|
+
value: innerValue.value
|
|
58479
|
+
});
|
|
58480
|
+
handleChange();
|
|
58433
58481
|
};
|
|
58434
58482
|
const handleDelete = (idx) => {
|
|
58435
58483
|
innerValue.value.splice(idx, 1);
|
|
58484
|
+
emits("delete", idx);
|
|
58485
|
+
handleChange();
|
|
58436
58486
|
};
|
|
58437
58487
|
const handleChange = () => {
|
|
58438
|
-
|
|
58439
|
-
|
|
58488
|
+
const arr = innerValue.value.map((e) => {
|
|
58489
|
+
return { key: e.key, value: e.value };
|
|
58490
|
+
});
|
|
58491
|
+
emits("change", arr);
|
|
58492
|
+
emits("update:value", arr);
|
|
58440
58493
|
};
|
|
58441
58494
|
require$$0.watch(
|
|
58442
58495
|
() => props.value,
|
|
@@ -58444,7 +58497,8 @@
|
|
|
58444
58497
|
innerValue.value = n && n.length > 0 ? n : [{ key: null, value: null }];
|
|
58445
58498
|
},
|
|
58446
58499
|
{
|
|
58447
|
-
immediate: true
|
|
58500
|
+
immediate: true,
|
|
58501
|
+
deep: true
|
|
58448
58502
|
}
|
|
58449
58503
|
);
|
|
58450
58504
|
return (_ctx, _cache) => {
|
|
@@ -58466,11 +58520,12 @@
|
|
|
58466
58520
|
null,
|
|
58467
58521
|
require$$0.renderList(innerValue.value, (_item, idx) => {
|
|
58468
58522
|
return require$$0.openBlock(), require$$0.createBlock(keyValueItem, {
|
|
58469
|
-
key: idx,
|
|
58523
|
+
key: idx + +/* @__PURE__ */ new Date(),
|
|
58470
58524
|
ref_for: true,
|
|
58471
58525
|
ref: (el) => keyValueItems.value[idx] = el,
|
|
58472
58526
|
value: innerValue.value[idx],
|
|
58473
58527
|
"onUpdate:value": ($event) => innerValue.value[idx] = $event,
|
|
58528
|
+
idx,
|
|
58474
58529
|
"key-label": props.keyLabel,
|
|
58475
58530
|
"value-label": props.valueLabel,
|
|
58476
58531
|
"key-value-type-dict": keyValueTypeDict.value,
|
|
@@ -58480,6 +58535,9 @@
|
|
|
58480
58535
|
"key-types": props.keyTypes,
|
|
58481
58536
|
"value-type": props.valueType,
|
|
58482
58537
|
disabled: props.disabled,
|
|
58538
|
+
"disabled-value": props.disabledValue,
|
|
58539
|
+
"disabled-key": props.disabledKey,
|
|
58540
|
+
"disabled-delete": props.disabledDelete,
|
|
58483
58541
|
onDelete: ($event) => handleDelete(idx),
|
|
58484
58542
|
onChange: handleChange
|
|
58485
58543
|
}, require$$0.createSlots({
|
|
@@ -58494,7 +58552,7 @@
|
|
|
58494
58552
|
])
|
|
58495
58553
|
};
|
|
58496
58554
|
})
|
|
58497
|
-
]), 1032, ["value", "onUpdate:value", "key-label", "value-label", "key-value-type-dict", "show-delete", "key-value-type", "key-type", "key-types", "value-type", "disabled", "onDelete"]);
|
|
58555
|
+
]), 1032, ["value", "onUpdate:value", "idx", "key-label", "value-label", "key-value-type-dict", "show-delete", "key-value-type", "key-type", "key-types", "value-type", "disabled", "disabled-value", "disabled-key", "disabled-delete", "onDelete"]);
|
|
58498
58556
|
}),
|
|
58499
58557
|
128
|
|
58500
58558
|
/* KEYED_FRAGMENT */
|
|
@@ -58502,7 +58560,7 @@
|
|
|
58502
58560
|
require$$0.createVNode(_component_ll_button, {
|
|
58503
58561
|
class: require$$0.normalizeClass(require$$0.unref(bem).e("add")),
|
|
58504
58562
|
loading: _ctx.loading,
|
|
58505
|
-
disabled: props.disabled,
|
|
58563
|
+
disabled: props.disabled || props.disabledAdd,
|
|
58506
58564
|
onClick: handleAddItem
|
|
58507
58565
|
}, {
|
|
58508
58566
|
default: require$$0.withCtx(() => [
|