orion-design 0.1.52 → 0.1.53
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/Pagetable/hooks/usePagetable.d.ts +17 -15
- package/dist/components/Pagetable/hooks/usePagetable.js +15 -14
- package/dist/components/Pagetable/hooks/usePagetable.js.map +1 -1
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +1 -1
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
@@ -4,35 +4,37 @@ interface PaginationProps {
|
|
4
4
|
pageSizes?: number[];
|
5
5
|
total?: number;
|
6
6
|
}
|
7
|
-
type LoadDataFn<
|
8
|
-
data:
|
7
|
+
type LoadDataFn<Row, Tail> = (pagination: PaginationProps) => Promise<{
|
8
|
+
data: Row[];
|
9
9
|
total: number;
|
10
|
+
tailData?: Tail;
|
10
11
|
}>;
|
11
|
-
interface UsePagetableOptions<
|
12
|
+
interface UsePagetableOptions<Row, Tail> {
|
12
13
|
tableRef: any;
|
13
|
-
onLoadData: LoadDataFn<
|
14
|
-
afterSelectionChange?: (newSelection:
|
15
|
-
afterCurrentRowChange?: (currentRow:
|
16
|
-
initialData?:
|
14
|
+
onLoadData: LoadDataFn<Row, Tail>;
|
15
|
+
afterSelectionChange?: (newSelection: Row[]) => void;
|
16
|
+
afterCurrentRowChange?: (currentRow: Row, oldCurrentRow: Row) => void;
|
17
|
+
initialData?: Row[];
|
17
18
|
initialPagination?: PaginationProps;
|
18
19
|
}
|
19
|
-
declare const usePagetable: <
|
20
|
-
data: import('@vue/reactivity').UnwrapRefSimple<
|
20
|
+
declare const usePagetable: <Row = any, Tail = any>(options: UsePagetableOptions<Row, Tail>) => {
|
21
|
+
data: import('@vue/reactivity').UnwrapRefSimple<Row>[];
|
21
22
|
pagination: {
|
22
23
|
currentPage: number;
|
23
24
|
pageSize: number;
|
24
25
|
pageSizes?: number[] | undefined;
|
25
26
|
total?: number | undefined;
|
26
27
|
};
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
tailData: Tail | undefined;
|
29
|
+
selection: import('@vue/reactivity').UnwrapRefSimple<Row>[];
|
30
|
+
currentRow: Row | undefined;
|
31
|
+
onSelectionChange: (newSelection: Row[]) => void;
|
32
|
+
onCurrentRowChange: (newCurrentRow: Row, oldCurrentRow: Row) => void;
|
31
33
|
clearSelection: () => void;
|
32
|
-
toggleRowSelection: (row:
|
34
|
+
toggleRowSelection: (row: Row, selected?: boolean) => void;
|
33
35
|
toggleAllSelection: () => void;
|
34
36
|
getSelectionRows: () => void;
|
35
|
-
setCurrentRow: (row:
|
37
|
+
setCurrentRow: (row: Row) => void;
|
36
38
|
loadData: () => Promise<void>;
|
37
39
|
};
|
38
40
|
export default usePagetable;
|
@@ -1,29 +1,30 @@
|
|
1
|
-
import { ref as a, reactive as
|
2
|
-
const
|
3
|
-
const { tableRef: o, onLoadData:
|
1
|
+
import { ref as a, reactive as C } from "vue";
|
2
|
+
const x = (v) => {
|
3
|
+
const { tableRef: o, onLoadData: w, afterSelectionChange: l, afterCurrentRowChange: c, initialData: i, initialPagination: g } = v, r = a(i || []), n = a(
|
4
4
|
g || {
|
5
5
|
currentPage: 1,
|
6
6
|
pageSize: 10
|
7
7
|
}
|
8
|
-
), s = a([]),
|
9
|
-
return
|
8
|
+
), s = a(), u = a([]), S = a();
|
9
|
+
return C({
|
10
10
|
data: r,
|
11
11
|
pagination: n,
|
12
|
-
|
13
|
-
|
12
|
+
tailData: s,
|
13
|
+
selection: u,
|
14
|
+
currentRow: S,
|
14
15
|
onSelectionChange: (e) => {
|
15
|
-
|
16
|
+
u.value = e, l && l(e);
|
16
17
|
},
|
17
18
|
onCurrentRowChange: (e, t) => {
|
18
|
-
|
19
|
+
S.value = e, c && c(e, t);
|
19
20
|
},
|
20
21
|
clearSelection: () => {
|
21
22
|
var e;
|
22
23
|
(e = o.value) == null || e.clearSelection();
|
23
24
|
},
|
24
25
|
toggleRowSelection: (e, t) => {
|
25
|
-
var
|
26
|
-
(
|
26
|
+
var R;
|
27
|
+
(R = o.value) == null || R.toggleRowSelection(e, t);
|
27
28
|
},
|
28
29
|
toggleAllSelection: () => {
|
29
30
|
var e;
|
@@ -38,12 +39,12 @@ const m = (R) => {
|
|
38
39
|
(t = o.value) == null || t.setCurrentRow(e);
|
39
40
|
},
|
40
41
|
loadData: async () => {
|
41
|
-
const e = await
|
42
|
-
r.value = e.data, n.value.total = e.total;
|
42
|
+
const e = await w(n.value);
|
43
|
+
r.value = e.data, n.value.total = e.total, s.value = e.tailData;
|
43
44
|
}
|
44
45
|
});
|
45
46
|
};
|
46
47
|
export {
|
47
|
-
|
48
|
+
x as default
|
48
49
|
};
|
49
50
|
//# sourceMappingURL=usePagetable.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usePagetable.js","sources":["../../../../src/components/Pagetable/hooks/usePagetable.ts"],"sourcesContent":["import { reactive, ref } from 'vue'\r\n\r\ninterface PaginationProps {\r\n currentPage: number\r\n pageSize: number\r\n pageSizes?: number[]\r\n total?: number\r\n}\r\n\r\ntype LoadDataFn<
|
1
|
+
{"version":3,"file":"usePagetable.js","sources":["../../../../src/components/Pagetable/hooks/usePagetable.ts"],"sourcesContent":["import { reactive, ref } from 'vue'\r\n\r\ninterface PaginationProps {\r\n currentPage: number\r\n pageSize: number\r\n pageSizes?: number[]\r\n total?: number\r\n}\r\n\r\ntype LoadDataFn<Row, Tail> = (pagination: PaginationProps) => Promise<{\r\n data: Row[]\r\n total: number\r\n tailData?: Tail\r\n}>\r\n\r\ninterface UsePagetableOptions<Row, Tail> {\r\n tableRef: any\r\n onLoadData: LoadDataFn<Row, Tail>\r\n afterSelectionChange?: (newSelection: Row[]) => void\r\n afterCurrentRowChange?: (currentRow: Row, oldCurrentRow: Row) => void\r\n initialData?: Row[]\r\n initialPagination?: PaginationProps\r\n}\r\n\r\nconst usePagetable = <Row = any, Tail = any>(options: UsePagetableOptions<Row, Tail>) => {\r\n const { tableRef, onLoadData, afterSelectionChange, afterCurrentRowChange, initialData, initialPagination } = options\r\n\r\n const data = ref<Row[]>(initialData ? initialData : [])\r\n const pagination = ref<PaginationProps>(\r\n initialPagination\r\n ? initialPagination\r\n : {\r\n currentPage: 1,\r\n pageSize: 10,\r\n }\r\n )\r\n const tailData = ref<Tail>()\r\n const selection = ref<Row[]>([])\r\n const currentRow = ref<Row>()\r\n\r\n const onSelectionChange = (newSelection: Row[]) => {\r\n selection.value = newSelection\r\n afterSelectionChange && afterSelectionChange(newSelection)\r\n }\r\n const onCurrentRowChange = (newCurrentRow: Row, oldCurrentRow: Row) => {\r\n currentRow.value = newCurrentRow\r\n afterCurrentRowChange && afterCurrentRowChange(newCurrentRow, oldCurrentRow)\r\n }\r\n\r\n const clearSelection = () => {\r\n tableRef.value?.clearSelection()\r\n }\r\n const toggleRowSelection = (row: Row, selected?: boolean) => {\r\n tableRef.value?.toggleRowSelection(row, selected)\r\n }\r\n const toggleAllSelection = () => {\r\n tableRef.value?.toggleAllSelection()\r\n }\r\n const getSelectionRows = () => {\r\n tableRef.value?.getSelectionRows()\r\n }\r\n const setCurrentRow = (row: Row) => {\r\n tableRef.value?.setCurrentRow(row)\r\n }\r\n\r\n const loadData = async () => {\r\n const loaded = await onLoadData(pagination.value)\r\n data.value = loaded.data\r\n pagination.value.total = loaded.total\r\n tailData.value = loaded.tailData\r\n }\r\n\r\n return reactive({\r\n data,\r\n pagination,\r\n tailData,\r\n selection,\r\n currentRow,\r\n onSelectionChange,\r\n onCurrentRowChange,\r\n clearSelection,\r\n toggleRowSelection,\r\n toggleAllSelection,\r\n getSelectionRows,\r\n setCurrentRow,\r\n loadData,\r\n })\r\n}\r\n\r\nexport default usePagetable\r\n"],"names":["usePagetable","options","tableRef","onLoadData","afterSelectionChange","afterCurrentRowChange","initialData","initialPagination","data","ref","pagination","tailData","selection","currentRow","reactive","newSelection","newCurrentRow","oldCurrentRow","_a","row","selected","loaded"],"mappings":";AAwBM,MAAAA,IAAe,CAAwBC,MA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ChD,MAAAF,EAAK,QAAQa,EAAO,MACTX,EAAA,MAAM,QAAQW,EAAO,OAChCV,EAAS,QAAQU,EAAO;AAAA,IAAA;AAAA,EAgBxB,CACD;AACH;"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: "0.1.
|
1
|
+
declare const _default: "0.1.53";
|
2
2
|
export default _default;
|
package/dist/version/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../src/version/version.ts"],"sourcesContent":["export default '0.1.
|
1
|
+
{"version":3,"file":"version.js","sources":["../../src/version/version.ts"],"sourcesContent":["export default '0.1.53';"],"names":["version"],"mappings":"AAAA,MAAAA,IAAe;"}
|