Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
77
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/VConfirmEdit.mjs
generated
vendored
Normal file
77
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/VConfirmEdit.mjs
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
|
||||
// Components
|
||||
import { VBtn } from "../../components/VBtn/index.mjs"; // Composables
|
||||
import { useLocale } from "../../composables/index.mjs";
|
||||
import { useProxiedModel } from "../../composables/proxiedModel.mjs"; // Utilities
|
||||
import { computed, ref, toRaw, watchEffect } from 'vue';
|
||||
import { deepEqual, genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
|
||||
export const makeVConfirmEditProps = propsFactory({
|
||||
modelValue: null,
|
||||
color: String,
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: '$vuetify.confirmEdit.cancel'
|
||||
},
|
||||
okText: {
|
||||
type: String,
|
||||
default: '$vuetify.confirmEdit.ok'
|
||||
}
|
||||
}, 'VConfirmEdit');
|
||||
export const VConfirmEdit = genericComponent()({
|
||||
name: 'VConfirmEdit',
|
||||
props: makeVConfirmEditProps(),
|
||||
emits: {
|
||||
cancel: () => true,
|
||||
save: value => true,
|
||||
'update:modelValue': value => true
|
||||
},
|
||||
setup(props, _ref) {
|
||||
let {
|
||||
emit,
|
||||
slots
|
||||
} = _ref;
|
||||
const model = useProxiedModel(props, 'modelValue');
|
||||
const internalModel = ref();
|
||||
watchEffect(() => {
|
||||
internalModel.value = structuredClone(toRaw(model.value));
|
||||
});
|
||||
const {
|
||||
t
|
||||
} = useLocale();
|
||||
const isPristine = computed(() => {
|
||||
return deepEqual(model.value, internalModel.value);
|
||||
});
|
||||
function save() {
|
||||
model.value = internalModel.value;
|
||||
emit('save', internalModel.value);
|
||||
}
|
||||
function cancel() {
|
||||
internalModel.value = structuredClone(toRaw(model.value));
|
||||
emit('cancel');
|
||||
}
|
||||
let actionsUsed = false;
|
||||
useRender(() => {
|
||||
const actions = _createVNode(_Fragment, null, [_createVNode(VBtn, {
|
||||
"disabled": isPristine.value,
|
||||
"variant": "text",
|
||||
"color": props.color,
|
||||
"onClick": cancel,
|
||||
"text": t(props.cancelText)
|
||||
}, null), _createVNode(VBtn, {
|
||||
"disabled": isPristine.value,
|
||||
"variant": "text",
|
||||
"color": props.color,
|
||||
"onClick": save,
|
||||
"text": t(props.okText)
|
||||
}, null)]);
|
||||
return _createVNode(_Fragment, null, [slots.default?.({
|
||||
model: internalModel,
|
||||
get actions() {
|
||||
actionsUsed = true;
|
||||
return actions;
|
||||
}
|
||||
}), !actionsUsed && actions]);
|
||||
});
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VConfirmEdit.mjs.map
|
1
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/VConfirmEdit.mjs.map
generated
vendored
Normal file
1
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/VConfirmEdit.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
74
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/__test__/VConfirmEdit.spec.cy.mjs
generated
vendored
Normal file
74
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/__test__/VConfirmEdit.spec.cy.mjs
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
import { createTextVNode as _createTextVNode, Fragment as _Fragment, createVNode as _createVNode } from "vue";
|
||||
/// <reference types="../../../../types/cypress" />
|
||||
import { VConfirmEdit } from "../index.mjs"; // Utilities
|
||||
import { ref } from 'vue';
|
||||
|
||||
// Tests
|
||||
describe('VConfirmEdit', () => {
|
||||
it('mirrors external updates', () => {
|
||||
const externalModel = ref('foo');
|
||||
cy.mount(() => _createVNode(VConfirmEdit, {
|
||||
"modelValue": externalModel.value
|
||||
}, {
|
||||
default: _ref => {
|
||||
let {
|
||||
model
|
||||
} = _ref;
|
||||
return _createVNode("p", null, [model.value]);
|
||||
}
|
||||
})).get('p').should('have.text', 'foo').then(() => {
|
||||
externalModel.value = 'bar';
|
||||
}).get('p').should('have.text', 'bar');
|
||||
});
|
||||
it(`doesn't mutate the original value`, () => {
|
||||
const externalModel = ref(['foo']);
|
||||
cy.mount(_createVNode(VConfirmEdit, {
|
||||
"modelValue": externalModel.value,
|
||||
"onUpdate:modelValue": $event => externalModel.value = $event
|
||||
}, {
|
||||
default: _ref2 => {
|
||||
let {
|
||||
model
|
||||
} = _ref2;
|
||||
return _createVNode(_Fragment, null, [_createVNode("p", null, [model.value.join(',')]), _createVNode("button", {
|
||||
"data-test": "push",
|
||||
"onClick": () => model.value.push('bar')
|
||||
}, [_createTextVNode("Push")])]);
|
||||
}
|
||||
})).get('p').should('have.text', 'foo').get('[data-test="push"]').click().get('p').should('have.text', 'foo,bar').then(() => {
|
||||
expect(externalModel.value).to.deep.equal(['foo']);
|
||||
});
|
||||
cy.contains('.v-btn', 'OK').click();
|
||||
cy.get('p').should('have.text', 'foo,bar').then(() => {
|
||||
expect(externalModel.value).to.deep.equal(['foo', 'bar']);
|
||||
});
|
||||
});
|
||||
it('hides actions if used from the slot', () => {
|
||||
cy.mount(_createVNode(VConfirmEdit, null, null)).get('.v-btn').should('have.length', 2);
|
||||
cy.mount(_createVNode(VConfirmEdit, null, {
|
||||
default: _ref3 => {
|
||||
let {
|
||||
model
|
||||
} = _ref3;
|
||||
void model;
|
||||
}
|
||||
})).get('.v-btn').should('have.length', 2);
|
||||
cy.mount(_createVNode(VConfirmEdit, null, {
|
||||
default: _ref4 => {
|
||||
let {
|
||||
actions
|
||||
} = _ref4;
|
||||
void actions;
|
||||
}
|
||||
})).get('.v-btn').should('have.length', 0);
|
||||
cy.mount(_createVNode(VConfirmEdit, null, {
|
||||
default: _ref5 => {
|
||||
let {
|
||||
actions
|
||||
} = _ref5;
|
||||
return actions;
|
||||
}
|
||||
})).get('.v-btn').should('have.length', 2);
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=VConfirmEdit.spec.cy.mjs.map
|
1
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/__test__/VConfirmEdit.spec.cy.mjs.map
generated
vendored
Normal file
1
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/__test__/VConfirmEdit.spec.cy.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
147
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/index.d.mts
generated
vendored
Normal file
147
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/index.d.mts
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
import * as vue from 'vue';
|
||||
import { ComponentPropsOptions, ExtractPropTypes, VNodeChild, VNode, Ref } from 'vue';
|
||||
|
||||
type SlotsToProps<U extends RawSlots, T = MakeInternalSlots<U>> = {
|
||||
$children?: (VNodeChild | (T extends {
|
||||
default: infer V;
|
||||
} ? V : {}) | {
|
||||
[K in keyof T]?: T[K];
|
||||
});
|
||||
'v-slots'?: {
|
||||
[K in keyof T]?: T[K] | false;
|
||||
};
|
||||
} & {
|
||||
[K in keyof T as `v-slot:${K & string}`]?: T[K] | false;
|
||||
};
|
||||
type RawSlots = Record<string, unknown>;
|
||||
type Slot<T> = [T] extends [never] ? () => VNodeChild : (arg: T) => VNodeChild;
|
||||
type VueSlot<T> = [T] extends [never] ? () => VNode[] : (arg: T) => VNode[];
|
||||
type MakeInternalSlots<T extends RawSlots> = {
|
||||
[K in keyof T]: Slot<T[K]>;
|
||||
};
|
||||
type MakeSlots<T extends RawSlots> = {
|
||||
[K in keyof T]: VueSlot<T[K]>;
|
||||
};
|
||||
type GenericProps<Props, Slots extends Record<string, unknown>> = {
|
||||
$props: Props & SlotsToProps<Slots>;
|
||||
$slots: MakeSlots<Slots>;
|
||||
};
|
||||
interface FilterPropsOptions<PropsOptions extends Readonly<ComponentPropsOptions>, Props = ExtractPropTypes<PropsOptions>> {
|
||||
filterProps<T extends Partial<Props>, U extends Exclude<keyof Props, Exclude<keyof Props, keyof T>>>(props: T): Partial<Pick<T, U>>;
|
||||
}
|
||||
|
||||
type VConfirmEditSlots<T> = {
|
||||
default: {
|
||||
model: Ref<T>;
|
||||
get actions(): VNode;
|
||||
};
|
||||
};
|
||||
declare const VConfirmEdit: {
|
||||
new (...args: any[]): vue.CreateComponentPublicInstance<{
|
||||
cancelText: string;
|
||||
okText: string;
|
||||
} & {
|
||||
color?: string | undefined;
|
||||
} & {
|
||||
onCancel?: (() => any) | undefined;
|
||||
}, void, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
|
||||
cancel: () => true;
|
||||
save: (value: any) => true;
|
||||
'update:modelValue': (value: any) => true;
|
||||
}, "$children" | "v-slot:default" | "v-slots" | "modelValue" | "update:modelValue" | "save">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
|
||||
cancelText: string;
|
||||
okText: string;
|
||||
} & {
|
||||
color?: string | undefined;
|
||||
} & {
|
||||
onCancel?: (() => any) | undefined;
|
||||
}, {
|
||||
cancelText: string;
|
||||
okText: string;
|
||||
}, true, {}, vue.SlotsType<Partial<{
|
||||
default: (arg: {
|
||||
model: Ref<unknown>;
|
||||
readonly actions: VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>;
|
||||
}) => VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[];
|
||||
}>>, {
|
||||
P: {};
|
||||
B: {};
|
||||
D: {};
|
||||
C: {};
|
||||
M: {};
|
||||
Defaults: {};
|
||||
}, {
|
||||
cancelText: string;
|
||||
okText: string;
|
||||
} & {
|
||||
color?: string | undefined;
|
||||
} & {
|
||||
onCancel?: (() => any) | undefined;
|
||||
}, {}, {}, {}, {}, {
|
||||
cancelText: string;
|
||||
okText: string;
|
||||
}>;
|
||||
__isFragment?: undefined;
|
||||
__isTeleport?: undefined;
|
||||
__isSuspense?: undefined;
|
||||
} & vue.ComponentOptionsBase<{
|
||||
cancelText: string;
|
||||
okText: string;
|
||||
} & {
|
||||
color?: string | undefined;
|
||||
} & {
|
||||
onCancel?: (() => any) | undefined;
|
||||
}, void, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
|
||||
cancel: () => true;
|
||||
save: (value: any) => true;
|
||||
'update:modelValue': (value: any) => true;
|
||||
}, "$children" | "v-slot:default" | "v-slots" | "modelValue" | "update:modelValue" | "save">, string, {
|
||||
cancelText: string;
|
||||
okText: string;
|
||||
}, {}, string, vue.SlotsType<Partial<{
|
||||
default: (arg: {
|
||||
model: Ref<unknown>;
|
||||
readonly actions: VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>;
|
||||
}) => VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[];
|
||||
}>>> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new <T>(props: {
|
||||
modelValue?: T | undefined;
|
||||
'onUpdate:modelValue'?: ((value: T) => void) | undefined;
|
||||
onSave?: ((value: T) => void) | undefined;
|
||||
}, slots: VConfirmEditSlots<T>) => GenericProps<{
|
||||
modelValue?: T | undefined;
|
||||
'onUpdate:modelValue'?: ((value: T) => void) | undefined;
|
||||
onSave?: ((value: T) => void) | undefined;
|
||||
}, VConfirmEditSlots<T>>) & FilterPropsOptions<{
|
||||
modelValue: null;
|
||||
color: StringConstructor;
|
||||
cancelText: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
okText: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
}, vue.ExtractPropTypes<{
|
||||
modelValue: null;
|
||||
color: StringConstructor;
|
||||
cancelText: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
okText: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
}>>;
|
||||
type VConfirmEdit = InstanceType<typeof VConfirmEdit>;
|
||||
|
||||
export { VConfirmEdit };
|
2
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/index.mjs
generated
vendored
Normal file
2
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/index.mjs
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export { VConfirmEdit } from "./VConfirmEdit.mjs";
|
||||
//# sourceMappingURL=index.mjs.map
|
1
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/index.mjs.map
generated
vendored
Normal file
1
VApp/node_modules/vuetify/lib/labs/VConfirmEdit/index.mjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","names":["VConfirmEdit"],"sources":["../../../src/labs/VConfirmEdit/index.ts"],"sourcesContent":["export { VConfirmEdit } from './VConfirmEdit'\n"],"mappings":"SAASA,YAAY"}
|
Reference in New Issue
Block a user