qidian-vue-ui 2.0.30 → 2.0.32
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/components/config-provider/index.d.ts +9 -0
- package/dist/components/config-provider/types.d.ts +3 -0
- package/dist/components/config-provider/useConfig.d.ts +12 -0
- package/dist/components/service-dialog-table-select/index.css +10 -10
- package/dist/components/service-dialog-table-select/index.vue.d.ts +1 -0
- package/dist/components/service-dialog-table-select/index.vue.mjs +1 -1
- package/dist/components/service-dialog-table-select/index.vue2.mjs +14 -1
- package/dist/components/service-dialog-tabs-table-select/index.css +10 -10
- package/dist/components/service-dialog-tabs-table-select/index.vue.d.ts +1 -0
- package/dist/components/service-dialog-tabs-table-select/index.vue.mjs +1 -1
- package/dist/components/service-dialog-tabs-table-select/index.vue2.mjs +14 -1
- package/dist/components/service-select/index.css +1 -1
- package/dist/components/service-select/index.vue.mjs +3 -1
- package/dist/components/service-select/index.vue2.mjs +69 -3
- package/dist/components/service-select/index2.css +6 -0
- package/dist/locales/en-US.d.ts +3 -0
- package/dist/locales/en-US.mjs +3 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.mjs +3 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.mjs +3 -0
- package/dist/styles/index.css +5 -2
- package/package.json +1 -1
|
@@ -16,6 +16,9 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
|
|
|
16
16
|
loading?: {
|
|
17
17
|
text?: string;
|
|
18
18
|
};
|
|
19
|
+
serviceSelect?: {
|
|
20
|
+
createText?: string;
|
|
21
|
+
};
|
|
19
22
|
timeFormat?: {
|
|
20
23
|
seconds?: string;
|
|
21
24
|
minutes?: string;
|
|
@@ -157,6 +160,9 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
|
|
|
157
160
|
loading?: {
|
|
158
161
|
text?: string;
|
|
159
162
|
};
|
|
163
|
+
serviceSelect?: {
|
|
164
|
+
createText?: string;
|
|
165
|
+
};
|
|
160
166
|
timeFormat?: {
|
|
161
167
|
seconds?: string;
|
|
162
168
|
minutes?: string;
|
|
@@ -283,6 +289,9 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
|
|
|
283
289
|
loading?: {
|
|
284
290
|
text?: string;
|
|
285
291
|
};
|
|
292
|
+
serviceSelect?: {
|
|
293
|
+
createText?: string;
|
|
294
|
+
};
|
|
286
295
|
timeFormat?: {
|
|
287
296
|
seconds?: string;
|
|
288
297
|
minutes?: string;
|
|
@@ -4,6 +4,9 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
|
|
|
4
4
|
loading?: {
|
|
5
5
|
text?: string;
|
|
6
6
|
};
|
|
7
|
+
serviceSelect?: {
|
|
8
|
+
createText?: string;
|
|
9
|
+
};
|
|
7
10
|
timeFormat?: {
|
|
8
11
|
seconds?: string;
|
|
9
12
|
minutes?: string;
|
|
@@ -128,6 +131,9 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
|
|
|
128
131
|
loading?: {
|
|
129
132
|
text?: string;
|
|
130
133
|
};
|
|
134
|
+
serviceSelect?: {
|
|
135
|
+
createText?: string;
|
|
136
|
+
};
|
|
131
137
|
timeFormat?: {
|
|
132
138
|
seconds?: string;
|
|
133
139
|
minutes?: string;
|
|
@@ -252,6 +258,9 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
|
|
|
252
258
|
loading?: {
|
|
253
259
|
text?: string;
|
|
254
260
|
};
|
|
261
|
+
serviceSelect?: {
|
|
262
|
+
createText?: string;
|
|
263
|
+
};
|
|
255
264
|
timeFormat?: {
|
|
256
265
|
seconds?: string;
|
|
257
266
|
minutes?: string;
|
|
@@ -377,6 +386,9 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
|
|
|
377
386
|
loading?: {
|
|
378
387
|
text?: string;
|
|
379
388
|
};
|
|
389
|
+
serviceSelect?: {
|
|
390
|
+
createText?: string;
|
|
391
|
+
};
|
|
380
392
|
timeFormat?: {
|
|
381
393
|
seconds?: string;
|
|
382
394
|
minutes?: string;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
.qd-dialog-table-select[data-v-
|
|
1
|
+
.qd-dialog-table-select[data-v-30e6f548] {
|
|
2
2
|
width: 100%;
|
|
3
3
|
}
|
|
4
|
-
.qd-dialog-table-select__trigger[data-v-
|
|
4
|
+
.qd-dialog-table-select__trigger[data-v-30e6f548] {
|
|
5
5
|
width: 100%;
|
|
6
6
|
}
|
|
7
|
-
.qd-dialog-table-select__trigger[data-v-
|
|
7
|
+
.qd-dialog-table-select__trigger[data-v-30e6f548]:not(.qd-dialog-table-select__trigger--readonly):not(.qd-dialog-table-select__trigger--disabled) {
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
}
|
|
10
|
-
.qd-dialog-table-select__input-trigger[data-v-
|
|
10
|
+
.qd-dialog-table-select__input-trigger[data-v-30e6f548] {
|
|
11
11
|
border-top-left-radius: 0;
|
|
12
12
|
border-bottom-left-radius: 0;
|
|
13
13
|
}
|
|
14
|
-
.qd-dialog-table-select__table[data-v-
|
|
15
|
-
.qd-dialog-table-select__table[data-v-
|
|
14
|
+
.qd-dialog-table-select__table[data-v-30e6f548] .qd-crud-search > .t-loading__parent > .t-card__body,
|
|
15
|
+
.qd-dialog-table-select__table[data-v-30e6f548] .qd-crud-table__body > .t-loading__parent > .t-card__body {
|
|
16
16
|
padding: 0 !important;
|
|
17
17
|
}
|
|
18
|
-
.qd-dialog-table-select__table[data-v-
|
|
18
|
+
.qd-dialog-table-select__table[data-v-30e6f548] .qd-crud-table__toolbar {
|
|
19
19
|
display: none;
|
|
20
20
|
}
|
|
21
|
-
.qd-dialog-table-select__table[data-v-
|
|
21
|
+
.qd-dialog-table-select__table[data-v-30e6f548] .qd-service-table {
|
|
22
22
|
margin-top: 0;
|
|
23
23
|
}
|
|
24
|
-
.qd-dialog-table-select__table-add[data-v-
|
|
24
|
+
.qd-dialog-table-select__table-add[data-v-30e6f548] {
|
|
25
25
|
margin-top: var(--td-comp-margin-m);
|
|
26
26
|
display: flex;
|
|
27
27
|
}
|
|
28
|
-
.qd-dialog-table-select__table-add .t-input__wrap[data-v-
|
|
28
|
+
.qd-dialog-table-select__table-add .t-input__wrap[data-v-30e6f548] {
|
|
29
29
|
flex: 1 1 0;
|
|
30
30
|
overflow: hidden;
|
|
31
31
|
margin-right: var(--td-comp-margin-m);
|
|
@@ -27,6 +27,7 @@ declare const _default: <D extends TableRowData = TableRowData, R = unknown, P =
|
|
|
27
27
|
'dialog-footer'?: (props: {
|
|
28
28
|
cancel: (event: MouseEvent) => void;
|
|
29
29
|
confirm: () => Promise<boolean | void>;
|
|
30
|
+
confirmDisabled: boolean;
|
|
30
31
|
confirmLoading: boolean;
|
|
31
32
|
selectedOptions: import("@vue/reactivity").UnwrapRefSimple<D>[];
|
|
32
33
|
}) => any;
|
|
@@ -2,7 +2,7 @@ import './index.css'
|
|
|
2
2
|
import _sfc_main from "./index.vue2.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-30e6f548"]]);
|
|
6
6
|
export {
|
|
7
7
|
index as default
|
|
8
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './index.css'
|
|
2
|
-
import { defineComponent, mergeDefaults, useTemplateRef, ref,
|
|
2
|
+
import { defineComponent, mergeDefaults, useTemplateRef, ref, computed, reactive, createVNode, watch, createElementBlock, openBlock, Fragment, createElementVNode, mergeProps, renderSlot, createBlock, unref, withCtx, renderList, createTextVNode, toDisplayString, isRef, createSlots, normalizeProps, guardReactiveProps } from "vue";
|
|
3
3
|
import { useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
|
|
4
4
|
import { isEmpty, identifyType, useDoubleClick, suspectedWrapperPromise, createExposeProxy, extractSlotsWithPrefix, hasOwn } from "qidian-shared";
|
|
5
5
|
import { AddIcon, SearchIcon } from "tdesign-icons-vue-next";
|
|
@@ -358,6 +358,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
358
358
|
const selectedRowKeys = ref([]);
|
|
359
359
|
const selectedRows = ref([]);
|
|
360
360
|
const latestSelectedRows = ref([]);
|
|
361
|
+
const confirmDisabled = computed(() => isEmpty(data.value));
|
|
361
362
|
let lastRowKey;
|
|
362
363
|
const addCustom = reactive({
|
|
363
364
|
visible: false,
|
|
@@ -440,6 +441,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
440
441
|
header: placeholder,
|
|
441
442
|
onCancel
|
|
442
443
|
}, wrapper);
|
|
444
|
+
if (confirmDisabled.value && dialogOptions.confirmBtn !== null) {
|
|
445
|
+
dialogOptions.confirmBtn = typeof dialogOptions.confirmBtn === "string" ? {
|
|
446
|
+
content: dialogOptions.confirmBtn,
|
|
447
|
+
disabled: true
|
|
448
|
+
} : typeof dialogOptions.confirmBtn === "object" ? {
|
|
449
|
+
...dialogOptions.confirmBtn,
|
|
450
|
+
disabled: true
|
|
451
|
+
} : {
|
|
452
|
+
disabled: true
|
|
453
|
+
};
|
|
454
|
+
}
|
|
443
455
|
const onBeforeOpen = dialogOptions.onBeforeOpen;
|
|
444
456
|
dialogOptions.onBeforeOpen = () => {
|
|
445
457
|
onBeforeOpen?.();
|
|
@@ -844,6 +856,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
844
856
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "dialog-footer", {
|
|
845
857
|
cancel: handleFooterCancel,
|
|
846
858
|
confirm: () => handleConfirm(),
|
|
859
|
+
confirmDisabled: confirmDisabled.value,
|
|
847
860
|
confirmLoading: confirmLoad.value,
|
|
848
861
|
selectedOptions: latestSelectedRows.value
|
|
849
862
|
}, void 0, true)]),
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
.qd-dialog-tabs-table-select[data-v-
|
|
1
|
+
.qd-dialog-tabs-table-select[data-v-158a6f3b] {
|
|
2
2
|
width: 100%;
|
|
3
3
|
}
|
|
4
|
-
.qd-dialog-tabs-table-select__trigger[data-v-
|
|
4
|
+
.qd-dialog-tabs-table-select__trigger[data-v-158a6f3b] {
|
|
5
5
|
width: 100%;
|
|
6
6
|
}
|
|
7
|
-
.qd-dialog-tabs-table-select__trigger[data-v-
|
|
7
|
+
.qd-dialog-tabs-table-select__trigger[data-v-158a6f3b]:not(.qd-dialog-tabs-table-select__trigger--readonly):not(.qd-dialog-tabs-table-select__trigger--disabled) {
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
}
|
|
10
|
-
.qd-dialog-tabs-table-select__input-trigger[data-v-
|
|
10
|
+
.qd-dialog-tabs-table-select__input-trigger[data-v-158a6f3b] {
|
|
11
11
|
border-top-left-radius: 0;
|
|
12
12
|
border-bottom-left-radius: 0;
|
|
13
13
|
}
|
|
14
|
-
.qd-dialog-tabs-table-select__table[data-v-
|
|
14
|
+
.qd-dialog-tabs-table-select__table[data-v-158a6f3b] .qd-crud-search > .t-loading__parent > .t-card__body {
|
|
15
15
|
padding-left: 0 !important;
|
|
16
16
|
padding-right: 0 !important;
|
|
17
17
|
padding-bottom: 0 !important;
|
|
18
18
|
}
|
|
19
|
-
.qd-dialog-tabs-table-select__table[data-v-
|
|
19
|
+
.qd-dialog-tabs-table-select__table[data-v-158a6f3b] .qd-crud-table__body > .t-loading__parent > .t-card__body {
|
|
20
20
|
padding-left: 0 !important;
|
|
21
21
|
padding-right: 0 !important;
|
|
22
22
|
padding-bottom: 0 !important;
|
|
23
23
|
}
|
|
24
|
-
.qd-dialog-tabs-table-select__table[data-v-
|
|
24
|
+
.qd-dialog-tabs-table-select__table[data-v-158a6f3b] .qd-crud-table__toolbar {
|
|
25
25
|
display: none;
|
|
26
26
|
}
|
|
27
|
-
.qd-dialog-tabs-table-select__table[data-v-
|
|
27
|
+
.qd-dialog-tabs-table-select__table[data-v-158a6f3b] .qd-service-table {
|
|
28
28
|
margin-top: 0;
|
|
29
29
|
}
|
|
30
|
-
.qd-dialog-tabs-table-select__table-add[data-v-
|
|
30
|
+
.qd-dialog-tabs-table-select__table-add[data-v-158a6f3b] {
|
|
31
31
|
margin-top: var(--td-comp-margin-m);
|
|
32
32
|
display: flex;
|
|
33
33
|
}
|
|
34
|
-
.qd-dialog-tabs-table-select__table-add .t-input__wrap[data-v-
|
|
34
|
+
.qd-dialog-tabs-table-select__table-add .t-input__wrap[data-v-158a6f3b] {
|
|
35
35
|
flex: 1 1 0;
|
|
36
36
|
overflow: hidden;
|
|
37
37
|
margin-right: var(--td-comp-margin-m);
|
|
@@ -22,6 +22,7 @@ declare const _default: <D extends TableRowData = TableRowData, R = unknown, P =
|
|
|
22
22
|
'dialog-footer'?: (props: {
|
|
23
23
|
cancel: (event: MouseEvent) => void;
|
|
24
24
|
confirm: () => Promise<boolean | void>;
|
|
25
|
+
confirmDisabled: boolean;
|
|
25
26
|
confirmLoading: boolean;
|
|
26
27
|
selectedOptions: import("@vue/reactivity").UnwrapRefSimple<D>[];
|
|
27
28
|
activeTab: import("tdesign-vue-next").TabValue | undefined;
|
|
@@ -2,7 +2,7 @@ import './index.css'
|
|
|
2
2
|
import _sfc_main from "./index.vue2.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-158a6f3b"]]);
|
|
6
6
|
export {
|
|
7
7
|
index as default
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './index.css'
|
|
2
2
|
import { defineComponent, mergeDefaults, ref, useTemplateRef, computed, reactive, h, watch, createElementBlock, openBlock, Fragment, createElementVNode, createVNode, mergeProps, unref, renderSlot, createBlock, withCtx, renderList, createTextVNode, toDisplayString, isRef, createSlots, normalizeProps, guardReactiveProps, nextTick } from "vue";
|
|
3
3
|
import { useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { isEmpty, useDoubleClick, identifyType, suspectedWrapperPromise, createExposeProxy, extractSlotsWithPrefix, hasOwn } from "qidian-shared";
|
|
5
5
|
import { AddIcon, SearchIcon } from "tdesign-icons-vue-next";
|
|
6
6
|
import { Select, Option, InputAdornment, Input, Button, Space } from "tdesign-vue-next";
|
|
7
7
|
import { useConfig } from "../config-provider/useConfig.mjs";
|
|
@@ -355,6 +355,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
355
355
|
const latestSelectedTab = ref(props.activeTab);
|
|
356
356
|
const dialogRef = useTemplateRef("dialog");
|
|
357
357
|
const tabsTableRef = useTemplateRef("tabsTable");
|
|
358
|
+
const confirmDisabled = computed(() => !props.tabs.length || isEmpty(tabsTableRef.value?.data));
|
|
358
359
|
const sel = useServiceDialogTableSelect(props, {
|
|
359
360
|
modelValue,
|
|
360
361
|
visible,
|
|
@@ -386,6 +387,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
386
387
|
const dialogOptions = {
|
|
387
388
|
...selectState.dialogOptions
|
|
388
389
|
};
|
|
390
|
+
if (confirmDisabled.value && dialogOptions.confirmBtn !== null) {
|
|
391
|
+
dialogOptions.confirmBtn = typeof dialogOptions.confirmBtn === "string" ? {
|
|
392
|
+
content: dialogOptions.confirmBtn,
|
|
393
|
+
disabled: true
|
|
394
|
+
} : typeof dialogOptions.confirmBtn === "object" ? {
|
|
395
|
+
...dialogOptions.confirmBtn,
|
|
396
|
+
disabled: true
|
|
397
|
+
} : {
|
|
398
|
+
disabled: true
|
|
399
|
+
};
|
|
400
|
+
}
|
|
389
401
|
const onBeforeOpen = dialogOptions.onBeforeOpen;
|
|
390
402
|
dialogOptions.onBeforeOpen = () => {
|
|
391
403
|
currentActiveTab.value = activeTab.value ?? props.tabs[0]?.value;
|
|
@@ -1022,6 +1034,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1022
1034
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "dialog-footer", {
|
|
1023
1035
|
cancel: handleFooterCancel,
|
|
1024
1036
|
confirm: () => handleConfirm(),
|
|
1037
|
+
confirmDisabled: confirmDisabled.value,
|
|
1025
1038
|
confirmLoading: unref(confirmLoad),
|
|
1026
1039
|
selectedOptions: unref(latestSelectedRows),
|
|
1027
1040
|
activeTab: currentActiveTab.value
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import './index2.css'
|
|
1
2
|
import './index.css'
|
|
2
3
|
import _sfc_main from "./index.vue2.mjs";
|
|
3
4
|
/* empty css */
|
|
5
|
+
/* empty css */
|
|
4
6
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
-
const QdServiceSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
7
|
+
const QdServiceSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d3c475ee"]]);
|
|
6
8
|
export {
|
|
7
9
|
QdServiceSelect as default
|
|
8
10
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './index2.css'
|
|
1
2
|
import './index.css'
|
|
2
3
|
import { defineComponent, mergeDefaults, computed, ref, unref, watch, onMounted, onActivated, onDeactivated, createBlock, openBlock, mergeProps, isRef, createSlots, withCtx, renderSlot, createCommentVNode, renderList, normalizeProps, guardReactiveProps } from "vue";
|
|
3
4
|
import { useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
|
|
@@ -148,9 +149,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
});
|
|
151
|
-
const { t } = useConfig("loading");
|
|
152
|
+
const { t: loadingT } = useConfig("loading");
|
|
153
|
+
const { t: serviceSelectT } = useConfig("serviceSelect");
|
|
152
154
|
const search = ref("");
|
|
155
|
+
const searchPending = ref(false);
|
|
153
156
|
const autofocus = ref(false);
|
|
157
|
+
const createOptionText = computed(() => JSON.stringify(serviceSelectT("createText")));
|
|
154
158
|
let autoOpenedOnce = false;
|
|
155
159
|
const reProps = computed(() => {
|
|
156
160
|
const {
|
|
@@ -174,18 +178,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
174
178
|
options: inOptions,
|
|
175
179
|
valueLabel: valueLabel2,
|
|
176
180
|
popupProps,
|
|
181
|
+
creatable,
|
|
177
182
|
filterable,
|
|
178
183
|
filter,
|
|
179
184
|
autofocus: autofocus2,
|
|
180
185
|
onSearch,
|
|
186
|
+
onInputChange,
|
|
181
187
|
onPopupVisibleChange,
|
|
182
188
|
onFocus,
|
|
189
|
+
onCreate,
|
|
183
190
|
onChange,
|
|
184
191
|
...selectOptions
|
|
185
192
|
} = props;
|
|
186
193
|
const mergedManual = manual ?? unref(pagination) !== false;
|
|
187
194
|
const rePopupProps = {
|
|
188
195
|
...popupProps,
|
|
196
|
+
overlayClassName: ["qd-service-select__popup", popupProps?.overlayClassName],
|
|
197
|
+
overlayStyle: (triggerElement, popupElement) => ({
|
|
198
|
+
...typeof popupProps?.overlayStyle === "function" ? popupProps.overlayStyle(triggerElement, popupElement) : popupProps?.overlayStyle,
|
|
199
|
+
"--qd-service-select-create-text": createOptionText.value
|
|
200
|
+
}),
|
|
189
201
|
onScrollToBottom: (context) => {
|
|
190
202
|
popupProps?.onScrollToBottom?.(context);
|
|
191
203
|
if (loading.value || noMore.value) return;
|
|
@@ -198,6 +210,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
198
210
|
if (!service) return;
|
|
199
211
|
refresh();
|
|
200
212
|
};
|
|
213
|
+
const reOnInputChange = (value, context) => {
|
|
214
|
+
onInputChange?.(value, context);
|
|
215
|
+
search.value = String(value ?? "").trim();
|
|
216
|
+
searchPending.value = !!service && !!search.value;
|
|
217
|
+
};
|
|
201
218
|
const reOnPopupVisibleChange = (visible, context) => {
|
|
202
219
|
onPopupVisibleChange?.(visible, context);
|
|
203
220
|
if (!service || loading.value) return;
|
|
@@ -213,6 +230,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
213
230
|
popupVisible.value = true;
|
|
214
231
|
}
|
|
215
232
|
};
|
|
233
|
+
const reOnCreate = (value) => {
|
|
234
|
+
if (!reCreatable.value) return;
|
|
235
|
+
onCreate?.(value);
|
|
236
|
+
};
|
|
216
237
|
const reOnChange = (value, context) => {
|
|
217
238
|
onChange?.(value, context);
|
|
218
239
|
const { selectOptions: selectOptions2 } = reProps.value;
|
|
@@ -244,14 +265,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
244
265
|
defaultSelectFirst,
|
|
245
266
|
fillOptions,
|
|
246
267
|
convStr,
|
|
268
|
+
creatable,
|
|
247
269
|
selectOptions: {
|
|
248
270
|
...selectOptions,
|
|
249
271
|
filterable: reFilterable,
|
|
250
272
|
filter: reFilter,
|
|
251
273
|
popupProps: rePopupProps,
|
|
252
274
|
onSearch: reOnSearch,
|
|
275
|
+
onInputChange: reOnInputChange,
|
|
253
276
|
onPopupVisibleChange: reOnPopupVisibleChange,
|
|
254
277
|
onFocus: reOnFocus,
|
|
278
|
+
onCreate: reOnCreate,
|
|
255
279
|
onChange: reOnChange
|
|
256
280
|
},
|
|
257
281
|
serviceOptions: {
|
|
@@ -301,6 +325,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
301
325
|
onBefore: () => {
|
|
302
326
|
reProps.value.serviceOptions.onBefore?.();
|
|
303
327
|
},
|
|
328
|
+
onAfter: () => {
|
|
329
|
+
searchPending.value = false;
|
|
330
|
+
reProps.value.serviceOptions.onAfter?.();
|
|
331
|
+
},
|
|
304
332
|
onSuccess: (res) => {
|
|
305
333
|
reProps.value.serviceOptions.onSuccess?.(res);
|
|
306
334
|
const list = data.value?.list || [];
|
|
@@ -322,6 +350,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
322
350
|
}
|
|
323
351
|
});
|
|
324
352
|
const selectLoad = computed(() => reProps.value.externalLoad || firstLoad.value);
|
|
353
|
+
const reCreatable = computed(() => {
|
|
354
|
+
if (!reProps.value.creatable || !reProps.value.selectOptions.filterable || selectLoad.value || loading.value || searchPending.value) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
const value = search.value;
|
|
358
|
+
if (!value) return false;
|
|
359
|
+
const labelKey = reProps.value.selectOptions.keys?.label || qdServiceSelectKeys.label;
|
|
360
|
+
return !options.value?.some(
|
|
361
|
+
(option) => String(option[labelKey] ?? "").trim() === value
|
|
362
|
+
);
|
|
363
|
+
});
|
|
325
364
|
function handleFilter(filterWords, option) {
|
|
326
365
|
if (!filterWords) return true;
|
|
327
366
|
if ("value" in option) {
|
|
@@ -335,6 +374,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
335
374
|
const value = filterWords.trim().toLowerCase();
|
|
336
375
|
return option.label.toLowerCase().includes(value);
|
|
337
376
|
}
|
|
377
|
+
function getSelectedOptions(value) {
|
|
378
|
+
const values = Array.isArray(value) ? value : [value];
|
|
379
|
+
const valueKey = reProps.value.selectOptions.keys?.value || qdServiceSelectKeys.value;
|
|
380
|
+
return (options.value || []).filter(
|
|
381
|
+
(option) => values.some(
|
|
382
|
+
(item) => typeof item === "object" && item !== null ? item[valueKey] === option[valueKey] : item === option[valueKey]
|
|
383
|
+
)
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
function handleKeydownCapture(event) {
|
|
387
|
+
if (event.key !== "Enter" || event.isComposing || !reCreatable.value) return;
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
event.stopImmediatePropagation();
|
|
390
|
+
const value = search.value;
|
|
391
|
+
const { multiple, onEnter, onCreate, onChange } = reProps.value.selectOptions;
|
|
392
|
+
const currentValue = reModelValue.value;
|
|
393
|
+
const selectedOptions = getSelectedOptions(currentValue);
|
|
394
|
+
const nextValue = multiple ? [...Array.isArray(currentValue) ? currentValue : [], value] : value;
|
|
395
|
+
onEnter?.({ inputValue: value, e: event, value: currentValue });
|
|
396
|
+
onCreate?.(value);
|
|
397
|
+
reModelValue.value = nextValue;
|
|
398
|
+
onChange?.(nextValue, { selectedOptions, trigger: "check", e: event });
|
|
399
|
+
popupVisible.value = false;
|
|
400
|
+
}
|
|
338
401
|
function setAutoSelectedWatch() {
|
|
339
402
|
if (!reProps.value.defaultSelectFirst) return;
|
|
340
403
|
unWatchAutoSelected = watch(options, setDefaultSelectFirst, { immediate: true });
|
|
@@ -409,13 +472,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
409
472
|
}, {
|
|
410
473
|
...reProps.value.selectOptions,
|
|
411
474
|
..._ctx.$slots.default ? {} : { options: unref(options) }
|
|
475
|
+
}, {
|
|
476
|
+
creatable: reCreatable.value,
|
|
477
|
+
onKeydownCapture: handleKeydownCapture
|
|
412
478
|
}), createSlots({
|
|
413
479
|
"panel-bottom-content": withCtx(() => [
|
|
414
480
|
unref(loading) && !unref(firstLoad) ? (openBlock(), createBlock(unref(Loading), {
|
|
415
481
|
key: 0,
|
|
416
482
|
class: "qd-service-select__load",
|
|
417
483
|
size: "small",
|
|
418
|
-
text: unref(
|
|
484
|
+
text: unref(loadingT)("text")
|
|
419
485
|
}, null, 8, ["text"])) : _ctx.$slots["panel-bottom-content"] ? renderSlot(_ctx.$slots, "panel-bottom-content", { key: 1 }, void 0, true) : createCommentVNode("", true)
|
|
420
486
|
]),
|
|
421
487
|
default: withCtx(() => [
|
|
@@ -433,7 +499,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
433
499
|
])
|
|
434
500
|
};
|
|
435
501
|
})
|
|
436
|
-
]), 1040, ["modelValue", "input", "popup-visible", "autofocus", "loading"]);
|
|
502
|
+
]), 1040, ["modelValue", "input", "popup-visible", "autofocus", "loading", "creatable"]);
|
|
437
503
|
};
|
|
438
504
|
}
|
|
439
505
|
});
|
package/dist/locales/en-US.d.ts
CHANGED
package/dist/locales/en-US.mjs
CHANGED
package/dist/locales/zh-CN.d.ts
CHANGED
package/dist/locales/zh-CN.mjs
CHANGED
package/dist/locales/zh-TW.d.ts
CHANGED
package/dist/locales/zh-TW.mjs
CHANGED
package/dist/styles/index.css
CHANGED
|
@@ -174,9 +174,12 @@ p {
|
|
|
174
174
|
.t-table__cell--title {
|
|
175
175
|
justify-content: space-between;
|
|
176
176
|
}
|
|
177
|
-
.t-table__body > tr > td .t-
|
|
177
|
+
.t-table__body > tr > td > .t-form__item:last-child {
|
|
178
|
+
margin-bottom: 0 !important;
|
|
179
|
+
}
|
|
180
|
+
.t-table__body > tr > td > .t-form__item:last-child .t-form__controls > .t-input__extra {
|
|
178
181
|
position: initial;
|
|
179
|
-
|
|
182
|
+
bottom: auto;
|
|
180
183
|
}
|
|
181
184
|
.t-table__content tbody > tr:last-child:not(.t-table__empty-row) > td,
|
|
182
185
|
.t-table__content tfoot > tr:last-child > td {
|