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.
Files changed (219) hide show
  1. package/dist/Throne/index.js +30 -14
  2. package/dist/Throne/index.js.map +1 -1
  3. package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
  4. package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
  5. package/dist/components/Button/index.js +40 -33
  6. package/dist/components/Button/index.js.map +1 -1
  7. package/dist/components/Flex/index.js +122 -89
  8. package/dist/components/Flex/index.js.map +1 -1
  9. package/dist/components/Form/Form.js +2 -2
  10. package/dist/components/Form/Form.js.map +1 -1
  11. package/dist/components/Form/LovInput/LovInput.js +2 -2
  12. package/dist/components/Form/LovInput/LovInput.js.map +1 -1
  13. package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
  14. package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
  15. package/dist/components/Form/LovInput/index.js +4 -4
  16. package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
  17. package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
  18. package/dist/components/Form/hooks/index.js +128 -66
  19. package/dist/components/Form/hooks/index.js.map +1 -1
  20. package/dist/components/Form/index.js +836 -656
  21. package/dist/components/Form/index.js.map +1 -1
  22. package/dist/components/Form/utils/index.js +30 -18
  23. package/dist/components/Form/utils/index.js.map +1 -1
  24. package/dist/components/LovTable/LovPagetable.vue.d.ts +28 -0
  25. package/dist/components/LovTable/index.d.ts +14 -0
  26. package/dist/components/LovTable/index.js +179 -105
  27. package/dist/components/LovTable/index.js.map +1 -1
  28. package/dist/components/Modal/Modal.d.ts +2 -0
  29. package/dist/components/Modal/ModalLocator.vue.d.ts +20 -0
  30. package/dist/components/Modal/index.d.ts +4 -1
  31. package/dist/components/Modal/index.js +127 -0
  32. package/dist/components/Modal/index.js.map +1 -0
  33. package/dist/components/Modal/types.d.ts +18 -0
  34. package/dist/components/Modal/types.js +7 -0
  35. package/dist/components/Modal/types.js.map +1 -0
  36. package/dist/components/Modal/useModal.d.ts +1 -3
  37. package/dist/components/Modal/useModal.js +5 -4
  38. package/dist/components/Modal/useModal.js.map +1 -1
  39. package/dist/components/Pagetable/Pagetable.d.ts +13 -0
  40. package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
  41. package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
  42. package/dist/components/Pagetable/columns/PagetableColumnDiy.d.ts +13 -0
  43. package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
  44. package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
  45. package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
  46. package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
  47. package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
  48. package/dist/components/Pagetable/hooks/useColumns.js +88 -74
  49. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
  50. package/dist/components/Pagetable/index.d.ts +9 -0
  51. package/dist/components/Pagetable/index.js +697 -491
  52. package/dist/components/Pagetable/index.js.map +1 -1
  53. package/dist/components/Pagetable/utils/index.js +92 -54
  54. package/dist/components/Pagetable/utils/index.js.map +1 -1
  55. package/dist/components/Querytable/hooks/useColumns.js +82 -74
  56. package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
  57. package/dist/components/Querytable/index.js +579 -469
  58. package/dist/components/Querytable/index.js.map +1 -1
  59. package/dist/components/Querytable/utils/index.js +92 -54
  60. package/dist/components/Querytable/utils/index.js.map +1 -1
  61. package/dist/components/RichTextEditor/index.js +100 -74
  62. package/dist/components/RichTextEditor/index.js.map +1 -1
  63. package/dist/components/Tabs/constants.js +2 -2
  64. package/dist/components/Tabs/constants.js.map +1 -1
  65. package/dist/components/Tabs/index.js +603 -358
  66. package/dist/components/Tabs/index.js.map +1 -1
  67. package/dist/components/Tabs/tab-bar.js +6 -6
  68. package/dist/components/Tabs/tab-bar.js.map +1 -1
  69. package/dist/components/Tabs/tab-pane.js +3 -3
  70. package/dist/components/Tabs/tab-pane.js.map +1 -1
  71. package/dist/components/_constants/aria.js +2 -2
  72. package/dist/components/_constants/aria.js.map +1 -1
  73. package/dist/components/_constants/event.js +6 -4
  74. package/dist/components/_constants/event.js.map +1 -1
  75. package/dist/components/_constants/index.js +6 -6
  76. package/dist/components/_hooks/index.js +7 -7
  77. package/dist/components/_hooks/use-namespace/index.js +74 -39
  78. package/dist/components/_hooks/use-namespace/index.js.map +1 -1
  79. package/dist/components/_hooks/use-ordered-children/index.js +29 -19
  80. package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
  81. package/dist/components/_util/arrays.js +9 -5
  82. package/dist/components/_util/arrays.js.map +1 -1
  83. package/dist/components/_util/browser.js +6 -6
  84. package/dist/components/_util/browser.js.map +1 -1
  85. package/dist/components/_util/classNames.js +22 -17
  86. package/dist/components/_util/classNames.js.map +1 -1
  87. package/dist/components/_util/dom/aria.js +74 -39
  88. package/dist/components/_util/dom/aria.js.map +1 -1
  89. package/dist/components/_util/dom/element.js +9 -8
  90. package/dist/components/_util/dom/element.js.map +1 -1
  91. package/dist/components/_util/dom/event.js +14 -7
  92. package/dist/components/_util/dom/event.js.map +1 -1
  93. package/dist/components/_util/dom/index.js +36 -36
  94. package/dist/components/_util/dom/position.js +49 -25
  95. package/dist/components/_util/dom/position.js.map +1 -1
  96. package/dist/components/_util/dom/scroll.js +103 -61
  97. package/dist/components/_util/dom/scroll.js.map +1 -1
  98. package/dist/components/_util/dom/style.js +65 -50
  99. package/dist/components/_util/dom/style.js.map +1 -1
  100. package/dist/components/_util/easings.js +8 -4
  101. package/dist/components/_util/easings.js.map +1 -1
  102. package/dist/components/_util/error.js +12 -11
  103. package/dist/components/_util/error.js.map +1 -1
  104. package/dist/components/_util/functions.js +3 -3
  105. package/dist/components/_util/i18n.js +2 -2
  106. package/dist/components/_util/i18n.js.map +1 -1
  107. package/dist/components/_util/index.js +137 -137
  108. package/dist/components/_util/isValid.js +4 -2
  109. package/dist/components/_util/isValid.js.map +1 -1
  110. package/dist/components/_util/objects.js +18 -14
  111. package/dist/components/_util/objects.js.map +1 -1
  112. package/dist/components/_util/props-util/index.js +46 -20
  113. package/dist/components/_util/props-util/index.js.map +1 -1
  114. package/dist/components/_util/props-util/initDefaultProps.js +18 -10
  115. package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
  116. package/dist/components/_util/raf.js +5 -4
  117. package/dist/components/_util/raf.js.map +1 -1
  118. package/dist/components/_util/rand.js +4 -3
  119. package/dist/components/_util/rand.js.map +1 -1
  120. package/dist/components/_util/strings.js +9 -8
  121. package/dist/components/_util/strings.js.map +1 -1
  122. package/dist/components/_util/throttleByRaf.js +16 -10
  123. package/dist/components/_util/throttleByRaf.js.map +1 -1
  124. package/dist/components/_util/type.js +41 -38
  125. package/dist/components/_util/type.js.map +1 -1
  126. package/dist/components/_util/types.js +41 -22
  127. package/dist/components/_util/types.js.map +1 -1
  128. package/dist/components/_util/typescript.js +2 -2
  129. package/dist/components/_util/typescript.js.map +1 -1
  130. package/dist/components/_util/util.js +85 -43
  131. package/dist/components/_util/util.js.map +1 -1
  132. package/dist/components/_util/vue/global-node.js +27 -15
  133. package/dist/components/_util/vue/global-node.js.map +1 -1
  134. package/dist/components/_util/vue/icon.js +29 -25
  135. package/dist/components/_util/vue/icon.js.map +1 -1
  136. package/dist/components/_util/vue/index.js +41 -41
  137. package/dist/components/_util/vue/install.js +35 -18
  138. package/dist/components/_util/vue/install.js.map +1 -1
  139. package/dist/components/_util/vue/props/index.js +6 -6
  140. package/dist/components/_util/vue/props/runtime.js +46 -30
  141. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  142. package/dist/components/_util/vue/refs.js +12 -6
  143. package/dist/components/_util/vue/refs.js.map +1 -1
  144. package/dist/components/_util/vue/size.js +5 -3
  145. package/dist/components/_util/vue/size.js.map +1 -1
  146. package/dist/components/_util/vue/validator.js +5 -4
  147. package/dist/components/_util/vue/validator.js.map +1 -1
  148. package/dist/components/_util/vue/vnode.js +100 -54
  149. package/dist/components/_util/vue/vnode.js.map +1 -1
  150. package/dist/components/_util/vue-types/index.js +231 -220
  151. package/dist/components/_util/vue-types/index.js.map +1 -1
  152. package/dist/components/components.js +20 -20
  153. package/dist/components/index.js +38 -35
  154. package/dist/components/index.js.map +1 -1
  155. package/dist/components-8oZ2kpUC.js +27 -0
  156. package/dist/components-8oZ2kpUC.js.map +1 -0
  157. package/dist/components-B3d9m_tn.js +27 -0
  158. package/dist/components-B3d9m_tn.js.map +1 -0
  159. package/dist/error/OrionError.js +8 -4
  160. package/dist/error/OrionError.js.map +1 -1
  161. package/dist/functions-BeMkokbY.js +63 -0
  162. package/dist/functions-BeMkokbY.js.map +1 -0
  163. package/dist/index-BOKLZnqH.js +54 -0
  164. package/dist/index-BOKLZnqH.js.map +1 -0
  165. package/dist/index-D1m0KTpK.js +69 -0
  166. package/dist/index-D1m0KTpK.js.map +1 -0
  167. package/dist/index-DR5ZP7mD.js +160 -0
  168. package/dist/index-DR5ZP7mD.js.map +1 -0
  169. package/dist/index-DkwIULcN.js +200 -0
  170. package/dist/index-DkwIULcN.js.map +1 -0
  171. package/dist/index.css +797 -1
  172. package/dist/index.js +36 -36
  173. package/dist/print/LodopFuncs.js +101 -43
  174. package/dist/print/LodopFuncs.js.map +1 -1
  175. package/dist/print/index.js +200 -108
  176. package/dist/print/index.js.map +1 -1
  177. package/dist/request/ErrorHandlerChain.js +17 -14
  178. package/dist/request/ErrorHandlerChain.js.map +1 -1
  179. package/dist/request/RequestFilterChain.js +16 -13
  180. package/dist/request/RequestFilterChain.js.map +1 -1
  181. package/dist/request/ResponseParserChain.js +17 -14
  182. package/dist/request/ResponseParserChain.js.map +1 -1
  183. package/dist/request/disivion/DateSerializer.js +47 -22
  184. package/dist/request/disivion/DateSerializer.js.map +1 -1
  185. package/dist/request/disivion/DivisionErrorHandler.js +40 -25
  186. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
  187. package/dist/request/disivion/DivisionResponseParser.js +16 -10
  188. package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
  189. package/dist/request/disivion/index.js +305 -201
  190. package/dist/request/disivion/index.js.map +1 -1
  191. package/dist/request/error/BizExceptionResponseError.js +11 -5
  192. package/dist/request/error/BizExceptionResponseError.js.map +1 -1
  193. package/dist/request/error/ExceptionResponseError.js +11 -5
  194. package/dist/request/error/ExceptionResponseError.js.map +1 -1
  195. package/dist/request/error/ResponseError.js +9 -4
  196. package/dist/request/error/ResponseError.js.map +1 -1
  197. package/dist/request/error/SessionExceptionResponseError.js +11 -5
  198. package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
  199. package/dist/request/index.js +11 -11
  200. package/dist/utils/DateUtil.js +48 -33
  201. package/dist/utils/DateUtil.js.map +1 -1
  202. package/dist/utils/NumberUtil.js +6 -6
  203. package/dist/utils/NumberUtil.js.map +1 -1
  204. package/dist/utils/cloneDeep.js +2 -2
  205. package/dist/utils/delay.js +3 -3
  206. package/dist/utils/delay.js.map +1 -1
  207. package/dist/utils/functions.js +3 -3
  208. package/dist/utils/index.js +12 -12
  209. package/dist/utils/md5.js +191 -93
  210. package/dist/utils/md5.js.map +1 -1
  211. package/dist/utils/uuid.js +35 -25
  212. package/dist/utils/uuid.js.map +1 -1
  213. package/dist/version/index.js +2 -2
  214. package/dist/version/version.d.ts +1 -1
  215. package/dist/version/version.js +2 -2
  216. package/dist/version/version.js.map +1 -1
  217. package/package.json +1 -1
  218. package/dist/components-J6-qau6Y.js +0 -73
  219. package/dist/components-J6-qau6Y.js.map +0 -1
@@ -1,137 +1,211 @@
1
- import { findIndex as P } from "lodash-es";
2
- import { defineComponent as A, useTemplateRef as x, ref as v, watch as k, openBlock as y, createBlock as I, unref as L, withCtx as S, renderSlot as z } from "vue";
3
- import { withInstall as U } from "../_util/vue/install.js";
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 T from "../Querytable/index.js";
5
+ import Querytable from "../Querytable/index.js";
6
6
  import "../Form/index.js";
7
- import D from "../Form/LovInput/hooks/useLov.js";
8
- import q from "../Pagetable/index.js";
9
- const B = /* @__PURE__ */ A({
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(e) {
17
- const d = x("table"), i = v(), s = v(), l = D();
18
- l == null || l.registerKeydownHandler((a) => {
19
- if (a == "ArrowUp") {
20
- let o;
21
- i.value == 0 ? o = e.data[e.data.length - 1] : o = e.data[i.value - 1], d.value.setCurrentRow(o), r(i.value);
22
- } else if (a == "ArrowDown") {
23
- let o;
24
- i.value == e.data.length - 1 ? o = e.data[0] : o = e.data[i.value + 1], d.value.setCurrentRow(o), r(i.value);
25
- } else a == "Enter" && s.value && (l == null || l.backfill(s.value));
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 r = (a) => {
28
- var t;
29
- ((t = d.value) == null ? void 0 : t.$el).querySelectorAll(".el-table__row")[a].scrollIntoViewIfNeeded();
30
- }, f = (a) => {
31
- l == null || l.backfill(a);
32
- }, u = (a) => {
33
- const o = P(e.data, a);
34
- o == -1 ? (i.value = 0, s.value = e.data[0]) : (i.value = o, s.value = a);
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
- return k(
37
- () => e.data,
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
- e.data.length > 0 && d.value.setCurrentRow(e.data[0]);
65
+ if (__props.data.length > 0) {
66
+ tableRef.value.setCurrentRow(__props.data[0]);
67
+ }
40
68
  }
41
- ), (a, o) => (y(), I(L(T), {
42
- ref: "table",
43
- data: a.data,
44
- onRowClick: f,
45
- "current-row-mode": "",
46
- onCurrentRowChange: u,
47
- size: "small"
48
- }, {
49
- default: S(() => [
50
- z(a.$slots, "default")
51
- ]),
52
- _: 3
53
- }, 8, ["data"]));
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
- }), E = /* @__PURE__ */ A({
56
- name: "OLovPagetable",
57
- inheritAttrs: !0,
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(e, { emit: d }) {
65
- const i = d, s = (t) => {
66
- i("update:pagination", t);
67
- }, l = x("table"), r = v(), f = v(), u = D();
68
- u == null || u.registerKeydownHandler((t) => {
69
- var c, R, g, h, C, $;
70
- if (t == "ArrowUp") {
71
- let n;
72
- r.value == 0 ? n = e.data[e.data.length - 1] : n = e.data[r.value - 1], l.value.setCurrentRow(n), a(r.value);
73
- } else if (t == "ArrowDown") {
74
- let n;
75
- r.value == e.data.length - 1 ? n = e.data[0] : n = e.data[r.value + 1], l.value.setCurrentRow(n), a(r.value);
76
- } else if (t == "Enter")
77
- f.value && (u == null || u.backfill(f.value));
78
- else if (t == "ArrowLeft") {
79
- const n = (c = e.pagination) == null ? void 0 : c.currentPage, w = (R = e.pagination) == null ? void 0 : R.pageSize, m = (g = e.pagination) == null ? void 0 : g.total;
80
- if (!n || !w || !m)
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
- n > 1 && i("update:pagination", {
83
- ...e.pagination,
84
- currentPage: n - 1
85
- });
86
- } else if (t == "ArrowRight") {
87
- const n = (h = e.pagination) == null ? void 0 : h.currentPage, w = (C = e.pagination) == null ? void 0 : C.pageSize, m = ($ = e.pagination) == null ? void 0 : $.total;
88
- if (!n || !w || !m)
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
- const Q = Math.ceil(m / w);
91
- n < Q && i("update:pagination", {
92
- ...e.pagination,
93
- currentPage: n + 1
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 a = (t) => {
98
- var g;
99
- ((g = l.value) == null ? void 0 : g.$el).querySelectorAll(".el-table__row")[t].scrollIntoViewIfNeeded();
100
- }, o = (t) => {
101
- u == null || u.backfill(t);
102
- }, b = (t) => {
103
- const c = P(e.data, t);
104
- c == -1 ? (r.value = 0, f.value = e.data[0]) : (r.value = c, f.value = t);
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
- return k(
107
- () => e.data,
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
- e.data.length > 0 && l.value.setCurrentRow(e.data[0]);
177
+ if (__props.data.length > 0) {
178
+ tableRef.value.setCurrentRow(__props.data[0]);
179
+ }
110
180
  }
111
- ), (t, c) => (y(), I(L(q), {
112
- ref: "table",
113
- data: t.data,
114
- onRowClick: o,
115
- "current-row-mode": "",
116
- onCurrentRowChange: b,
117
- pagination: t.pagination,
118
- "onUpdate:pagination": s,
119
- size: "small"
120
- }, {
121
- default: S(() => [
122
- z(t.$slots, "default")
123
- ]),
124
- _: 3
125
- }, 8, ["data", "pagination"]));
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
- }), G = U(
200
+ });
201
+ const index = withInstall(
128
202
  {},
129
203
  {
130
- LovQuerytable: B,
131
- LovPagetable: E
204
+ LovQuerytable: _sfc_main$1,
205
+ LovPagetable: _sfc_main
132
206
  }
133
207
  );
134
208
  export {
135
- G as default
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":["tableRef","useTemplateRef","currentRowIndex","ref","currentRowData","lov","useLov","code","nextRow","__props","scrollToRow","index","_a","onRowClick","row","handleCurrentRowChange","findIndex","watch","emits","__emit","onUpdatePagination","data","currentPage","pageSize","_b","total","_c","_d","_e","_f","totalPage","withInstall","LovQuerytable","LovPagetable"],"mappings":";;;;;;;;;;;;;;;;AAcM,UAAAA,IAAWC,EAAe,OAAO,GACjCC,IAAkBC,KAClBC,IAAiBD,KAEjBE,IAAMC;AACP,IAAAD,KAAA,QAAAA,EAAA,uBAAuB,CAACE,MAAS;AACpC,UAAIA,KAAQ,WAAW;AACjB,YAAAC;AACA,QAAAN,EAAgB,SAAS,IAC3BM,IAAUC,EAAI,KAACA,EAAI,KAAC,SAAS,CAAC,IAE9BD,IAAUC,OAAKP,EAAgB,QAAQ,CAAC,GAGjCF,EAAA,MAAM,cAAcQ,CAAO,GACpCE,EAAYR,EAAgB,KAAK;AAAA,MAAA,WACxBK,KAAQ,aAAa;AAC1B,YAAAC;AACJ,QAAIN,EAAgB,SAASO,EAAI,KAAC,SAAS,IAC/BD,IAAAC,OAAK,CAAC,IAEhBD,IAAUC,OAAKP,EAAgB,QAAQ,CAAC,GAGjCF,EAAA,MAAM,cAAcQ,CAAO,GACpCE,EAAYR,EAAgB,KAAK;AAAA,MAAA,MACnC,CAAWK,KAAQ,WACjBH,EAAe,UAASC,KAAA,QAAAA,EAAK,SAASD,EAAe;AAAA,IACvD;AAGI,UAAAM,IAAc,CAACC,MAAkB;;AAGrC,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CAAC,MAE7BP,EAAgB,QAAQS,GACxBP,EAAe,QAAQU;AAAA,IACzB;AAGF,WAAAG;AAAA,MACE,MAAMR,EAAI;AAAA,MACV,MAAM;AACA,QAAAA,EAAI,KAAC,SAAS,KAEhBT,EAAS,MAAM,cAAcS,EAAA,KAAK,CAAC,CAAC;AAAA,MAExC;AAAA,IAAA;;;;;;;;;;;;;;;;ICrHFE,IAAeoB;AAAA,EACb,CAAC;AAAA,EACD;AAAA,IAAA,eACEC;AAAAA,IAAA,cACAC;AAAAA,EACF;AACF;"}
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,gBAAgB,KAAK;AAAA,MAAA,WACxB,QAAQ,SAAS;AAC1B,uBAAe,UAAS,2BAAK,SAAS,eAAe;AAAA,MACvD;AAAA,IAAA;AAGI,UAAA,cAAc,CAACA,WAAkB;;AAC/B,YAAA,UAAS,cAAS,UAAT,mBAAgB;AAC/B,YAAM,OAAO,OAAO,iBAAiB,gBAAgB,EAAEA,MAAK;AAC5D,WAAK,uBAAuB;AAAA,IAAA;AAGxB,UAAA,aAAa,CAAC,QAA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AGF;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
- 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>> & {};
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,QAAQD;AACd,UAAME,UAAUC;AAChB,UAAMC,eAAeJ;AACrB,UAAMK,QAAQL;AACd,UAAMM,SAASN;AACf,UAAMO,YAAYP;AAClB,UAAMQ,YAAYR,IAAI,IAAI;AAC1B,UAAMS,WAAWT;AAEjB,UAAMU,QAAiE,OAAOC,YAAY;AACxFZ,WAAKa,QAAQ;AACbX,YAAMW,QAAQD,QAAQV;AACtBC,cAAQU,QAAQD,QAAQT;AACxB,UAAIS,QAAQP,cAAc;AACxBA,qBAAaQ,QAAQD,QAAQP;AAAAA,MAC/B,OAAO;AACLA,qBAAaQ,QAAQ;MACvB;AACA,UAAID,QAAQN,OAAO;AACjBA,cAAMO,QAAQD,QAAQN;AAAAA,MACxB;AACA,UAAIM,QAAQL,QAAQ;AAClBA,eAAOM,QAAQC,QAAQF,QAAQL,MAAM;AAAA,MACvC;AACA,UAAIK,QAAQH,aAAaM,UAAaH,QAAQH,aAAa,OAAO;AAChEA,kBAAUI,QAAQ;AAAA,MACpB;AACA,UAAID,QAAQI,SAAS;AACnBN,iBAASG,QAAQD,QAAQI;AAAAA,MAC3B,OAAO;AACL,YAAInB,gBAAgBA,aAAamB,QAAQH,OAAO;AAC9CH,mBAASG,QAAQhB,aAAamB,QAAQH;AAAAA,QACxC;AAAA,MACF;AAEA,YAAMI,UAAU,IAAIC,QAA6B,CAACC,SAASC,WAAW;AACpEZ,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
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,7 @@
1
+ const modalContextKey = Symbol("modalContextKey");
2
+ const modalLocatorContextKey = Symbol("modalLocatorContextKey");
3
+ export {
4
+ modalContextKey,
5
+ modalLocatorContextKey
6
+ };
7
+ //# sourceMappingURL=types.js.map
@@ -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,3 +1 @@
1
- export default function useModal(): {
2
- close: (params: Record<string, any>) => void;
3
- } | undefined;
1
+ export default function useModal(): import('./types').ModalContext | undefined;
@@ -1,8 +1,9 @@
1
- import { inject as o } from "vue";
2
- function $() {
3
- return o("$$Modal");
1
+ import { inject } from "vue";
2
+ import { modalContextKey } from "./types.js";
3
+ function useModal() {
4
+ return inject(modalContextKey);
4
5
  }
5
6
  export {
6
- $ as default
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 const $$Modal = inject<{\r\n close: (params: Record<string, any>) => void\r\n }>('$$Modal')\r\n return $$Modal\r\n}\r\n"],"names":["useModal","inject"],"mappings":";AAEA,SAAwBA,IAAW;AAI1B,SAHSC,EAEb,SAAS;AAEd;"}
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;"}