8197-perf_vnTableInside #1175
|
@ -14,6 +14,7 @@ defineProps({
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="promise"
|
@update:model-value="promise"
|
||||||
|
data-cy="vnBtnSelect_select"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -297,7 +297,7 @@ defineExpose({
|
||||||
ref="dmsRef"
|
ref="dmsRef"
|
||||||
:data-key="$props.model"
|
:data-key="$props.model"
|
||||||
:url="$props.model"
|
:url="$props.model"
|
||||||
:filter="dmsFilter"
|
:user-filter="dmsFilter"
|
||||||
alexm marked this conversation as resolved
|
|||||||
:order="['dmsFk DESC']"
|
:order="['dmsFk DESC']"
|
||||||
:auto-load="true"
|
:auto-load="true"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
|
|
|
@ -20,16 +20,15 @@ const hasContent = ref();
|
||||||
let observer;
|
let observer;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (teleportRef.value) {
|
if (!teleportRef.value) return;
|
||||||
const checkContent = () => {
|
const checkContent = () => {
|
||||||
hasContent.value = teleportRef.value.innerHTML.trim() !== '';
|
hasContent.value = teleportRef.value?.innerHTML?.trim() !== '';
|
||||||
};
|
};
|
||||||
|
|
||||||
observer = new MutationObserver(checkContent);
|
observer = new MutationObserver(checkContent);
|
||||||
observer.observe(teleportRef.value, { childList: true, subtree: true });
|
observer.observe(teleportRef.value, { childList: true, subtree: true });
|
||||||
|
|
||||||
checkContent();
|
checkContent();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
keepData: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -56,6 +60,7 @@ onBeforeMount(() => {
|
||||||
if ($props.dataKey)
|
if ($props.dataKey)
|
||||||
arrayData = useArrayData($props.dataKey, {
|
arrayData = useArrayData($props.dataKey, {
|
||||||
searchUrl: 'table',
|
searchUrl: 'table',
|
||||||
|
keepData: $props.keepData,
|
||||||
...$props.arrayDataProps,
|
...$props.arrayDataProps,
|
||||||
navigate: $props.redirect,
|
navigate: $props.redirect,
|
||||||
});
|
});
|
||||||
|
|
|
@ -111,6 +111,7 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
if (!store.keepData) arrayData.reset(['data']);
|
||||||
arrayData.resetPagination();
|
arrayData.resetPagination();
|
||||||
});
|
});
|
||||||
alexm
commented
Aixina en els List no borrem mai els datos, pero en tot lo demes si. Aixina en els List no borrem mai els datos, pero en tot lo demes si.
Aixina se fora forsa a que quan canvies el id, te fasa reload
|
|||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
'searchUrl',
|
'searchUrl',
|
||||||
'navigate',
|
'navigate',
|
||||||
'mapKey',
|
'mapKey',
|
||||||
|
'keepData',
|
||||||
];
|
];
|
||||||
if (typeof userOptions === 'object') {
|
if (typeof userOptions === 'object') {
|
||||||
for (const option in userOptions) {
|
for (const option in userOptions) {
|
||||||
|
@ -302,7 +303,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
for (const row of data) {
|
for (const row of data) {
|
||||||
const key = row[store.mapKey];
|
const key = row[store.mapKey];
|
||||||
const val = { ...row, key };
|
const val = { ...row, key };
|
||||||
if (store.map.has(key)) {
|
if (key && store.map.has(key)) {
|
||||||
const { position } = store.map.get(key);
|
const { position } = store.map.get(key);
|
||||||
val.position = position;
|
val.position = position;
|
||||||
store.map.set(key, val);
|
store.map.set(key, val);
|
||||||
|
|
|
@ -18,6 +18,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
||||||
navigate: null,
|
navigate: null,
|
||||||
page: 1,
|
page: 1,
|
||||||
mapKey: 'id',
|
mapKey: 'id',
|
||||||
|
keepData: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
function get(key) {
|
function get(key) {
|
||||||
|
|
|
@ -16,7 +16,9 @@ describe('Ticket expedtion', () => {
|
||||||
|
|
||||||
cy.wait('@show');
|
cy.wait('@show');
|
||||||
cy.selectRows([1, 2]);
|
cy.selectRows([1, 2]);
|
||||||
cy.selectOption('[data-cy="change-state"]', 'Perdida');
|
|
||||||
|
cy.dataCy('change-state').click();
|
||||||
|
cy.selectOption('[data-cy="vnBtnSelect_select"]', 'Perdida');
|
||||||
cy.wait('@add');
|
cy.wait('@add');
|
||||||
|
|
||||||
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
|
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
|
||||||
|
|
|
@ -16,6 +16,7 @@ describe('VnBreadcrumbs', () => {
|
||||||
cy.visit('#/customer/list');
|
cy.visit('#/customer/list');
|
||||||
cy.get('.q-breadcrumbs__el').should('have.length', 2);
|
cy.get('.q-breadcrumbs__el').should('have.length', 2);
|
||||||
|
|
||||||
|
cy.writeSearchbar('{enter}');
|
||||||
cy.get(firstCard).click();
|
cy.get(firstCard).click();
|
||||||
cy.get(`${lastBreadcrumb} > .q-icon`).should('have.text', 'launch');
|
cy.get(`${lastBreadcrumb} > .q-icon`).should('have.text', 'launch');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
En lo nou del map en ArrayData, si no se espeicifica falla.