sun-biz 0.0.4-beta.35 → 0.0.4-beta.36
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 +15 -15
- package/dist/index.js +15 -15
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -361,7 +361,7 @@ function _isSlot(s) {
|
|
|
361
361
|
return 'function' == typeof s || '[object Object]' === Object.prototype.toString.call(s) && !(0, __WEBPACK_EXTERNAL_MODULE_vue__.isVNode)(s);
|
|
362
362
|
}
|
|
363
363
|
const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
364
|
-
name:
|
|
364
|
+
name: 'TableColumn',
|
|
365
365
|
props: {
|
|
366
366
|
column: {
|
|
367
367
|
required: true,
|
|
@@ -369,13 +369,13 @@ const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
371
|
setup (props, { slots }) {
|
|
372
|
-
const enumMap = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)(
|
|
373
|
-
const hiddenDefaultText = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)(
|
|
372
|
+
const enumMap = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('enumMap', (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(new Map())); // 注入数据(带默认值)
|
|
373
|
+
const hiddenDefaultText = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('hiddenDefaultText'); // 渲染表格数据
|
|
374
374
|
const renderCellData = (item, scope)=>{
|
|
375
375
|
const rawValue = handleRowAccordingToProp(scope.row, item.prop);
|
|
376
376
|
let result = enumMap.value.get(item.prop) && item.isFilterEnum ? filterEnum(rawValue, enumMap.value.get(item.prop), item.fieldNames) : formatValue(rawValue);
|
|
377
|
-
if (item?.autoFormatterNumber) result = formatDecimalNumber(result) ??
|
|
378
|
-
if (hiddenDefaultText &&
|
|
377
|
+
if (item?.autoFormatterNumber) result = formatDecimalNumber(result) ?? '--';
|
|
378
|
+
if (hiddenDefaultText && '--' === result) result = ' ';
|
|
379
379
|
return item?.supportCopyAndTips ? (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(copy_text_with_tooltip, {
|
|
380
380
|
supportTextCopy: item?.supportTextCopy,
|
|
381
381
|
align: "text-center",
|
|
@@ -387,12 +387,12 @@ const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
|
387
387
|
result
|
|
388
388
|
]);
|
|
389
389
|
}; // 获取 tag 类型
|
|
390
|
-
const getTagType = (item, scope)=>filterEnum(handleRowAccordingToProp(scope.row, item.prop), enumMap.value.get(item.prop), item.fieldNames,
|
|
390
|
+
const getTagType = (item, scope)=>filterEnum(handleRowAccordingToProp(scope.row, item.prop), enumMap.value.get(item.prop), item.fieldNames, 'tag') || 'primary';
|
|
391
391
|
const renderColumn = (column)=>{
|
|
392
392
|
const { label, ...restColumn } = column;
|
|
393
393
|
const columnProps = {
|
|
394
394
|
...restColumn,
|
|
395
|
-
align: column.align ??
|
|
395
|
+
align: column.align ?? 'center',
|
|
396
396
|
fixed: column.fixed ?? false,
|
|
397
397
|
showOverflowTooltip: column.showOverflowTooltip ?? column.prop !== OPERATION
|
|
398
398
|
};
|
|
@@ -412,34 +412,34 @@ const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
|
412
412
|
}, [
|
|
413
413
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("*")
|
|
414
414
|
]),
|
|
415
|
-
|
|
415
|
+
'function' == typeof column.label ? column.label() : column.label
|
|
416
416
|
], 2)
|
|
417
417
|
];
|
|
418
418
|
};
|
|
419
419
|
const renderDefault = (scope)=>{
|
|
420
420
|
if (Array.isArray(column._children) && column._children.length > 0) return column._children.map((child)=>renderColumn(child));
|
|
421
421
|
// Handle custom render function
|
|
422
|
-
if (
|
|
422
|
+
if ('function' == typeof column.render) {
|
|
423
423
|
if (column.editable && scope.row.editable) {
|
|
424
424
|
let _slot; // 计算 propPath
|
|
425
|
-
const getPropPath = ()=>{
|
|
425
|
+
const getPropPath = (index)=>{
|
|
426
426
|
const indexPath = scope.row.indexPath;
|
|
427
|
-
if (!indexPath) return
|
|
428
|
-
const parts = indexPath.split(
|
|
427
|
+
if (!indexPath) return `tableData.${index}.${column.prop}`;
|
|
428
|
+
const parts = indexPath.split('-');
|
|
429
429
|
if (parts.length > 1) return `tableData.${parts[0]}.${scope._self.props.treeProps.children}.${scope.$index}.${column.prop}`;
|
|
430
430
|
// normal table
|
|
431
431
|
return `tableData.${parts[1]}.${column.prop}`;
|
|
432
432
|
}; // 获取校验规则
|
|
433
433
|
const getRules = ()=>{
|
|
434
434
|
if (!column.rules) return [];
|
|
435
|
-
return
|
|
435
|
+
return 'function' == typeof column.rules ? column.rules(scope.row) : column.rules;
|
|
436
436
|
};
|
|
437
437
|
return [
|
|
438
438
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-form-item"), {
|
|
439
439
|
style: {
|
|
440
|
-
marginBottom:
|
|
440
|
+
marginBottom: '0'
|
|
441
441
|
},
|
|
442
|
-
prop: getPropPath(),
|
|
442
|
+
prop: getPropPath(scope.$index),
|
|
443
443
|
rules: getRules()
|
|
444
444
|
}, _isSlot(_slot = column.render(scope.row, scope.$index)) ? _slot : {
|
|
445
445
|
default: ()=>[
|
package/dist/index.js
CHANGED
|
@@ -361,7 +361,7 @@ function _isSlot(s) {
|
|
|
361
361
|
return 'function' == typeof s || '[object Object]' === Object.prototype.toString.call(s) && !(0, __WEBPACK_EXTERNAL_MODULE_vue__.isVNode)(s);
|
|
362
362
|
}
|
|
363
363
|
const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
364
|
-
name:
|
|
364
|
+
name: 'TableColumn',
|
|
365
365
|
props: {
|
|
366
366
|
column: {
|
|
367
367
|
required: true,
|
|
@@ -369,13 +369,13 @@ const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
371
|
setup (props, { slots }) {
|
|
372
|
-
const enumMap = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)(
|
|
373
|
-
const hiddenDefaultText = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)(
|
|
372
|
+
const enumMap = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('enumMap', (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(new Map())); // 注入数据(带默认值)
|
|
373
|
+
const hiddenDefaultText = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('hiddenDefaultText'); // 渲染表格数据
|
|
374
374
|
const renderCellData = (item, scope)=>{
|
|
375
375
|
const rawValue = handleRowAccordingToProp(scope.row, item.prop);
|
|
376
376
|
let result = enumMap.value.get(item.prop) && item.isFilterEnum ? filterEnum(rawValue, enumMap.value.get(item.prop), item.fieldNames) : formatValue(rawValue);
|
|
377
|
-
if (item?.autoFormatterNumber) result = formatDecimalNumber(result) ??
|
|
378
|
-
if (hiddenDefaultText &&
|
|
377
|
+
if (item?.autoFormatterNumber) result = formatDecimalNumber(result) ?? '--';
|
|
378
|
+
if (hiddenDefaultText && '--' === result) result = ' ';
|
|
379
379
|
return item?.supportCopyAndTips ? (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(copy_text_with_tooltip, {
|
|
380
380
|
supportTextCopy: item?.supportTextCopy,
|
|
381
381
|
align: "text-center",
|
|
@@ -387,12 +387,12 @@ const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
|
387
387
|
result
|
|
388
388
|
]);
|
|
389
389
|
}; // 获取 tag 类型
|
|
390
|
-
const getTagType = (item, scope)=>filterEnum(handleRowAccordingToProp(scope.row, item.prop), enumMap.value.get(item.prop), item.fieldNames,
|
|
390
|
+
const getTagType = (item, scope)=>filterEnum(handleRowAccordingToProp(scope.row, item.prop), enumMap.value.get(item.prop), item.fieldNames, 'tag') || 'primary';
|
|
391
391
|
const renderColumn = (column)=>{
|
|
392
392
|
const { label, ...restColumn } = column;
|
|
393
393
|
const columnProps = {
|
|
394
394
|
...restColumn,
|
|
395
|
-
align: column.align ??
|
|
395
|
+
align: column.align ?? 'center',
|
|
396
396
|
fixed: column.fixed ?? false,
|
|
397
397
|
showOverflowTooltip: column.showOverflowTooltip ?? column.prop !== OPERATION
|
|
398
398
|
};
|
|
@@ -412,34 +412,34 @@ const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
|
412
412
|
}, [
|
|
413
413
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("*")
|
|
414
414
|
]),
|
|
415
|
-
|
|
415
|
+
'function' == typeof column.label ? column.label() : column.label
|
|
416
416
|
], 2)
|
|
417
417
|
];
|
|
418
418
|
};
|
|
419
419
|
const renderDefault = (scope)=>{
|
|
420
420
|
if (Array.isArray(column._children) && column._children.length > 0) return column._children.map((child)=>renderColumn(child));
|
|
421
421
|
// Handle custom render function
|
|
422
|
-
if (
|
|
422
|
+
if ('function' == typeof column.render) {
|
|
423
423
|
if (column.editable && scope.row.editable) {
|
|
424
424
|
let _slot; // 计算 propPath
|
|
425
|
-
const getPropPath = ()=>{
|
|
425
|
+
const getPropPath = (index)=>{
|
|
426
426
|
const indexPath = scope.row.indexPath;
|
|
427
|
-
if (!indexPath) return
|
|
428
|
-
const parts = indexPath.split(
|
|
427
|
+
if (!indexPath) return `tableData.${index}.${column.prop}`;
|
|
428
|
+
const parts = indexPath.split('-');
|
|
429
429
|
if (parts.length > 1) return `tableData.${parts[0]}.${scope._self.props.treeProps.children}.${scope.$index}.${column.prop}`;
|
|
430
430
|
// normal table
|
|
431
431
|
return `tableData.${parts[1]}.${column.prop}`;
|
|
432
432
|
}; // 获取校验规则
|
|
433
433
|
const getRules = ()=>{
|
|
434
434
|
if (!column.rules) return [];
|
|
435
|
-
return
|
|
435
|
+
return 'function' == typeof column.rules ? column.rules(scope.row) : column.rules;
|
|
436
436
|
};
|
|
437
437
|
return [
|
|
438
438
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-form-item"), {
|
|
439
439
|
style: {
|
|
440
|
-
marginBottom:
|
|
440
|
+
marginBottom: '0'
|
|
441
441
|
},
|
|
442
|
-
prop: getPropPath(),
|
|
442
|
+
prop: getPropPath(scope.$index),
|
|
443
443
|
rules: getRules()
|
|
444
444
|
}, _isSlot(_slot = column.render(scope.row, scope.$index)) ? _slot : {
|
|
445
445
|
default: ()=>[
|