@gx-design-vue/pro-table 0.2.0-alpha.2 → 0.2.0-alpha.21
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/ProTable.d.ts +14 -493
- package/dist/ProTable.js +902 -511
- package/dist/components/Drag/Handle.d.ts +90 -0
- package/dist/components/Drag/Handle.js +64 -0
- package/dist/components/Drag/Tbody.d.ts +17 -0
- package/dist/components/Drag/Tbody.js +27 -0
- package/dist/components/EllipsisText/index.d.ts +50 -0
- package/dist/components/EllipsisText/index.js +65 -0
- package/dist/components/ScrollBar/Bar.d.ts +79 -0
- package/dist/components/ScrollBar/Bar.js +84 -0
- package/dist/components/ScrollBar/Thumb.d.ts +50 -0
- package/dist/components/ScrollBar/{Thumb/index.js → Thumb.js} +67 -58
- package/dist/components/ScrollBar/context.d.ts +3 -4
- package/dist/components/ScrollBar/context.js +3 -5
- package/dist/components/ScrollBar/util.d.ts +6 -5
- package/dist/components/ScrollBar/util.js +1 -14
- package/dist/components/SearchForm/CollapseToggle.d.ts +53 -0
- package/dist/components/SearchForm/CollapseToggle.js +47 -0
- package/dist/components/SearchForm/FormItemContainer.d.ts +73 -0
- package/dist/components/SearchForm/FormItemContainer.js +225 -0
- package/dist/components/SearchForm/FormItemWrapper.d.ts +80 -0
- package/dist/components/SearchForm/FormItemWrapper.js +62 -0
- package/dist/components/SearchForm/SearchForm.d.ts +128 -0
- package/dist/components/SearchForm/SearchForm.js +319 -0
- package/dist/components/SearchForm/index.d.ts +2 -0
- package/dist/components/SearchForm/index.js +2 -0
- package/dist/components/Toolbar/FullscreenIcon.d.ts +24 -0
- package/dist/components/Toolbar/FullscreenIcon.js +22 -0
- package/dist/components/Toolbar/ListToolBar.d.ts +109 -0
- package/dist/components/Toolbar/ListToolBar.js +101 -0
- package/dist/components/Toolbar/index.d.ts +101 -0
- package/dist/components/Toolbar/index.js +101 -0
- package/dist/components/Toolbar/style.d.ts +8 -0
- package/dist/components/{ListToolBar → Toolbar}/style.js +32 -27
- package/dist/context/TableContext.d.ts +15 -27
- package/dist/context/TableContext.js +3 -5
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/useAutoScroll.d.ts +32 -0
- package/dist/hooks/useAutoScroll.js +127 -0
- package/dist/hooks/useBreakpoints.d.ts +13 -0
- package/dist/hooks/useBreakpoints.js +65 -0
- package/dist/hooks/useCellRender.d.ts +13 -0
- package/dist/hooks/useCellRender.js +40 -0
- package/dist/hooks/useColumnResize.d.ts +29 -0
- package/dist/hooks/useColumnResize.js +112 -0
- package/dist/hooks/useColumns.d.ts +35 -24
- package/dist/hooks/useColumns.js +89 -58
- package/dist/hooks/useDragHandleColumn.d.ts +26 -0
- package/dist/hooks/useDragHandleColumn.js +52 -0
- package/dist/hooks/useEllipsis.d.ts +20 -0
- package/dist/hooks/useEllipsis.js +51 -0
- package/dist/hooks/useFetchData.d.ts +42 -65
- package/dist/hooks/useFetchData.js +160 -176
- package/dist/hooks/useFitPage.d.ts +19 -0
- package/dist/hooks/useFitPage.js +90 -0
- package/dist/hooks/useKeepAliveReload.d.ts +21 -0
- package/dist/hooks/useKeepAliveReload.js +24 -0
- package/dist/hooks/useLoading.d.ts +18 -7
- package/dist/hooks/useLoading.js +27 -11
- package/dist/hooks/usePagination.d.ts +10 -7
- package/dist/hooks/usePagination.js +38 -29
- package/dist/hooks/useRequestOptions.d.ts +18 -0
- package/dist/hooks/useRequestOptions.js +39 -0
- package/dist/hooks/useRowDrag.d.ts +42 -0
- package/dist/hooks/useRowDrag.js +268 -0
- package/dist/hooks/useRowSelection.d.ts +27 -15
- package/dist/hooks/useRowSelection.js +93 -80
- package/dist/hooks/useTable.d.ts +35 -77
- package/dist/hooks/useTable.js +76 -49
- package/dist/hooks/useTableForm.d.ts +17 -82
- package/dist/hooks/useTableForm.js +137 -52
- package/dist/hooks/useTableScroll.d.ts +33 -31
- package/dist/hooks/useTableScroll.js +71 -28
- package/dist/hooks/useTableSize.d.ts +17 -7
- package/dist/hooks/useTableSize.js +21 -9
- package/dist/index.d.ts +11 -7
- package/dist/index.js +10 -4
- package/dist/interface.d.ts +537 -0
- package/dist/interface.js +1 -0
- package/dist/pro-table.esm.js +8897 -4012
- package/dist/pro-table.js +4 -1
- package/dist/style/ellipsis.d.ts +13 -0
- package/dist/style/ellipsis.js +16 -0
- package/dist/style/fit-page.d.ts +4 -2
- package/dist/style/fit-page.js +10 -5
- package/dist/style/index.d.ts +3 -7
- package/dist/style/index.js +38 -76
- package/dist/style/list.d.ts +4 -2
- package/dist/style/list.js +2 -12
- package/dist/style/resizable.d.ts +8 -0
- package/dist/style/resizable.js +18 -0
- package/dist/style/row-drag.d.ts +8 -0
- package/dist/style/row-drag.js +44 -0
- package/dist/style/scroll.d.ts +4 -2
- package/dist/style/scroll.js +9 -9
- package/dist/style/search.d.ts +8 -0
- package/dist/{components/Form/style.js → style/search.js} +22 -9
- package/dist/theme/augment.d.ts +8 -0
- package/dist/theme/augment.js +1 -0
- package/dist/theme/interface/components.d.ts +8 -0
- package/dist/theme/interface/components.js +1 -0
- package/dist/utils/arrayMove.d.ts +9 -0
- package/dist/utils/arrayMove.js +15 -0
- package/dist/utils/dateFormat.d.ts +9 -0
- package/dist/utils/dateFormat.js +29 -0
- package/dist/utils/ellipsis.d.ts +19 -0
- package/dist/utils/ellipsis.js +30 -0
- package/dist/utils/flipAnimate.d.ts +25 -0
- package/dist/utils/flipAnimate.js +40 -0
- package/dist/utils/formConstants.d.ts +9 -0
- package/dist/utils/formConstants.js +29 -0
- package/dist/utils/valueFormat.d.ts +9 -0
- package/dist/utils/valueFormat.js +27 -0
- package/package.json +23 -11
- package/dist/components/Form/components/RequestSelect.d.ts +0 -50
- package/dist/components/Form/components/RequestSelect.js +0 -58
- package/dist/components/Form/hooks/useForm.d.ts +0 -11
- package/dist/components/Form/hooks/useForm.js +0 -32
- package/dist/components/Form/index.d.ts +0 -33
- package/dist/components/Form/index.js +0 -479
- package/dist/components/Form/style.d.ts +0 -6
- package/dist/components/Form/utils/config.d.ts +0 -9
- package/dist/components/Form/utils/config.js +0 -30
- package/dist/components/Form/utils/dateFormat.d.ts +0 -22
- package/dist/components/Form/utils/dateFormat.js +0 -45
- package/dist/components/ListToolBar/index.d.ts +0 -60
- package/dist/components/ListToolBar/index.js +0 -123
- package/dist/components/ListToolBar/style.d.ts +0 -6
- package/dist/components/ScrollBar/Bar/index.d.ts +0 -49
- package/dist/components/ScrollBar/Bar/index.js +0 -71
- package/dist/components/ScrollBar/Bar/props.d.ts +0 -25
- package/dist/components/ScrollBar/Bar/props.js +0 -18
- package/dist/components/ScrollBar/Thumb/index.d.ts +0 -40
- package/dist/components/ScrollBar/Thumb/props.d.ts +0 -20
- package/dist/components/ScrollBar/Thumb/props.js +0 -18
- package/dist/components/TableCell/index.d.ts +0 -37
- package/dist/components/TableCell/index.js +0 -72
- package/dist/components/ToolBar/FullscreenIcon.d.ts +0 -7
- package/dist/components/ToolBar/FullscreenIcon.js +0 -14
- package/dist/components/ToolBar/index.d.ts +0 -34
- package/dist/components/ToolBar/index.js +0 -100
- package/dist/hooks/tryOnActivated.d.ts +0 -6
- package/dist/hooks/tryOnActivated.js +0 -14
- package/dist/hooks/useDebounceFn.d.ts +0 -8
- package/dist/hooks/useDebounceFn.js +0 -34
- package/dist/hooks/useScrollArea.d.ts +0 -24
- package/dist/hooks/useScrollArea.js +0 -104
- package/dist/props.d.ts +0 -340
- package/dist/props.js +0 -251
- package/dist/types/ColumnTypings.d.ts +0 -129
- package/dist/types/ColumnTypings.js +0 -1
- package/dist/types/SlotsTypings.d.ts +0 -63
- package/dist/types/SlotsTypings.js +0 -13
- package/dist/types/TableTypings.d.ts +0 -359
- package/dist/types/TableTypings.js +0 -1
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.js +0 -1
- package/dist/utils/utils.d.ts +0 -10
- package/dist/utils/utils.js +0 -91
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/utils/flipAnimate.ts
|
|
2
|
+
/**
|
|
3
|
+
* FLIP 动画 —— 精简复刻 `@dnd-kit/dom` 的 `sortable#animate`。
|
|
4
|
+
*
|
|
5
|
+
* 用 Web Animations API(`element.animate`)+ CSS `translate` 属性(非 transform):
|
|
6
|
+
* 1. 取消元素上 transform/translate/scale 的 CSS transition(避免 getBoundingClientRect 取到中间帧)
|
|
7
|
+
* 2. 测新旧位置算 `delta = prev.top - next.top`(同时支持 X/Y)
|
|
8
|
+
* 3. `el.animate({ translate: [delta, 0] }, { duration, easing })`
|
|
9
|
+
*
|
|
10
|
+
* 命中 `prefers-reduced-motion` 时 duration 置 0。
|
|
11
|
+
*/
|
|
12
|
+
function flipAnimate(entries, prevRects, options = {}) {
|
|
13
|
+
const { duration = 200, easing = "cubic-bezier(0.2,0,0,1)" } = options;
|
|
14
|
+
const finalDuration = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : duration;
|
|
15
|
+
for (const { key, el } of entries) {
|
|
16
|
+
const prev = prevRects.get(key);
|
|
17
|
+
if (!prev) continue;
|
|
18
|
+
for (const animation of el.getAnimations()) {
|
|
19
|
+
const transitionProperty = animation.transitionProperty;
|
|
20
|
+
if (transitionProperty === "transform" || transitionProperty === "translate" || transitionProperty === "scale") animation.cancel();
|
|
21
|
+
}
|
|
22
|
+
const next = el.getBoundingClientRect();
|
|
23
|
+
const deltaX = prev.left - next.left;
|
|
24
|
+
const deltaY = prev.top - next.top;
|
|
25
|
+
if (deltaX === 0 && deltaY === 0) continue;
|
|
26
|
+
const animation = el.animate({ translate: [`${deltaX}px ${deltaY}px`, "0px 0px"] }, {
|
|
27
|
+
duration: finalDuration,
|
|
28
|
+
easing
|
|
29
|
+
});
|
|
30
|
+
const clearTranslate = () => {
|
|
31
|
+
el.style.translate = "";
|
|
32
|
+
};
|
|
33
|
+
if ("addEventListener" in animation) {
|
|
34
|
+
animation.addEventListener("finish", clearTranslate, { once: true });
|
|
35
|
+
animation.addEventListener("cancel", clearTranslate, { once: true });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { flipAnimate };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/utils/formConstants.ts
|
|
2
|
+
const DEFAULT_BREAKPOINT_SPANS = [
|
|
3
|
+
{
|
|
4
|
+
breakpoint: "xxl",
|
|
5
|
+
span: 5
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
breakpoint: "xl",
|
|
9
|
+
span: 4
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
breakpoint: "lg",
|
|
13
|
+
span: 3
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
breakpoint: "md",
|
|
17
|
+
span: 2
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
breakpoint: "sm",
|
|
21
|
+
span: 2
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
breakpoint: "xs",
|
|
25
|
+
span: 1
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
//#endregion
|
|
29
|
+
export { DEFAULT_BREAKPOINT_SPANS };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProColumnsValueType } from "../interface.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/valueFormat.d.ts
|
|
4
|
+
interface ValueFormatOptions {
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function valueFormat(value: any, valueType: ProColumnsValueType | undefined, options?: ValueFormatOptions): any;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ValueFormatOptions, valueFormat };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
import { isNil, isObject } from "@gx-design-vue/pro-utils";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
//#region src/utils/valueFormat.ts
|
|
5
|
+
function valueFormat(value, valueType, options = {}) {
|
|
6
|
+
if (isNil(value) || value === "") return value;
|
|
7
|
+
if (!valueType || valueType === "text") return value;
|
|
8
|
+
if (isObject(valueType) && !Array.isArray(valueType)) {
|
|
9
|
+
const config = valueType;
|
|
10
|
+
const tagName = config.node ?? "span";
|
|
11
|
+
return h(tagName === "a" ? "span" : tagName, {
|
|
12
|
+
class: config.class,
|
|
13
|
+
...config.attr ?? {},
|
|
14
|
+
...config.click ? { onClick: config.click } : {}
|
|
15
|
+
}, value);
|
|
16
|
+
}
|
|
17
|
+
switch (valueType) {
|
|
18
|
+
case "link": return h("span", { class: [`${options.className}-a`] }, value);
|
|
19
|
+
case "time": return dayjs(value).format("HH:mm:ss");
|
|
20
|
+
case "dateMonth": return `${dayjs(value).month() + 1}月`;
|
|
21
|
+
case "date": return dayjs(value).format("YYYY-MM-DD");
|
|
22
|
+
case "dateTime": return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
|
|
23
|
+
default: return value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { valueFormat };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gx-design-vue/pro-table",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.0-alpha.
|
|
4
|
+
"version": "0.2.0-alpha.21",
|
|
5
5
|
"description": "Gx Design Pro Table",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "gx12358",
|
|
@@ -37,20 +37,32 @@
|
|
|
37
37
|
"package.json"
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
|
+
"@antdv-next/cssinjs": "^1.0.6",
|
|
41
|
+
"@chenglou/pretext": "^0.0.8",
|
|
42
|
+
"@gx-design-vue/context": "^0.0.5-alpha.8",
|
|
43
|
+
"@gx-design-vue/icon": "^0.0.1-alpha.13",
|
|
44
|
+
"@gx-design-vue/pro-hooks": "^0.2.0-alpha.8",
|
|
45
|
+
"@gx-design-vue/pro-provider": "^0.1.0-alpha.17",
|
|
46
|
+
"@gx-design-vue/pro-utils": "^0.2.0-alpha.10",
|
|
47
|
+
"antdv-next": "^1.4.1",
|
|
40
48
|
"vue": ">=3.2.0"
|
|
41
49
|
},
|
|
42
50
|
"dependencies": {
|
|
43
|
-
"@ant-design/icons-vue": "^7.0.1",
|
|
44
51
|
"@ctrl/tinycolor": "^3.5.0",
|
|
45
|
-
"@vueuse/core": "^14.
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
53
|
-
"
|
|
52
|
+
"@vueuse/core": "^14.3.0",
|
|
53
|
+
"dayjs": "^1.11.21",
|
|
54
|
+
"es-toolkit": "1.48.1"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@antdv-next/cssinjs": "^1.0.6",
|
|
58
|
+
"@chenglou/pretext": "^0.0.8",
|
|
59
|
+
"antdv-next": "^1.4.1",
|
|
60
|
+
"vue": "^3.5.38",
|
|
61
|
+
"@gx-design-vue/icon": "^0.0.1-alpha.13",
|
|
62
|
+
"@gx-design-vue/pro-hooks": "^0.2.0-alpha.8",
|
|
63
|
+
"@gx-design-vue/pro-provider": "^0.1.0-alpha.17",
|
|
64
|
+
"@gx-design-vue/pro-utils": "^0.2.0-alpha.10",
|
|
65
|
+
"@gx-design-vue/context": "^0.0.5-alpha.8"
|
|
54
66
|
},
|
|
55
67
|
"browserslist": [
|
|
56
68
|
"> 1%",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ProSchemaValueEnumType } from "../../../types/ColumnTypings.js";
|
|
2
|
-
import * as vue199 from "vue";
|
|
3
|
-
import { PropType } from "vue";
|
|
4
|
-
|
|
5
|
-
//#region src/components/Form/components/RequestSelect.d.ts
|
|
6
|
-
declare const _default: vue199.DefineComponent<vue199.ExtractPropTypes<{
|
|
7
|
-
fetch: PropType<() => Promise<ProSchemaValueEnumType[]>>;
|
|
8
|
-
loading: {
|
|
9
|
-
type: PropType<boolean>;
|
|
10
|
-
default: boolean;
|
|
11
|
-
};
|
|
12
|
-
debounceTime: PropType<number>;
|
|
13
|
-
manual: {
|
|
14
|
-
type: PropType<boolean>;
|
|
15
|
-
default: any;
|
|
16
|
-
};
|
|
17
|
-
fieldName: {
|
|
18
|
-
type: PropType<string>;
|
|
19
|
-
default: string;
|
|
20
|
-
};
|
|
21
|
-
notFoundContent: {
|
|
22
|
-
type: PropType<(loading: boolean) => any>;
|
|
23
|
-
};
|
|
24
|
-
}>, () => vue199.VNode<vue199.RendererNode, vue199.RendererElement, {
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
}>, {}, {}, {}, vue199.ComponentOptionsMixin, vue199.ComponentOptionsMixin, {}, string, vue199.PublicProps, Readonly<vue199.ExtractPropTypes<{
|
|
27
|
-
fetch: PropType<() => Promise<ProSchemaValueEnumType[]>>;
|
|
28
|
-
loading: {
|
|
29
|
-
type: PropType<boolean>;
|
|
30
|
-
default: boolean;
|
|
31
|
-
};
|
|
32
|
-
debounceTime: PropType<number>;
|
|
33
|
-
manual: {
|
|
34
|
-
type: PropType<boolean>;
|
|
35
|
-
default: any;
|
|
36
|
-
};
|
|
37
|
-
fieldName: {
|
|
38
|
-
type: PropType<string>;
|
|
39
|
-
default: string;
|
|
40
|
-
};
|
|
41
|
-
notFoundContent: {
|
|
42
|
-
type: PropType<(loading: boolean) => any>;
|
|
43
|
-
};
|
|
44
|
-
}>> & Readonly<{}>, {
|
|
45
|
-
loading: boolean;
|
|
46
|
-
manual: boolean;
|
|
47
|
-
fieldName: string;
|
|
48
|
-
}, {}, {}, {}, string, vue199.ComponentProvideOptions, true, {}, any>;
|
|
49
|
-
//#endregion
|
|
50
|
-
export { _default as default };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { cloneVNode, defineComponent, ref, watch } from "vue";
|
|
2
|
-
import { isArray } from "@gx-design-vue/pro-utils";
|
|
3
|
-
import { useDebounceFn } from "@vueuse/core";
|
|
4
|
-
import { cloneDeep as cloneDeep$1 } from "es-toolkit";
|
|
5
|
-
|
|
6
|
-
//#region src/components/Form/components/RequestSelect.tsx
|
|
7
|
-
var RequestSelect_default = /* @__PURE__ */ defineComponent({
|
|
8
|
-
name: "RequestSelect",
|
|
9
|
-
props: {
|
|
10
|
-
fetch: Function,
|
|
11
|
-
loading: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: false
|
|
14
|
-
},
|
|
15
|
-
debounceTime: Number,
|
|
16
|
-
manual: {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
default: void 0
|
|
19
|
-
},
|
|
20
|
-
fieldName: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: "options"
|
|
23
|
-
},
|
|
24
|
-
notFoundContent: { type: Function }
|
|
25
|
-
},
|
|
26
|
-
setup(props, { slots }) {
|
|
27
|
-
const options = ref([]);
|
|
28
|
-
const loading = ref(props.loading);
|
|
29
|
-
const status = ref("init");
|
|
30
|
-
const debouncedFn = useDebounceFn(props.fetch, props.debounceTime || 10);
|
|
31
|
-
watch([() => props.fetch, () => props.manual], () => {
|
|
32
|
-
if (status.value !== "init" && loading.value) return;
|
|
33
|
-
const manual = props.manual ?? false;
|
|
34
|
-
if (props.fetch && !manual) {
|
|
35
|
-
loading.value = true;
|
|
36
|
-
debouncedFn().then((result) => {
|
|
37
|
-
options.value = cloneDeep$1(result);
|
|
38
|
-
status.value = "success";
|
|
39
|
-
}).catch((e) => {
|
|
40
|
-
console.error(e);
|
|
41
|
-
status.value = "error";
|
|
42
|
-
}).finally(() => {
|
|
43
|
-
loading.value = false;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}, { immediate: true });
|
|
47
|
-
return () => {
|
|
48
|
-
const children = slots.default?.();
|
|
49
|
-
return cloneVNode(isArray(children) ? children[0] : children, {
|
|
50
|
-
options: options.value,
|
|
51
|
-
notFoundContent: props.notFoundContent?.(loading.value)
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
//#endregion
|
|
58
|
-
export { RequestSelect_default as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ProSearchMap } from "../../../types/ColumnTypings.js";
|
|
2
|
-
import { Ref } from "vue";
|
|
3
|
-
|
|
4
|
-
//#region src/components/Form/hooks/useForm.d.ts
|
|
5
|
-
declare function useForm(defaultState: Ref<any>, searchMap: Ref<ProSearchMap[]>): {
|
|
6
|
-
formState: any;
|
|
7
|
-
resetFormState: () => void;
|
|
8
|
-
changeFormState: (key: string, value: any) => void;
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { useForm };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { reactive, toRaw, watch } from "vue";
|
|
2
|
-
import { cloneDeep } from "@gx-design-vue/pro-utils";
|
|
3
|
-
|
|
4
|
-
//#region src/components/Form/hooks/useForm.ts
|
|
5
|
-
function useForm(defaultState, searchMap) {
|
|
6
|
-
const formState = reactive({});
|
|
7
|
-
function resetFormState() {
|
|
8
|
-
Object.assign(formState, cloneDeep(toRaw(defaultState.value)));
|
|
9
|
-
const dateRangeRecord = searchMap.value.find((item) => item.valueType === "dateRange");
|
|
10
|
-
if (dateRangeRecord && dateRangeRecord.name) {
|
|
11
|
-
const value = dateRangeRecord.rangeStartName || dateRangeRecord.rangeEndName ? defaultState.value[dateRangeRecord.rangeStartName || "start"] ? [defaultState.value[dateRangeRecord.rangeStartName || "start"], defaultState.value[dateRangeRecord.rangeEndName || "end"]] : void 0 : defaultState.value[dateRangeRecord.name];
|
|
12
|
-
changeFormState(dateRangeRecord.name, value);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
watch(() => defaultState.value, () => {
|
|
16
|
-
resetFormState();
|
|
17
|
-
}, {
|
|
18
|
-
deep: true,
|
|
19
|
-
immediate: true
|
|
20
|
-
});
|
|
21
|
-
function changeFormState(key, value) {
|
|
22
|
-
if (key) formState[key] = value;
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
formState,
|
|
26
|
-
resetFormState,
|
|
27
|
-
changeFormState
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { useForm };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ProSearchMap } from "../../types/ColumnTypings.js";
|
|
2
|
-
import { ProTableProps } from "../../types/TableTypings.js";
|
|
3
|
-
import "../../index.js";
|
|
4
|
-
import { DefineComponent, ExtractPropTypes, PropType } from "vue";
|
|
5
|
-
import { RecordType } from "@gx-design-vue/pro-utils";
|
|
6
|
-
import * as ant_design_vue1 from "ant-design-vue";
|
|
7
|
-
|
|
8
|
-
//#region src/components/Form/index.d.ts
|
|
9
|
-
declare const tableForm: {
|
|
10
|
-
modalScroll: PropType<boolean>;
|
|
11
|
-
formCols: {
|
|
12
|
-
type: PropType<ProSearchMap[]>;
|
|
13
|
-
default: () => any[];
|
|
14
|
-
};
|
|
15
|
-
loading: {
|
|
16
|
-
type: PropType<boolean | ant_design_vue1.SpinProps>;
|
|
17
|
-
default: any;
|
|
18
|
-
};
|
|
19
|
-
cardBordered: {
|
|
20
|
-
type: PropType<ProTableProps["showIndex"]>;
|
|
21
|
-
default: boolean;
|
|
22
|
-
};
|
|
23
|
-
prefixCls: PropType<string>;
|
|
24
|
-
defaultFormSearch: {
|
|
25
|
-
type: PropType<RecordType>;
|
|
26
|
-
default: () => {};
|
|
27
|
-
};
|
|
28
|
-
onSearch: PropType<(formState: any, buttonActions?: "reset" | "submit") => any>;
|
|
29
|
-
};
|
|
30
|
-
type ProTableFormProps = ExtractPropTypes<typeof tableForm>;
|
|
31
|
-
declare const ProTableForm: DefineComponent<ProTableFormProps>;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { ProTableFormProps, ProTableForm as default };
|