@oiij/naive-ui 0.0.64 → 0.0.65
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/_virtual/_/plugin-vue/export-helper.js +9 -0
- package/dist/components/_utils/cssr-bem.js +7 -0
- package/dist/components/_utils/prismjs.js +16 -0
- package/dist/components/bubble/Bubble.js +67 -0
- package/dist/components/bubble/Bubble.vue.d.ts +51 -46
- package/dist/components/bubble/bubble.cssr.js +23 -0
- package/dist/components/bubble/index.d.ts +19 -15
- package/dist/components/config-providers/ConfigProviders.js +78 -0
- package/dist/components/config-providers/ConfigProviders.vue.d.ts +37 -33
- package/dist/components/config-providers/index.d.ts +28 -24
- package/dist/components/copy-button/CopyButton.js +50 -0
- package/dist/components/copy-button/CopyButton.vue.d.ts +36 -30
- package/dist/components/copy-button/index.d.ts +13 -9
- package/dist/components/data-table-plus/DataTablePlus.js +374 -0
- package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +365 -351
- package/dist/components/data-table-plus/index.d.ts +54 -48
- package/dist/components/full-loading/FullLoading.js +70 -0
- package/dist/components/full-loading/FullLoading.vue.d.ts +36 -32
- package/dist/components/full-loading/full-loading.cssr.js +22 -0
- package/dist/components/full-loading/index.d.ts +16 -12
- package/dist/components/icons/MageArrowUp.js +29 -0
- package/dist/components/icons/MageCopyFill.js +21 -0
- package/dist/components/icons/MageMultiplyCircleFill.js +21 -0
- package/dist/components/icons/MageSearch.js +25 -0
- package/dist/components/index.d.ts +31 -15
- package/dist/components/preset-form/PresetForm.js +176 -0
- package/dist/components/preset-form/PresetForm.vue.d.ts +82 -72
- package/dist/components/preset-form/_utils.js +16 -0
- package/dist/components/preset-form/index.d.ts +34 -29
- package/dist/components/preset-input/PresetInput.js +87 -0
- package/dist/components/preset-input/PresetInput.vue.d.ts +20 -15
- package/dist/components/preset-input/index.d.ts +147 -145
- package/dist/components/preset-picker/PresetPicker.js +209 -0
- package/dist/components/preset-picker/PresetPicker.vue.d.ts +62 -49
- package/dist/components/preset-picker/index.d.ts +55 -49
- package/dist/components/preset-select/PresetSelect.js +274 -0
- package/dist/components/preset-select/PresetSelect.vue.d.ts +190 -180
- package/dist/components/preset-select/index.d.ts +44 -38
- package/dist/components/remote-request/RemoteRequest.js +90 -0
- package/dist/components/remote-request/RemoteRequest.vue.d.ts +55 -49
- package/dist/components/remote-request/index.d.ts +23 -17
- package/dist/components/search-input/SearchInput.js +85 -0
- package/dist/components/search-input/SearchInput.vue.d.ts +48 -2332
- package/dist/components/search-input/index.d.ts +16 -12
- package/dist/components/toggle-editor/ToggleEditor.js +44 -0
- package/dist/components/toggle-editor/ToggleEditor.vue.d.ts +18 -1157
- package/dist/components/toggle-editor/index.d.ts +1 -1
- package/dist/components/tooltip-button/TooltipButton.js +31 -0
- package/dist/components/tooltip-button/TooltipButton.vue.d.ts +33 -28
- package/dist/components/tooltip-button/index.d.ts +11 -7
- package/dist/components/transition/BaseTransition.js +30 -0
- package/dist/components/transition/BaseTransition.vue.d.ts +23 -21
- package/dist/components/transition/index.d.ts +10 -6
- package/dist/components/transition/transition.cssr.js +20 -0
- package/dist/components/type-writer/TypeWriter.js +72 -0
- package/dist/components/type-writer/TypeWriter.vue.d.ts +34 -29
- package/dist/components/type-writer/index.d.ts +12 -8
- package/dist/components/type-writer/type-writer.cssr.js +27 -0
- package/dist/components.d.ts +33 -1
- package/dist/components.js +18 -7893
- package/dist/composables/{index.d.mts → index.d.ts} +3 -3
- package/dist/composables/{useNaiveForm.d.mts → useNaiveForm.d.ts} +1 -1
- package/dist/composables/{useNaiveTheme.d.mts → useNaiveTheme.d.ts} +1 -1
- package/dist/composables/{useNaiveTheme.mjs → useNaiveTheme.js} +1 -1
- package/dist/{index.d.mts → index.d.ts} +4 -4
- package/dist/index.js +5 -0
- package/package.json +11 -10
- package/dist/components/_utils/cssr-bem.d.ts +0 -1
- package/dist/components/_utils/index.d.ts +0 -2
- package/dist/components/_utils/prismjs.d.ts +0 -1
- package/dist/components/bubble/bubble.cssr.d.ts +0 -2
- package/dist/components/full-loading/full-loading.cssr.d.ts +0 -2
- package/dist/components/icons/MageArrowUp.vue.d.ts +0 -2
- package/dist/components/icons/MageCopyFill.vue.d.ts +0 -2
- package/dist/components/icons/MageMultiplyCircleFill.vue.d.ts +0 -2
- package/dist/components/icons/MageSearch.vue.d.ts +0 -2
- package/dist/components/preset-form/_utils.d.ts +0 -8
- package/dist/components/transition/transition.cssr.d.ts +0 -13
- package/dist/components/type-writer/type-writer.cssr.d.ts +0 -2
- package/dist/index.mjs +0 -5
- /package/dist/composables/{_helper.d.mts → _helper.d.ts} +0 -0
- /package/dist/composables/{_helper.mjs → _helper.js} +0 -0
- /package/dist/composables/{useDataRequest.d.mts → useDataRequest.d.ts} +0 -0
- /package/dist/composables/{useDataRequest.mjs → useDataRequest.js} +0 -0
- /package/dist/composables/{useNaiveForm.mjs → useNaiveForm.js} +0 -0
|
@@ -1,148 +1,150 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { SearchInputProps } from "../search-input/index.js";
|
|
2
|
+
import { ClassStyle } from "../data-table-plus/index.js";
|
|
3
|
+
import { _default } from "./PresetInput.vue.js";
|
|
4
|
+
import { VNode, VNodeArrayChildren } from "vue";
|
|
5
|
+
import { ButtonProps, CheckboxGroupProps, CheckboxProps, ColorPickerProps, DatePickerProps, DividerProps, DynamicTagsProps, InputNumberProps, InputProps, RadioGroupProps, RadioProps, RateProps, SelectProps, SliderProps, SwitchProps, TimePickerProps } from "naive-ui";
|
|
6
|
+
|
|
7
|
+
//#region src/components/preset-input/index.d.ts
|
|
6
8
|
type RawChildren = string | number | boolean | VNode | VNodeArrayChildren | (() => any);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
9
|
+
type PresetInputType = {
|
|
10
|
+
'button': {
|
|
11
|
+
props?: ButtonProps & {
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
slots?: {
|
|
15
|
+
default?: () => RawChildren;
|
|
16
|
+
icon?: () => RawChildren;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
'color-picker': {
|
|
20
|
+
props?: ColorPickerProps;
|
|
21
|
+
slots?: {
|
|
22
|
+
label?: (color: string | null) => RawChildren;
|
|
23
|
+
action?: () => RawChildren;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
'checkbox': {
|
|
27
|
+
props?: CheckboxGroupProps & {
|
|
28
|
+
options?: CheckboxProps[];
|
|
29
|
+
};
|
|
30
|
+
slots?: {
|
|
31
|
+
default?: () => RawChildren;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
'divider': {
|
|
35
|
+
props?: DividerProps;
|
|
36
|
+
slots?: {
|
|
37
|
+
default?: () => RawChildren;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
'date-picker': {
|
|
41
|
+
props?: DatePickerProps;
|
|
42
|
+
slots?: undefined;
|
|
43
|
+
};
|
|
44
|
+
'dynamic-tags': {
|
|
45
|
+
props?: DynamicTagsProps;
|
|
46
|
+
slots?: {
|
|
47
|
+
input?: (info: {
|
|
48
|
+
submit: (value: any) => void;
|
|
49
|
+
deactivate: () => void;
|
|
50
|
+
}) => RawChildren;
|
|
51
|
+
trigger?: (info: {
|
|
52
|
+
activate: () => void;
|
|
53
|
+
disabled: boolean;
|
|
54
|
+
}) => RawChildren;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
'input': {
|
|
58
|
+
props?: InputProps;
|
|
59
|
+
slots?: {
|
|
60
|
+
clearIcon?: () => RawChildren;
|
|
61
|
+
count?: (props: {
|
|
62
|
+
value: string;
|
|
63
|
+
}) => RawChildren;
|
|
64
|
+
passwordInvisibleIcon?: () => RawChildren;
|
|
65
|
+
passwordVisibleIcon?: () => RawChildren;
|
|
66
|
+
prefix?: () => RawChildren;
|
|
67
|
+
separator?: () => RawChildren;
|
|
68
|
+
suffix?: () => RawChildren;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
'input-number': {
|
|
72
|
+
props?: InputNumberProps;
|
|
73
|
+
slots?: {
|
|
74
|
+
addIcon?: () => RawChildren;
|
|
75
|
+
minusIcon?: () => RawChildren;
|
|
76
|
+
prefix?: () => RawChildren;
|
|
77
|
+
suffix?: () => RawChildren;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
'search': {
|
|
81
|
+
props?: SearchInputProps;
|
|
82
|
+
slots?: {
|
|
83
|
+
prefix?: () => RawChildren;
|
|
84
|
+
prefixIcon?: () => RawChildren;
|
|
85
|
+
button?: (props: {
|
|
86
|
+
value: string;
|
|
87
|
+
loading: boolean;
|
|
88
|
+
}) => RawChildren;
|
|
89
|
+
buttonIcon?: () => RawChildren;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
'radio': {
|
|
93
|
+
props?: RadioGroupProps & {
|
|
94
|
+
options?: RadioProps[];
|
|
95
|
+
};
|
|
96
|
+
slots?: {
|
|
97
|
+
default?: () => RawChildren;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
'rate': {
|
|
101
|
+
props?: RateProps;
|
|
102
|
+
slots?: {
|
|
103
|
+
default?: (info: {
|
|
104
|
+
index: number;
|
|
105
|
+
}) => RawChildren;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
'select': {
|
|
109
|
+
props?: SelectProps;
|
|
110
|
+
slots?: {
|
|
111
|
+
header?: () => RawChildren;
|
|
112
|
+
action?: () => RawChildren;
|
|
113
|
+
empty?: () => RawChildren;
|
|
114
|
+
arrow?: () => RawChildren;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
'slider': {
|
|
118
|
+
props?: SliderProps;
|
|
119
|
+
slots?: {
|
|
120
|
+
thumb?: () => RawChildren;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
'switch': {
|
|
124
|
+
props?: SwitchProps;
|
|
125
|
+
slots?: {
|
|
126
|
+
checked?: () => RawChildren;
|
|
127
|
+
checkedIcon?: () => RawChildren;
|
|
128
|
+
icon?: () => RawChildren;
|
|
129
|
+
unchecked?: () => RawChildren;
|
|
130
|
+
uncheckedIcon?: () => RawChildren;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
'time-picker': {
|
|
134
|
+
props?: TimePickerProps;
|
|
135
|
+
slots?: {
|
|
136
|
+
icon?: () => RawChildren;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
137
139
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
value?: V;
|
|
147
|
-
options?: PresetInputOptions;
|
|
140
|
+
type PresetInputOptions = { [K in keyof PresetInputType]: {
|
|
141
|
+
type?: K;
|
|
142
|
+
props?: PresetInputType[K]['props'] & ClassStyle;
|
|
143
|
+
slots?: PresetInputType[K]['slots'];
|
|
144
|
+
} }[keyof PresetInputType];
|
|
145
|
+
type PresetInputProps<V> = {
|
|
146
|
+
value?: V;
|
|
147
|
+
options?: PresetInputOptions;
|
|
148
148
|
};
|
|
149
|
+
//#endregion
|
|
150
|
+
export { PresetInputOptions, PresetInputProps, PresetInputType };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import MageMultiplyCircleFill_default from "../icons/MageMultiplyCircleFill.js";
|
|
2
|
+
import { computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, reactive, ref, renderSlot, toDisplayString, toRaw, toValue, unref, watch, withCtx, withModifiers } from "vue";
|
|
3
|
+
import { cloneDeep } from "es-toolkit/object";
|
|
4
|
+
import { NBadge, NButton, NButtonGroup, NModal, NTooltip } from "naive-ui";
|
|
5
|
+
|
|
6
|
+
//#region src/components/preset-picker/PresetPicker.vue
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "PresetPicker",
|
|
9
|
+
props: {
|
|
10
|
+
value: {},
|
|
11
|
+
fallbackLabel: { type: [String, Function] },
|
|
12
|
+
multiple: { type: Boolean },
|
|
13
|
+
disabled: { type: Boolean },
|
|
14
|
+
clearable: { type: Boolean },
|
|
15
|
+
placeholder: { default: "请选择" },
|
|
16
|
+
type: {},
|
|
17
|
+
columns: {},
|
|
18
|
+
selectionOptions: {},
|
|
19
|
+
fields: {},
|
|
20
|
+
buttonProps: {},
|
|
21
|
+
clearButtonProps: {},
|
|
22
|
+
badgeProps: {},
|
|
23
|
+
modalProps: {}
|
|
24
|
+
},
|
|
25
|
+
emits: [
|
|
26
|
+
"update:value",
|
|
27
|
+
"afterEnter",
|
|
28
|
+
"afterLeave",
|
|
29
|
+
"esc",
|
|
30
|
+
"maskClick",
|
|
31
|
+
"update:show",
|
|
32
|
+
"close",
|
|
33
|
+
"negativeClick",
|
|
34
|
+
"positiveClick"
|
|
35
|
+
],
|
|
36
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
37
|
+
const emit = __emit;
|
|
38
|
+
const _fields = {
|
|
39
|
+
label: "label",
|
|
40
|
+
value: "value",
|
|
41
|
+
...__props.fields
|
|
42
|
+
};
|
|
43
|
+
const checkedRowKeys = ref([]);
|
|
44
|
+
const checkedRows = ref([]);
|
|
45
|
+
const selectionColumn = reactive({
|
|
46
|
+
type: "selection",
|
|
47
|
+
multiple: __props.multiple,
|
|
48
|
+
width: 60,
|
|
49
|
+
fixed: "left",
|
|
50
|
+
...__props.selectionOptions
|
|
51
|
+
});
|
|
52
|
+
watch(() => __props.multiple, () => {
|
|
53
|
+
selectionColumn.multiple = __props.multiple;
|
|
54
|
+
});
|
|
55
|
+
const _columns = reactive([selectionColumn, ...__props.columns ?? []]);
|
|
56
|
+
const showModalFlag = ref(false);
|
|
57
|
+
function showModal() {
|
|
58
|
+
checkedRowKeys.value = cloneDeep(Array.isArray(__props.value) ? __props.value : __props.value ? [__props.value] : []);
|
|
59
|
+
showModalFlag.value = true;
|
|
60
|
+
}
|
|
61
|
+
function clickRowEffect(row) {
|
|
62
|
+
if (__props.multiple) if (checkedRowKeys.value.includes(row?.[_fields.value])) {
|
|
63
|
+
checkedRowKeys.value = checkedRowKeys.value.filter((f) => f !== row?.[_fields.value]);
|
|
64
|
+
checkedRows.value = checkedRows.value.filter((f) => f?.[_fields.value] !== row?.[_fields.value]);
|
|
65
|
+
} else {
|
|
66
|
+
checkedRowKeys.value.push(row?.[_fields.value]);
|
|
67
|
+
checkedRows.value.push(row);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
checkedRowKeys.value = [row?.[_fields.value]];
|
|
71
|
+
checkedRows.value = [row];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function updateCheckedRowKeysEffect(keys, rows, meta, currentData) {
|
|
75
|
+
if (meta.action === "checkAll") {
|
|
76
|
+
const allKeys = keys.filter((f) => !checkedRowKeys.value.includes(f));
|
|
77
|
+
checkedRowKeys.value.push(...allKeys);
|
|
78
|
+
const allRows = rows.filter((f) => !checkedRows.value.some((s) => s?.[_fields.value] === f?.[_fields.value]));
|
|
79
|
+
checkedRows.value.push(...allRows);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (meta.action === "uncheckAll") {
|
|
83
|
+
checkedRowKeys.value = checkedRowKeys.value.filter((f) => !currentData?.some((s) => s?.[_fields.value] === f));
|
|
84
|
+
checkedRows.value = checkedRows.value.filter((f) => !currentData?.some((s) => s?.[_fields.value] === f?.[_fields.value]));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function onNegativeClick() {
|
|
88
|
+
emit("negativeClick");
|
|
89
|
+
showModalFlag.value = false;
|
|
90
|
+
}
|
|
91
|
+
function onPositiveClick() {
|
|
92
|
+
emit("positiveClick");
|
|
93
|
+
if (__props.multiple) {
|
|
94
|
+
const keys = toRaw(toValue(checkedRowKeys));
|
|
95
|
+
emit("update:value", keys, keys.map((m) => toRaw(toValue(checkedRows.value.find((f) => f?.[_fields.value] === m)))));
|
|
96
|
+
} else {
|
|
97
|
+
const key = checkedRowKeys.value[0] ?? null;
|
|
98
|
+
emit("update:value", key, toRaw(toValue(checkedRows.value.find((f) => f?.[_fields.value] === key))));
|
|
99
|
+
}
|
|
100
|
+
showModalFlag.value = false;
|
|
101
|
+
}
|
|
102
|
+
function clearValue() {
|
|
103
|
+
emit("update:value", null, null);
|
|
104
|
+
}
|
|
105
|
+
const _label = computed(() => {
|
|
106
|
+
if (Array.isArray(__props.value) && __props.value.length > 0) return typeof __props.fallbackLabel === "string" ? __props.fallbackLabel : __props.value.map((m) => {
|
|
107
|
+
const item = checkedRows.value.find((f) => f?.[_fields.value] === m);
|
|
108
|
+
return item && item?.[_fields.label] ? item[_fields.label] : typeof __props.fallbackLabel === "function" ? __props.fallbackLabel(m) : m;
|
|
109
|
+
}).join(",");
|
|
110
|
+
if (__props.value && !Array.isArray(__props.value)) {
|
|
111
|
+
const item = checkedRows.value.find((f) => f?.[_fields.value] === __props.value);
|
|
112
|
+
return item && item?.[_fields.label] ? item?.[_fields.label] : typeof __props.fallbackLabel === "function" ? __props.fallbackLabel(__props.value) : __props.fallbackLabel ?? __props.value;
|
|
113
|
+
}
|
|
114
|
+
return __props.placeholder;
|
|
115
|
+
});
|
|
116
|
+
const showClearButton = computed(() => {
|
|
117
|
+
return __props.clearable && (Array.isArray(__props.value) ? __props.value.length > 0 : !!__props.value);
|
|
118
|
+
});
|
|
119
|
+
const checkedCount = computed(() => Array.isArray(__props.value) ? __props.value.length : void 0);
|
|
120
|
+
const expose = {
|
|
121
|
+
showModalFlag,
|
|
122
|
+
checkedRowKeys,
|
|
123
|
+
checkedRows,
|
|
124
|
+
columns: _columns,
|
|
125
|
+
showModal,
|
|
126
|
+
updateCheckedRowKeysEffect,
|
|
127
|
+
clickRowEffect,
|
|
128
|
+
clearValue,
|
|
129
|
+
setCheckedRowKeys: (keys) => {
|
|
130
|
+
checkedRowKeys.value = keys;
|
|
131
|
+
},
|
|
132
|
+
setCheckedRows: (rows) => {
|
|
133
|
+
checkedRows.value = rows;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const templateBind = computed(() => {
|
|
137
|
+
return {
|
|
138
|
+
...expose,
|
|
139
|
+
showModalFlag: toValue(showModalFlag),
|
|
140
|
+
checkedRowKeys: toValue(checkedRowKeys),
|
|
141
|
+
checkedRows: toValue(checkedRows),
|
|
142
|
+
columns: toValue(_columns)
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
__expose(expose);
|
|
146
|
+
return (_ctx, _cache) => {
|
|
147
|
+
return openBlock(), createBlock(unref(NBadge), mergeProps({ value: checkedCount.value }, __props.badgeProps), {
|
|
148
|
+
default: withCtx(() => [createVNode(unref(NButtonGroup), null, {
|
|
149
|
+
default: withCtx(() => [
|
|
150
|
+
createVNode(unref(NTooltip), {
|
|
151
|
+
disabled: Array.isArray(__props.value) ? false : true,
|
|
152
|
+
trigger: Array.isArray(__props.value) ? "hover" : "manual"
|
|
153
|
+
}, {
|
|
154
|
+
trigger: withCtx(() => [createVNode(unref(NButton), mergeProps({
|
|
155
|
+
type: __props.type,
|
|
156
|
+
disabled: __props.disabled
|
|
157
|
+
}, __props.buttonProps, { onClick: showModal }), {
|
|
158
|
+
icon: withCtx(() => [renderSlot(_ctx.$slots, "button-icon")]),
|
|
159
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "button", {}, () => [createElementVNode("span", null, toDisplayString(Array.isArray(__props.value) ? "已选择" : _label.value), 1)])]),
|
|
160
|
+
_: 3
|
|
161
|
+
}, 16, ["type", "disabled"])]),
|
|
162
|
+
default: withCtx(() => [createElementVNode("div", null, toDisplayString(Array.isArray(__props.value) ? _label.value : ""), 1)]),
|
|
163
|
+
_: 3
|
|
164
|
+
}, 8, ["disabled", "trigger"]),
|
|
165
|
+
renderSlot(_ctx.$slots, "clear-button", {}, () => [showClearButton.value ? (openBlock(), createBlock(unref(NButton), mergeProps({
|
|
166
|
+
key: 0,
|
|
167
|
+
circle: "",
|
|
168
|
+
type: __props.type
|
|
169
|
+
}, __props.clearButtonProps, { onClick: withModifiers(clearValue, ["stop"]) }), {
|
|
170
|
+
icon: withCtx(() => [renderSlot(_ctx.$slots, "clear-icon", {}, () => [createVNode(MageMultiplyCircleFill_default)])]),
|
|
171
|
+
_: 3
|
|
172
|
+
}, 16, ["type"])) : createCommentVNode("v-if", true)]),
|
|
173
|
+
createVNode(unref(NModal), mergeProps({
|
|
174
|
+
show: showModalFlag.value,
|
|
175
|
+
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => showModalFlag.value = $event),
|
|
176
|
+
style: { "width": "auto" },
|
|
177
|
+
preset: "dialog",
|
|
178
|
+
title: __props.placeholder,
|
|
179
|
+
"positive-text": "确认",
|
|
180
|
+
"negative-text": "取消"
|
|
181
|
+
}, __props.modalProps, {
|
|
182
|
+
onPositiveClick,
|
|
183
|
+
onNegativeClick,
|
|
184
|
+
onClose: _cache[1] || (_cache[1] = ($event) => emit("close")),
|
|
185
|
+
onAfterEnter: _cache[2] || (_cache[2] = ($event) => emit("afterEnter")),
|
|
186
|
+
onAfterLeave: _cache[3] || (_cache[3] = ($event) => emit("afterLeave")),
|
|
187
|
+
onEsc: _cache[4] || (_cache[4] = ($event) => emit("esc")),
|
|
188
|
+
onMaskClick: _cache[5] || (_cache[5] = ($event) => emit("maskClick")),
|
|
189
|
+
"onUpdate:show": _cache[6] || (_cache[6] = (val) => emit("update:show", val))
|
|
190
|
+
}), {
|
|
191
|
+
action: withCtx(() => [renderSlot(_ctx.$slots, "modal-action")]),
|
|
192
|
+
header: withCtx(() => [renderSlot(_ctx.$slots, "modal-header")]),
|
|
193
|
+
icon: withCtx(() => [renderSlot(_ctx.$slots, "modal-icon")]),
|
|
194
|
+
close: withCtx(() => [renderSlot(_ctx.$slots, "modal-close")]),
|
|
195
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(templateBind.value)))]),
|
|
196
|
+
_: 3
|
|
197
|
+
}, 16, ["show", "title"])
|
|
198
|
+
]),
|
|
199
|
+
_: 3
|
|
200
|
+
})]),
|
|
201
|
+
_: 3
|
|
202
|
+
}, 16, ["value"]);
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
var PresetPicker_default = _sfc_main;
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
export { PresetPicker_default as default };
|
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
import { DataObject } from "../../composables/useDataRequest.js";
|
|
2
|
+
import { PresetPickerEmits, PresetPickerExpose, PresetPickerProps, PresetPickerValue } from "./index.js";
|
|
3
|
+
import * as vue85 from "vue";
|
|
4
|
+
import { DataTableColumns } from "naive-ui";
|
|
5
|
+
|
|
6
|
+
//#region src/components/preset-picker/PresetPicker.vue.d.ts
|
|
7
|
+
declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
+
props: __VLS_PrettifyLocal<PresetPickerProps<V, R> & {
|
|
9
|
+
onClose?: (() => any) | undefined;
|
|
10
|
+
"onUpdate:value"?: ((val: V | null, raw: R | R[] | null) => any) | undefined;
|
|
11
|
+
onAfterEnter?: (() => any) | undefined;
|
|
12
|
+
onAfterLeave?: (() => any) | undefined;
|
|
13
|
+
onEsc?: (() => any) | undefined;
|
|
14
|
+
onMaskClick?: (() => any) | undefined;
|
|
15
|
+
onNegativeClick?: (() => any) | undefined;
|
|
16
|
+
onPositiveClick?: (() => any) | undefined;
|
|
17
|
+
"onUpdate:show"?: ((value: boolean) => any) | undefined;
|
|
18
|
+
}> & vue85.PublicProps & (typeof globalThis extends {
|
|
19
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
20
|
+
} ? P : {});
|
|
21
|
+
expose: (exposed: vue85.ShallowUnwrapRef<PresetPickerExpose<R>>) => void;
|
|
22
|
+
attrs: any;
|
|
23
|
+
slots: {
|
|
24
|
+
'button-icon'?: (props: {}) => any;
|
|
25
|
+
} & {
|
|
26
|
+
button?: (props: {}) => any;
|
|
27
|
+
} & {
|
|
28
|
+
'clear-button'?: (props: {}) => any;
|
|
29
|
+
} & {
|
|
30
|
+
'clear-icon'?: (props: {}) => any;
|
|
31
|
+
} & {
|
|
32
|
+
default?: (props: {
|
|
33
|
+
showModalFlag: boolean;
|
|
34
|
+
checkedRowKeys: (string | number)[];
|
|
35
|
+
checkedRows: R[];
|
|
36
|
+
columns: DataTableColumns<any>;
|
|
37
|
+
showModal: () => void;
|
|
38
|
+
updateCheckedRowKeysEffect: (keys: (string | number)[], rows: (R | undefined)[], meta: {
|
|
39
|
+
row: R | undefined;
|
|
40
|
+
action: "check" | "uncheck" | "checkAll" | "uncheckAll";
|
|
41
|
+
}, currentData: R[]) => void;
|
|
42
|
+
clickRowEffect: (row: R) => void;
|
|
43
|
+
clearValue: () => void;
|
|
44
|
+
setCheckedRowKeys: (keys: (string | number)[]) => void;
|
|
45
|
+
setCheckedRows: (rows: R[]) => void;
|
|
46
|
+
}) => any;
|
|
47
|
+
} & {
|
|
48
|
+
'modal-action'?: (props: {}) => any;
|
|
49
|
+
} & {
|
|
50
|
+
'modal-header'?: (props: {}) => any;
|
|
51
|
+
} & {
|
|
52
|
+
'modal-icon'?: (props: {}) => any;
|
|
53
|
+
} & {
|
|
54
|
+
'modal-close'?: (props: {}) => any;
|
|
55
|
+
};
|
|
56
|
+
emit: PresetPickerEmits<V, R>;
|
|
57
|
+
}>) => vue85.VNode & {
|
|
58
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
46
59
|
};
|
|
47
|
-
|
|
48
|
-
type __VLS_PrettifyLocal<T> = {
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
declare const _default: typeof __VLS_export;
|
|
61
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { _default };
|