@veltra/desktop 1.2.9 → 1.2.10
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/components/action/action-group.vue.d.ts +2 -2
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
- package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
- package/dist/components/batch-edit/batch-edit.js +4 -1
- package/dist/components/batch-edit/batch-edit.js.map +1 -1
- package/dist/components/batch-edit/use-edit-state.js +7 -3
- package/dist/components/batch-edit/use-edit-state.js.map +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +4 -4
- package/dist/components/checkbox/checkbox-button.vue.d.ts +2 -2
- package/dist/components/checkbox/checkbox.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
- package/dist/components/code-editor/code-editor.vue.d.ts +1 -1
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
- package/dist/components/file-picker/file-picker.vue.d.ts +1 -1
- package/dist/components/input/input.vue.d.ts +3 -3
- package/dist/components/multi-select/multi-select.vue.d.ts +3 -3
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +6 -6
- package/dist/components/number-input/number-input.vue.d.ts +3 -3
- package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
- package/dist/components/palette/palette.vue.d.ts +1 -1
- package/dist/components/password-input/password-input.vue.d.ts +1 -1
- package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
- package/dist/components/progress-nodes/progress-nodes.vue.d.ts +1 -1
- package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
- package/dist/components/select/select.vue.d.ts +2 -2
- package/dist/components/steps/steps.vue.d.ts +3 -3
- package/dist/components/switch/switch.vue.d.ts +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
- package/dist/components/tabs/tabs.vue.d.ts +2 -2
- package/dist/components/textarea/textarea.vue.d.ts +3 -3
- package/dist/components/tip/tip.vue.d.ts +1 -1
- package/dist/components/tree/tree.vue.d.ts +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +6 -6
- package/package.json +6 -6
- package/src/components/batch-edit/batch-edit-form.vue +0 -1
- package/src/components/batch-edit/batch-edit.vue +1 -1
- package/src/components/batch-edit/use-edit-state.ts +12 -6
|
@@ -6,10 +6,10 @@ type __VLS_Slots = {
|
|
|
6
6
|
default?: () => VNode[];
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<ActionGroupProps, _ActionGroupExposed, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ActionGroupProps> & Readonly<{}>, {
|
|
9
|
-
size: "small" | "default" | "large";
|
|
10
9
|
type: import("@veltra/utils").ColorType;
|
|
11
|
-
|
|
10
|
+
size: "small" | "default" | "large";
|
|
12
11
|
text: boolean;
|
|
12
|
+
max: number;
|
|
13
13
|
circle: boolean;
|
|
14
14
|
loading: boolean;
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -12,8 +12,8 @@ declare const __VLS_base: import("vue").DefineComponent<ActionProps, {}, {}, {},
|
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<ActionProps> & Readonly<{
|
|
13
13
|
onRun?: (() => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
|
-
size: import("@veltra/utils").ComponentSize;
|
|
16
15
|
type: ButtonType;
|
|
16
|
+
size: import("@veltra/utils").ComponentSize;
|
|
17
17
|
text: boolean;
|
|
18
18
|
circle: boolean;
|
|
19
19
|
loading: boolean;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Auto
|
|
|
22
22
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
23
23
|
onSelect?: ((value: string) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
|
-
readonly: boolean;
|
|
26
25
|
disabled: boolean;
|
|
26
|
+
readonly: boolean;
|
|
27
27
|
placeholder: string;
|
|
28
28
|
clearable: boolean;
|
|
29
29
|
allowCustom: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-edit-form.js","names":[],"sources":["../../../src/components/batch-edit/batch-edit-form.vue"],"sourcesContent":["<template>\n <aside :class=\"cls.e('form')\" v-if=\"state.formVisible && !!props.model\">\n <header :class=\"cls.e('form-header')\">\n <span :class=\"[cls.e('form-icon'), bem.is(state.formActionType)]\">\n <u-icon>\n <component :is=\"headerInfo.icon\" />\n </u-icon>\n </span>\n <div :class=\"cls.e('form-title')\">\n <h3 :class=\"cls.e('form-title-text')\">{{ headerInfo.title }}</h3>\n </div>\n <u-button\n :class=\"cls.e('form-close')\"\n :icon=\"Close\"\n text\n circle\n size=\"small\"\n title=\"关闭\"\n @click=\"handleClose\"\n />\n </header>\n\n <u-scroll always :class=\"cls.e('form-body')\" :key=\"bodyKey\">\n <transition name=\"fade\" appear mode=\"out-in\">\n <u-form\n ref=\"formComponentRef\"\n :model=\"props.model\"\n :readonly=\"props.readonly\"\n :label-width=\"props.labelWidth\"\n @field:change=\"handleFieldChange\"\n >\n <slot\n v-bind=\"{\n row: state.row,\n depth: state.depth,\n indexes: state.indexPath,\n index: state.row?.index\n }\"\n />\n </u-form>\n </transition>\n </u-scroll>\n\n <footer :class=\"cls.e('form-footer')\">\n <span :class=\"cls.e('form-hint')\">\n <template v-if=\"props.readonly\"> 只读模式 </template>\n\n <span :class=\"{ [bem.is('concealed')]: !focused }\">\n <template v-if=\"!(state.formActionType === 'update' && props.quickEdit)\">\n <u-kbd>Ctrl + S</u-kbd> 保存 ·\n </template>\n <u-kbd>Esc</u-kbd> 关闭\n </span>\n </span>\n\n <div :class=\"cls.e('form-actions')\">\n <u-button text :loading=\"state.loading\" @click=\"handleClose\"> 取消 </u-button>\n <u-button v-if=\"showSaveBtn\" type=\"primary\" :loading=\"state.loading\" @click=\"handleSave\">\n 保存\n </u-button>\n </div>\n </footer>\n </aside>\n</template>\n\n<script lang=\"ts\" setup>\nimport { o } from '@cat-kit/core'\nimport { Close } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, shallowRef, toRef } from 'vue'\n\nimport type {
|
|
1
|
+
{"version":3,"file":"batch-edit-form.js","names":[],"sources":["../../../src/components/batch-edit/batch-edit-form.vue"],"sourcesContent":["<template>\n <aside :class=\"cls.e('form')\" v-if=\"state.formVisible && !!props.model\">\n <header :class=\"cls.e('form-header')\">\n <span :class=\"[cls.e('form-icon'), bem.is(state.formActionType)]\">\n <u-icon>\n <component :is=\"headerInfo.icon\" />\n </u-icon>\n </span>\n <div :class=\"cls.e('form-title')\">\n <h3 :class=\"cls.e('form-title-text')\">{{ headerInfo.title }}</h3>\n </div>\n <u-button\n :class=\"cls.e('form-close')\"\n :icon=\"Close\"\n text\n circle\n size=\"small\"\n title=\"关闭\"\n @click=\"handleClose\"\n />\n </header>\n\n <u-scroll always :class=\"cls.e('form-body')\" :key=\"bodyKey\">\n <transition name=\"fade\" appear mode=\"out-in\">\n <u-form\n ref=\"formComponentRef\"\n :model=\"props.model\"\n :readonly=\"props.readonly\"\n :label-width=\"props.labelWidth\"\n @field:change=\"handleFieldChange\"\n >\n <slot\n v-bind=\"{\n row: state.row,\n depth: state.depth,\n indexes: state.indexPath,\n index: state.row?.index\n }\"\n />\n </u-form>\n </transition>\n </u-scroll>\n\n <footer :class=\"cls.e('form-footer')\">\n <span :class=\"cls.e('form-hint')\">\n <template v-if=\"props.readonly\"> 只读模式 </template>\n\n <span :class=\"{ [bem.is('concealed')]: !focused }\">\n <template v-if=\"!(state.formActionType === 'update' && props.quickEdit)\">\n <u-kbd>Ctrl + S</u-kbd> 保存 ·\n </template>\n <u-kbd>Esc</u-kbd> 关闭\n </span>\n </span>\n\n <div :class=\"cls.e('form-actions')\">\n <u-button text :loading=\"state.loading\" @click=\"handleClose\"> 取消 </u-button>\n <u-button v-if=\"showSaveBtn\" type=\"primary\" :loading=\"state.loading\" @click=\"handleSave\">\n 保存\n </u-button>\n </div>\n </footer>\n </aside>\n</template>\n\n<script lang=\"ts\" setup>\nimport { o } from '@cat-kit/core'\nimport { Close } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, shallowRef, toRef } from 'vue'\n\nimport type { _FormExposed, FormExposed } from '../../types/form'\nimport { UButton } from '../button'\nimport { UForm } from '../form'\nimport { UIcon } from '../icon'\nimport { UKbd } from '../kbd'\nimport { UScroll } from '../scroll'\nimport { BatchEditDIKey } from './di'\nimport { FORM_ACTION_HEADER_MAP } from './form-action-header'\n\ndefineOptions({ name: 'BatchEditForm' })\n\nconst batchEditCtx = inject(BatchEditDIKey)!\n\nconst { cls, props, state, handleClose, handleSave, staticFeatures, dynamicFeatures } = batchEditCtx\n\nconst focused = toRef(batchEditCtx, 'focused')\n\nconst formComponentRef = shallowRef<FormExposed>()\n\ndefineExpose<_FormExposed>({\n el: toRef(() => formComponentRef.value?.el),\n validate: () => formComponentRef.value?.validate() ?? Promise.resolve(true),\n clearValidate: () => formComponentRef.value?.clearValidate(),\n reset: () => formComponentRef.value?.reset()\n})\n\nfunction handleFieldChange(field: string, value: any) {\n if (state.row && props.quickEdit) {\n o(state.row.data).set(field, value)\n }\n}\n\nconst creatable = computed(() => {\n if (state.formActionType !== 'create') return false\n return staticFeatures.value.has('create') || dynamicFeatures.value.create?.(state.row)\n})\n\nconst creatableChild = computed(() => {\n if (state.formActionType !== 'createChild') return false\n return staticFeatures.value.has('createChild') || dynamicFeatures.value.createChild?.(state.row)\n})\n\nconst updatable = computed(() => {\n if (state.formActionType !== 'update') return false\n return staticFeatures.value.has('update') || dynamicFeatures.value.update?.(state.row)\n})\n\nconst showSaveBtn = computed(() => {\n if (props.readonly) return false\n if (props.quickEdit && state.formActionType === 'update') return false\n return creatable.value || updatable.value || creatableChild.value\n})\n\nconst headerInfo = computed(() => FORM_ACTION_HEADER_MAP[state.formActionType])\n\n/** 通过 row 切换 / 类型切换驱动表单内容淡出淡入 */\nconst bodyKey = computed(() => {\n return `${state.formActionType}-${state.row?.uid ?? 'create'}-${state.parentRow?.uid ?? 'root'}`\n})\n</script>\n"],"mappings":"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"}
|
|
@@ -61,7 +61,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
61
|
const slots = useSlots();
|
|
62
62
|
const cls = bem("batch-edit");
|
|
63
63
|
const formRef = useTemplateRef("form");
|
|
64
|
-
const { state, resetState } = useEditState({
|
|
64
|
+
const { state, resetState } = useEditState({
|
|
65
|
+
props,
|
|
66
|
+
formRef
|
|
67
|
+
});
|
|
65
68
|
const { staticFeatures, dynamicFeatures } = useFeatures({ props });
|
|
66
69
|
const handlers = useHandlers({
|
|
67
70
|
props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-edit.js","names":[],"sources":["../../../src/components/batch-edit/batch-edit.vue"],"sourcesContent":["<template>\n <u-layout\n :class=\"cls.b\"\n :cols=\"cols\"\n rows=\"minmax(0, 1fr) \"\n gap=\"8px\"\n resizable\n tabindex=\"-1\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @keydown.capture=\"handleKeydown\"\n >\n <!-- 编辑列表 -->\n <BatchEditList :slots=\"slots\" />\n\n <!-- 编辑表单 -->\n <BatchEditForm ref=\"form\" v-slot=\"scoped\">\n <slot name=\"form\" v-bind=\"scoped\" />\n </BatchEditForm>\n </u-layout>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed, provide, useTemplateRef } from 'vue'\n\nimport type { BatchEditEmits, BatchEditProps, BatchEditSlots, FormExposed } from '../../types'\nimport { ULayout } from '../layout'\nimport BatchEditForm from './batch-edit-form.vue'\nimport BatchEditList from './batch-edit-list.vue'\nimport { BatchEditDIKey } from './di'\nimport { useEditState } from './use-edit-state'\nimport { useFeatures } from './use-features'\nimport { useHandlers } from './use-handlers'\nimport { useShortcutKey } from './use-shortcut-key'\n\ndefineOptions({ name: 'BatchEdit' })\n\nconst props = withDefaults(defineProps<BatchEditProps>(), { cols: () => ['1fr', '420px'] })\n\nconst emit = defineEmits<BatchEditEmits>()\n\nconst slots = defineSlots<BatchEditSlots>()\n\nconst cls = bem('batch-edit')\n\nconst formRef = useTemplateRef<FormExposed>('form')\n\nconst { state, resetState } = useEditState({ props })\n\nconst { staticFeatures, dynamicFeatures } = useFeatures({ props })\n\nconst handlers = useHandlers({ props, emit, state, resetState, formRef })\n\n// 快捷键处理\nconst { handleFocusIn, handleFocusOut, handleKeydown, focused } = useShortcutKey({\n props,\n onSave: handlers.handleSave,\n onClose: handlers.handleClose,\n state\n})\n\nconst cols = computed(() => {\n return state.formVisible ? props.cols : undefined\n})\n\nprovide(BatchEditDIKey, {\n cls,\n props,\n emit,\n state,\n staticFeatures,\n dynamicFeatures,\n focused,\n ...handlers\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAEb,MAAM,QAAQ,SAAA;EAEd,MAAM,MAAM,IAAI,YAAY;EAE5B,MAAM,UAAU,eAA4B,MAAM;EAElD,MAAM,EAAE,OAAO,eAAe,aAAa,
|
|
1
|
+
{"version":3,"file":"batch-edit.js","names":[],"sources":["../../../src/components/batch-edit/batch-edit.vue"],"sourcesContent":["<template>\n <u-layout\n :class=\"cls.b\"\n :cols=\"cols\"\n rows=\"minmax(0, 1fr) \"\n gap=\"8px\"\n resizable\n tabindex=\"-1\"\n @focusin=\"handleFocusIn\"\n @focusout=\"handleFocusOut\"\n @keydown.capture=\"handleKeydown\"\n >\n <!-- 编辑列表 -->\n <BatchEditList :slots=\"slots\" />\n\n <!-- 编辑表单 -->\n <BatchEditForm ref=\"form\" v-slot=\"scoped\">\n <slot name=\"form\" v-bind=\"scoped\" />\n </BatchEditForm>\n </u-layout>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed, provide, useTemplateRef } from 'vue'\n\nimport type { BatchEditEmits, BatchEditProps, BatchEditSlots, FormExposed } from '../../types'\nimport { ULayout } from '../layout'\nimport BatchEditForm from './batch-edit-form.vue'\nimport BatchEditList from './batch-edit-list.vue'\nimport { BatchEditDIKey } from './di'\nimport { useEditState } from './use-edit-state'\nimport { useFeatures } from './use-features'\nimport { useHandlers } from './use-handlers'\nimport { useShortcutKey } from './use-shortcut-key'\n\ndefineOptions({ name: 'BatchEdit' })\n\nconst props = withDefaults(defineProps<BatchEditProps>(), { cols: () => ['1fr', '420px'] })\n\nconst emit = defineEmits<BatchEditEmits>()\n\nconst slots = defineSlots<BatchEditSlots>()\n\nconst cls = bem('batch-edit')\n\nconst formRef = useTemplateRef<FormExposed>('form')\n\nconst { state, resetState } = useEditState({ props, formRef })\n\nconst { staticFeatures, dynamicFeatures } = useFeatures({ props })\n\nconst handlers = useHandlers({ props, emit, state, resetState, formRef })\n\n// 快捷键处理\nconst { handleFocusIn, handleFocusOut, handleKeydown, focused } = useShortcutKey({\n props,\n onSave: handlers.handleSave,\n onClose: handlers.handleClose,\n state\n})\n\nconst cols = computed(() => {\n return state.formVisible ? props.cols : undefined\n})\n\nprovide(BatchEditDIKey, {\n cls,\n props,\n emit,\n state,\n staticFeatures,\n dynamicFeatures,\n focused,\n ...handlers\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAEb,MAAM,QAAQ,SAAA;EAEd,MAAM,MAAM,IAAI,YAAY;EAE5B,MAAM,UAAU,eAA4B,MAAM;EAElD,MAAM,EAAE,OAAO,eAAe,aAAa;GAAE;GAAO;EAAQ,CAAC;EAE7D,MAAM,EAAE,gBAAgB,oBAAoB,YAAY,EAAE,MAAM,CAAC;EAEjE,MAAM,WAAW,YAAY;GAAE;GAAO;GAAM;GAAO;GAAY;EAAQ,CAAC;EAGxE,MAAM,EAAE,eAAe,gBAAgB,eAAe,YAAY,eAAe;GAC/E;GACA,QAAQ,SAAS;GACjB,SAAS,SAAS;GAClB;EACF,CAAC;EAED,MAAM,OAAO,eAAe;GAC1B,OAAO,MAAM,cAAc,MAAM,OAAO,KAAA;EAC1C,CAAC;EAED,QAAQ,gBAAgB;GACtB;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;EACL,CAAC;;uBA1EC,YAkBW,MAAA,WAAA,GAAA;IAjBR,OAAK,eAAE,MAAA,GAAA,EAAI,CAAC;IACZ,MAAM,KAAA;IACP,MAAK;IACL,KAAI;IACJ,WAAA;IACA,UAAS;IACR,WAAS,MAAA,aAAA;IACT,YAAU,MAAA,cAAA;sBACO,MAAA,aAAA;;2BAEL;KAAb,mBAAA,QAAA;KACA,YAAgC,aAAA,EAAT,MAAK,CAAA;KAE5B,mBAAA,QAAA;KACA,YAEgB,aAAA,EAFD,KAAI,OAAM,GAAA;wBAAS,WAAM,CACtC,WAAoC,KAAA,QAAA,QAAA,eAAA,mBAAV,MAAM,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { shallowReactive, watch } from "vue";
|
|
1
|
+
import { nextTick, shallowReactive, watch } from "vue";
|
|
2
2
|
import { o } from "@cat-kit/core";
|
|
3
3
|
//#region src/components/batch-edit/use-edit-state.ts
|
|
4
4
|
function useEditState(options) {
|
|
5
|
-
const { props } = options;
|
|
5
|
+
const { props, formRef } = options;
|
|
6
6
|
const defaultState = {
|
|
7
7
|
depth: -1,
|
|
8
8
|
formVisible: false,
|
|
@@ -19,8 +19,12 @@ function useEditState(options) {
|
|
|
19
19
|
Object.assign(state, defaultState);
|
|
20
20
|
}
|
|
21
21
|
watch(() => state.row, (row) => {
|
|
22
|
+
formRef.value?.reset();
|
|
22
23
|
if (row) {
|
|
23
|
-
|
|
24
|
+
/** 延迟设置 model,防止表单初始状态丢失 */
|
|
25
|
+
nextTick(() => {
|
|
26
|
+
if (props.model) o(props.model).deepExtend(row.data);
|
|
27
|
+
});
|
|
24
28
|
state.formActionType = props.readonly ? "view" : "update";
|
|
25
29
|
state.formVisible = true;
|
|
26
30
|
state.depth = row.depth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-edit-state.js","names":[],"sources":["../../../src/components/batch-edit/use-edit-state.ts"],"sourcesContent":["import { o } from '@cat-kit/core'\nimport { shallowReactive, watch } from 'vue'\n\nimport type { BatchEditProps, BatchEditStates } from '../../types'\n\ninterface Options {\n props: BatchEditProps\n}\n\nexport function useEditState(options: Options) {\n const { props } = options\n\n const defaultState: BatchEditStates = {\n depth: -1,\n formVisible: false,\n formActionType: 'create',\n loading: false,\n indexPath: []\n }\n\n const state = shallowReactive({ ...defaultState })\n\n function resetState() {\n if (state.row) {\n state.row.isCurrent = false\n }\n\n Object.keys(state).forEach((key) => {\n delete state[key]\n })\n\n Object.assign(state, defaultState)\n }\n\n watch(\n () => state.row,\n (row) => {\n if (row) {\n if (props.model) {\n
|
|
1
|
+
{"version":3,"file":"use-edit-state.js","names":[],"sources":["../../../src/components/batch-edit/use-edit-state.ts"],"sourcesContent":["import { o } from '@cat-kit/core'\nimport { nextTick, shallowReactive, watch, type ShallowRef } from 'vue'\n\nimport type { BatchEditProps, BatchEditStates, FormExposed } from '../../types'\n\ninterface Options {\n props: BatchEditProps\n formRef: ShallowRef<FormExposed | null>\n}\n\nexport function useEditState(options: Options) {\n const { props, formRef } = options\n\n const defaultState: BatchEditStates = {\n depth: -1,\n formVisible: false,\n formActionType: 'create',\n loading: false,\n indexPath: []\n }\n\n const state = shallowReactive({ ...defaultState })\n\n function resetState() {\n if (state.row) {\n state.row.isCurrent = false\n }\n\n Object.keys(state).forEach((key) => {\n delete state[key]\n })\n\n Object.assign(state, defaultState)\n }\n\n watch(\n () => state.row,\n (row) => {\n formRef.value?.reset()\n\n if (row) {\n /** 延迟设置 model,防止表单初始状态丢失 */\n nextTick(() => {\n if (props.model) {\n o(props.model).deepExtend(row.data)\n }\n })\n state.formActionType = props.readonly ? 'view' : 'update'\n state.formVisible = true\n state.depth = row.depth\n state.indexPath = [...row.indexes]\n\n return\n }\n\n resetState()\n }\n )\n\n return { state, resetState }\n}\n"],"mappings":";;;AAUA,SAAgB,aAAa,SAAkB;CAC7C,MAAM,EAAE,OAAO,YAAY;CAE3B,MAAM,eAAgC;EACpC,OAAO;EACP,aAAa;EACb,gBAAgB;EAChB,SAAS;EACT,WAAW,CAAC;CACd;CAEA,MAAM,QAAQ,gBAAgB,EAAE,GAAG,aAAa,CAAC;CAEjD,SAAS,aAAa;EACpB,IAAI,MAAM,KACR,MAAM,IAAI,YAAY;EAGxB,OAAO,KAAK,KAAK,EAAE,SAAS,QAAQ;GAClC,OAAO,MAAM;EACf,CAAC;EAED,OAAO,OAAO,OAAO,YAAY;CACnC;CAEA,YACQ,MAAM,MACX,QAAQ;EACP,QAAQ,OAAO,MAAM;EAErB,IAAI,KAAK;;GAEP,eAAe;IACb,IAAI,MAAM,OACR,EAAE,MAAM,KAAK,EAAE,WAAW,IAAI,IAAI;GAEtC,CAAC;GACD,MAAM,iBAAiB,MAAM,WAAW,SAAS;GACjD,MAAM,cAAc;GACpB,MAAM,QAAQ,IAAI;GAClB,MAAM,YAAY,CAAC,GAAG,IAAI,OAAO;GAEjC;EACF;EAEA,WAAW;CACb,CACF;CAEA,OAAO;EAAE;EAAO;CAAW;AAC7B"}
|
|
@@ -2,17 +2,17 @@ import { CascadeProps } from "../../types/cascade.js";
|
|
|
2
2
|
//#region src/components/cascade/cascade.vue.d.ts
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<CascadeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
4
|
"update:modelValue": (value?: string | string[] | undefined) => any;
|
|
5
|
-
change: (...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any;
|
|
6
5
|
clear: () => any;
|
|
6
|
+
change: (...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<CascadeProps> & Readonly<{
|
|
8
8
|
"onUpdate:modelValue"?: ((value?: string | string[] | undefined) => any) | undefined;
|
|
9
|
-
onChange?: ((...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any) | undefined;
|
|
10
9
|
onClear?: (() => any) | undefined;
|
|
10
|
+
onChange?: ((...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any) | undefined;
|
|
11
11
|
}>, {
|
|
12
|
-
readonly: boolean;
|
|
13
|
-
disabled: boolean;
|
|
14
12
|
labelKey: string;
|
|
15
13
|
valueKey: string;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
readonly: boolean;
|
|
16
16
|
childrenKey: string;
|
|
17
17
|
data: Record<string, any>[];
|
|
18
18
|
placeholder: string;
|
|
@@ -17,9 +17,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
17
17
|
"onUpdate:modelValue"?: ((checked: boolean) => any) | undefined;
|
|
18
18
|
onChange?: ((checked: boolean) => any) | undefined;
|
|
19
19
|
}>, {
|
|
20
|
-
readonly: boolean;
|
|
21
|
-
disabled: boolean;
|
|
22
20
|
type: import("@veltra/utils").ColorType;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
readonly: boolean;
|
|
23
23
|
round: boolean;
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -18,8 +18,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
18
18
|
"onUpdate:modelValue"?: ((checked: boolean) => any) | undefined;
|
|
19
19
|
onChange?: ((checked: boolean, e: MouseEvent) => any) | undefined;
|
|
20
20
|
}>, {
|
|
21
|
-
readonly: boolean;
|
|
22
21
|
disabled: boolean;
|
|
22
|
+
readonly: boolean;
|
|
23
23
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
24
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
25
|
declare const _default: typeof __VLS_export;
|
|
@@ -12,10 +12,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
13
|
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
|
-
readonly: boolean;
|
|
16
|
-
disabled: boolean;
|
|
17
15
|
labelKey: string;
|
|
18
16
|
valueKey: string;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
readonly: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const _default: typeof __VLS_export;
|
|
21
21
|
//#endregion
|
|
@@ -10,8 +10,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
11
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
|
-
readonly: boolean;
|
|
14
13
|
disabled: boolean;
|
|
14
|
+
readonly: boolean;
|
|
15
15
|
dark: boolean;
|
|
16
16
|
defaultLines: number;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -7,8 +7,8 @@ declare const __VLS_export: import("vue").DefineComponent<DatePanelProps, {}, {}
|
|
|
7
7
|
"onSelect:range-date"?: ((rangeDate?: [import("@cat-kit/core").Dater, import("@cat-kit/core").Dater] | undefined) => any) | undefined;
|
|
8
8
|
"onSelect:date"?: ((date: import("@cat-kit/core").Dater) => any) | undefined;
|
|
9
9
|
}>, {
|
|
10
|
-
size: import("@veltra/utils").ComponentSize;
|
|
11
10
|
type: "date" | "month" | "year";
|
|
11
|
+
size: import("@veltra/utils").ComponentSize;
|
|
12
12
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: typeof __VLS_export;
|
|
14
14
|
//#endregion
|
|
@@ -5,9 +5,9 @@ declare const __VLS_export: import("vue").DefineComponent<DatePickerProps, {}, {
|
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<DatePickerProps> & Readonly<{
|
|
6
6
|
"onUpdate:modelValue"?: ((value?: string | number | Date | undefined) => any) | undefined;
|
|
7
7
|
}>, {
|
|
8
|
-
readonly: boolean;
|
|
9
|
-
disabled: boolean;
|
|
10
8
|
type: "date" | "month" | "year";
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
readonly: boolean;
|
|
11
11
|
placeholder: string;
|
|
12
12
|
clearable: boolean;
|
|
13
13
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -5,9 +5,9 @@ declare const __VLS_export: import("vue").DefineComponent<DateRangePickerProps,
|
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<DateRangePickerProps> & Readonly<{
|
|
6
6
|
"onUpdate:modelValue"?: ((value?: [string, string] | undefined) => any) | undefined;
|
|
7
7
|
}>, {
|
|
8
|
-
readonly: boolean;
|
|
9
|
-
disabled: boolean;
|
|
10
8
|
type: "date" | "month" | "year";
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
readonly: boolean;
|
|
11
11
|
placeholder: [string, string];
|
|
12
12
|
clearable: boolean;
|
|
13
13
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -11,8 +11,8 @@ declare const __VLS_base: import("vue").DefineComponent<UploaderProps, {}, {}, {
|
|
|
11
11
|
}, string, import("vue").PublicProps, Readonly<UploaderProps> & Readonly<{
|
|
12
12
|
onPick?: ((files: File[]) => any) | undefined;
|
|
13
13
|
}>, {
|
|
14
|
-
multiple: boolean;
|
|
15
14
|
tag: string;
|
|
15
|
+
multiple: boolean;
|
|
16
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
@@ -15,8 +15,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Inpu
|
|
|
15
15
|
"update:modelValue": (value: string | undefined) => any;
|
|
16
16
|
} & {
|
|
17
17
|
"update:modelValue": (value: string) => any;
|
|
18
|
-
change: (value: string) => any;
|
|
19
18
|
clear: () => any;
|
|
19
|
+
change: (value: string) => any;
|
|
20
20
|
"suffix:click": (value?: string | undefined) => any;
|
|
21
21
|
"prefix:click": (value?: string | undefined) => any;
|
|
22
22
|
focus: (value?: string | undefined) => any;
|
|
@@ -24,16 +24,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Inpu
|
|
|
24
24
|
"native:input": (ev: Event) => any;
|
|
25
25
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
26
26
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
27
|
-
onChange?: ((value: string) => any) | undefined;
|
|
28
27
|
onClear?: (() => any) | undefined;
|
|
28
|
+
onChange?: ((value: string) => any) | undefined;
|
|
29
29
|
"onSuffix:click"?: ((value?: string | undefined) => any) | undefined;
|
|
30
30
|
"onPrefix:click"?: ((value?: string | undefined) => any) | undefined;
|
|
31
31
|
onFocus?: ((value?: string | undefined) => any) | undefined;
|
|
32
32
|
onBlur?: ((value?: string | undefined) => any) | undefined;
|
|
33
33
|
"onNative:input"?: ((ev: Event) => any) | undefined;
|
|
34
34
|
}>, {
|
|
35
|
-
readonly: boolean;
|
|
36
35
|
disabled: boolean;
|
|
36
|
+
readonly: boolean;
|
|
37
37
|
placeholder: string;
|
|
38
38
|
clearable: boolean;
|
|
39
39
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -26,13 +26,13 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
26
26
|
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
27
27
|
onChange?: ((options: Record<string, any>[]) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
|
-
readonly: boolean;
|
|
30
|
-
disabled: boolean;
|
|
31
29
|
labelKey: string;
|
|
32
30
|
valueKey: string;
|
|
33
|
-
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
readonly: boolean;
|
|
34
33
|
placeholder: string;
|
|
35
34
|
clearable: boolean;
|
|
35
|
+
minWidth: string;
|
|
36
36
|
visibilityLimit: number;
|
|
37
37
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -14,22 +14,22 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
14
14
|
"update:modelValue": (value: (string | number)[]) => any;
|
|
15
15
|
} & {
|
|
16
16
|
"update:modelValue": (value: any[]) => any;
|
|
17
|
-
change: (checked: Record<string, any>[]) => any;
|
|
18
17
|
clear: () => any;
|
|
18
|
+
change: (checked: Record<string, any>[]) => any;
|
|
19
19
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
20
20
|
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
21
|
-
onChange?: ((checked: Record<string, any>[]) => any) | undefined;
|
|
22
21
|
onClear?: (() => any) | undefined;
|
|
22
|
+
onChange?: ((checked: Record<string, any>[]) => any) | undefined;
|
|
23
23
|
}>, {
|
|
24
|
-
readonly: boolean;
|
|
25
|
-
disabled: boolean;
|
|
26
|
-
expandAll: boolean;
|
|
27
24
|
labelKey: string;
|
|
28
25
|
valueKey: string;
|
|
29
|
-
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
readonly: boolean;
|
|
28
|
+
expandAll: boolean;
|
|
30
29
|
placeholder: string;
|
|
31
30
|
clearable: boolean;
|
|
32
31
|
filterable: boolean;
|
|
32
|
+
minWidth: string;
|
|
33
33
|
visibilityLimit: number;
|
|
34
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
35
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -13,15 +13,15 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
13
13
|
"update:modelValue": (value: number | undefined) => any;
|
|
14
14
|
} & {
|
|
15
15
|
"update:modelValue": (value?: number | undefined) => any;
|
|
16
|
-
change: (value?: number | undefined) => any;
|
|
17
16
|
clear: () => any;
|
|
17
|
+
change: (value?: number | undefined) => any;
|
|
18
18
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
19
|
"onUpdate:modelValue"?: ((value?: number | undefined) => any) | undefined;
|
|
20
|
-
onChange?: ((value?: number | undefined) => any) | undefined;
|
|
21
20
|
onClear?: (() => any) | undefined;
|
|
21
|
+
onChange?: ((value?: number | undefined) => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
|
-
readonly: boolean;
|
|
24
23
|
disabled: boolean;
|
|
24
|
+
readonly: boolean;
|
|
25
25
|
placeholder: string;
|
|
26
26
|
clearable: boolean;
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
22
22
|
"onUpdate:start"?: ((value: number | undefined) => any) | undefined;
|
|
23
23
|
"onUpdate:end"?: ((value: number | undefined) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
|
-
readonly: boolean;
|
|
26
25
|
disabled: boolean;
|
|
26
|
+
readonly: boolean;
|
|
27
27
|
clearable: boolean;
|
|
28
28
|
startPlaceholder: string;
|
|
29
29
|
endPlaceholder: string;
|
|
@@ -10,8 +10,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
11
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
|
-
readonly: boolean;
|
|
14
13
|
disabled: boolean;
|
|
14
|
+
readonly: boolean;
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
declare const _default: typeof __VLS_export;
|
|
17
17
|
//#endregion
|
|
@@ -13,8 +13,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
13
13
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
14
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
15
15
|
}>, {
|
|
16
|
-
readonly: boolean;
|
|
17
16
|
disabled: boolean;
|
|
17
|
+
readonly: boolean;
|
|
18
18
|
clearable: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -12,8 +12,8 @@ declare const __VLS_base: import("vue").DefineComponent<PopConfirmProps, {}, {},
|
|
|
12
12
|
onConfirm?: (() => any) | undefined;
|
|
13
13
|
onCancel?: (() => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
|
-
direction: TipDirection;
|
|
16
15
|
trigger: "hover" | "click";
|
|
16
|
+
direction: TipDirection;
|
|
17
17
|
icon: import("vue").Component;
|
|
18
18
|
iconColor: string;
|
|
19
19
|
confirmText: string;
|
|
@@ -19,9 +19,9 @@ declare const __VLS_base: import("vue").DefineComponent<ProgressNodesProps, {},
|
|
|
19
19
|
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
20
20
|
onClick?: ((node: Record<string, any>, index: number) => any) | undefined;
|
|
21
21
|
}>, {
|
|
22
|
+
colorType: import("@veltra/utils").ColorType;
|
|
22
23
|
labelKey: string;
|
|
23
24
|
valueKey: string;
|
|
24
|
-
colorType: import("@veltra/utils").ColorType;
|
|
25
25
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
27
27
|
declare const _default: typeof __VLS_export;
|
|
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
14
14
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
15
15
|
onChange?: ((item: Record<string, any>) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
|
-
readonly: boolean;
|
|
18
|
-
disabled: boolean;
|
|
19
17
|
labelKey: string;
|
|
20
18
|
valueKey: string;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
readonly: boolean;
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
//#endregion
|
|
@@ -10,8 +10,8 @@ declare const __VLS_export: import("vue").DefineComponent<RichTextEditorProps &
|
|
|
10
10
|
}> & Readonly<{
|
|
11
11
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
|
-
readonly: boolean;
|
|
14
13
|
disabled: boolean;
|
|
14
|
+
readonly: boolean;
|
|
15
15
|
placeholder: string;
|
|
16
16
|
format: RichTextFormat;
|
|
17
17
|
toolbar: ToolbarItem[];
|
|
@@ -24,10 +24,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
24
24
|
"onUpdate:text"?: ((value: any) => any) | undefined;
|
|
25
25
|
"onUpdate:label"?: ((label?: string | undefined) => any) | undefined;
|
|
26
26
|
}>, {
|
|
27
|
-
readonly: boolean;
|
|
28
|
-
disabled: boolean;
|
|
29
27
|
labelKey: string;
|
|
30
28
|
valueKey: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
readonly: boolean;
|
|
31
31
|
placeholder: string;
|
|
32
32
|
clearable: boolean;
|
|
33
33
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -6,14 +6,14 @@ type __VLS_Slots = {
|
|
|
6
6
|
tip?: (scope: StepsSlotScope) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<StepsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
-
"item-click": (item: Record<string, any>, index: number) => any;
|
|
10
9
|
"update:current": (value?: string | number | undefined) => any;
|
|
10
|
+
"item-click": (item: Record<string, any>, index: number) => any;
|
|
11
11
|
}, string, import("vue").PublicProps, Readonly<StepsProps> & Readonly<{
|
|
12
|
-
"onItem-click"?: ((item: Record<string, any>, index: number) => any) | undefined;
|
|
13
12
|
"onUpdate:current"?: ((value?: string | number | undefined) => any) | undefined;
|
|
13
|
+
"onItem-click"?: ((item: Record<string, any>, index: number) => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
|
-
direction: "horizontal" | "vertical";
|
|
16
15
|
labelKey: string;
|
|
16
|
+
direction: "horizontal" | "vertical";
|
|
17
17
|
finishedStepType: import("@veltra/utils").ColorType;
|
|
18
18
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
19
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -14,8 +14,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
14
14
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
15
15
|
onChange?: ((value: boolean) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
|
-
readonly: boolean;
|
|
18
17
|
disabled: boolean;
|
|
18
|
+
readonly: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const _default: typeof __VLS_export;
|
|
21
21
|
//#endregion
|
|
@@ -15,12 +15,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
15
15
|
"update:modelValue": (value: string | undefined) => any;
|
|
16
16
|
} & {
|
|
17
17
|
"update:modelValue": (value: string) => any;
|
|
18
|
-
close: (item: TabItem, index: number) => any;
|
|
19
18
|
click: (item: TabItem, index: number) => any;
|
|
19
|
+
close: (item: TabItem, index: number) => any;
|
|
20
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
21
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
22
|
-
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
22
|
onClick?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
|
+
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
25
|
closable: boolean;
|
|
26
26
|
position: "top" | "bottom";
|
|
@@ -15,12 +15,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
15
15
|
"update:modelValue": (value: string | undefined) => any;
|
|
16
16
|
} & {
|
|
17
17
|
"update:modelValue": (value: string) => any;
|
|
18
|
-
close: (item: TabItem, index: number) => any;
|
|
19
18
|
click: (item: TabItem, index: number) => any;
|
|
19
|
+
close: (item: TabItem, index: number) => any;
|
|
20
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
21
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
22
|
-
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
22
|
onClick?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
|
+
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
25
|
closable: boolean;
|
|
26
26
|
position: "left" | "right";
|
|
@@ -10,12 +10,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
10
10
|
"update:modelValue": (value: string | undefined) => any;
|
|
11
11
|
} & {
|
|
12
12
|
"update:modelValue": (value: string) => any;
|
|
13
|
-
close: (item: TabItem, index: number) => any;
|
|
14
13
|
click: (item: TabItem, index: number) => any;
|
|
14
|
+
close: (item: TabItem, index: number) => any;
|
|
15
15
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
16
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
17
|
-
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
18
17
|
onClick?: ((item: TabItem, index: number) => any) | undefined;
|
|
18
|
+
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
19
19
|
}>, {
|
|
20
20
|
closable: boolean;
|
|
21
21
|
position: "left" | "right" | "top" | "bottom";
|
|
@@ -9,19 +9,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
9
9
|
"update:modelValue": (value: string | undefined) => any;
|
|
10
10
|
} & {
|
|
11
11
|
"update:modelValue": (value: string) => any;
|
|
12
|
-
change: (value: string) => any;
|
|
13
12
|
clear: () => any;
|
|
13
|
+
change: (value: string) => any;
|
|
14
14
|
focus: () => any;
|
|
15
15
|
blur: () => any;
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
17
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
18
|
-
onChange?: ((value: string) => any) | undefined;
|
|
19
18
|
onClear?: (() => any) | undefined;
|
|
19
|
+
onChange?: ((value: string) => any) | undefined;
|
|
20
20
|
onFocus?: (() => any) | undefined;
|
|
21
21
|
onBlur?: (() => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
|
-
readonly: boolean;
|
|
24
23
|
disabled: boolean;
|
|
24
|
+
readonly: boolean;
|
|
25
25
|
placeholder: string;
|
|
26
26
|
clearable: boolean;
|
|
27
27
|
resize: boolean;
|
|
@@ -9,10 +9,10 @@ declare const __VLS_base: import("vue").DefineComponent<TipProps, {}, {}, {}, {}
|
|
|
9
9
|
}, string, import("vue").PublicProps, Readonly<TipProps> & Readonly<{
|
|
10
10
|
"onUpdate:visible"?: ((value: boolean) => any) | undefined;
|
|
11
11
|
}>, {
|
|
12
|
-
direction: TipDirection;
|
|
13
12
|
trigger: "hover" | "click";
|
|
14
13
|
contentTag: string;
|
|
15
14
|
visible: boolean;
|
|
15
|
+
direction: TipDirection;
|
|
16
16
|
content: string;
|
|
17
17
|
alignment: TipAlign;
|
|
18
18
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -19,9 +19,9 @@ declare const __VLS_base: import("vue").DefineComponent<TreeProps, _TreeExposed,
|
|
|
19
19
|
"onNode-contextmenu"?: ((event: MouseEvent, node: TreeNode<Record<string, any>>) => any) | undefined;
|
|
20
20
|
"onSelected-synced"?: ((selected?: Record<string, any> | undefined) => any) | undefined;
|
|
21
21
|
}>, {
|
|
22
|
-
expandOnClickNode: boolean;
|
|
23
22
|
labelKey: string;
|
|
24
23
|
valueKey: string;
|
|
24
|
+
expandOnClickNode: boolean;
|
|
25
25
|
childrenKey: string;
|
|
26
26
|
data: Record<string, any>[];
|
|
27
27
|
checkStrictly: boolean;
|
|
@@ -14,24 +14,24 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
14
14
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
15
|
"update:modelValue": (value: string | number | undefined) => any;
|
|
16
16
|
} & {
|
|
17
|
-
change: (value?: string | number | undefined, selectedData?: Record<string, any> | undefined) => any;
|
|
18
17
|
clear: () => any;
|
|
18
|
+
change: (value?: string | number | undefined, selectedData?: Record<string, any> | undefined) => any;
|
|
19
19
|
"update:text": (text?: string | undefined) => any;
|
|
20
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
21
|
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
22
|
-
onChange?: ((value?: string | number | undefined, selectedData?: Record<string, any> | undefined) => any) | undefined;
|
|
23
22
|
onClear?: (() => any) | undefined;
|
|
23
|
+
onChange?: ((value?: string | number | undefined, selectedData?: Record<string, any> | undefined) => any) | undefined;
|
|
24
24
|
"onUpdate:text"?: ((text?: string | undefined) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
|
-
readonly: boolean;
|
|
27
|
-
disabled: boolean;
|
|
28
|
-
expandAll: boolean;
|
|
29
26
|
labelKey: string;
|
|
30
27
|
valueKey: string;
|
|
31
|
-
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
readonly: boolean;
|
|
30
|
+
expandAll: boolean;
|
|
32
31
|
placeholder: string;
|
|
33
32
|
clearable: boolean;
|
|
34
33
|
filterable: boolean;
|
|
34
|
+
minWidth: string;
|
|
35
35
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
36
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
37
|
declare const _default: typeof __VLS_export;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltra/desktop",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src"
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"@cat-kit/core": ">=1.1.6",
|
|
69
69
|
"@cat-kit/excel": ">=1.0.0",
|
|
70
70
|
"@cat-kit/fe": "^1.1.6",
|
|
71
|
-
"@veltra/compositions": "1.2.
|
|
72
|
-
"@veltra/directives": "1.2.
|
|
73
|
-
"@veltra/icons": "1.2.
|
|
74
|
-
"@veltra/styles": "1.2.
|
|
75
|
-
"@veltra/utils": "1.2.
|
|
71
|
+
"@veltra/compositions": "1.2.10",
|
|
72
|
+
"@veltra/directives": "1.2.10",
|
|
73
|
+
"@veltra/icons": "1.2.10",
|
|
74
|
+
"@veltra/styles": "1.2.10",
|
|
75
|
+
"@veltra/utils": "1.2.10",
|
|
76
76
|
"vue": ">=3.5.0"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -69,7 +69,6 @@ import { Close } from '@veltra/icons/normal'
|
|
|
69
69
|
import { bem } from '@veltra/utils'
|
|
70
70
|
import { computed, inject, shallowRef, toRef } from 'vue'
|
|
71
71
|
|
|
72
|
-
import type { BatchEditSlots } from '../../types'
|
|
73
72
|
import type { _FormExposed, FormExposed } from '../../types/form'
|
|
74
73
|
import { UButton } from '../button'
|
|
75
74
|
import { UForm } from '../form'
|
|
@@ -46,7 +46,7 @@ const cls = bem('batch-edit')
|
|
|
46
46
|
|
|
47
47
|
const formRef = useTemplateRef<FormExposed>('form')
|
|
48
48
|
|
|
49
|
-
const { state, resetState } = useEditState({ props })
|
|
49
|
+
const { state, resetState } = useEditState({ props, formRef })
|
|
50
50
|
|
|
51
51
|
const { staticFeatures, dynamicFeatures } = useFeatures({ props })
|
|
52
52
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { o } from '@cat-kit/core'
|
|
2
|
-
import { shallowReactive, watch } from 'vue'
|
|
2
|
+
import { nextTick, shallowReactive, watch, type ShallowRef } from 'vue'
|
|
3
3
|
|
|
4
|
-
import type { BatchEditProps, BatchEditStates } from '../../types'
|
|
4
|
+
import type { BatchEditProps, BatchEditStates, FormExposed } from '../../types'
|
|
5
5
|
|
|
6
6
|
interface Options {
|
|
7
7
|
props: BatchEditProps
|
|
8
|
+
formRef: ShallowRef<FormExposed | null>
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export function useEditState(options: Options) {
|
|
11
|
-
const { props } = options
|
|
12
|
+
const { props, formRef } = options
|
|
12
13
|
|
|
13
14
|
const defaultState: BatchEditStates = {
|
|
14
15
|
depth: -1,
|
|
@@ -35,10 +36,15 @@ export function useEditState(options: Options) {
|
|
|
35
36
|
watch(
|
|
36
37
|
() => state.row,
|
|
37
38
|
(row) => {
|
|
39
|
+
formRef.value?.reset()
|
|
40
|
+
|
|
38
41
|
if (row) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
/** 延迟设置 model,防止表单初始状态丢失 */
|
|
43
|
+
nextTick(() => {
|
|
44
|
+
if (props.model) {
|
|
45
|
+
o(props.model).deepExtend(row.data)
|
|
46
|
+
}
|
|
47
|
+
})
|
|
42
48
|
state.formActionType = props.readonly ? 'view' : 'update'
|
|
43
49
|
state.formVisible = true
|
|
44
50
|
state.depth = row.depth
|