bkui-vue 0.0.1-beta.227 → 0.0.1-beta.228
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.cjs.js +23 -23
- package/dist/index.esm.js +40 -10
- package/dist/index.umd.js +23 -23
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/transfer/index.d.ts +3 -3
- package/lib/transfer/index.js +1 -1
- package/lib/transfer/transfer.css +15 -8
- package/lib/transfer/transfer.d.ts +1 -1
- package/lib/transfer/transfer.less +6 -1
- package/lib/transfer/transfer.variable.css +15 -8
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -27056,7 +27056,11 @@ const transferProps = {
|
|
27056
27056
|
function useTransferData(sourceData, targetList, settingCode) {
|
27057
27057
|
const selectList = ref([]);
|
27058
27058
|
const selectedList = ref([]);
|
27059
|
-
const transformData = () => {
|
27059
|
+
const transformData = (isChange = false) => {
|
27060
|
+
if (isChange) {
|
27061
|
+
selectList.value = [];
|
27062
|
+
selectedList.value = [];
|
27063
|
+
}
|
27060
27064
|
sourceData.value.forEach((s2) => {
|
27061
27065
|
const keyId = s2[settingCode.value];
|
27062
27066
|
if (targetList.value.includes(keyId)) {
|
@@ -27067,7 +27071,11 @@ function useTransferData(sourceData, targetList, settingCode) {
|
|
27067
27071
|
});
|
27068
27072
|
};
|
27069
27073
|
transformData();
|
27070
|
-
watch(() => [sourceData, targetList, settingCode],
|
27074
|
+
watch(() => [sourceData, targetList, settingCode], () => {
|
27075
|
+
transformData(true);
|
27076
|
+
}, {
|
27077
|
+
deep: true
|
27078
|
+
});
|
27071
27079
|
return {
|
27072
27080
|
selectList,
|
27073
27081
|
selectedList
|
@@ -27142,20 +27150,40 @@ var Component$9 = defineComponent({
|
|
27142
27150
|
return va > vb ? 1 : -1;
|
27143
27151
|
});
|
27144
27152
|
});
|
27153
|
+
watch(() => [selectList, selectedList], () => {
|
27154
|
+
handleEmitUpdateTargetList();
|
27155
|
+
}, {
|
27156
|
+
deep: true
|
27157
|
+
});
|
27158
|
+
const handleCheckAllItemSelect = (list, source) => {
|
27159
|
+
const itemKey = settingCode.value;
|
27160
|
+
return list.some((val) => val[itemKey] === source[itemKey]) && source.disabled;
|
27161
|
+
};
|
27145
27162
|
const allToRight = () => {
|
27146
|
-
selectList.value = [
|
27147
|
-
|
27163
|
+
selectList.value = [...sourceData.value.filter((source) => {
|
27164
|
+
return handleCheckAllItemSelect(selectList.value, source);
|
27165
|
+
})];
|
27166
|
+
selectedList.value = [...sourceData.value.filter((source) => {
|
27167
|
+
return !handleCheckAllItemSelect(selectList.value, source);
|
27168
|
+
})];
|
27148
27169
|
handleEmitUpdateTargetList();
|
27149
27170
|
};
|
27150
27171
|
const allToLeft = () => {
|
27151
|
-
selectList.value = [...sourceData.value
|
27152
|
-
|
27172
|
+
selectList.value = [...sourceData.value.filter((source) => {
|
27173
|
+
return !handleCheckAllItemSelect(selectedList.value, source);
|
27174
|
+
})];
|
27175
|
+
selectedList.value = [...sourceData.value.filter((source) => {
|
27176
|
+
return handleCheckAllItemSelect(selectedList.value, source);
|
27177
|
+
})];
|
27153
27178
|
handleEmitUpdateTargetList();
|
27154
27179
|
};
|
27155
|
-
const handleItemClick = (
|
27180
|
+
const handleItemClick = (item, isLeft) => {
|
27181
|
+
if (item.disabled)
|
27182
|
+
return;
|
27183
|
+
const itemKey = item[settingCode.value];
|
27156
27184
|
const from = isLeft ? selectList : selectedList;
|
27157
27185
|
const to = isLeft ? selectedList : selectList;
|
27158
|
-
const index = from.value.findIndex((
|
27186
|
+
const index = from.value.findIndex((item2) => item2[settingCode.value] === itemKey);
|
27159
27187
|
to.value.push(...from.value.splice(index, 1));
|
27160
27188
|
handleEmitUpdateTargetList();
|
27161
27189
|
};
|
@@ -27212,7 +27240,9 @@ var Component$9 = defineComponent({
|
|
27212
27240
|
};
|
27213
27241
|
const getDefaultListHtml = (item, isLeft = true) => {
|
27214
27242
|
return createVNode("div", {
|
27215
|
-
"class": "item-content"
|
27243
|
+
"class": ["item-content", {
|
27244
|
+
"is-disabled": item.disabled
|
27245
|
+
}]
|
27216
27246
|
}, [createVNode("span", {
|
27217
27247
|
"class": "content-text",
|
27218
27248
|
"title": item[this.displayCode]
|
@@ -27236,7 +27266,7 @@ var Component$9 = defineComponent({
|
|
27236
27266
|
return createVNode("li", {
|
27237
27267
|
"key": item[this.settingCode],
|
27238
27268
|
"class": [this.$slots[slotName] ? "custom-item" : ""],
|
27239
|
-
"onClick": () => this.handleItemClick(item
|
27269
|
+
"onClick": () => this.handleItemClick(item, isLeft)
|
27240
27270
|
}, [(_c = (_b = (_a = this.$slots)[slotName]) == null ? void 0 : _b.call(_a, item)) != null ? _c : getDefaultListHtml(item, isLeft)]);
|
27241
27271
|
})]) : getEmptyHtml(emptySlotName);
|
27242
27272
|
};
|