pro-design-vue 1.3.23 → 1.3.26
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/index.css +1 -1
- package/dist/index.full.js +144 -56
- package/dist/index.full.min.js +7 -7
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +7 -7
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +144 -57
- package/es/components/table/src/components/Body/Body.vue.d.ts +1 -1
- package/es/components/table/src/components/Body/BodyRow.vue.d.ts +1 -1
- package/es/components/table/src/components/Body/BodyRows.vue.d.ts +1 -1
- package/es/components/table/src/components/InteralTable.vue.d.ts +1 -1
- package/es/components/table/src/components/interface.d.ts +8 -0
- package/es/components/table/src/hooks/useEdit.d.ts +1 -1
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/use-fetch-data/index.d.ts +3 -0
- package/es/index.d.ts +11 -0
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyCell.vue.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyCell.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyEditCell.mjs +122 -55
- package/es/packages/components/table/src/components/Body/BodyEditCell.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyRow.vue.mjs +1 -1
- package/es/packages/components/table/src/components/Body/BodyRow.vue.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyRow.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/components/interface.mjs.map +1 -1
- package/es/packages/components/table/src/hooks/useEdit.mjs.map +1 -1
- package/es/packages/hooks/index.mjs +1 -0
- package/es/packages/hooks/index.mjs.map +1 -1
- package/es/packages/hooks/use-fetch-data/index.mjs +25 -0
- package/es/packages/hooks/use-fetch-data/index.mjs.map +1 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/table/src/components/Body/Body.vue.d.ts +1 -1
- package/lib/components/table/src/components/Body/BodyRow.vue.d.ts +1 -1
- package/lib/components/table/src/components/Body/BodyRows.vue.d.ts +1 -1
- package/lib/components/table/src/components/InteralTable.vue.d.ts +1 -1
- package/lib/components/table/src/components/interface.d.ts +8 -0
- package/lib/components/table/src/hooks/useEdit.d.ts +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/use-fetch-data/index.d.ts +3 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyCell.vue.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyCell.vue2.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyEditCell.js +120 -53
- package/lib/packages/components/table/src/components/Body/BodyEditCell.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyRow.vue.js +1 -1
- package/lib/packages/components/table/src/components/Body/BodyRow.vue.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyRow.vue2.js.map +1 -1
- package/lib/packages/components/table/src/components/interface.js.map +1 -1
- package/lib/packages/components/table/src/hooks/useEdit.js.map +1 -1
- package/lib/packages/hooks/index.js +2 -0
- package/lib/packages/hooks/index.js.map +1 -1
- package/lib/packages/hooks/use-fetch-data/index.js +27 -0
- package/lib/packages/hooks/use-fetch-data/index.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/table/table.less +2 -0
package/dist/index.full.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Pro Design Vue v1.3.
|
|
1
|
+
/*! Pro Design Vue v1.3.26 */
|
|
2
2
|
|
|
3
3
|
import { Modal, theme as theme$1, ConfigProvider, App, Button as Button$1, Tooltip, Popconfirm, Dropdown, Menu, Slider, Drawer, Input, InputNumber, Form as Form$1, Space, Textarea, Select, TreeSelect, Checkbox as Checkbox$1, CheckboxGroup, RadioGroup, Radio as Radio$1, Cascader, Switch, Rate, DatePicker, RangePicker, TimePicker, TimeRangePicker, Upload, FormItemRest, Spin, message, Row as Row$1, Col, FormItem as FormItem$1, Steps, Popover, MenuItem, SubMenu, Empty, Badge, Tag, Pagination, InputSearch, Tree, Card, Tabs, TabPane } from 'ant-design-vue';
|
|
4
4
|
import { inject, ref, getCurrentInstance, nextTick, h, reactive, defineComponent, createVNode, isVNode, Fragment, cloneVNode, provide, watch, computed, renderSlot, createPropsRestProxy, createBlock, openBlock, unref, mergeProps, withCtx, normalizeProps, guardReactiveProps, shallowRef, shallowReadonly, toValue, getCurrentScope, onScopeDispose, onMounted, hasInjectionContext, isRef, toRefs as toRefs$1, customRef, toRef as toRef$1, readonly, watchEffect, toRaw, createElementBlock, createCommentVNode, resolveDynamicComponent, createElementVNode, normalizeStyle, toDisplayString, normalizeClass, createSlots, createTextVNode, useAttrs, useTemplateRef, Teleport, onUnmounted, Comment as Comment$1, useSlots, useModel, withModifiers, mergeModels, renderList, camelize, isReactive, onActivated, onDeactivated, triggerRef, onBeforeUnmount, resolveDirective, withDirectives, vShow, render as render$1, resolveComponent } from 'vue';
|
|
@@ -30,7 +30,7 @@ const SCROLL_FIXED_CLASS = `_scroll__fixed_`;
|
|
|
30
30
|
const DEFAULT_NAMESPACE = "pro";
|
|
31
31
|
const DEFAULT_LOCALE = "zh-CN";
|
|
32
32
|
|
|
33
|
-
const version$1 = "1.3.
|
|
33
|
+
const version$1 = "1.3.26";
|
|
34
34
|
|
|
35
35
|
const makeInstaller = (components = []) => {
|
|
36
36
|
const install = (app) => {
|
|
@@ -10119,6 +10119,27 @@ function useState(defaultStateValue) {
|
|
|
10119
10119
|
return [innerValue, triggerChange];
|
|
10120
10120
|
}
|
|
10121
10121
|
|
|
10122
|
+
function useFetchData$2(props) {
|
|
10123
|
+
const abortRef = ref(null);
|
|
10124
|
+
const fetchData = async (params, index) => {
|
|
10125
|
+
var _a, _b;
|
|
10126
|
+
(_a = abortRef.value) == null ? void 0 : _a.abort();
|
|
10127
|
+
const abort = new AbortController();
|
|
10128
|
+
abortRef.value = abort;
|
|
10129
|
+
const loadData = await Promise.race([
|
|
10130
|
+
(_b = props.request) == null ? void 0 : _b.call(props, params, index),
|
|
10131
|
+
new Promise((_, reject) => {
|
|
10132
|
+
var _a2, _b2;
|
|
10133
|
+
(_b2 = (_a2 = abortRef.value) == null ? void 0 : _a2.signal) == null ? void 0 : _b2.addEventListener("abort", () => {
|
|
10134
|
+
reject(new Error("aborted"));
|
|
10135
|
+
});
|
|
10136
|
+
})
|
|
10137
|
+
]);
|
|
10138
|
+
return loadData;
|
|
10139
|
+
};
|
|
10140
|
+
return fetchData;
|
|
10141
|
+
}
|
|
10142
|
+
|
|
10122
10143
|
const _hoisted_1$g = ["src"];
|
|
10123
10144
|
var _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
10124
10145
|
__name: "icon",
|
|
@@ -32664,24 +32685,27 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32664
32685
|
},
|
|
32665
32686
|
emits: ["closeEditor", "keydown"],
|
|
32666
32687
|
setup(props) {
|
|
32688
|
+
var _a;
|
|
32689
|
+
const loading = ref(false);
|
|
32667
32690
|
const tableContext = useInjectTable();
|
|
32668
32691
|
const level = useInjectLevel();
|
|
32692
|
+
const fetchOptions = ref();
|
|
32669
32693
|
const columnKey = computed(() => props.column.columnKey);
|
|
32670
32694
|
const recordIndexs = computed(() => tableContext.getIndexsByKey(props.rowKey));
|
|
32671
|
-
const childrenColumnName = computed(() => tableContext.props.childrenColumnName || "children");
|
|
32672
32695
|
const valueEnum = computed(() => {
|
|
32673
|
-
var
|
|
32674
|
-
return parsingValueEnumToArray(runFunction((
|
|
32696
|
+
var _a2;
|
|
32697
|
+
return parsingValueEnumToArray(runFunction((_a2 = props.column) == null ? void 0 : _a2.valueEnum, props.item));
|
|
32675
32698
|
});
|
|
32699
|
+
const originValue = get(props.item, props.column.dataIndex);
|
|
32676
32700
|
const errorList = ref();
|
|
32677
32701
|
const {
|
|
32678
32702
|
editRowsMap,
|
|
32679
32703
|
setEditingCell
|
|
32680
32704
|
} = useEditInject();
|
|
32681
|
-
const cellValue = computed(() => props.column.dataIndex ? get(
|
|
32705
|
+
const cellValue = computed(() => props.column.dataIndex ? get(props.editRow, props.column.dataIndex) : void 0);
|
|
32682
32706
|
const cellRender = computed(() => {
|
|
32683
|
-
var
|
|
32684
|
-
return ((_b = (
|
|
32707
|
+
var _a2, _b;
|
|
32708
|
+
return ((_b = (_a2 = tableContext.allCellProps.value) == null ? void 0 : _a2[props.rowKey]) == null ? void 0 : _b[props.column.columnKey]) || {};
|
|
32685
32709
|
});
|
|
32686
32710
|
const cellProps = computed(() => cellRender.value.props || {});
|
|
32687
32711
|
const cellRowSpan = computed(() => cellProps.value.rowSpan);
|
|
@@ -32689,8 +32713,8 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32689
32713
|
key
|
|
32690
32714
|
}) => key === columnKey.value));
|
|
32691
32715
|
const sorterOrder = computed(() => {
|
|
32692
|
-
var
|
|
32693
|
-
return sorterState.value ? (
|
|
32716
|
+
var _a2;
|
|
32717
|
+
return sorterState.value ? (_a2 = sorterState.value) == null ? void 0 : _a2.sortOrder : null;
|
|
32694
32718
|
});
|
|
32695
32719
|
const cellClass = computed(() => ({
|
|
32696
32720
|
[`${props.prefixCls}-cell`]: true,
|
|
@@ -32700,26 +32724,41 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32700
32724
|
[`${props.prefixCls}-cell-hidden`]: cellRowSpan.value === 0,
|
|
32701
32725
|
[`${props.prefixCls}-column-sort`]: sorterOrder.value
|
|
32702
32726
|
}));
|
|
32727
|
+
const hasFetchOptions = computed(() => {
|
|
32728
|
+
var _a2, _b, _c;
|
|
32729
|
+
return ((_a2 = props.column.edit) == null ? void 0 : _a2.request) && ((_c = (_b = props.column.edit) == null ? void 0 : _b.dependencies) == null ? void 0 : _c.length);
|
|
32730
|
+
});
|
|
32703
32731
|
const rules = computed(() => {
|
|
32704
|
-
var
|
|
32705
|
-
return (_b = runFunction((
|
|
32732
|
+
var _a2, _b;
|
|
32733
|
+
return (_b = runFunction((_a2 = props.column.edit) == null ? void 0 : _a2.rules, {
|
|
32706
32734
|
column: props.column,
|
|
32707
|
-
record: props.
|
|
32735
|
+
record: props.editRow,
|
|
32708
32736
|
recordIndexs: recordIndexs.value,
|
|
32709
32737
|
newValue: cellValue.value
|
|
32710
32738
|
})) != null ? _b : [];
|
|
32711
32739
|
});
|
|
32712
32740
|
const validateEnabled = computed(() => rules.value.length > 0);
|
|
32713
32741
|
const editValue = ref();
|
|
32742
|
+
const updateEditedCellValue = (key, value) => {
|
|
32743
|
+
setTimeout(() => {
|
|
32744
|
+
const editRow = {
|
|
32745
|
+
...props.editRow
|
|
32746
|
+
};
|
|
32747
|
+
set(editRow, key, value);
|
|
32748
|
+
editRowsMap.value[props.rowKey] = editRow;
|
|
32749
|
+
triggerRef(editRowsMap);
|
|
32750
|
+
}, 10);
|
|
32751
|
+
};
|
|
32714
32752
|
const cellParams = computed(() => ({
|
|
32715
32753
|
column: props.column,
|
|
32716
|
-
record:
|
|
32754
|
+
record: props.editRow,
|
|
32717
32755
|
recordIndexs: recordIndexs.value,
|
|
32718
|
-
value: editValue.value
|
|
32756
|
+
value: editValue.value,
|
|
32757
|
+
updateEditedCellValue
|
|
32719
32758
|
}));
|
|
32720
32759
|
const editOnListeners = computed(() => {
|
|
32721
|
-
var
|
|
32722
|
-
return ((_b = (
|
|
32760
|
+
var _a2, _b;
|
|
32761
|
+
return ((_b = (_a2 = props.column.edit) == null ? void 0 : _a2.on) == null ? void 0 : _b.call(_a2, {
|
|
32723
32762
|
...cellParams.value
|
|
32724
32763
|
})) || {};
|
|
32725
32764
|
});
|
|
@@ -32732,8 +32771,8 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32732
32771
|
};
|
|
32733
32772
|
});
|
|
32734
32773
|
const options = computed(() => {
|
|
32735
|
-
var
|
|
32736
|
-
return (_b = (
|
|
32774
|
+
var _a2, _b, _c;
|
|
32775
|
+
return (_c = (_b = fetchOptions.value) != null ? _b : (_a2 = editProps.value) == null ? void 0 : _a2.options) != null ? _c : valueEnum.value;
|
|
32737
32776
|
});
|
|
32738
32777
|
const componentProps = computed(() => {
|
|
32739
32778
|
const {
|
|
@@ -32754,6 +32793,10 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32754
32793
|
resolve(true);
|
|
32755
32794
|
return true;
|
|
32756
32795
|
}
|
|
32796
|
+
if (isEqual(originValue, editValue.value) && !(originValue === void 0 || originValue === null || originValue === "")) {
|
|
32797
|
+
resolve(true);
|
|
32798
|
+
return true;
|
|
32799
|
+
}
|
|
32757
32800
|
validate(editValue.value, rules.value).then((result) => {
|
|
32758
32801
|
const list = result == null ? void 0 : result.filter((t) => !t.result);
|
|
32759
32802
|
if (!list || !list.length) {
|
|
@@ -32766,48 +32809,92 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32766
32809
|
});
|
|
32767
32810
|
});
|
|
32768
32811
|
};
|
|
32769
|
-
const
|
|
32770
|
-
|
|
32812
|
+
const updateEditRow = () => {
|
|
32813
|
+
const editRow = {
|
|
32814
|
+
...props.editRow
|
|
32815
|
+
};
|
|
32816
|
+
set(editRow, props.column.dataIndex, editValue.value);
|
|
32817
|
+
editRowsMap.value[props.rowKey] = {
|
|
32818
|
+
...editRow
|
|
32819
|
+
};
|
|
32820
|
+
triggerRef(editRowsMap);
|
|
32821
|
+
};
|
|
32822
|
+
const fetchData = useFetchData$2({
|
|
32823
|
+
request: (_a = props.column.edit) == null ? void 0 : _a.request
|
|
32824
|
+
});
|
|
32825
|
+
const requestOptions = debounce(async (newRow) => {
|
|
32826
|
+
var _a2, _b;
|
|
32827
|
+
const row = {
|
|
32828
|
+
...props.item,
|
|
32829
|
+
...newRow
|
|
32830
|
+
};
|
|
32771
32831
|
const params = {
|
|
32772
|
-
|
|
32773
|
-
record: props.isRowEdit ? props.editRow : props.item,
|
|
32774
|
-
recordIndexs: recordIndexs.value,
|
|
32775
|
-
newValue: cellValue.value
|
|
32832
|
+
rowKey: props.rowKey
|
|
32776
32833
|
};
|
|
32777
|
-
|
|
32778
|
-
|
|
32834
|
+
(_b = (_a2 = props.column.edit) == null ? void 0 : _a2.dependencies) == null ? void 0 : _b.forEach((dataIndex) => {
|
|
32835
|
+
const newValue = get(row, dataIndex);
|
|
32836
|
+
set(params, dataIndex, newValue);
|
|
32837
|
+
});
|
|
32838
|
+
loading.value = true;
|
|
32839
|
+
const result = await fetchData(params);
|
|
32840
|
+
fetchOptions.value = result;
|
|
32841
|
+
loading.value = false;
|
|
32842
|
+
}, 200);
|
|
32843
|
+
const onEditChange = (val, ...args) => {
|
|
32844
|
+
var _a2, _b, _c, _d, _e;
|
|
32845
|
+
const valueSetter = (_a2 = props.column.edit) == null ? void 0 : _a2.valueSetter;
|
|
32779
32846
|
if (valueSetter) {
|
|
32780
|
-
valueSetter(
|
|
32847
|
+
valueSetter(cellParams.value);
|
|
32781
32848
|
} else {
|
|
32782
|
-
(
|
|
32783
|
-
(
|
|
32784
|
-
|
|
32785
|
-
const record = {
|
|
32786
|
-
...props.editRow
|
|
32787
|
-
};
|
|
32788
|
-
set(record, props.column.dataIndex, value);
|
|
32789
|
-
editRowsMap.value[props.rowKey] = record;
|
|
32790
|
-
triggerRef(editRowsMap);
|
|
32791
|
-
} else {
|
|
32792
|
-
let record = {};
|
|
32793
|
-
let dataSource = tableContext.rawData.value || [];
|
|
32794
|
-
recordIndexs.value.forEach((index) => {
|
|
32795
|
-
record = dataSource[index];
|
|
32796
|
-
dataSource = record[childrenColumnName.value] || [];
|
|
32797
|
-
});
|
|
32798
|
-
set(record, props.column.dataIndex, value);
|
|
32799
|
-
triggerRef(tableContext.rawData);
|
|
32800
|
-
}
|
|
32849
|
+
(_c = (_b = editProps.value) == null ? void 0 : _b.onChange) == null ? void 0 : _c.call(_b, val, ...args, cellParams.value);
|
|
32850
|
+
(_e = (_d = editOnListeners.value) == null ? void 0 : _d.onChange) == null ? void 0 : _e.call(_d, cellParams.value);
|
|
32851
|
+
updateEditRow();
|
|
32801
32852
|
}
|
|
32802
32853
|
validateEdit();
|
|
32803
32854
|
};
|
|
32855
|
+
const updateRecordValue = debounce(async (newValue) => {
|
|
32856
|
+
let record = {};
|
|
32857
|
+
let dataSource = tableContext.rawData.value || [];
|
|
32858
|
+
recordIndexs.value.forEach((index) => {
|
|
32859
|
+
record = dataSource[index];
|
|
32860
|
+
dataSource = record[tableContext.childrenColumnName.value] || [];
|
|
32861
|
+
});
|
|
32862
|
+
set(record, props.column.dataIndex, newValue);
|
|
32863
|
+
triggerRef(tableContext.rawData);
|
|
32864
|
+
}, 200);
|
|
32804
32865
|
watch(cellValue, (value) => {
|
|
32805
|
-
var
|
|
32806
|
-
editValue.value = (_c = (_b = (
|
|
32866
|
+
var _a2, _b, _c;
|
|
32867
|
+
editValue.value = (_c = (_b = (_a2 = props.column.edit) == null ? void 0 : _a2.valueGetter) == null ? void 0 : _b.call(_a2, cellParams.value)) != null ? _c : value;
|
|
32868
|
+
if (!props.isRowEdit) {
|
|
32869
|
+
updateRecordValue(value);
|
|
32870
|
+
}
|
|
32807
32871
|
}, {
|
|
32808
32872
|
immediate: true
|
|
32809
32873
|
});
|
|
32874
|
+
watch(() => props.editRow, (newRow, oldRow) => {
|
|
32875
|
+
var _a2, _b;
|
|
32876
|
+
if (hasFetchOptions.value) {
|
|
32877
|
+
const isSame = (_b = (_a2 = props.column.edit) == null ? void 0 : _a2.dependencies) == null ? void 0 : _b.every((dataIndex) => {
|
|
32878
|
+
const newValue = get(newRow, dataIndex);
|
|
32879
|
+
const oldIndex = get(oldRow, dataIndex);
|
|
32880
|
+
return isEqual(newValue, oldIndex);
|
|
32881
|
+
});
|
|
32882
|
+
if (!isSame) {
|
|
32883
|
+
requestOptions(newRow);
|
|
32884
|
+
}
|
|
32885
|
+
}
|
|
32886
|
+
});
|
|
32810
32887
|
onMounted(() => {
|
|
32888
|
+
var _a2;
|
|
32889
|
+
if (!props.isRowEdit && !editRowsMap.value[props.rowKey]) {
|
|
32890
|
+
editRowsMap.value[props.rowKey] = {
|
|
32891
|
+
...props.item
|
|
32892
|
+
};
|
|
32893
|
+
triggerRef(editRowsMap);
|
|
32894
|
+
}
|
|
32895
|
+
if ((_a2 = props.column.edit) == null ? void 0 : _a2.request) {
|
|
32896
|
+
requestOptions();
|
|
32897
|
+
}
|
|
32811
32898
|
setEditingCell({
|
|
32812
32899
|
recordIndexs: recordIndexs.value,
|
|
32813
32900
|
column: props.column,
|
|
@@ -32819,7 +32906,7 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32819
32906
|
}, true);
|
|
32820
32907
|
});
|
|
32821
32908
|
onUnmounted(() => {
|
|
32822
|
-
var
|
|
32909
|
+
var _a2, _b, _c;
|
|
32823
32910
|
setEditingCell({
|
|
32824
32911
|
recordIndexs: recordIndexs.value,
|
|
32825
32912
|
column: props.column,
|
|
@@ -32829,11 +32916,11 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32829
32916
|
columnKey: props.column.columnKey,
|
|
32830
32917
|
validateEdit
|
|
32831
32918
|
}, false);
|
|
32832
|
-
(_c = (_b = (
|
|
32919
|
+
(_c = (_b = (_a2 = props.column) == null ? void 0 : _a2.edit) == null ? void 0 : _b.onEdited) == null ? void 0 : _c.call(_b, cellParams.value);
|
|
32833
32920
|
});
|
|
32834
32921
|
return () => {
|
|
32835
|
-
var
|
|
32836
|
-
const Component = (
|
|
32922
|
+
var _a2, _b, _c, _d;
|
|
32923
|
+
const Component = (_a2 = props.column.edit) == null ? void 0 : _a2.component;
|
|
32837
32924
|
const errorMessage = (_c = (_b = errorList.value) == null ? void 0 : _b[0]) == null ? void 0 : _c.message;
|
|
32838
32925
|
const inlineError = (_d = props.column.edit) == null ? void 0 : _d.inlineError;
|
|
32839
32926
|
const tmpEditOnListeners = {
|
|
@@ -32871,10 +32958,10 @@ var BodyEditCell = /* @__PURE__ */ defineComponent({
|
|
|
32871
32958
|
"class": `${props.prefixCls}-cell-content-error`
|
|
32872
32959
|
}, [createVNode(CloseCircleFilled, null, null)])],
|
|
32873
32960
|
content: () => {
|
|
32874
|
-
var
|
|
32961
|
+
var _a3;
|
|
32875
32962
|
return createVNode("div", {
|
|
32876
32963
|
"class": `${props.prefixCls}-cell-content-error-message`
|
|
32877
|
-
}, [(
|
|
32964
|
+
}, [(_a3 = errorList.value) == null ? void 0 : _a3.map((error) => createVNode("div", {
|
|
32878
32965
|
"key": error.message
|
|
32879
32966
|
}, [error.message]))]);
|
|
32880
32967
|
}
|
|
@@ -33831,7 +33918,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
33831
33918
|
record: _ctx.record,
|
|
33832
33919
|
onMouseenter: ($event) => _ctx.handleCellHover(_ctx.rowKey, column.columnKey, _ctx.tableContext.draggingRowKey.value),
|
|
33833
33920
|
onMouseleave: _ctx.handleCellBlur
|
|
33834
|
-
}, null, 8, ["prefix-cls", "row-key", "row-index", "type", "column", "expanded", "expandIconType", "support-expand", "record", "onMouseenter", "onMouseleave"])) : column && ((_b = column.edit) == null ? void 0 : _b.component)
|
|
33921
|
+
}, null, 8, ["prefix-cls", "row-key", "row-index", "type", "column", "expanded", "expandIconType", "support-expand", "record", "onMouseenter", "onMouseleave"])) : column && ((_b = column.edit) == null ? void 0 : _b.component) ? (openBlock(), createBlock(_component_BodyCell, {
|
|
33835
33922
|
key: 1,
|
|
33836
33923
|
"prefix-cls": _ctx.prefixCls,
|
|
33837
33924
|
item: _ctx.record,
|
|
@@ -38940,4 +39027,4 @@ var zhCn$1 = /*#__PURE__*/_mergeNamespaces({
|
|
|
38940
39027
|
default: zhCn
|
|
38941
39028
|
}, [zhCnExports]);
|
|
38942
39029
|
|
|
38943
|
-
export { CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT, CSS_VARIABLE_LAYOUT_CONTENT_WIDTH, CSS_VARIABLE_LAYOUT_FOOTER_HEIGHT, CSS_VARIABLE_LAYOUT_HEADER_HEIGHT, DEFAULT_LOCALE, DEFAULT_NAMESPACE, ELEMENT_ID_MAIN_CONTENT, INSTALLED_KEY, LayoutContextKey, ProButton, ProClipboard, ProConfigProvider, ProCounter, ProCropper, ProDrawer, ProDrawerForm, FieldReadonly as ProFieldReadonly, ProFieldType, ProForm, ProIcon, ProLayout, ProLoading, ProModal, ProModalForm, ProPage, ProQueryFilter, ProSlot, ProSpinner, ProStepsForm, ProTable, _sfc_main$6 as ProTableColumn, _sfc_main$5 as ProTableColumnGroup, ProTableSummary, ProTableSummaryCell, ProTableSummaryRow, SCROLL_FIXED_CLASS, SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE, arEGIntl, caESIntl, cellResize, createIntl, csCZIntl, dayjs, deDEIntl, installer as default, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, heILIntl, hrHRIntl, idIDIntl, install, intlMap, intlMapKeys, itITIntl, jaJPIntl, koKRIntl, makeInstaller, mnMNIntl, msMYIntl, nlNLIntl, plPLIntl, proConfigProviderContextKey, ptBRIntl, registerField, resize, roROIntl, ruRUIntl, setConfig, setLicenseKey, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useIntl, useIsMobile, useMergedState$1 as useMergedState, usePrefixCls, useProConfigInject, useProConfigProvide, useProLayoutInject, useProLayoutProvide, useState, uzUZIntl, version, viVNIntl, zhCNIntl, zhTWIntl };
|
|
39030
|
+
export { CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT, CSS_VARIABLE_LAYOUT_CONTENT_WIDTH, CSS_VARIABLE_LAYOUT_FOOTER_HEIGHT, CSS_VARIABLE_LAYOUT_HEADER_HEIGHT, DEFAULT_LOCALE, DEFAULT_NAMESPACE, ELEMENT_ID_MAIN_CONTENT, INSTALLED_KEY, LayoutContextKey, ProButton, ProClipboard, ProConfigProvider, ProCounter, ProCropper, ProDrawer, ProDrawerForm, FieldReadonly as ProFieldReadonly, ProFieldType, ProForm, ProIcon, ProLayout, ProLoading, ProModal, ProModalForm, ProPage, ProQueryFilter, ProSlot, ProSpinner, ProStepsForm, ProTable, _sfc_main$6 as ProTableColumn, _sfc_main$5 as ProTableColumnGroup, ProTableSummary, ProTableSummaryCell, ProTableSummaryRow, SCROLL_FIXED_CLASS, SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE, arEGIntl, caESIntl, cellResize, createIntl, csCZIntl, dayjs, deDEIntl, installer as default, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, heILIntl, hrHRIntl, idIDIntl, install, intlMap, intlMapKeys, itITIntl, jaJPIntl, koKRIntl, makeInstaller, mnMNIntl, msMYIntl, nlNLIntl, plPLIntl, proConfigProviderContextKey, ptBRIntl, registerField, resize, roROIntl, ruRUIntl, setConfig, setLicenseKey, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useFetchData$2 as useFetchData, useIntl, useIsMobile, useMergedState$1 as useMergedState, usePrefixCls, useProConfigInject, useProConfigProvide, useProLayoutInject, useProLayoutProvide, useState, uzUZIntl, version, viVNIntl, zhCNIntl, zhTWIntl };
|
|
@@ -231,7 +231,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
231
231
|
isRowEdit: import("vue").ComputedRef<boolean>;
|
|
232
232
|
editRow: import("vue").ComputedRef<Record<string, any> | undefined>;
|
|
233
233
|
mergedEditableKeys: import("vue").Ref<import("pro-design-vue").ProTableKey[] | undefined, import("pro-design-vue").ProTableKey[] | undefined>;
|
|
234
|
-
openEditor: (key: string | string[]) => void;
|
|
234
|
+
openEditor: (key: string | string[], values?: Record<string, any>) => void;
|
|
235
235
|
closeEditor: (key: string) => void;
|
|
236
236
|
hoverRowKey: import("vue").Ref<import("pro-design-vue").ProTableKey, import("pro-design-vue").ProTableKey>;
|
|
237
237
|
hoverColumnKey: import("vue").Ref<import("pro-design-vue").ProTableKey, import("pro-design-vue").ProTableKey>;
|
|
@@ -63,7 +63,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
63
63
|
isRowEdit: import("vue").ComputedRef<boolean>;
|
|
64
64
|
editRow: import("vue").ComputedRef<Record<string, any> | undefined>;
|
|
65
65
|
mergedEditableKeys: import("vue").Ref<Key[] | undefined, Key[] | undefined>;
|
|
66
|
-
openEditor: (key: string | string[]) => void;
|
|
66
|
+
openEditor: (key: string | string[], values?: Record<string, any>) => void;
|
|
67
67
|
closeEditor: (key: string) => void;
|
|
68
68
|
hoverRowKey: import("vue").Ref<Key, Key>;
|
|
69
69
|
hoverColumnKey: import("vue").Ref<Key, Key>;
|
|
@@ -95,7 +95,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
95
95
|
isRowEdit: import("vue").ComputedRef<boolean>;
|
|
96
96
|
editRow: import("vue").ComputedRef<Record<string, any> | undefined>;
|
|
97
97
|
mergedEditableKeys: import("vue").Ref<import("pro-design-vue").ProTableKey[] | undefined, import("pro-design-vue").ProTableKey[] | undefined>;
|
|
98
|
-
openEditor: (key: string | string[]) => void;
|
|
98
|
+
openEditor: (key: string | string[], values?: Record<string, any>) => void;
|
|
99
99
|
closeEditor: (key: string) => void;
|
|
100
100
|
hoverRowKey: import("vue").Ref<import("pro-design-vue").ProTableKey, import("pro-design-vue").ProTableKey>;
|
|
101
101
|
hoverColumnKey: import("vue").Ref<import("pro-design-vue").ProTableKey, import("pro-design-vue").ProTableKey>;
|
|
@@ -16567,7 +16567,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
16567
16567
|
isRowEdit: import("vue").ComputedRef<boolean>;
|
|
16568
16568
|
editRow: import("vue").ComputedRef<Record<string, any> | undefined>;
|
|
16569
16569
|
mergedEditableKeys: import("vue").Ref<Key[] | undefined, Key[] | undefined>;
|
|
16570
|
-
openEditor: (key: string | string[]) => void;
|
|
16570
|
+
openEditor: (key: string | string[], values?: Record<string, any>) => void;
|
|
16571
16571
|
closeEditor: (key: string) => void;
|
|
16572
16572
|
hoverRowKey: import("vue").Ref<Key, Key>;
|
|
16573
16573
|
hoverColumnKey: import("vue").Ref<Key, Key>;
|
|
@@ -182,6 +182,7 @@ export interface EditableValueParams<RecordType = DefaultRecordType, TValue = an
|
|
|
182
182
|
record: RecordType;
|
|
183
183
|
recordIndexs: number[];
|
|
184
184
|
column: ColumnType<RecordType>;
|
|
185
|
+
updateEditedCellValue?: (key: DataIndex, value: any) => void;
|
|
185
186
|
}
|
|
186
187
|
export interface ValueParserFunc<T = any, TValue = any> {
|
|
187
188
|
(params: EditableValueParams<T, TValue>): TValue | null | undefined;
|
|
@@ -1790,6 +1791,13 @@ export interface EditableCellConfig<T = DefaultRecordType> {
|
|
|
1790
1791
|
* 校验规则
|
|
1791
1792
|
*/
|
|
1792
1793
|
rules?: EditableCellRules<T>;
|
|
1794
|
+
/**
|
|
1795
|
+
* 是否显示编辑图标
|
|
1796
|
+
* @default true
|
|
1797
|
+
*/
|
|
1798
|
+
request?: (params: Record<string, any>) => Promise<Record<string, any>[]>;
|
|
1799
|
+
/** @name 依赖字段的name,暂时只在拥有 request 的项目中生效,会自动注入到 params 中 */
|
|
1800
|
+
dependencies?: DataIndex[];
|
|
1793
1801
|
}
|
|
1794
1802
|
export interface ColumnType<RecordType = DefaultRecordType> extends ColumnSharedType, Omit<ProFormItemType, 'key' | 'originKey' | 'tooltip' | 'hidden' | 'grid' | 'title' | 'spaceProps' | 'children' | 'width' | 'ignoreWidth' | 'name' | 'originName' | 'rowProps' | 'colProps' | 'valueEnum'> {
|
|
1795
1803
|
search?: ProFormItemType;
|
|
@@ -2,7 +2,7 @@ import type { Ref, ShallowRef, ComputedRef } from 'vue';
|
|
|
2
2
|
import type { AddLineOptions, DefaultRecordType, GetRowKey, Key, ProTableProps, RowEditableType, TableEditingCell, TablePromiseErrorData } from '../components/interface';
|
|
3
3
|
type EditProps = {
|
|
4
4
|
editCellKeys: Ref<string[]>;
|
|
5
|
-
openEditor: (key: string | string[]) => void;
|
|
5
|
+
openEditor: (key: string | string[], values?: Record<string, any>) => void;
|
|
6
6
|
closeEditor: (key: string) => void;
|
|
7
7
|
editableType: ComputedRef<RowEditableType | undefined>;
|
|
8
8
|
mergedEditableKeys: Ref<Key[] | undefined>;
|
package/es/hooks/index.d.ts
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -5243,6 +5243,13 @@ declare interface EditableCellConfig<T = DefaultRecordType> {
|
|
|
5243
5243
|
* 校验规则
|
|
5244
5244
|
*/
|
|
5245
5245
|
rules?: EditableCellRules<T>;
|
|
5246
|
+
/**
|
|
5247
|
+
* 是否显示编辑图标
|
|
5248
|
+
* @default true
|
|
5249
|
+
*/
|
|
5250
|
+
request?: (params: Record<string, any>) => Promise<Record<string, any>[]>;
|
|
5251
|
+
/** @name 依赖字段的name,暂时只在拥有 request 的项目中生效,会自动注入到 params 中 */
|
|
5252
|
+
dependencies?: DataIndex[];
|
|
5246
5253
|
}
|
|
5247
5254
|
declare type EditableCellProps<T> = PlainObject | ((params: EditableValueParams<T>) => PlainObject);
|
|
5248
5255
|
declare type EditableCellRules<T> = EditRule[] | ((params: EditableValueParams<T>) => EditRule[]);
|
|
@@ -5253,6 +5260,7 @@ declare interface EditableValueParams<RecordType = DefaultRecordType, TValue = a
|
|
|
5253
5260
|
record: RecordType;
|
|
5254
5261
|
recordIndexs: number[];
|
|
5255
5262
|
column: ColumnType<RecordType>;
|
|
5263
|
+
updateEditedCellValue?: (key: DataIndex, value: any) => void;
|
|
5256
5264
|
}
|
|
5257
5265
|
declare interface EditRule {
|
|
5258
5266
|
/**
|
|
@@ -11123,6 +11131,9 @@ declare type TriggerEventHandler<RecordType> = (record: RecordType, key: ProTabl
|
|
|
11123
11131
|
export declare const trTRIntl: IntlType;
|
|
11124
11132
|
export declare const ukUAIntl: IntlType;
|
|
11125
11133
|
declare const UP = "up";
|
|
11134
|
+
export declare function useFetchData(props: {
|
|
11135
|
+
request?: any;
|
|
11136
|
+
}): (params?: Record<string, any>, index?: number) => Promise<any>;
|
|
11126
11137
|
declare type UseFetchDataAction<T = any> = {
|
|
11127
11138
|
dataSource: Ref<T[]>;
|
|
11128
11139
|
keyword: Ref<string>;
|
package/es/index.mjs
CHANGED
|
@@ -40,6 +40,7 @@ export { usePrefixCls } from './packages/hooks/use-prefix-cls/index.mjs';
|
|
|
40
40
|
export { useIsMobile } from './packages/hooks/use-is-mobile/index.mjs';
|
|
41
41
|
export { useMergedState } from './packages/hooks/use-merged-state/index.mjs';
|
|
42
42
|
export { useState } from './packages/hooks/use-state/index.mjs';
|
|
43
|
+
export { useFetchData } from './packages/hooks/use-fetch-data/index.mjs';
|
|
43
44
|
|
|
44
45
|
const install = installer.install;
|
|
45
46
|
const version = installer.version;
|
package/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../packages/pro-design-vue/index.ts"],"sourcesContent":["/*\n * @Author: shen\n * @Date: 2025-08-26 21:22:00\n * @LastEditors: shen\n * @LastEditTime: 2025-08-31 17:47:05\n * @Description:\n */\nimport installer from './defaults'\n\nexport * from '@pro-design-vue/components'\nexport * from '@pro-design-vue/constants'\nexport * from '@pro-design-vue/directives'\nexport * from '@pro-design-vue/hooks'\nexport * from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n\nexport { default as dayjs } from 'dayjs'\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../packages/pro-design-vue/index.ts"],"sourcesContent":["/*\n * @Author: shen\n * @Date: 2025-08-26 21:22:00\n * @LastEditors: shen\n * @LastEditTime: 2025-08-31 17:47:05\n * @Description:\n */\nimport installer from './defaults'\n\nexport * from '@pro-design-vue/components'\nexport * from '@pro-design-vue/constants'\nexport * from '@pro-design-vue/directives'\nexport * from '@pro-design-vue/hooks'\nexport * from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n\nexport { default as dayjs } from 'dayjs'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,MAAM,UAAU,SAAA,CAAU;AAC1B,MAAM,UAAU,SAAA,CAAU;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyCell.vue.mjs","sources":["../../../../../../../../../packages/components/table/src/components/Body/BodyCell.vue"],"sourcesContent":["<!--\n * @Author: shen\n * @Date: 2023-11-09 22:29:52\n * @LastEditors: shen\n * @LastEditTime: 2025-12-
|
|
1
|
+
{"version":3,"file":"BodyCell.vue.mjs","sources":["../../../../../../../../../packages/components/table/src/components/Body/BodyCell.vue"],"sourcesContent":["<!--\n * @Author: shen\n * @Date: 2023-11-09 22:29:52\n * @LastEditors: shen\n * @LastEditTime: 2025-12-04 10:03:58\n * @Description:\n-->\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { EditableTrigger, FinallyColumnType, Key, RowType } from '../interface'\nimport { defineComponent, computed, watch, onMounted } from 'vue'\nimport { get } from '@pro-design-vue/utils'\nimport { useInjectTable } from '../context/TableContext'\nimport { getCellKey } from '../../utils/util'\nimport BodyTextCell from './BodyTextCell'\nimport BodyEditCell from './BodyEditCell'\nexport default defineComponent({\n inheritAttrs: false,\n props: {\n prefixCls: String as PropType<string>,\n rowIndex: { type: Number as PropType<number>, required: true },\n flattenRowIndex: { type: Number, required: true },\n rowKey: { type: [Number, String] },\n column: { type: Object as PropType<FinallyColumnType>, default: () => ({}) },\n item: { type: Object as PropType<any>, default: () => ({}) },\n wrapText: { type: Boolean as PropType<boolean>, default: false },\n type: { type: String as PropType<RowType> },\n height: Number as PropType<number>,\n hasAppendNode: Boolean as PropType<boolean>,\n resizeObserver: { type: Object as PropType<ResizeObserver> },\n editRow: { type: Object as PropType<any> },\n calMaxHeight: Function,\n editCellKeys: Array as PropType<string[]>,\n editableKeys: Array as PropType<Key[]>,\n isRowEdit: Boolean as PropType<boolean>,\n tooltipOpen: Boolean as PropType<boolean>,\n getPopupContainer: Function as PropType<() => HTMLElement>,\n onOpenEditor: Function,\n onCloseEditor: Function,\n onCellLeave: Function,\n onMouseenter: Function,\n },\n emits: ['mouseenter', 'cellLeave'],\n components: { BodyTextCell, BodyEditCell },\n setup(props) {\n const tableContext = useInjectTable()\n const isKeepEditMode = computed(() => props.column.edit?.keepEditMode)\n const cellValue = computed(() =>\n props.column!.dataIndex ? get(props.item, props.column!.dataIndex) : undefined,\n )\n\n const key = computed(() => getCellKey(props.rowKey!, props.column.columnKey))\n\n const cellParams = computed(() => ({\n column: props.column,\n record: props.isRowEdit ? props.editRow : props.item,\n recordIndexs: tableContext.getIndexsByKey(props.rowKey!),\n value: cellValue.value,\n }))\n\n const editable = computed(() => {\n if (!props.column.edit?.component) {\n return false\n }\n if (props.isRowEdit && !props.editableKeys?.includes(props.rowKey!)) {\n return false\n }\n if (!props.column.edit?.editable) {\n return true\n }\n const cellEditable = props.column.edit?.editable(cellParams.value)\n return cellEditable\n })\n\n const isEditing = computed(() => {\n if (props.isRowEdit) {\n return editable.value && props.editableKeys?.includes(props.rowKey!)\n }\n if (!editable.value) {\n return false\n }\n if (isKeepEditMode.value) {\n return true\n }\n if (props.editCellKeys?.includes(key.value)) {\n return true\n }\n return false\n })\n\n const editableTrigger = computed(() => {\n let { editableTrigger = ['click'] } = props.column!.edit ?? {}\n editableTrigger = Array.isArray(editableTrigger) ? editableTrigger : [editableTrigger]\n return editableTrigger\n })\n\n const onCellEvent = (e: MouseEvent, trigger: EditableTrigger) => {\n if (editable.value && editableTrigger.value?.includes(trigger) && !props.isRowEdit) {\n openEditor()\n closeEditor()\n e.stopPropagation()\n e.preventDefault()\n }\n }\n\n const openEditor = () => {\n const oldValue = props.column.edit?.valueGetter?.(cellParams.value) ?? cellValue.value\n props.onOpenEditor?.(key.value, { [key.value]: oldValue })\n }\n\n const closeEditor = () => {\n props.onCloseEditor?.(key.value)\n }\n\n watch(key, () => {\n if (props.column.edit?.defaultEditable && !props.isRowEdit) {\n openEditor()\n }\n })\n\n onMounted(() => {\n if (props.column.edit?.defaultEditable && !props.isRowEdit) {\n openEditor()\n }\n })\n\n return {\n props,\n key,\n isEditing,\n editable,\n onCellEvent,\n }\n },\n})\n</script>\n\n<template>\n <template v-if=\"isEditing\">\n <BodyEditCell\n :key=\"key\"\n :prefixCls=\"prefixCls\"\n :rowIndex=\"rowIndex\"\n :flattenRowIndex=\"flattenRowIndex\"\n :rowKey=\"rowKey\"\n :column=\"column\"\n :item=\"item\"\n :edit-row=\"editRow\"\n :editable-keys=\"editableKeys\"\n :is-row-edit=\"isRowEdit\"\n />\n </template>\n <template v-else>\n <BodyTextCell\n v-bind=\"props\"\n :style=\"{ cursor: editable ? 'poiner' : '' }\"\n @click=\"onCellEvent($event, 'click')\"\n @dblClick=\"onCellEvent($event, 'dblClick')\"\n @contextmenu=\"onCellEvent($event, 'contextmenu')\"\n >\n <template #appendNode>\n <slot name=\"appendNode\" />\n </template>\n </BodyTextCell>\n </template>\n</template>\n"],"names":["_openBlock","_createBlock","_mergeProps","_withCtx","_renderSlot"],"mappings":";;;;;;;AA0IkB,EAAA,OAAA,IAAA,CAAA,SAAA,IAAAA,SAAA,EAAA,EACdC,YAWE,uBAAA,EAAA;AAAA,IAVC,KAAK,IAAA,CAAA,GAAA;AAAA,IACL,WAAW,IAAA,CAAA,SAAA;AAAA,IACX,UAAU,IAAA,CAAA,QAAA;AAAA,IACV,iBAAiB,IAAA,CAAA,eAAA;AAAA,IACjB,QAAQ,IAAA,CAAA,MAAA;AAAA,IACR,QAAQ,IAAA,CAAA,MAAA;AAAA,IACR,MAAM,IAAA,CAAA,IAAA;AAAA,IACN,YAAU,IAAA,CAAA,OAAA;AAAA,IACV,iBAAe,IAAA,CAAA,YAAA;AAAA,IACf,eAAa,IAAA,CAAA;AAAA,GAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,WAAA,EAAA,YAAA,iBAAA,EAAA,QAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,eAAA,EAAA,aAAA,CAAA,CAAA,KAAAD,SAAA,EAAA,EAIhBC,WAAA,CAUe,uBAAA,EAVfC,UAAA,CAUe,EAAA,GAAA,EAAA,CAAA,EAAA,EATL,IAAA,CAAA,KAAA,EAAK;AAAA,IACZ,OAAK,UAAY,IAAA,CAAA,QAAA,GAAQ,WAAA,EAAA,EAAA;AAAA,IACzB,OAAA,EAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,WAAA,CAAY,MAAA,EAAM,OAAA,CAAA,CAAA;AAAA,IACzB,UAAA,EAAQ,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,WAAA,CAAY,MAAA,EAAM,UAAA,CAAA,CAAA;AAAA,IAC5B,aAAA,EAAW,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAE,IAAA,CAAA,WAAA,CAAY,MAAA,EAAM,aAAA,CAAA;AAAA,GAAA,CAAA,EAAA;AAAA,IAErB,UAAA,EAAUC,QACnB,MAA0B;AAAA,MAA1BC,UAAA,CAA0B,IAAA,CAAA,MAAA,EAAA,YAAA;AAAA,KAAA,CAAA;AAAA;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyCell.vue2.mjs","sources":["../../../../../../../../../packages/components/table/src/components/Body/BodyCell.vue"],"sourcesContent":["<!--\n * @Author: shen\n * @Date: 2023-11-09 22:29:52\n * @LastEditors: shen\n * @LastEditTime: 2025-12-
|
|
1
|
+
{"version":3,"file":"BodyCell.vue2.mjs","sources":["../../../../../../../../../packages/components/table/src/components/Body/BodyCell.vue"],"sourcesContent":["<!--\n * @Author: shen\n * @Date: 2023-11-09 22:29:52\n * @LastEditors: shen\n * @LastEditTime: 2025-12-04 10:03:58\n * @Description:\n-->\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { EditableTrigger, FinallyColumnType, Key, RowType } from '../interface'\nimport { defineComponent, computed, watch, onMounted } from 'vue'\nimport { get } from '@pro-design-vue/utils'\nimport { useInjectTable } from '../context/TableContext'\nimport { getCellKey } from '../../utils/util'\nimport BodyTextCell from './BodyTextCell'\nimport BodyEditCell from './BodyEditCell'\nexport default defineComponent({\n inheritAttrs: false,\n props: {\n prefixCls: String as PropType<string>,\n rowIndex: { type: Number as PropType<number>, required: true },\n flattenRowIndex: { type: Number, required: true },\n rowKey: { type: [Number, String] },\n column: { type: Object as PropType<FinallyColumnType>, default: () => ({}) },\n item: { type: Object as PropType<any>, default: () => ({}) },\n wrapText: { type: Boolean as PropType<boolean>, default: false },\n type: { type: String as PropType<RowType> },\n height: Number as PropType<number>,\n hasAppendNode: Boolean as PropType<boolean>,\n resizeObserver: { type: Object as PropType<ResizeObserver> },\n editRow: { type: Object as PropType<any> },\n calMaxHeight: Function,\n editCellKeys: Array as PropType<string[]>,\n editableKeys: Array as PropType<Key[]>,\n isRowEdit: Boolean as PropType<boolean>,\n tooltipOpen: Boolean as PropType<boolean>,\n getPopupContainer: Function as PropType<() => HTMLElement>,\n onOpenEditor: Function,\n onCloseEditor: Function,\n onCellLeave: Function,\n onMouseenter: Function,\n },\n emits: ['mouseenter', 'cellLeave'],\n components: { BodyTextCell, BodyEditCell },\n setup(props) {\n const tableContext = useInjectTable()\n const isKeepEditMode = computed(() => props.column.edit?.keepEditMode)\n const cellValue = computed(() =>\n props.column!.dataIndex ? get(props.item, props.column!.dataIndex) : undefined,\n )\n\n const key = computed(() => getCellKey(props.rowKey!, props.column.columnKey))\n\n const cellParams = computed(() => ({\n column: props.column,\n record: props.isRowEdit ? props.editRow : props.item,\n recordIndexs: tableContext.getIndexsByKey(props.rowKey!),\n value: cellValue.value,\n }))\n\n const editable = computed(() => {\n if (!props.column.edit?.component) {\n return false\n }\n if (props.isRowEdit && !props.editableKeys?.includes(props.rowKey!)) {\n return false\n }\n if (!props.column.edit?.editable) {\n return true\n }\n const cellEditable = props.column.edit?.editable(cellParams.value)\n return cellEditable\n })\n\n const isEditing = computed(() => {\n if (props.isRowEdit) {\n return editable.value && props.editableKeys?.includes(props.rowKey!)\n }\n if (!editable.value) {\n return false\n }\n if (isKeepEditMode.value) {\n return true\n }\n if (props.editCellKeys?.includes(key.value)) {\n return true\n }\n return false\n })\n\n const editableTrigger = computed(() => {\n let { editableTrigger = ['click'] } = props.column!.edit ?? {}\n editableTrigger = Array.isArray(editableTrigger) ? editableTrigger : [editableTrigger]\n return editableTrigger\n })\n\n const onCellEvent = (e: MouseEvent, trigger: EditableTrigger) => {\n if (editable.value && editableTrigger.value?.includes(trigger) && !props.isRowEdit) {\n openEditor()\n closeEditor()\n e.stopPropagation()\n e.preventDefault()\n }\n }\n\n const openEditor = () => {\n const oldValue = props.column.edit?.valueGetter?.(cellParams.value) ?? cellValue.value\n props.onOpenEditor?.(key.value, { [key.value]: oldValue })\n }\n\n const closeEditor = () => {\n props.onCloseEditor?.(key.value)\n }\n\n watch(key, () => {\n if (props.column.edit?.defaultEditable && !props.isRowEdit) {\n openEditor()\n }\n })\n\n onMounted(() => {\n if (props.column.edit?.defaultEditable && !props.isRowEdit) {\n openEditor()\n }\n })\n\n return {\n props,\n key,\n isEditing,\n editable,\n onCellEvent,\n }\n },\n})\n</script>\n\n<template>\n <template v-if=\"isEditing\">\n <BodyEditCell\n :key=\"key\"\n :prefixCls=\"prefixCls\"\n :rowIndex=\"rowIndex\"\n :flattenRowIndex=\"flattenRowIndex\"\n :rowKey=\"rowKey\"\n :column=\"column\"\n :item=\"item\"\n :edit-row=\"editRow\"\n :editable-keys=\"editableKeys\"\n :is-row-edit=\"isRowEdit\"\n />\n </template>\n <template v-else>\n <BodyTextCell\n v-bind=\"props\"\n :style=\"{ cursor: editable ? 'poiner' : '' }\"\n @click=\"onCellEvent($event, 'click')\"\n @dblClick=\"onCellEvent($event, 'dblClick')\"\n @contextmenu=\"onCellEvent($event, 'contextmenu')\"\n >\n <template #appendNode>\n <slot name=\"appendNode\" />\n </template>\n </BodyTextCell>\n </template>\n</template>\n"],"names":["BodyTextCell","editableTrigger"],"mappings":";;;;;;;AAgBA,gBAAe,eAAA,CAAgB;AAAA,EAC7B,YAAA,EAAc,KAAA;AAAA,EACd,KAAA,EAAO;AAAA,IACL,SAAA,EAAW,MAAA;AAAA,IACX,QAAA,EAAU,EAAE,IAAA,EAAM,MAAA,EAA4B,UAAU,IAAA,EAAK;AAAA,IAC7D,eAAA,EAAiB,EAAE,IAAA,EAAM,MAAA,EAAQ,UAAU,IAAA,EAAK;AAAA,IAChD,QAAQ,EAAE,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA,EAAE;AAAA,IACjC,QAAQ,EAAE,IAAA,EAAM,QAAuC,OAAA,EAAS,OAAO,EAAC,CAAA,EAAG;AAAA,IAC3E,MAAM,EAAE,IAAA,EAAM,QAAyB,OAAA,EAAS,OAAO,EAAC,CAAA,EAAG;AAAA,IAC3D,QAAA,EAAU,EAAE,IAAA,EAAM,OAAA,EAA8B,SAAS,KAAA,EAAM;AAAA,IAC/D,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAA4B;AAAA,IAC1C,MAAA,EAAQ,MAAA;AAAA,IACR,aAAA,EAAe,OAAA;AAAA,IACf,cAAA,EAAgB,EAAE,IAAA,EAAM,MAAA,EAAmC;AAAA,IAC3D,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,EAAwB;AAAA,IACzC,YAAA,EAAc,QAAA;AAAA,IACd,YAAA,EAAc,KAAA;AAAA,IACd,YAAA,EAAc,KAAA;AAAA,IACd,SAAA,EAAW,OAAA;AAAA,IACX,WAAA,EAAa,OAAA;AAAA,IACb,iBAAA,E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