sun-biz 0.0.4-beta.56 → 0.0.4-beta.58
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/index.js +18 -15
- package/dist/components/static/css/index.css +15 -6
- package/dist/components/table-select/composable/useDirectionKey.d.ts +5 -2
- package/dist/components/table-select/types/index.d.ts +23 -1
- package/dist/index.js +122 -59
- package/dist/static/css/index.css +15 -6
- package/dist/types/index.d.ts +28 -0
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -4449,7 +4449,7 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
|
|
|
4449
4449
|
indexTypeCode: data.indexTypeCode
|
|
4450
4450
|
}
|
|
4451
4451
|
});
|
|
4452
|
-
return res?.data;
|
|
4452
|
+
return res?.data?.bizOutputParam;
|
|
4453
4453
|
};
|
|
4454
4454
|
/** 处理检索结果 */ const handleSearchResult = (res, cardInfo)=>{
|
|
4455
4455
|
// 查询的结果 超过一条 则需要 弹出弹窗让用户选择
|
|
@@ -6371,17 +6371,19 @@ const printReceiptBtn_exports_ = printReceiptBtnvue_type_script_setup_true_lang_
|
|
|
6371
6371
|
/**
|
|
6372
6372
|
* 方向键监听的 hook
|
|
6373
6373
|
* @param hookActive hook是否激活
|
|
6374
|
-
* @
|
|
6375
|
-
|
|
6374
|
+
* @param cb 键盘事件回调函数
|
|
6375
|
+
* @param options 配置选项
|
|
6376
|
+
*/ function useDirectionKey(hookActive, cb, options) {
|
|
6377
|
+
const { immediate = false } = options || {};
|
|
6376
6378
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(hookActive, (v)=>{
|
|
6377
6379
|
if (v) document.addEventListener('keydown', cb);
|
|
6378
|
-
else
|
|
6379
|
-
|
|
6380
|
+
else document.removeEventListener('keydown', cb);
|
|
6381
|
+
}, {
|
|
6382
|
+
immediate
|
|
6380
6383
|
});
|
|
6381
6384
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount)(()=>{
|
|
6382
|
-
|
|
6385
|
+
document.removeEventListener('keydown', cb);
|
|
6383
6386
|
});
|
|
6384
|
-
// return {};
|
|
6385
6387
|
}
|
|
6386
6388
|
/**
|
|
6387
6389
|
* table-select 模式枚举值
|
|
@@ -6391,7 +6393,7 @@ const printReceiptBtn_exports_ = printReceiptBtnvue_type_script_setup_true_lang_
|
|
|
6391
6393
|
return TableSelectMode;
|
|
6392
6394
|
}({});
|
|
6393
6395
|
const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Record_3CPropertyKey_2C_20any_3E_hoisted_1 = {
|
|
6394
|
-
class: "flex h-full flex-col"
|
|
6396
|
+
class: "test flex h-full flex-col"
|
|
6395
6397
|
};
|
|
6396
6398
|
const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Record_3CPropertyKey_2C_20any_3E_hoisted_2 = {
|
|
6397
6399
|
class: "header flex items-center"
|
|
@@ -6450,22 +6452,22 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
6450
6452
|
default: 'default'
|
|
6451
6453
|
},
|
|
6452
6454
|
simpleConfig: {
|
|
6453
|
-
default:
|
|
6454
|
-
showHeader: false
|
|
6455
|
-
} : {}
|
|
6455
|
+
default: void 0
|
|
6456
6456
|
},
|
|
6457
6457
|
complexConfig: {
|
|
6458
|
-
default:
|
|
6459
|
-
width: 400
|
|
6460
|
-
})
|
|
6458
|
+
default: void 0
|
|
6461
6459
|
},
|
|
6462
6460
|
highlightCurrentRow: {
|
|
6463
6461
|
type: Boolean,
|
|
6464
6462
|
default: true
|
|
6465
6463
|
},
|
|
6464
|
+
rowClassName: {},
|
|
6466
6465
|
data: {
|
|
6467
6466
|
default: ()=>[]
|
|
6468
6467
|
},
|
|
6468
|
+
exists: {
|
|
6469
|
+
default: ()=>[]
|
|
6470
|
+
},
|
|
6469
6471
|
remoteMethod: {
|
|
6470
6472
|
type: Function,
|
|
6471
6473
|
default: void 0
|
|
@@ -6474,7 +6476,8 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
6474
6476
|
modelValue: {},
|
|
6475
6477
|
modelModifiers: {}
|
|
6476
6478
|
}), [
|
|
6477
|
-
"nextPage"
|
|
6479
|
+
"nextPage",
|
|
6480
|
+
"blur"
|
|
6478
6481
|
], [
|
|
6479
6482
|
"update:modelValue"
|
|
6480
6483
|
];
|
|
@@ -26,26 +26,35 @@
|
|
|
26
26
|
font-weight: 400;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.input[data-v-
|
|
29
|
+
.input[data-v-d8701274] .el-input__inner {
|
|
30
30
|
cursor: pointer !important;
|
|
31
31
|
}
|
|
32
|
-
.table-select-popover[data-v-
|
|
32
|
+
.table-select-popover[data-v-d8701274] {
|
|
33
33
|
height: 350px;
|
|
34
34
|
width: auto !important;
|
|
35
35
|
}
|
|
36
|
-
.table-select-popover-simple .header[data-v-
|
|
36
|
+
.table-select-popover-simple .header[data-v-d8701274] {
|
|
37
37
|
width: 100%;
|
|
38
38
|
}
|
|
39
|
-
.table-select-popover-simple .header > span[data-v-
|
|
39
|
+
.table-select-popover-simple .header > span[data-v-d8701274] {
|
|
40
40
|
flex: var(--simple-column-flex);
|
|
41
41
|
}
|
|
42
|
-
.table-select-popover-simple .cell[data-v-
|
|
42
|
+
.table-select-popover-simple .cell[data-v-d8701274] {
|
|
43
43
|
width: 100%;
|
|
44
44
|
}
|
|
45
|
-
.table-select-popover-simple .cell > span[data-v-
|
|
45
|
+
.table-select-popover-simple .cell > span[data-v-d8701274] {
|
|
46
46
|
flex: var(--simple-column-flex);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
.table-select-popover .exist-row {
|
|
50
|
+
--el-table-tr-bg-color: #f2f5fc;
|
|
51
|
+
color: #a8abb2;
|
|
52
|
+
--el-table-row-hover-bg-color: #f2f5fc !important;
|
|
53
|
+
}
|
|
54
|
+
.table-select-popover .exist-row.current-row {
|
|
55
|
+
--el-table-current-row-bg-color: #f2f5fc;
|
|
56
|
+
}
|
|
57
|
+
|
|
49
58
|
|
|
50
59
|
|
|
51
60
|
.disabled-user-tooltip, .disabled-user-tooltip .el-tooltip__trigger {
|
|
@@ -2,6 +2,9 @@ import { Ref } from 'vue';
|
|
|
2
2
|
/**
|
|
3
3
|
* 方向键监听的 hook
|
|
4
4
|
* @param hookActive hook是否激活
|
|
5
|
-
* @
|
|
5
|
+
* @param cb 键盘事件回调函数
|
|
6
|
+
* @param options 配置选项
|
|
6
7
|
*/
|
|
7
|
-
export default function useDirectionKey(hookActive: Ref<boolean>, cb: (e: KeyboardEvent) => void
|
|
8
|
+
export default function useDirectionKey(hookActive: Ref<boolean>, cb: (e: KeyboardEvent) => void, options?: {
|
|
9
|
+
immediate?: boolean;
|
|
10
|
+
}): void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ComponentSize } from 'element-sun';
|
|
2
|
-
import { ColumnProps } from '
|
|
2
|
+
import { ColumnProps } from '../../pro-table';
|
|
3
|
+
import type { ComponentExposed } from '@/types';
|
|
4
|
+
import type TableSelect from '../index.vue';
|
|
3
5
|
/**
|
|
4
6
|
* 简易模式 option 类型
|
|
5
7
|
*/
|
|
@@ -84,8 +86,15 @@ export interface TableSelectProps<T extends Record<PropertyKey, any>> {
|
|
|
84
86
|
complexConfig?: ISelectComplexConfig;
|
|
85
87
|
/** 是否高亮当前行 */
|
|
86
88
|
highlightCurrentRow?: boolean;
|
|
89
|
+
/** 行类名 */
|
|
90
|
+
rowClassName?: (args: {
|
|
91
|
+
row: T;
|
|
92
|
+
rowIndex: number;
|
|
93
|
+
}) => string;
|
|
87
94
|
/** 表格数据 */
|
|
88
95
|
data: T[];
|
|
96
|
+
/** 已存在的行数据 key 数组 */
|
|
97
|
+
exists?: string[];
|
|
89
98
|
/** 远程加载数据的方法 */
|
|
90
99
|
remoteMethod?: RemoteMethod<string | undefined>;
|
|
91
100
|
}
|
|
@@ -105,5 +114,18 @@ export interface ISelectComplexConfig {
|
|
|
105
114
|
* 弹窗最大高度
|
|
106
115
|
*/
|
|
107
116
|
maxHeight?: string | number;
|
|
117
|
+
/**
|
|
118
|
+
* 是否显示 prefix
|
|
119
|
+
*/
|
|
120
|
+
showPrefix?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* 失焦时清除
|
|
123
|
+
*/
|
|
124
|
+
clearWhenBlur?: boolean;
|
|
108
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* TableSelect 组件实例类型
|
|
128
|
+
* 用于获取组件 exposed 的方法和属性
|
|
129
|
+
*/
|
|
130
|
+
export type TableSelectInstance = ComponentExposed<typeof TableSelect>;
|
|
109
131
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -4949,7 +4949,7 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
|
|
|
4949
4949
|
indexTypeCode: data.indexTypeCode
|
|
4950
4950
|
}
|
|
4951
4951
|
});
|
|
4952
|
-
return res?.data;
|
|
4952
|
+
return res?.data?.bizOutputParam;
|
|
4953
4953
|
};
|
|
4954
4954
|
/** 处理检索结果 */ const handleSearchResult = (res, cardInfo)=>{
|
|
4955
4955
|
// 查询的结果 超过一条 则需要 弹出弹窗让用户选择
|
|
@@ -11165,17 +11165,19 @@ const invoice_exports_ = invoicevue_type_script_setup_true_lang_ts_name_proInvoi
|
|
|
11165
11165
|
/**
|
|
11166
11166
|
* 方向键监听的 hook
|
|
11167
11167
|
* @param hookActive hook是否激活
|
|
11168
|
-
* @
|
|
11169
|
-
|
|
11168
|
+
* @param cb 键盘事件回调函数
|
|
11169
|
+
* @param options 配置选项
|
|
11170
|
+
*/ function useDirectionKey(hookActive, cb, options) {
|
|
11171
|
+
const { immediate = false } = options || {};
|
|
11170
11172
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(hookActive, (v)=>{
|
|
11171
11173
|
if (v) document.addEventListener('keydown', cb);
|
|
11172
|
-
else
|
|
11173
|
-
|
|
11174
|
+
else document.removeEventListener('keydown', cb);
|
|
11175
|
+
}, {
|
|
11176
|
+
immediate
|
|
11174
11177
|
});
|
|
11175
11178
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount)(()=>{
|
|
11176
|
-
|
|
11179
|
+
document.removeEventListener('keydown', cb);
|
|
11177
11180
|
});
|
|
11178
|
-
// return {};
|
|
11179
11181
|
}
|
|
11180
11182
|
/**
|
|
11181
11183
|
* table-select 模式枚举值
|
|
@@ -11185,7 +11187,7 @@ const invoice_exports_ = invoicevue_type_script_setup_true_lang_ts_name_proInvoi
|
|
|
11185
11187
|
return TableSelectMode;
|
|
11186
11188
|
}({});
|
|
11187
11189
|
const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Record_3CPropertyKey_2C_20any_3E_hoisted_1 = {
|
|
11188
|
-
class: "flex h-full flex-col"
|
|
11190
|
+
class: "test flex h-full flex-col"
|
|
11189
11191
|
};
|
|
11190
11192
|
const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Record_3CPropertyKey_2C_20any_3E_hoisted_2 = {
|
|
11191
11193
|
class: "header flex items-center"
|
|
@@ -11246,22 +11248,22 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11246
11248
|
default: 'default'
|
|
11247
11249
|
},
|
|
11248
11250
|
simpleConfig: {
|
|
11249
|
-
default:
|
|
11250
|
-
showHeader: false
|
|
11251
|
-
} : {}
|
|
11251
|
+
default: void 0
|
|
11252
11252
|
},
|
|
11253
11253
|
complexConfig: {
|
|
11254
|
-
default:
|
|
11255
|
-
width: 400
|
|
11256
|
-
})
|
|
11254
|
+
default: void 0
|
|
11257
11255
|
},
|
|
11258
11256
|
highlightCurrentRow: {
|
|
11259
11257
|
type: Boolean,
|
|
11260
11258
|
default: true
|
|
11261
11259
|
},
|
|
11260
|
+
rowClassName: {},
|
|
11262
11261
|
data: {
|
|
11263
11262
|
default: ()=>[]
|
|
11264
11263
|
},
|
|
11264
|
+
exists: {
|
|
11265
|
+
default: ()=>[]
|
|
11266
|
+
},
|
|
11265
11267
|
remoteMethod: {
|
|
11266
11268
|
type: Function,
|
|
11267
11269
|
default: void 0
|
|
@@ -11271,14 +11273,30 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11271
11273
|
modelModifiers: {}
|
|
11272
11274
|
}),
|
|
11273
11275
|
emits: /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeModels)([
|
|
11274
|
-
"nextPage"
|
|
11276
|
+
"nextPage",
|
|
11277
|
+
"blur"
|
|
11275
11278
|
], [
|
|
11276
11279
|
"update:modelValue"
|
|
11277
11280
|
]),
|
|
11278
11281
|
setup (__props, { expose: __expose, emit: __emit }) {
|
|
11279
11282
|
const model = (0, __WEBPACK_EXTERNAL_MODULE_vue__.useModel)(__props, "modelValue");
|
|
11280
11283
|
const props = __props;
|
|
11284
|
+
const getRowClassName = ({ row })=>{
|
|
11285
|
+
if (props.exists?.includes(row[props.rowKey])) return 'exist-row cursor-not-allowed';
|
|
11286
|
+
return 'cursor-pointer';
|
|
11287
|
+
};
|
|
11281
11288
|
const isSimpleMode = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>'simple' === props.mode);
|
|
11289
|
+
// 合并默认配置和用户传入的配置
|
|
11290
|
+
const mergedComplexConfig = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>({
|
|
11291
|
+
showPrefix: true,
|
|
11292
|
+
width: 400,
|
|
11293
|
+
clearWhenBlur: true,
|
|
11294
|
+
...props.complexConfig
|
|
11295
|
+
}));
|
|
11296
|
+
const mergedSimpleConfig = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>({
|
|
11297
|
+
showHeader: false,
|
|
11298
|
+
...props.simpleConfig
|
|
11299
|
+
}));
|
|
11282
11300
|
const simpleColumns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
|
|
11283
11301
|
if (isSimpleMode.value) return props.columns || [];
|
|
11284
11302
|
return [];
|
|
@@ -11295,16 +11313,19 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11295
11313
|
const popoverVisible = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(props.popoverVisible);
|
|
11296
11314
|
const inputValue = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)('');
|
|
11297
11315
|
const keydownIndex = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(-1);
|
|
11298
|
-
const rowElements = (0, __WEBPACK_EXTERNAL_MODULE_vue__.
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
return
|
|
11316
|
+
const rowElements = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
|
|
11317
|
+
/**
|
|
11318
|
+
* 更新行元素缓存
|
|
11319
|
+
*/ function updateRowElements() {
|
|
11320
|
+
if (!popoverVisible.value || !tableRef.value?.proTableRef || !props.data.length) {
|
|
11321
|
+
rowElements.value = [];
|
|
11322
|
+
return;
|
|
11305
11323
|
}
|
|
11306
|
-
|
|
11307
|
-
|
|
11324
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(()=>{
|
|
11325
|
+
const elRowSelector = '.el-table__body tbody .el-table__row';
|
|
11326
|
+
rowElements.value = Array.from((tableRef.value?.proTableRef.$el).querySelectorAll(elRowSelector));
|
|
11327
|
+
});
|
|
11328
|
+
}
|
|
11308
11329
|
function setCurrentRow() {
|
|
11309
11330
|
const option = props.data[keydownIndex.value];
|
|
11310
11331
|
if (option) tableRef.value?.proTableRef.setCurrentRow(option);
|
|
@@ -11320,18 +11341,21 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11320
11341
|
});
|
|
11321
11342
|
}
|
|
11322
11343
|
}
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
if (
|
|
11327
|
-
|
|
11328
|
-
keydownIndex.value
|
|
11329
|
-
|
|
11344
|
+
/**
|
|
11345
|
+
* 键盘事件处理函数
|
|
11346
|
+
*/ const handleKeydown = (e)=>{
|
|
11347
|
+
if (!props.data.length) return;
|
|
11348
|
+
if ('Enter' === e.key) {
|
|
11349
|
+
const row = props.data[keydownIndex.value];
|
|
11350
|
+
if (row && keydownIndex.value >= 0) handleRowClick(row);
|
|
11351
|
+
} else if ('ArrowUp' === e.key) {
|
|
11352
|
+
e.preventDefault();
|
|
11353
|
+
keydownIndex.value = Math.max(keydownIndex.value - 1, 0);
|
|
11330
11354
|
setCurrentRow();
|
|
11331
11355
|
scrollToCurrentRow();
|
|
11332
11356
|
} else if ('ArrowDown' === e.key) {
|
|
11333
|
-
|
|
11334
|
-
keydownIndex.value = Math.min(keydownIndex.value, props.data.length - 1);
|
|
11357
|
+
e.preventDefault();
|
|
11358
|
+
keydownIndex.value = Math.min(keydownIndex.value + 1, props.data.length - 1);
|
|
11335
11359
|
setCurrentRow();
|
|
11336
11360
|
scrollToCurrentRow();
|
|
11337
11361
|
}
|
|
@@ -11354,13 +11378,14 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11354
11378
|
/**
|
|
11355
11379
|
* 聚焦事件
|
|
11356
11380
|
*/ function focus() {
|
|
11357
|
-
|
|
11381
|
+
inputSearchRef.value?.focus();
|
|
11358
11382
|
toggleVisible();
|
|
11359
11383
|
}
|
|
11360
11384
|
/**
|
|
11361
11385
|
* 点击行
|
|
11362
11386
|
* @param row 点击的行
|
|
11363
11387
|
*/ function handleRowClick(row) {
|
|
11388
|
+
if (!row || props.exists?.includes(row[props.rowKey])) return;
|
|
11364
11389
|
// 多选
|
|
11365
11390
|
if ((0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isArray)(model.value)) {
|
|
11366
11391
|
const existedIndex = model.value.findIndex((item)=>item[props.rowKey] === row[props.rowKey]);
|
|
@@ -11385,27 +11410,42 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11385
11410
|
model.value = row;
|
|
11386
11411
|
keydownIndex.value = index;
|
|
11387
11412
|
}
|
|
11388
|
-
|
|
11413
|
+
popoverVisible.value = false;
|
|
11414
|
+
// popoverRef.value?.hide();
|
|
11389
11415
|
}
|
|
11390
11416
|
}
|
|
11391
11417
|
/**
|
|
11392
11418
|
* 输入框输入
|
|
11393
11419
|
* @param v 输入的值
|
|
11394
11420
|
*/ function handleInput(v) {
|
|
11395
|
-
(
|
|
11396
|
-
// 存在异步行为,要判断
|
|
11397
|
-
if (props.remoteMethod) props.remoteMethod(v);
|
|
11398
|
-
}, 500)();
|
|
11421
|
+
debouncedQuery(v);
|
|
11399
11422
|
popoverVisible.value = true;
|
|
11400
11423
|
}
|
|
11424
|
+
const debouncedQuery = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.debounce)((v)=>{
|
|
11425
|
+
if (props.remoteMethod) props.remoteMethod(v);
|
|
11426
|
+
}, 500);
|
|
11401
11427
|
/**
|
|
11402
11428
|
* 处理下拉加载
|
|
11403
11429
|
*/ function handleScrollLoad() {
|
|
11404
11430
|
emits('nextPage');
|
|
11405
11431
|
}
|
|
11406
11432
|
function handleClickOutside(e) {
|
|
11407
|
-
if (
|
|
11408
|
-
|
|
11433
|
+
if (inputSearchRef.value?.$el && inputSearchRef.value?.$el.contains(e.target)) return;
|
|
11434
|
+
{
|
|
11435
|
+
const hasNoSelection = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isArray)(model.value) && 0 === model.value.length || !model.value;
|
|
11436
|
+
if (mergedComplexConfig.value.clearWhenBlur && hasNoSelection) // 只有当输入框有内容但没有选中值时,才需要重置并重新请求
|
|
11437
|
+
{
|
|
11438
|
+
if (inputValue.value) {
|
|
11439
|
+
reset();
|
|
11440
|
+
debouncedQuery('');
|
|
11441
|
+
}
|
|
11442
|
+
}
|
|
11443
|
+
// 总是关闭弹窗
|
|
11444
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(()=>{
|
|
11445
|
+
popoverVisible.value = false;
|
|
11446
|
+
});
|
|
11447
|
+
emits('blur');
|
|
11448
|
+
}
|
|
11409
11449
|
}
|
|
11410
11450
|
function toggleVisible() {
|
|
11411
11451
|
popoverVisible.value = true;
|
|
@@ -11472,13 +11512,25 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11472
11512
|
// // 启动动画
|
|
11473
11513
|
// requestAnimationFrame(updateScroll);
|
|
11474
11514
|
// }
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
if (
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11515
|
+
// 同步 model 到 inputValue
|
|
11516
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(model, (val)=>{
|
|
11517
|
+
if ((0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isArray)(val)) inputValue.value = '';
|
|
11518
|
+
else inputValue.value = val ? val[props.labelKey] : '';
|
|
11519
|
+
}, {
|
|
11520
|
+
immediate: true
|
|
11521
|
+
});
|
|
11522
|
+
// 同步外部 popoverVisible
|
|
11523
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.popoverVisible, (val)=>{
|
|
11524
|
+
popoverVisible.value = val;
|
|
11525
|
+
});
|
|
11526
|
+
// 监听数据变化和弹层状态,更新行元素
|
|
11527
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)([
|
|
11528
|
+
()=>props.data,
|
|
11529
|
+
popoverVisible
|
|
11530
|
+
], ()=>{
|
|
11531
|
+
updateRowElements();
|
|
11532
|
+
}, {
|
|
11533
|
+
deep: true
|
|
11482
11534
|
});
|
|
11483
11535
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeMount)(()=>{
|
|
11484
11536
|
if (isSimpleMode.value) document.documentElement.style.setProperty('--simple-column-flex', `0 0 ${Math.floor(100 / simpleColumns.value.length)}%`);
|
|
@@ -11489,6 +11541,10 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11489
11541
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
|
|
11490
11542
|
if (props.immediate && props.remoteMethod) props.remoteMethod();
|
|
11491
11543
|
});
|
|
11544
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted)(()=>{
|
|
11545
|
+
// 取消待执行的防抖函数
|
|
11546
|
+
debouncedQuery?.cancel?.();
|
|
11547
|
+
});
|
|
11492
11548
|
__expose({
|
|
11493
11549
|
reset,
|
|
11494
11550
|
focus,
|
|
@@ -11504,13 +11560,15 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11504
11560
|
}, [
|
|
11505
11561
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElInput), {
|
|
11506
11562
|
class: "input",
|
|
11507
|
-
"prefix-icon":
|
|
11563
|
+
"prefix-icon": mergedComplexConfig.value.showPrefix ? 'Search' : '',
|
|
11508
11564
|
modelValue: inputValue.value,
|
|
11509
11565
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>inputValue.value = $event),
|
|
11510
11566
|
ref_key: "inputSearchRef",
|
|
11511
11567
|
ref: inputSearchRef,
|
|
11512
11568
|
size: _ctx.size,
|
|
11513
|
-
placeholder: _ctx.placeholder || '
|
|
11569
|
+
placeholder: _ctx.placeholder || _ctx.$t('global:placeholder.input.template', {
|
|
11570
|
+
content: _ctx.$t('global:search') + _ctx.$t('global:content')
|
|
11571
|
+
}),
|
|
11514
11572
|
clearable: "",
|
|
11515
11573
|
onKeydownCapture: _cache[1] || (_cache[1] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.withKeys)((0, __WEBPACK_EXTERNAL_MODULE_vue__.withModifiers)(()=>{}, [
|
|
11516
11574
|
"prevent"
|
|
@@ -11546,6 +11604,7 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11546
11604
|
key: "1"
|
|
11547
11605
|
} : void 0
|
|
11548
11606
|
]), 1032, [
|
|
11607
|
+
"prefix-icon",
|
|
11549
11608
|
"modelValue",
|
|
11550
11609
|
"size",
|
|
11551
11610
|
"placeholder"
|
|
@@ -11553,7 +11612,7 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11553
11612
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElPopover), {
|
|
11554
11613
|
ref_key: "popoverRef",
|
|
11555
11614
|
ref: popoverRef,
|
|
11556
|
-
width:
|
|
11615
|
+
width: mergedComplexConfig.value.width,
|
|
11557
11616
|
visible: popoverVisible.value,
|
|
11558
11617
|
"virtual-ref": inputSearchRef.value,
|
|
11559
11618
|
"virtual-triggering": "",
|
|
@@ -11567,10 +11626,11 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11567
11626
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "header"),
|
|
11568
11627
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(pro_table), {
|
|
11569
11628
|
ref: "table",
|
|
11570
|
-
"max-height":
|
|
11629
|
+
"max-height": mergedComplexConfig.value.maxHeight,
|
|
11571
11630
|
"component-no": _ctx.componentNo,
|
|
11572
11631
|
"row-key": _ctx.rowKey,
|
|
11573
11632
|
"current-row-key": _ctx.currentRowKey,
|
|
11633
|
+
"row-class-name": getRowClassName,
|
|
11574
11634
|
"highlight-current-row": _ctx.highlightCurrentRow,
|
|
11575
11635
|
columns: complexColumns.value,
|
|
11576
11636
|
data: _ctx.data,
|
|
@@ -11614,14 +11674,16 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11614
11674
|
clearable: "",
|
|
11615
11675
|
"popper-class": "table-select-popover-simple",
|
|
11616
11676
|
size: _ctx.size,
|
|
11617
|
-
placeholder:
|
|
11677
|
+
placeholder: _ctx.$t('global:placeholder.input.template', {
|
|
11678
|
+
content: _ctx.$t('global:search') + _ctx.$t('global:content')
|
|
11679
|
+
}),
|
|
11618
11680
|
"value-key": _ctx.rowKey
|
|
11619
11681
|
}, (0, __WEBPACK_EXTERNAL_MODULE_vue__.createSlots)({
|
|
11620
11682
|
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
11621
11683
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "default", {}, ()=>[
|
|
11622
|
-
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(_ctx.data, (item
|
|
11684
|
+
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(_ctx.data, (item)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(_component_el_option, {
|
|
11623
11685
|
class: "cell flex items-center",
|
|
11624
|
-
key:
|
|
11686
|
+
key: item[_ctx.rowKey],
|
|
11625
11687
|
label: item[_ctx.labelKey],
|
|
11626
11688
|
value: item
|
|
11627
11689
|
}, {
|
|
@@ -11639,15 +11701,15 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11639
11701
|
]),
|
|
11640
11702
|
_: 2
|
|
11641
11703
|
}, [
|
|
11642
|
-
|
|
11704
|
+
mergedSimpleConfig.value.showHeader ? {
|
|
11643
11705
|
name: "header",
|
|
11644
11706
|
fn: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
11645
11707
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "header", {
|
|
11646
11708
|
columns: simpleColumns.value
|
|
11647
11709
|
}, ()=>[
|
|
11648
11710
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Record_3CPropertyKey_2C_20any_3E_hoisted_2, [
|
|
11649
|
-
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(simpleColumns.value, (head
|
|
11650
|
-
key:
|
|
11711
|
+
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(simpleColumns.value, (head)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("span", {
|
|
11712
|
+
key: head.key
|
|
11651
11713
|
}, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(head.label), 1))), 128))
|
|
11652
11714
|
])
|
|
11653
11715
|
])
|
|
@@ -11657,6 +11719,7 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11657
11719
|
]), 1032, [
|
|
11658
11720
|
"modelValue",
|
|
11659
11721
|
"size",
|
|
11722
|
+
"placeholder",
|
|
11660
11723
|
"value-key"
|
|
11661
11724
|
])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
|
|
11662
11725
|
], 64);
|
|
@@ -11666,7 +11729,7 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
|
|
|
11666
11729
|
const table_select_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Record_3CPropertyKey_2C_20any_3E, [
|
|
11667
11730
|
[
|
|
11668
11731
|
'__scopeId',
|
|
11669
|
-
"data-v-
|
|
11732
|
+
"data-v-d8701274"
|
|
11670
11733
|
]
|
|
11671
11734
|
]);
|
|
11672
11735
|
/* ESM default export */ const table_select = table_select_exports_;
|
|
@@ -66,26 +66,35 @@
|
|
|
66
66
|
margin-top: 8px !important;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.input[data-v-
|
|
69
|
+
.input[data-v-d8701274] .el-input__inner {
|
|
70
70
|
cursor: pointer !important;
|
|
71
71
|
}
|
|
72
|
-
.table-select-popover[data-v-
|
|
72
|
+
.table-select-popover[data-v-d8701274] {
|
|
73
73
|
height: 350px;
|
|
74
74
|
width: auto !important;
|
|
75
75
|
}
|
|
76
|
-
.table-select-popover-simple .header[data-v-
|
|
76
|
+
.table-select-popover-simple .header[data-v-d8701274] {
|
|
77
77
|
width: 100%;
|
|
78
78
|
}
|
|
79
|
-
.table-select-popover-simple .header > span[data-v-
|
|
79
|
+
.table-select-popover-simple .header > span[data-v-d8701274] {
|
|
80
80
|
flex: var(--simple-column-flex);
|
|
81
81
|
}
|
|
82
|
-
.table-select-popover-simple .cell[data-v-
|
|
82
|
+
.table-select-popover-simple .cell[data-v-d8701274] {
|
|
83
83
|
width: 100%;
|
|
84
84
|
}
|
|
85
|
-
.table-select-popover-simple .cell > span[data-v-
|
|
85
|
+
.table-select-popover-simple .cell > span[data-v-d8701274] {
|
|
86
86
|
flex: var(--simple-column-flex);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
.table-select-popover .exist-row {
|
|
90
|
+
--el-table-tr-bg-color: #f2f5fc;
|
|
91
|
+
color: #a8abb2;
|
|
92
|
+
--el-table-row-hover-bg-color: #f2f5fc !important;
|
|
93
|
+
}
|
|
94
|
+
.table-select-popover .exist-row.current-row {
|
|
95
|
+
--el-table-current-row-bg-color: #f2f5fc;
|
|
96
|
+
}
|
|
97
|
+
|
|
89
98
|
|
|
90
99
|
|
|
91
100
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 组件类型工具
|
|
3
|
+
* @see https://github.com/vuejs/language-tools/blob/master/packages/component-type-helpers/index.ts
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 提取组件通过 defineExpose 暴露的类型
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { ref } from 'vue';
|
|
10
|
+
* import { TableSelect, type ComponentExposed } from 'sun-biz';
|
|
11
|
+
*
|
|
12
|
+
* type TableSelectInstance = ComponentExposed<typeof TableSelect>;
|
|
13
|
+
* const tableSelectRef = ref<TableSelectInstance>();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export type ComponentExposed<T> = T extends new (...args: any) => infer E ? E : T extends (props: any, ctx: any, expose: (exposed: infer E) => any, ...args: any) => any ? NonNullable<E> : {};
|
|
17
|
+
/**
|
|
18
|
+
* 提取组件的 Props 类型
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { TableSelect, type ComponentProps } from 'sun-biz';
|
|
22
|
+
*
|
|
23
|
+
* type TableSelectProps = ComponentProps<typeof TableSelect>;
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export type ComponentProps<T> = T extends new (...args: any) => {
|
|
27
|
+
$props: infer P;
|
|
28
|
+
} ? NonNullable<P> : T extends (props: infer P, ...args: any) => any ? P : {};
|