orion-design 0.1.29 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Throne/index.js +30 -14
- package/dist/Throne/index.js.map +1 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
- package/dist/components/Button/index.js +40 -33
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +122 -89
- package/dist/components/Flex/index.js.map +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.js +2 -2
- package/dist/components/Form/LovInput/LovInput.js.map +1 -1
- package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
- package/dist/components/Form/LovInput/index.js +4 -4
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
- package/dist/components/Form/hooks/index.js +128 -66
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +836 -656
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +30 -18
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/LovPagetable.vue.d.ts +28 -0
- package/dist/components/LovTable/index.d.ts +14 -0
- package/dist/components/LovTable/index.js +179 -105
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/Modal.d.ts +2 -0
- package/dist/components/Modal/ModalLocator.vue.d.ts +20 -0
- package/dist/components/Modal/index.d.ts +4 -1
- package/dist/components/Modal/index.js +127 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/types.d.ts +18 -0
- package/dist/components/Modal/types.js +7 -0
- package/dist/components/Modal/types.js.map +1 -0
- package/dist/components/Modal/useModal.d.ts +1 -3
- package/dist/components/Modal/useModal.js +5 -4
- package/dist/components/Modal/useModal.js.map +1 -1
- package/dist/components/Pagetable/Pagetable.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDiy.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
- package/dist/components/Pagetable/hooks/useColumns.js +88 -74
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.d.ts +9 -0
- package/dist/components/Pagetable/index.js +697 -491
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +92 -54
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +82 -74
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +579 -469
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +92 -54
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +100 -74
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/Tabs/constants.js +2 -2
- package/dist/components/Tabs/constants.js.map +1 -1
- package/dist/components/Tabs/index.js +603 -358
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-bar.js +6 -6
- package/dist/components/Tabs/tab-bar.js.map +1 -1
- package/dist/components/Tabs/tab-pane.js +3 -3
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/_constants/aria.js +2 -2
- package/dist/components/_constants/aria.js.map +1 -1
- package/dist/components/_constants/event.js +6 -4
- package/dist/components/_constants/event.js.map +1 -1
- package/dist/components/_constants/index.js +6 -6
- package/dist/components/_hooks/index.js +7 -7
- package/dist/components/_hooks/use-namespace/index.js +74 -39
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +29 -19
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +9 -5
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js +6 -6
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/classNames.js +22 -17
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +74 -39
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +9 -8
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +14 -7
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/index.js +36 -36
- package/dist/components/_util/dom/position.js +49 -25
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +103 -61
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +65 -50
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +8 -4
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +12 -11
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/functions.js +3 -3
- package/dist/components/_util/i18n.js +2 -2
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/index.js +137 -137
- package/dist/components/_util/isValid.js +4 -2
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +18 -14
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +46 -20
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +18 -10
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +5 -4
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +4 -3
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +9 -8
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +16 -10
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +41 -38
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +41 -22
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js +2 -2
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/util.js +85 -43
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +27 -15
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +29 -25
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/index.js +41 -41
- package/dist/components/_util/vue/install.js +35 -18
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/index.js +6 -6
- package/dist/components/_util/vue/props/runtime.js +46 -30
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +12 -6
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +5 -3
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +5 -4
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +100 -54
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +231 -220
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +38 -35
- package/dist/components/index.js.map +1 -1
- package/dist/components-8oZ2kpUC.js +27 -0
- package/dist/components-8oZ2kpUC.js.map +1 -0
- package/dist/components-B3d9m_tn.js +27 -0
- package/dist/components-B3d9m_tn.js.map +1 -0
- package/dist/error/OrionError.js +8 -4
- package/dist/error/OrionError.js.map +1 -1
- package/dist/functions-BeMkokbY.js +63 -0
- package/dist/functions-BeMkokbY.js.map +1 -0
- package/dist/index-BOKLZnqH.js +54 -0
- package/dist/index-BOKLZnqH.js.map +1 -0
- package/dist/index-D1m0KTpK.js +69 -0
- package/dist/index-D1m0KTpK.js.map +1 -0
- package/dist/index-DR5ZP7mD.js +160 -0
- package/dist/index-DR5ZP7mD.js.map +1 -0
- package/dist/index-DkwIULcN.js +200 -0
- package/dist/index-DkwIULcN.js.map +1 -0
- package/dist/index.css +797 -1
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +101 -43
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +200 -108
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +17 -14
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +16 -13
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +17 -14
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +47 -22
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +40 -25
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +16 -10
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +305 -201
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +11 -5
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +11 -5
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +9 -4
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +11 -5
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +48 -33
- package/dist/utils/DateUtil.js.map +1 -1
- package/dist/utils/NumberUtil.js +6 -6
- package/dist/utils/NumberUtil.js.map +1 -1
- package/dist/utils/cloneDeep.js +2 -2
- package/dist/utils/delay.js +3 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/functions.js +3 -3
- package/dist/utils/index.js +12 -12
- package/dist/utils/md5.js +191 -93
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +35 -25
- package/dist/utils/uuid.js.map +1 -1
- package/dist/version/index.js +2 -2
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +2 -2
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/components-J6-qau6Y.js +0 -73
- package/dist/components-J6-qau6Y.js.map +0 -1
@@ -1,137 +1,211 @@
|
|
1
|
-
import { findIndex
|
2
|
-
import { defineComponent
|
3
|
-
import { withInstall
|
1
|
+
import { findIndex } from "lodash-es";
|
2
|
+
import { defineComponent, useTemplateRef, ref, watch, openBlock, createBlock, unref, withCtx, renderSlot } from "vue";
|
3
|
+
import { withInstall } from "../_util/vue/install.js";
|
4
4
|
import "element-plus";
|
5
|
-
import
|
5
|
+
import Querytable from "../Querytable/index.js";
|
6
6
|
import "../Form/index.js";
|
7
|
-
import
|
8
|
-
import
|
9
|
-
const
|
10
|
-
name: "OLovQuerytable",
|
11
|
-
inheritAttrs: !0,
|
7
|
+
import useLov from "../Form/LovInput/hooks/useLov.js";
|
8
|
+
import Pagetable from "../Pagetable/index.js";
|
9
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
10
|
+
...{ name: "OLovQuerytable", inheritAttrs: true },
|
12
11
|
__name: "LovQuerytable",
|
13
12
|
props: {
|
14
13
|
data: {}
|
15
14
|
},
|
16
|
-
setup(
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
let
|
24
|
-
|
25
|
-
|
15
|
+
setup(__props) {
|
16
|
+
const tableRef = useTemplateRef("table");
|
17
|
+
const currentRowIndex = ref();
|
18
|
+
const currentRowData = ref();
|
19
|
+
const lov = useLov();
|
20
|
+
lov == null ? void 0 : lov.registerKeydownHandler((code) => {
|
21
|
+
if (code == "ArrowUp") {
|
22
|
+
let nextRow;
|
23
|
+
if (currentRowIndex.value == 0) {
|
24
|
+
nextRow = __props.data[__props.data.length - 1];
|
25
|
+
} else {
|
26
|
+
nextRow = __props.data[currentRowIndex.value - 1];
|
27
|
+
}
|
28
|
+
tableRef.value.setCurrentRow(nextRow);
|
29
|
+
scrollToRow(currentRowIndex.value);
|
30
|
+
} else if (code == "ArrowDown") {
|
31
|
+
let nextRow;
|
32
|
+
if (currentRowIndex.value == __props.data.length - 1) {
|
33
|
+
nextRow = __props.data[0];
|
34
|
+
} else {
|
35
|
+
nextRow = __props.data[currentRowIndex.value + 1];
|
36
|
+
}
|
37
|
+
tableRef.value.setCurrentRow(nextRow);
|
38
|
+
scrollToRow(currentRowIndex.value);
|
39
|
+
} else if (code == "Enter") {
|
40
|
+
currentRowData.value && (lov == null ? void 0 : lov.backfill(currentRowData.value));
|
41
|
+
}
|
26
42
|
});
|
27
|
-
const
|
28
|
-
var
|
29
|
-
(
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
|
43
|
+
const scrollToRow = (index2) => {
|
44
|
+
var _a;
|
45
|
+
const $table = (_a = tableRef.value) == null ? void 0 : _a.$el;
|
46
|
+
const $row = $table.querySelectorAll(".el-table__row")[index2];
|
47
|
+
$row.scrollIntoViewIfNeeded();
|
48
|
+
};
|
49
|
+
const onRowClick = (row) => {
|
50
|
+
lov == null ? void 0 : lov.backfill(row);
|
35
51
|
};
|
36
|
-
|
37
|
-
|
52
|
+
const handleCurrentRowChange = (row) => {
|
53
|
+
const index2 = findIndex(__props.data, row);
|
54
|
+
if (index2 == -1) {
|
55
|
+
currentRowIndex.value = 0;
|
56
|
+
currentRowData.value = __props.data[0];
|
57
|
+
} else {
|
58
|
+
currentRowIndex.value = index2;
|
59
|
+
currentRowData.value = row;
|
60
|
+
}
|
61
|
+
};
|
62
|
+
watch(
|
63
|
+
() => __props.data,
|
38
64
|
() => {
|
39
|
-
|
65
|
+
if (__props.data.length > 0) {
|
66
|
+
tableRef.value.setCurrentRow(__props.data[0]);
|
67
|
+
}
|
40
68
|
}
|
41
|
-
)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
69
|
+
);
|
70
|
+
return (_ctx, _cache) => {
|
71
|
+
return openBlock(), createBlock(unref(Querytable), {
|
72
|
+
ref: "table",
|
73
|
+
data: _ctx.data,
|
74
|
+
onRowClick,
|
75
|
+
"current-row-mode": "",
|
76
|
+
onCurrentRowChange: handleCurrentRowChange,
|
77
|
+
size: "small"
|
78
|
+
}, {
|
79
|
+
default: withCtx(() => [
|
80
|
+
renderSlot(_ctx.$slots, "default")
|
81
|
+
]),
|
82
|
+
_: 3
|
83
|
+
}, 8, ["data"]);
|
84
|
+
};
|
54
85
|
}
|
55
|
-
})
|
56
|
-
|
57
|
-
inheritAttrs:
|
86
|
+
});
|
87
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
88
|
+
...{ name: "OLovPagetable", inheritAttrs: true },
|
58
89
|
__name: "LovPagetable",
|
59
90
|
props: {
|
60
91
|
data: {},
|
61
92
|
pagination: {}
|
62
93
|
},
|
63
94
|
emits: ["update:pagination"],
|
64
|
-
setup(
|
65
|
-
const
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
95
|
+
setup(__props, { emit: __emit }) {
|
96
|
+
const emits = __emit;
|
97
|
+
const onUpdatePagination = (data) => {
|
98
|
+
emits("update:pagination", data);
|
99
|
+
};
|
100
|
+
const tableRef = useTemplateRef("table");
|
101
|
+
const currentRowIndex = ref();
|
102
|
+
const currentRowData = ref();
|
103
|
+
const lov = useLov();
|
104
|
+
lov == null ? void 0 : lov.registerKeydownHandler((code) => {
|
105
|
+
var _a, _b, _c, _d, _e, _f;
|
106
|
+
if (code == "ArrowUp") {
|
107
|
+
let nextRow;
|
108
|
+
if (currentRowIndex.value == 0) {
|
109
|
+
nextRow = __props.data[__props.data.length - 1];
|
110
|
+
} else {
|
111
|
+
nextRow = __props.data[currentRowIndex.value - 1];
|
112
|
+
}
|
113
|
+
tableRef.value.setCurrentRow(nextRow);
|
114
|
+
scrollToRow(currentRowIndex.value);
|
115
|
+
} else if (code == "ArrowDown") {
|
116
|
+
let nextRow;
|
117
|
+
if (currentRowIndex.value == __props.data.length - 1) {
|
118
|
+
nextRow = __props.data[0];
|
119
|
+
} else {
|
120
|
+
nextRow = __props.data[currentRowIndex.value + 1];
|
121
|
+
}
|
122
|
+
tableRef.value.setCurrentRow(nextRow);
|
123
|
+
scrollToRow(currentRowIndex.value);
|
124
|
+
} else if (code == "Enter") {
|
125
|
+
currentRowData.value && (lov == null ? void 0 : lov.backfill(currentRowData.value));
|
126
|
+
} else if (code == "ArrowLeft") {
|
127
|
+
const currentPage = (_a = __props.pagination) == null ? void 0 : _a.currentPage;
|
128
|
+
const pageSize = (_b = __props.pagination) == null ? void 0 : _b.pageSize;
|
129
|
+
const total = (_c = __props.pagination) == null ? void 0 : _c.total;
|
130
|
+
if (!currentPage || !pageSize || !total) {
|
81
131
|
return;
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
132
|
+
}
|
133
|
+
if (currentPage > 1) {
|
134
|
+
emits("update:pagination", {
|
135
|
+
...__props.pagination,
|
136
|
+
currentPage: currentPage - 1
|
137
|
+
});
|
138
|
+
}
|
139
|
+
} else if (code == "ArrowRight") {
|
140
|
+
const currentPage = (_d = __props.pagination) == null ? void 0 : _d.currentPage;
|
141
|
+
const pageSize = (_e = __props.pagination) == null ? void 0 : _e.pageSize;
|
142
|
+
const total = (_f = __props.pagination) == null ? void 0 : _f.total;
|
143
|
+
if (!currentPage || !pageSize || !total) {
|
89
144
|
return;
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
145
|
+
}
|
146
|
+
const totalPage = Math.ceil(total / pageSize);
|
147
|
+
if (currentPage < totalPage) {
|
148
|
+
emits("update:pagination", {
|
149
|
+
...__props.pagination,
|
150
|
+
currentPage: currentPage + 1
|
151
|
+
});
|
152
|
+
}
|
95
153
|
}
|
96
154
|
});
|
97
|
-
const
|
98
|
-
var
|
99
|
-
(
|
100
|
-
|
101
|
-
|
102
|
-
}
|
103
|
-
|
104
|
-
|
155
|
+
const scrollToRow = (index2) => {
|
156
|
+
var _a;
|
157
|
+
const $table = (_a = tableRef.value) == null ? void 0 : _a.$el;
|
158
|
+
const $row = $table.querySelectorAll(".el-table__row")[index2];
|
159
|
+
$row.scrollIntoViewIfNeeded();
|
160
|
+
};
|
161
|
+
const onRowClick = (row) => {
|
162
|
+
lov == null ? void 0 : lov.backfill(row);
|
105
163
|
};
|
106
|
-
|
107
|
-
|
164
|
+
const handleCurrentRowChange = (row) => {
|
165
|
+
const index2 = findIndex(__props.data, row);
|
166
|
+
if (index2 == -1) {
|
167
|
+
currentRowIndex.value = 0;
|
168
|
+
currentRowData.value = __props.data[0];
|
169
|
+
} else {
|
170
|
+
currentRowIndex.value = index2;
|
171
|
+
currentRowData.value = row;
|
172
|
+
}
|
173
|
+
};
|
174
|
+
watch(
|
175
|
+
() => __props.data,
|
108
176
|
() => {
|
109
|
-
|
177
|
+
if (__props.data.length > 0) {
|
178
|
+
tableRef.value.setCurrentRow(__props.data[0]);
|
179
|
+
}
|
110
180
|
}
|
111
|
-
)
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
181
|
+
);
|
182
|
+
return (_ctx, _cache) => {
|
183
|
+
return openBlock(), createBlock(unref(Pagetable), {
|
184
|
+
ref: "table",
|
185
|
+
data: _ctx.data,
|
186
|
+
onRowClick,
|
187
|
+
"current-row-mode": "",
|
188
|
+
onCurrentRowChange: handleCurrentRowChange,
|
189
|
+
pagination: _ctx.pagination,
|
190
|
+
"onUpdate:pagination": onUpdatePagination,
|
191
|
+
size: "small"
|
192
|
+
}, {
|
193
|
+
default: withCtx(() => [
|
194
|
+
renderSlot(_ctx.$slots, "default")
|
195
|
+
]),
|
196
|
+
_: 3
|
197
|
+
}, 8, ["data", "pagination"]);
|
198
|
+
};
|
126
199
|
}
|
127
|
-
})
|
200
|
+
});
|
201
|
+
const index = withInstall(
|
128
202
|
{},
|
129
203
|
{
|
130
|
-
LovQuerytable:
|
131
|
-
LovPagetable:
|
204
|
+
LovQuerytable: _sfc_main$1,
|
205
|
+
LovPagetable: _sfc_main
|
132
206
|
}
|
133
207
|
);
|
134
208
|
export {
|
135
|
-
|
209
|
+
index as default
|
136
210
|
};
|
137
211
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/LovTable/LovQuerytable.vue","../../../src/components/LovTable/LovPagetable.vue","../../../src/components/LovTable/index.ts"],"sourcesContent":["<template>\r\n <querytable ref=\"table\" :data=\"data\" @row-click=\"onRowClick\" current-row-mode @current-row-change=\"handleCurrentRowChange\" size=\"small\">\r\n <slot></slot>\r\n </querytable>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport { ref, useTemplateRef, watch } from 'vue'\r\nimport Querytable from '../Querytable'\r\nimport { useLov } from '../Form'\r\nimport { findIndex } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OLovQuerytable', inheritAttrs: true })\r\n\r\nconst { data } = defineProps<{ data: any[] }>()\r\nconst tableRef = useTemplateRef('table')\r\nconst currentRowIndex = ref()\r\nconst currentRowData = ref()\r\n\r\nconst lov = useLov()\r\nlov?.registerKeydownHandler((code) => {\r\n if (code == 'ArrowUp') {\r\n let nextRow: any\r\n if (currentRowIndex.value == 0) {\r\n nextRow = data[data.length - 1]\r\n } else {\r\n nextRow = data[currentRowIndex.value - 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'ArrowDown') {\r\n let nextRow: any\r\n if (currentRowIndex.value == data.length - 1) {\r\n nextRow = data[0]\r\n } else {\r\n nextRow = data[currentRowIndex.value + 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'Enter') {\r\n currentRowData.value && lov?.backfill(currentRowData.value)\r\n }\r\n})\r\n\r\nconst scrollToRow = (index: number) => {\r\n const $table = tableRef.value?.$el\r\n const $row = $table.querySelectorAll('.el-table__row')[index]\r\n $row.scrollIntoViewIfNeeded()\r\n}\r\n\r\nconst onRowClick = (row: any) => {\r\n lov?.backfill(row)\r\n}\r\n\r\nconst handleCurrentRowChange = (row: any) => {\r\n const index = findIndex(data, row)\r\n if (index == -1) {\r\n currentRowIndex.value = 0\r\n currentRowData.value = data[0]\r\n } else {\r\n currentRowIndex.value = index\r\n currentRowData.value = row\r\n }\r\n}\r\n\r\nwatch(\r\n () => data,\r\n () => {\r\n if (data.length > 0) {\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(data[0])\r\n }\r\n }\r\n)\r\n</script>\r\n","<template>\r\n <pagetable\r\n ref=\"table\"\r\n :data=\"data\"\r\n @row-click=\"onRowClick\"\r\n current-row-mode\r\n @current-row-change=\"handleCurrentRowChange\"\r\n :pagination=\"pagination\"\r\n @update:pagination=\"onUpdatePagination\"\r\n size=\"small\"\r\n >\r\n <slot></slot>\r\n </pagetable>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport Pagetable from '../Pagetable'\r\nimport { useLov } from '../Form'\r\nimport { ref, useTemplateRef, watch } from 'vue'\r\nimport { findIndex } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OLovPagetable', inheritAttrs: true })\r\n\r\nconst { data, pagination } = defineProps<{\r\n data: any[]\r\n pagination: {\r\n currentPage?: number\r\n pageSize?: number\r\n total?: number\r\n }\r\n}>()\r\n\r\nconst emits = defineEmits(['update:pagination'])\r\nconst onUpdatePagination = (data: any) => {\r\n emits('update:pagination', data)\r\n}\r\n\r\nconst tableRef = useTemplateRef('table')\r\nconst currentRowIndex = ref()\r\nconst currentRowData = ref()\r\n\r\nconst lov = useLov()\r\nlov?.registerKeydownHandler((code) => {\r\n if (code == 'ArrowUp') {\r\n let nextRow: any\r\n if (currentRowIndex.value == 0) {\r\n nextRow = data[data.length - 1]\r\n } else {\r\n nextRow = data[currentRowIndex.value - 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'ArrowDown') {\r\n let nextRow: any\r\n if (currentRowIndex.value == data.length - 1) {\r\n nextRow = data[0]\r\n } else {\r\n nextRow = data[currentRowIndex.value + 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'Enter') {\r\n currentRowData.value && lov?.backfill(currentRowData.value)\r\n } else if (code == 'ArrowLeft') {\r\n const currentPage = pagination?.currentPage\r\n const pageSize = pagination?.pageSize\r\n const total = pagination?.total\r\n if (!currentPage || !pageSize || !total) {\r\n return\r\n }\r\n if (currentPage > 1) {\r\n emits('update:pagination', {\r\n ...pagination,\r\n currentPage: currentPage - 1,\r\n })\r\n }\r\n } else if (code == 'ArrowRight') {\r\n const currentPage = pagination?.currentPage\r\n const pageSize = pagination?.pageSize\r\n const total = pagination?.total\r\n if (!currentPage || !pageSize || !total) {\r\n return\r\n }\r\n const totalPage = Math.ceil(total / pageSize)\r\n if (currentPage < totalPage) {\r\n emits('update:pagination', {\r\n ...pagination,\r\n currentPage: currentPage + 1,\r\n })\r\n }\r\n }\r\n})\r\n\r\nconst scrollToRow = (index: number) => {\r\n const $table = tableRef.value?.$el\r\n const $row = $table.querySelectorAll('.el-table__row')[index]\r\n $row.scrollIntoViewIfNeeded()\r\n}\r\n\r\nconst onRowClick = (row: any) => {\r\n lov?.backfill(row)\r\n}\r\n\r\nconst handleCurrentRowChange = (row: any) => {\r\n const index = findIndex(data, row)\r\n if (index == -1) {\r\n currentRowIndex.value = 0\r\n currentRowData.value = data[0]\r\n } else {\r\n currentRowIndex.value = index\r\n currentRowData.value = row\r\n }\r\n}\r\n\r\nwatch(\r\n () => data,\r\n () => {\r\n if (data.length > 0) {\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(data[0])\r\n }\r\n }\r\n)\r\n</script>\r\n","import { withInstall } from '../_util'\r\n\r\nimport LovQuerytable from './LovQuerytable.vue'\r\nimport LovPagetable from './LovPagetable.vue'\r\n\r\nexport default withInstall(\r\n {},\r\n {\r\n LovQuerytable,\r\n LovPagetable,\r\n }\r\n)\r\n"],"names":["
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/LovTable/LovQuerytable.vue","../../../src/components/LovTable/LovPagetable.vue","../../../src/components/LovTable/index.ts"],"sourcesContent":["<template>\r\n <querytable ref=\"table\" :data=\"data\" @row-click=\"onRowClick\" current-row-mode @current-row-change=\"handleCurrentRowChange\" size=\"small\">\r\n <slot></slot>\r\n </querytable>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport { ref, useTemplateRef, watch } from 'vue'\r\nimport Querytable from '../Querytable'\r\nimport { useLov } from '../Form'\r\nimport { findIndex } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OLovQuerytable', inheritAttrs: true })\r\n\r\nconst { data } = defineProps<{ data: any[] }>()\r\nconst tableRef = useTemplateRef('table')\r\nconst currentRowIndex = ref()\r\nconst currentRowData = ref()\r\n\r\nconst lov = useLov()\r\nlov?.registerKeydownHandler((code) => {\r\n if (code == 'ArrowUp') {\r\n let nextRow: any\r\n if (currentRowIndex.value == 0) {\r\n nextRow = data[data.length - 1]\r\n } else {\r\n nextRow = data[currentRowIndex.value - 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'ArrowDown') {\r\n let nextRow: any\r\n if (currentRowIndex.value == data.length - 1) {\r\n nextRow = data[0]\r\n } else {\r\n nextRow = data[currentRowIndex.value + 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'Enter') {\r\n currentRowData.value && lov?.backfill(currentRowData.value)\r\n }\r\n})\r\n\r\nconst scrollToRow = (index: number) => {\r\n const $table = tableRef.value?.$el\r\n const $row = $table.querySelectorAll('.el-table__row')[index]\r\n $row.scrollIntoViewIfNeeded()\r\n}\r\n\r\nconst onRowClick = (row: any) => {\r\n lov?.backfill(row)\r\n}\r\n\r\nconst handleCurrentRowChange = (row: any) => {\r\n const index = findIndex(data, row)\r\n if (index == -1) {\r\n currentRowIndex.value = 0\r\n currentRowData.value = data[0]\r\n } else {\r\n currentRowIndex.value = index\r\n currentRowData.value = row\r\n }\r\n}\r\n\r\nwatch(\r\n () => data,\r\n () => {\r\n if (data.length > 0) {\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(data[0])\r\n }\r\n }\r\n)\r\n</script>\r\n","<template>\r\n <pagetable\r\n ref=\"table\"\r\n :data=\"data\"\r\n @row-click=\"onRowClick\"\r\n current-row-mode\r\n @current-row-change=\"handleCurrentRowChange\"\r\n :pagination=\"pagination\"\r\n @update:pagination=\"onUpdatePagination\"\r\n size=\"small\"\r\n >\r\n <slot></slot>\r\n </pagetable>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport Pagetable from '../Pagetable'\r\nimport { useLov } from '../Form'\r\nimport { ref, useTemplateRef, watch } from 'vue'\r\nimport { findIndex } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OLovPagetable', inheritAttrs: true })\r\n\r\nconst { data, pagination } = defineProps<{\r\n data: any[]\r\n pagination: {\r\n currentPage?: number\r\n pageSize?: number\r\n total?: number\r\n }\r\n}>()\r\n\r\nconst emits = defineEmits(['update:pagination'])\r\nconst onUpdatePagination = (data: any) => {\r\n emits('update:pagination', data)\r\n}\r\n\r\nconst tableRef = useTemplateRef('table')\r\nconst currentRowIndex = ref()\r\nconst currentRowData = ref()\r\n\r\nconst lov = useLov()\r\nlov?.registerKeydownHandler((code) => {\r\n if (code == 'ArrowUp') {\r\n let nextRow: any\r\n if (currentRowIndex.value == 0) {\r\n nextRow = data[data.length - 1]\r\n } else {\r\n nextRow = data[currentRowIndex.value - 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'ArrowDown') {\r\n let nextRow: any\r\n if (currentRowIndex.value == data.length - 1) {\r\n nextRow = data[0]\r\n } else {\r\n nextRow = data[currentRowIndex.value + 1]\r\n }\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(nextRow)\r\n scrollToRow(currentRowIndex.value)\r\n } else if (code == 'Enter') {\r\n currentRowData.value && lov?.backfill(currentRowData.value)\r\n } else if (code == 'ArrowLeft') {\r\n const currentPage = pagination?.currentPage\r\n const pageSize = pagination?.pageSize\r\n const total = pagination?.total\r\n if (!currentPage || !pageSize || !total) {\r\n return\r\n }\r\n if (currentPage > 1) {\r\n emits('update:pagination', {\r\n ...pagination,\r\n currentPage: currentPage - 1,\r\n })\r\n }\r\n } else if (code == 'ArrowRight') {\r\n const currentPage = pagination?.currentPage\r\n const pageSize = pagination?.pageSize\r\n const total = pagination?.total\r\n if (!currentPage || !pageSize || !total) {\r\n return\r\n }\r\n const totalPage = Math.ceil(total / pageSize)\r\n if (currentPage < totalPage) {\r\n emits('update:pagination', {\r\n ...pagination,\r\n currentPage: currentPage + 1,\r\n })\r\n }\r\n }\r\n})\r\n\r\nconst scrollToRow = (index: number) => {\r\n const $table = tableRef.value?.$el\r\n const $row = $table.querySelectorAll('.el-table__row')[index]\r\n $row.scrollIntoViewIfNeeded()\r\n}\r\n\r\nconst onRowClick = (row: any) => {\r\n lov?.backfill(row)\r\n}\r\n\r\nconst handleCurrentRowChange = (row: any) => {\r\n const index = findIndex(data, row)\r\n if (index == -1) {\r\n currentRowIndex.value = 0\r\n currentRowData.value = data[0]\r\n } else {\r\n currentRowIndex.value = index\r\n currentRowData.value = row\r\n }\r\n}\r\n\r\nwatch(\r\n () => data,\r\n () => {\r\n if (data.length > 0) {\r\n //@ts-ignore\r\n tableRef.value.setCurrentRow(data[0])\r\n }\r\n }\r\n)\r\n</script>\r\n","import { withInstall } from '../_util'\r\n\r\nimport LovQuerytable from './LovQuerytable.vue'\r\nimport LovPagetable from './LovPagetable.vue'\r\n\r\nexport default withInstall(\r\n {},\r\n {\r\n LovQuerytable,\r\n LovPagetable,\r\n }\r\n)\r\n"],"names":["index","LovQuerytable","LovPagetable"],"mappings":";;;;;;;;;;;;;;;AAcM,UAAA,WAAW,eAAe,OAAO;AACvC,UAAM,kBAAkB;AACxB,UAAM,iBAAiB;AAEvB,UAAM,MAAM;AACP,+BAAA,uBAAuB,CAAC,SAAS;AACpC,UAAI,QAAQ,WAAW;AACjB,YAAA;AACA,YAAA,gBAAgB,SAAS,GAAG;AAC9B,oBAAU,QAAI,KAAC,QAAI,KAAC,SAAS,CAAC;AAAA,QAAA,OACzB;AACL,oBAAU,aAAK,gBAAgB,QAAQ,CAAC;AAAA,QAC1C;AAES,iBAAA,MAAM,cAAc,OAAO;AACpC,oBAAY,gBAAgB,KAAK;AAAA,MAAA,WACxB,QAAQ,aAAa;AAC1B,YAAA;AACJ,YAAI,gBAAgB,SAAS,QAAI,KAAC,SAAS,GAAG;AAClC,oBAAA,aAAK,CAAC;AAAA,QAAA,OACX;AACL,oBAAU,aAAK,gBAAgB,QAAQ,CAAC;AAAA,QAC1C;AAES,iBAAA,MAAM,cAAc,OAAO;AACpC,oBAAY,gBAAg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Aa,CAAC,QAAa;AAC/B,iCAAK,SAAS;AAAA,IAAG;AAGb,UAAA,yBAAyB,CAAC,QAAa;AAC3C,YAAMA,SAAQ,UAAU,QAAI,MAAE,GAAG;AACjC,UAAIA,UAAS,IAAI;AACf,wBAAgB,QAAQ;AACT,uBAAA,QAAQ,QAAA,KAAK,CAAC;AAAA,MAAA,OACxB;AACL,wBAAgB,QAAQA;AACxB,uBAAe,QAAQ;AAAA,MACzB;AAAA,IAAA;AAGF;AAAA,MACE,MAAM,QAAI;AAAA,MACV,MAAM;AACA,YAAA,QAAI,KAAC,SAAS,GAAG;AAEnB,mBAAS,MAAM,cAAc,QAAA,KAAK,CAAC,CAAC;AAAA,QACtC;AAAA,MACF;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;ACrHF,MAAA,QAAe;AAAA,EACb,CAAC;AAAA,EACD;AAAA,IAAA,eACEC;AAAAA,IAAA,cACAC;AAAAA,EACF;AACF;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
declare const Modal: import('vue').DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
2
|
+
export default Modal;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
declare function __VLS_template(): {
|
2
|
+
slots: {
|
3
|
+
default?(_: {}): any;
|
4
|
+
};
|
5
|
+
refs: {
|
6
|
+
"modal-locator": HTMLDivElement;
|
7
|
+
};
|
8
|
+
attrs: Partial<{}>;
|
9
|
+
};
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
12
|
+
"modal-locator": HTMLDivElement;
|
13
|
+
}, any>;
|
14
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
15
|
+
export default _default;
|
16
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
17
|
+
new (): {
|
18
|
+
$slots: S;
|
19
|
+
};
|
20
|
+
};
|
@@ -1,2 +1,5 @@
|
|
1
|
-
|
1
|
+
import { default as ModalLocator } from './ModalLocator.vue';
|
2
|
+
declare const _default: import('../_util').SFCWithInstall<import('vue').DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>> & {
|
3
|
+
ModalLocator: typeof ModalLocator;
|
4
|
+
};
|
2
5
|
export default _default;
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import "lodash-es";
|
2
|
+
import { defineComponent, inject, ref, shallowRef, provide, createVNode, Fragment, useTemplateRef, openBlock, createElementBlock, renderSlot } from "vue";
|
3
|
+
import { withInstall } from "../_util/vue/install.js";
|
4
|
+
import { ElDialog } from "element-plus";
|
5
|
+
import { addUnit } from "../_util/dom/style.js";
|
6
|
+
import { modalLocatorContextKey, modalContextKey } from "./types.js";
|
7
|
+
const Modal = /* @__PURE__ */ defineComponent({
|
8
|
+
name: "OModal",
|
9
|
+
setup(props, {
|
10
|
+
slots,
|
11
|
+
attrs,
|
12
|
+
emit,
|
13
|
+
expose
|
14
|
+
}) {
|
15
|
+
const modalLocator = inject(modalLocatorContextKey);
|
16
|
+
const show = ref(false);
|
17
|
+
const title = ref();
|
18
|
+
const content = shallowRef();
|
19
|
+
const contentProps = ref();
|
20
|
+
const width = ref();
|
21
|
+
const height = ref();
|
22
|
+
const __resolve = ref();
|
23
|
+
const showClose = ref(true);
|
24
|
+
const appendTo = ref();
|
25
|
+
const _open = async (options) => {
|
26
|
+
show.value = true;
|
27
|
+
title.value = options.title;
|
28
|
+
content.value = options.content;
|
29
|
+
if (options.contentProps) {
|
30
|
+
contentProps.value = options.contentProps;
|
31
|
+
} else {
|
32
|
+
contentProps.value = {};
|
33
|
+
}
|
34
|
+
if (options.width) {
|
35
|
+
width.value = options.width;
|
36
|
+
}
|
37
|
+
if (options.height) {
|
38
|
+
height.value = addUnit(options.height);
|
39
|
+
}
|
40
|
+
if (options.showClose != void 0 && options.showClose == false) {
|
41
|
+
showClose.value = false;
|
42
|
+
}
|
43
|
+
if (options.locator) {
|
44
|
+
appendTo.value = options.locator;
|
45
|
+
} else {
|
46
|
+
if (modalLocator && modalLocator.locator.value) {
|
47
|
+
appendTo.value = modalLocator.locator.value;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
const promise = new Promise((resolve, reject) => {
|
51
|
+
__resolve.value = resolve;
|
52
|
+
});
|
53
|
+
return promise;
|
54
|
+
};
|
55
|
+
expose({
|
56
|
+
open: _open
|
57
|
+
});
|
58
|
+
const _close = (options) => {
|
59
|
+
const resolve = __resolve.value;
|
60
|
+
show.value = false;
|
61
|
+
title.value = void 0;
|
62
|
+
content.value = void 0;
|
63
|
+
contentProps.value = void 0;
|
64
|
+
width.value = void 0;
|
65
|
+
height.value = void 0;
|
66
|
+
__resolve.value = void 0;
|
67
|
+
showClose.value = true;
|
68
|
+
appendTo.value = void 0;
|
69
|
+
resolve && resolve(options);
|
70
|
+
};
|
71
|
+
provide(modalContextKey, {
|
72
|
+
close: _close
|
73
|
+
});
|
74
|
+
return () => {
|
75
|
+
const Children = content.value;
|
76
|
+
return show.value ? createVNode(ElDialog, {
|
77
|
+
"title": title.value,
|
78
|
+
"width": width.value,
|
79
|
+
"modelValue": show.value,
|
80
|
+
"beforeClose": _close,
|
81
|
+
"draggable": true,
|
82
|
+
"closeOnClickModal": false,
|
83
|
+
"closeOnPressEscape": false,
|
84
|
+
"showClose": showClose.value,
|
85
|
+
"alignCenter": true,
|
86
|
+
"style": {
|
87
|
+
height: height.value
|
88
|
+
},
|
89
|
+
"appendTo": appendTo.value
|
90
|
+
}, {
|
91
|
+
default: () => [createVNode(Children, contentProps.value, null)]
|
92
|
+
}) : createVNode(Fragment, null, null);
|
93
|
+
};
|
94
|
+
}
|
95
|
+
});
|
96
|
+
const _hoisted_1 = {
|
97
|
+
ref: "modal-locator",
|
98
|
+
class: "orion-modal-locator"
|
99
|
+
};
|
100
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
101
|
+
...{ name: "OModalLocator", inheritAttrs: true },
|
102
|
+
__name: "ModalLocator",
|
103
|
+
setup(__props) {
|
104
|
+
const locator = useTemplateRef("modal-locator");
|
105
|
+
provide(modalLocatorContextKey, {
|
106
|
+
locator
|
107
|
+
});
|
108
|
+
return (_ctx, _cache) => {
|
109
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
110
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
111
|
+
], 512);
|
112
|
+
};
|
113
|
+
}
|
114
|
+
});
|
115
|
+
const _export_sfc = (sfc, props) => {
|
116
|
+
const target = sfc.__vccOpts || sfc;
|
117
|
+
for (const [key, val] of props) {
|
118
|
+
target[key] = val;
|
119
|
+
}
|
120
|
+
return target;
|
121
|
+
};
|
122
|
+
const ModalLocator = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0fd5a1a9"]]);
|
123
|
+
const index = withInstall(Modal, { ModalLocator });
|
124
|
+
export {
|
125
|
+
index as default
|
126
|
+
};
|
127
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Modal/Modal.tsx","../../../src/components/Modal/ModalLocator.vue","../../../src/components/Modal/index.ts"],"sourcesContent":["import { defineComponent, inject, provide, ref, shallowRef } from 'vue'\r\nimport { ElDialog } from 'element-plus'\r\nimport { addUnit } from '../_util'\r\nimport { modalContextKey, modalLocatorContextKey, ModalOptions } from './types'\r\n\r\nconst Modal = defineComponent({\r\n name: 'OModal',\r\n setup(props, { slots, attrs, emit, expose }) {\r\n const modalLocator = inject(modalLocatorContextKey)\r\n\r\n const show = ref(false)\r\n const title = ref<string>()\r\n const content = shallowRef()\r\n const contentProps = ref<Record<string, any>>()\r\n const width = ref<number | string>()\r\n const height = ref<number | string>()\r\n const __resolve = ref<(value: Record<string, any> | PromiseLike<Record<string, any>>) => void>()\r\n const showClose = ref(true)\r\n const appendTo = ref<string | HTMLElement>()\r\n\r\n const _open: (options: ModalOptions) => Promise<Record<string, any>> = async (options) => {\r\n show.value = true\r\n title.value = options.title\r\n content.value = options.content\r\n if (options.contentProps) {\r\n contentProps.value = options.contentProps\r\n } else {\r\n contentProps.value = {}\r\n }\r\n if (options.width) {\r\n width.value = options.width\r\n }\r\n if (options.height) {\r\n height.value = addUnit(options.height)\r\n }\r\n if (options.showClose != undefined && options.showClose == false) {\r\n showClose.value = false\r\n }\r\n if (options.locator) {\r\n appendTo.value = options.locator\r\n } else {\r\n if (modalLocator && modalLocator.locator.value) {\r\n appendTo.value = modalLocator.locator.value\r\n }\r\n }\r\n\r\n const promise = new Promise<Record<string, any>>((resolve, reject) => {\r\n __resolve.value = resolve\r\n })\r\n\r\n return promise\r\n }\r\n expose({\r\n open: _open,\r\n })\r\n\r\n const _close: (options: Record<string, any>) => void = (options) => {\r\n const resolve = __resolve.value\r\n\r\n show.value = false\r\n title.value = undefined\r\n content.value = undefined\r\n contentProps.value = undefined\r\n width.value = undefined\r\n height.value = undefined\r\n __resolve.value = undefined\r\n showClose.value = true\r\n appendTo.value = undefined\r\n\r\n resolve && resolve(options)\r\n }\r\n provide(modalContextKey, { close: _close })\r\n\r\n return () => {\r\n const Children = content.value\r\n return show.value ? (\r\n <ElDialog\r\n title={title.value}\r\n width={width.value}\r\n modelValue={show.value}\r\n beforeClose={_close}\r\n draggable={true}\r\n closeOnClickModal={false}\r\n closeOnPressEscape={false}\r\n showClose={showClose.value}\r\n alignCenter={true}\r\n style={{ height: height.value }}\r\n appendTo={appendTo.value}\r\n >\r\n <Children {...contentProps.value}></Children>\r\n </ElDialog>\r\n ) : (\r\n <></>\r\n )\r\n }\r\n },\r\n})\r\n\r\nexport default Modal\r\n","<template>\r\n <div ref=\"modal-locator\" class=\"orion-modal-locator\"><slot></slot></div>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport { provide, useTemplateRef } from 'vue'\r\nimport { modalLocatorContextKey } from './types'\r\n\r\ndefineOptions({ name: 'OModalLocator', inheritAttrs: true })\r\nconst locator = useTemplateRef('modal-locator')\r\n\r\nprovide(modalLocatorContextKey, {\r\n locator,\r\n})\r\n</script>\r\n<style lang=\"scss\" scoped>\r\n.orion-modal-locator {\r\n width: 100%;\r\n height: 100%;\r\n overflow: auto;\r\n box-sizing: border-box;\r\n position: relative;\r\n\r\n :deep(> .el-overlay) {\r\n position: absolute;\r\n\r\n > .el-overlay-dialog {\r\n position: absolute;\r\n }\r\n }\r\n}\r\n</style>\r\n","import { withInstall } from '../_util'\r\n\r\nimport Modal from './Modal'\r\nimport ModalLocator from './ModalLocator.vue'\r\n\r\nexport default withInstall<typeof Modal, { ModalLocator: typeof ModalLocator }>(Modal, { ModalLocator })\r\n"],"names":["Modal","defineComponent","name","setup","props","slots","attrs","emit","expose","modalLocator","inject","modalLocatorContextKey","show","ref","title","content","shallowRef","contentProps","width","height","__resolve","showClose","appendTo","_open","options","value","addUnit","undefined","locator","promise","Promise","resolve","reject","open","_close","provide","modalContextKey","close","Children","_createVNode","ElDialog","default","_Fragment"],"mappings":";;;;;;AAKA,MAAMA,QAAQC,gCAAgB;AAAA,EAC5BC,MAAM;AAAA,EACNC,MAAMC,OAAO;AAAA,IAAEC;AAAAA,IAAOC;AAAAA,IAAOC;AAAAA,IAAMC;AAAAA,EAAO,GAAG;AAC3C,UAAMC,eAAeC,OAAOC,sBAAsB;AAElD,UAAMC,OAAOC,IAAI,KAAK;AACtB,UAAMC,Q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P,OAAO;AAAA;AAE5BW,YAAQC,iBAAiB;AAAA,MAAEC,OAAOH;AAAAA,IAAO,CAAC;AAE1C,WAAO,MAAM;AACX,YAAMI,WAAWvB,QAAQU;AACzB,aAAOb,KAAKa,QAAKc,YAAAC,UAAA;AAAA,QAAA,SAEN1B,MAAMW;AAAAA,QAAK,SACXP,MAAMO;AAAAA,QAAK,cACNb,KAAKa;AAAAA,QAAK,eACTS;AAAAA,QAAM,aACR;AAAA,QAAI,qBACI;AAAA,QAAK,sBACJ;AAAA,QAAK,aACdb,UAAUI;AAAAA,QAAK,eACb;AAAA,QAAI,SACV;AAAA,UAAEN,QAAQA,OAAOM;AAAAA,QAAO;AAAA,QAAA,YACrBH,SAASG;AAAAA,MAAK,GAAA;AAAA,QAAAgB,SAAAA,MAAAF,CAAAA,YAAAD,UAEVrB,aAAaQ,OAAK,IAAA,CAAA;AAAA,MAAAc,CAAAA,IAAAA,YAAAG,UAInC,MAAA,IAAA;AAAA;EAEL;AACF,CAAC;;;;;;;;;ACxFK,UAAA,UAAU,eAAe,eAAe;AAE9C,YAAQ,wBAAwB;AAAA,MAC9B;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;ACPD,MAAA,QAAe,YAAiE,OAAO,EAAE,cAAc;"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { InjectionKey, ShallowRef, VNode } from 'vue';
|
2
|
+
export interface ModalOptions {
|
3
|
+
title: string;
|
4
|
+
content: VNode;
|
5
|
+
contentProps?: Record<string, any>;
|
6
|
+
width?: number | string;
|
7
|
+
height?: number | string;
|
8
|
+
showClose?: boolean;
|
9
|
+
locator?: string | HTMLElement;
|
10
|
+
}
|
11
|
+
export interface ModalContext {
|
12
|
+
close: (options: Record<string, any>) => void;
|
13
|
+
}
|
14
|
+
export declare const modalContextKey: InjectionKey<ModalContext>;
|
15
|
+
export interface ModalLocatorContext {
|
16
|
+
locator: ShallowRef<HTMLElement | null>;
|
17
|
+
}
|
18
|
+
export declare const modalLocatorContextKey: InjectionKey<ModalLocatorContext>;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/Modal/types.ts"],"sourcesContent":["import { InjectionKey, ShallowRef, VNode } from 'vue'\r\n\r\nexport interface ModalOptions {\r\n title: string\r\n content: VNode\r\n contentProps?: Record<string, any>\r\n width?: number | string\r\n height?: number | string\r\n showClose?: boolean\r\n locator?: string | HTMLElement\r\n}\r\n\r\nexport interface ModalContext {\r\n close: (options: Record<string, any>) => void\r\n}\r\n\r\nexport const modalContextKey: InjectionKey<ModalContext> = Symbol('modalContextKey')\r\n\r\nexport interface ModalLocatorContext {\r\n locator: ShallowRef<HTMLElement | null>\r\n}\r\n\r\nexport const modalLocatorContextKey: InjectionKey<ModalLocatorContext> = Symbol('modalLocatorContextKey')\r\n"],"names":[],"mappings":"AAgBa,MAAA,kBAA8C,OAAO,iBAAiB;AAMtE,MAAA,yBAA4D,OAAO,wBAAwB;"}
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import { inject
|
2
|
-
|
3
|
-
|
1
|
+
import { inject } from "vue";
|
2
|
+
import { modalContextKey } from "./types.js";
|
3
|
+
function useModal() {
|
4
|
+
return inject(modalContextKey);
|
4
5
|
}
|
5
6
|
export {
|
6
|
-
|
7
|
+
useModal as default
|
7
8
|
};
|
8
9
|
//# sourceMappingURL=useModal.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useModal.js","sources":["../../../src/components/Modal/useModal.ts"],"sourcesContent":["import { inject } from 'vue'\r\n\r\nexport default function useModal() {\r\n
|
1
|
+
{"version":3,"file":"useModal.js","sources":["../../../src/components/Modal/useModal.ts"],"sourcesContent":["import { inject } from 'vue'\r\nimport { modalContextKey } from './types'\r\n\r\nexport default function useModal() {\r\n return inject(modalContextKey)\r\n}\r\n"],"names":[],"mappings":";;AAGA,SAAwB,WAAW;AACjC,SAAO,OAAO,eAAe;AAC/B;"}
|