bl-common-vue3 3.8.133 → 3.8.134
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/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<bl-drawer
|
|
3
3
|
:title="t('ExtraManage.index.845270-0')"
|
|
4
|
-
:maskClosable="!editVisible"
|
|
4
|
+
:maskClosable="maskClosable && !editVisible"
|
|
5
5
|
:visible="visible"
|
|
6
6
|
:width="1040"
|
|
7
7
|
:destroyOnClose="true"
|
|
8
|
+
:footer="false"
|
|
8
9
|
:body-style="{ padding: '24px', background: '#f6f8fb', flex: 1 }"
|
|
9
10
|
@close="closeModal"
|
|
10
11
|
>
|
|
@@ -59,7 +60,6 @@
|
|
|
59
60
|
</CustomTable>
|
|
60
61
|
<div class="field-manager-hint">{{ t('components.ExtraManageEdit.301828-2') }}</div>
|
|
61
62
|
</div>
|
|
62
|
-
<template #footer><div class="field-manager-footer"><a-button @click="closeModal">{{ t('common.switch.close') }}</a-button></div></template>
|
|
63
63
|
|
|
64
64
|
<ExtraManageEdit
|
|
65
65
|
v-if="editVisible"
|
|
@@ -104,6 +104,11 @@ export default defineComponent({
|
|
|
104
104
|
type: Boolean,
|
|
105
105
|
default: false,
|
|
106
106
|
},
|
|
107
|
+
// 显式声明,避免外部透传属性覆盖编辑期间的防误关判断。
|
|
108
|
+
maskClosable: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: true,
|
|
111
|
+
},
|
|
107
112
|
tableConfig: {
|
|
108
113
|
type: Object,
|
|
109
114
|
default: () => {},
|
|
@@ -373,6 +378,5 @@ export default defineComponent({
|
|
|
373
378
|
.field-required { padding: 3px 8px; border-radius: 4px; color: #487ecc; background: #eef5ff; font-size: 12px; }
|
|
374
379
|
.field-optional { color: #8c97a6; font-size: 12px; }
|
|
375
380
|
.field-manager-hint { padding: 12px 8px; color: #8c97a6; font-size: 12px; }
|
|
376
|
-
.field-manager-footer { display: flex; justify-content: flex-end; }
|
|
377
381
|
@media (max-width: 767px) { .field-manager-title { gap: 8px; } .field-manager-search { width: 145px; } .field-manager-table { padding: 8px; } }
|
|
378
382
|
</style>
|
|
@@ -7,13 +7,16 @@ const Vue = require('vue');
|
|
|
7
7
|
const {parse, compileTemplate} = require('@vue/compiler-sfc');
|
|
8
8
|
const {transformSync} = require('@babel/core');
|
|
9
9
|
|
|
10
|
-
function loadScript(filename, mocks = {}) {
|
|
10
|
+
function loadScript(filename, mocks = {}, withTemplate = false) {
|
|
11
11
|
const source = readFileSync(filename, 'utf8');
|
|
12
12
|
let scriptSource = source;
|
|
13
13
|
if (filename.endsWith('.vue')) {
|
|
14
14
|
const {descriptor} = parse(source);
|
|
15
15
|
assert.deepEqual(compileTemplate({id: 'field-regression', filename, source: descriptor.template.content}).errors, []);
|
|
16
16
|
scriptSource = descriptor.script.content;
|
|
17
|
+
if (withTemplate) {
|
|
18
|
+
scriptSource += '\n' + compileTemplate({id: 'field-regression', filename, source: descriptor.template.content}).code;
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
const loaded = new Module(filename, module);
|
|
19
22
|
loaded.require = (name) => {
|
|
@@ -154,3 +157,39 @@ test('field deletion waits for the API, preserves the business alias and propaga
|
|
|
154
157
|
await retried;
|
|
155
158
|
} finally {app.unmount(); global.window = previousWindow;}
|
|
156
159
|
});
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
test('field list has no footer and mask closing remains disabled while editing with explicit parent props', async () => {
|
|
163
|
+
const previousWindow = global.window;
|
|
164
|
+
global.window = {addEventListener() {}, removeEventListener() {}};
|
|
165
|
+
const filename = path.resolve(__dirname, '../src/components/PublicExtensionField/index.vue');
|
|
166
|
+
const compiled = loadScript(filename, {}, true);
|
|
167
|
+
let drawerAttrs;
|
|
168
|
+
let drawerSlots;
|
|
169
|
+
const Drawer = {inheritAttrs: false, setup(_, {attrs, slots}) {
|
|
170
|
+
return () => {drawerAttrs = {...attrs}; drawerSlots = slots; return Vue.h('div');};
|
|
171
|
+
}};
|
|
172
|
+
const component = {...compiled.default, render: compiled.render, components: {...compiled.default.components, BlDrawer: Drawer}};
|
|
173
|
+
const instance = Vue.ref();
|
|
174
|
+
let closed = 0;
|
|
175
|
+
const app = renderer.createApp({render: () => Vue.h(component, {
|
|
176
|
+
ref: instance, visible: true, maskClosable: true, footer: false,
|
|
177
|
+
onCloseModal: () => {closed++;},
|
|
178
|
+
})});
|
|
179
|
+
app.config.warnHandler = () => {};
|
|
180
|
+
try {
|
|
181
|
+
app.mount({children: []});
|
|
182
|
+
await flush();
|
|
183
|
+
assert.equal(drawerAttrs.maskClosable, true);
|
|
184
|
+
assert.equal(drawerAttrs.footer, false);
|
|
185
|
+
assert.equal(drawerSlots.footer, undefined);
|
|
186
|
+
drawerAttrs.onClose();
|
|
187
|
+
assert.equal(closed, 1);
|
|
188
|
+
instance.value.handleEdit({id: 1});
|
|
189
|
+
await flush();
|
|
190
|
+
assert.equal(drawerAttrs.maskClosable, false);
|
|
191
|
+
instance.value.editVisible = false;
|
|
192
|
+
await flush();
|
|
193
|
+
assert.equal(drawerAttrs.maskClosable, true);
|
|
194
|
+
} finally {app.unmount(); global.window = previousWindow;}
|
|
195
|
+
});
|