@dazhicheng/ui 1.5.199 → 1.5.202

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
  2. package/dist/api/dataTypeContext.js +17 -0
  3. package/dist/assets/img/empty_images/no_data.png.js +4 -0
  4. package/dist/assets/img/empty_images/search.png.js +4 -0
  5. package/dist/assets/img/image_status/develop.png.js +4 -0
  6. package/dist/assets/img/image_status/loading.gif.js +4 -0
  7. package/dist/assets/img/image_status/loading_fail.png.js +4 -0
  8. package/dist/assets/img/image_status/no_network.png.js +4 -0
  9. package/dist/assets/img/image_status/no_permission.png.js +4 -0
  10. package/dist/assets/svg/RiRefreshLine.svg.js +4 -0
  11. package/dist/assets/svg/action_more.svg.js +4 -0
  12. package/dist/assets/svg/add.svg.js +4 -0
  13. package/dist/assets/svg/addCircleLine.svg.js +4 -0
  14. package/dist/assets/svg/arrowDown.svg.js +4 -0
  15. package/dist/assets/svg/arrowLineDown.svg.js +5 -0
  16. package/dist/assets/svg/arrowSUp.svg.js +4 -0
  17. package/dist/assets/svg/arrowUp.svg.js +4 -0
  18. package/dist/assets/svg/close.svg.js +4 -0
  19. package/dist/assets/svg/columnSet.svg.js +4 -0
  20. package/dist/assets/svg/determinateCircleLine.svg.js +5 -0
  21. package/dist/assets/svg/drag.svg.js +5 -0
  22. package/dist/assets/svg/exportSvg.svg.js +4 -0
  23. package/dist/assets/svg/fileSvg.svg.js +4 -0
  24. package/dist/assets/svg/help.svg.js +4 -0
  25. package/dist/assets/svg/item_error.svg.js +4 -0
  26. package/dist/assets/svg/paixu-jiangxu.svg.js +4 -0
  27. package/dist/assets/svg/paixu-moren.svg.js +4 -0
  28. package/dist/assets/svg/paixu-shengxu.svg.js +4 -0
  29. package/dist/assets/svg/quanping.svg.js +4 -0
  30. package/dist/assets/svg/suoxiao.svg.js +4 -0
  31. package/dist/components/tt-api-component/index.js +7 -0
  32. package/dist/components/tt-api-component/index.vue.js +7 -0
  33. package/dist/components/tt-api-component/index.vue2.js +199 -0
  34. package/dist/components/tt-area/TtArea.vue.js +7 -0
  35. package/dist/components/tt-area/TtArea.vue3.js +36 -0
  36. package/dist/components/tt-button/components/AddButton.vue.js +24 -0
  37. package/dist/components/tt-button/components/AddButton.vue2.js +4 -0
  38. package/dist/components/tt-button/index.js +9 -0
  39. package/dist/components/tt-button/index.vue.js +7 -0
  40. package/dist/components/tt-button/index.vue2.js +68 -0
  41. package/dist/components/tt-checkbox/index.js +7 -0
  42. package/dist/components/tt-checkbox/index.vue.js +77 -0
  43. package/dist/components/tt-checkbox/index.vue2.js +4 -0
  44. package/dist/components/tt-drawer/index.js +14 -0
  45. package/dist/components/tt-drawer/src/RenderDrawer.vue.js +157 -0
  46. package/dist/components/tt-drawer/src/RenderDrawer.vue3.js +5 -0
  47. package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +56 -0
  48. package/dist/components/tt-drawer/src/components/DrawerFooter.vue3.js +5 -0
  49. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +7 -0
  50. package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +21 -0
  51. package/dist/components/tt-drawer/src/hooks/useDrawerRender.js +124 -0
  52. package/dist/components/tt-drawer/src/hooks/useResizable.js +98 -0
  53. package/dist/components/tt-drawer/src/index.js +17 -0
  54. package/dist/components/tt-drawer/src/props.js +72 -0
  55. package/dist/components/tt-drawer/src/utils/drawer-api.js +191 -0
  56. package/dist/components/tt-empty/index.js +34 -0
  57. package/dist/components/tt-form/index.js +59 -0
  58. package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +38 -0
  59. package/dist/components/tt-form/src/components/ExpandableArrow.vue3.js +5 -0
  60. package/dist/components/tt-form/src/components/FormActions.vue2.js +177 -0
  61. package/dist/components/tt-form/src/components/FormActions.vue3.js +5 -0
  62. package/dist/components/tt-form/src/components/FormElInput.vue.js +80 -0
  63. package/dist/components/tt-form/src/components/FormElInput.vue2.js +4 -0
  64. package/dist/components/tt-form/src/components/Slot.js +28 -0
  65. package/dist/components/tt-form/src/config.js +57 -0
  66. package/dist/components/tt-form/src/form/FormControl.vue.js +16 -0
  67. package/dist/components/tt-form/src/form/FormControl.vue2.js +4 -0
  68. package/dist/components/tt-form/src/form/FormDescription.vue.js +21 -0
  69. package/dist/components/tt-form/src/form/FormDescription.vue2.js +4 -0
  70. package/dist/components/tt-form/src/form/FormItem.vue.js +20 -0
  71. package/dist/components/tt-form/src/form/FormItem.vue2.js +4 -0
  72. package/dist/components/tt-form/src/form/FormLabel.vue.js +19 -0
  73. package/dist/components/tt-form/src/form/FormLabel.vue2.js +4 -0
  74. package/dist/components/tt-form/src/form/FormMessage.vue.js +18 -0
  75. package/dist/components/tt-form/src/form/FormMessage.vue2.js +4 -0
  76. package/dist/components/tt-form/src/form/FormMessageToolTip.vue.js +30 -0
  77. package/dist/components/tt-form/src/form/FormMessageToolTip.vue2.js +4 -0
  78. package/dist/components/tt-form/src/form/RenderContent.vue.js +31 -0
  79. package/dist/components/tt-form/src/form/RenderContent.vue2.js +4 -0
  80. package/dist/components/tt-form/src/form/injectionKeys.js +4 -0
  81. package/dist/components/tt-form/src/form/useFormField.js +24 -0
  82. package/dist/components/tt-form/src/form-render/FormField.vue.js +4 -0
  83. package/dist/components/tt-form/src/form-render/FormField.vue2.js +345 -0
  84. package/dist/components/tt-form/src/form-render/FormFieldContact.js +54 -0
  85. package/dist/components/tt-form/src/form-render/FormLabel.vue.js +4 -0
  86. package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +101 -0
  87. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +195 -0
  88. package/dist/components/tt-form/src/form-render/array-register/props.js +47 -0
  89. package/dist/components/tt-form/src/form-render/array-register/utils.js +12 -0
  90. package/dist/components/tt-form/src/form-render/context.js +15 -0
  91. package/dist/components/tt-form/src/form-render/dependencies.js +51 -0
  92. package/dist/components/tt-form/src/form-render/expandable.js +46 -0
  93. package/dist/components/tt-form/src/form-render/form.vue2.js +196 -0
  94. package/dist/components/tt-form/src/form-render/form.vue3.js +5 -0
  95. package/dist/components/tt-form/src/form-render/helper.js +22 -0
  96. package/dist/components/tt-form/src/form-render/rootWrapperClass.js +10 -0
  97. package/dist/components/tt-form/src/formApi.js +790 -0
  98. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +223 -0
  99. package/dist/components/tt-form/src/group-form/GroupForm.vue3.js +5 -0
  100. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +277 -0
  101. package/dist/components/tt-form/src/group-form/GroupSection.vue3.js +5 -0
  102. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +153 -0
  103. package/dist/components/tt-form/src/group-form/LazyFormField.vue3.js +5 -0
  104. package/dist/components/tt-form/src/group-form/groupFormApi.js +700 -0
  105. package/dist/components/tt-form/src/group-form/lazyContext.js +38 -0
  106. package/dist/components/tt-form/src/group-form/useGroupForm.js +83 -0
  107. package/dist/components/tt-form/src/group-form/utils.js +106 -0
  108. package/dist/components/tt-form/src/hooks/useArrayRegistry.js +22 -0
  109. package/dist/components/tt-form/src/hooks/useFieldArray.js +137 -0
  110. package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +33 -0
  111. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +81 -0
  112. package/dist/components/tt-form/src/index.vue2.js +147 -0
  113. package/dist/components/tt-form/src/index.vue3.js +5 -0
  114. package/dist/components/tt-form/src/shared/createContext.js +14 -0
  115. package/dist/components/tt-form/src/shared/global-state.js +22 -0
  116. package/dist/components/tt-form/src/shared/zod-defaults.js +47 -0
  117. package/dist/components/tt-form/src/types/forms.js +6 -0
  118. package/dist/components/tt-form/src/useForm.js +28 -0
  119. package/dist/components/tt-form/src/useFormContext.js +320 -0
  120. package/dist/components/tt-form/src/utils/array-path.js +18 -0
  121. package/dist/components/tt-form-item-error-tooltip/index.js +9 -0
  122. package/dist/components/tt-form-item-error-tooltip/index.vue.js +183 -0
  123. package/dist/components/tt-form-item-error-tooltip/index.vue3.js +5 -0
  124. package/dist/components/tt-icon/components/AddIcon.vue.js +28 -0
  125. package/dist/components/tt-icon/components/AddIcon.vue2.js +4 -0
  126. package/dist/components/tt-icon/components/SubIcon.vue.js +28 -0
  127. package/dist/components/tt-icon/components/SubIcon.vue2.js +4 -0
  128. package/dist/components/tt-icon/index.js +11 -0
  129. package/dist/components/tt-icon/index.vue.js +8 -0
  130. package/dist/components/tt-icon/index.vue2.js +115 -0
  131. package/dist/components/tt-image/index.js +9 -0
  132. package/dist/components/tt-image/src/components/ImageViewer.js +41 -0
  133. package/dist/components/tt-image/tt-image.js +55 -0
  134. package/dist/components/tt-loading/index.js +8 -0
  135. package/dist/components/tt-loading/src/directive.js +51 -0
  136. package/dist/components/tt-loading/src/loading.vue.js +7 -0
  137. package/dist/components/tt-loading/src/loading.vue2.js +75 -0
  138. package/dist/components/tt-loading/src/service.js +79 -0
  139. package/dist/components/tt-log/index.js +7 -0
  140. package/dist/components/tt-log/index.vue.js +31 -0
  141. package/dist/components/tt-log/index.vue2.js +4 -0
  142. package/dist/components/tt-modal/index.js +14 -0
  143. package/dist/components/tt-modal/src/RenderModal.vue.js +310 -0
  144. package/dist/components/tt-modal/src/RenderModal.vue3.js +5 -0
  145. package/dist/components/tt-modal/src/components/ModalFooter.vue.js +7 -0
  146. package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +74 -0
  147. package/dist/components/tt-modal/src/components/ModalHeader.vue.js +7 -0
  148. package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +22 -0
  149. package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +48 -0
  150. package/dist/components/tt-modal/src/components/ModalWrapper.vue2.js +4 -0
  151. package/dist/components/tt-modal/src/hooks/useModalRender.js +131 -0
  152. package/dist/components/tt-modal/src/index.js +17 -0
  153. package/dist/components/tt-modal/src/props.js +75 -0
  154. package/dist/components/tt-modal/src/utils/modal-api.js +200 -0
  155. package/dist/components/tt-modal/src/utils/modal-stack.js +28 -0
  156. package/dist/components/tt-modal-form/hooks/useModalFormSlot.js +22 -0
  157. package/dist/components/tt-modal-form/index.vue.js +201 -0
  158. package/dist/components/tt-modal-form/index.vue2.js +4 -0
  159. package/dist/components/tt-modal-form/useModalForm.js +30 -0
  160. package/dist/components/tt-nav-anchor/index.js +8 -0
  161. package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +234 -0
  162. package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue3.js +5 -0
  163. package/dist/components/tt-nav-anchor/src/constants.js +4 -0
  164. package/dist/components/tt-panel-select/index.js +7 -0
  165. package/dist/components/tt-panel-select/src/common.js +4 -0
  166. package/dist/components/tt-panel-select/src/components/PanelLeft.vue.js +56 -0
  167. package/dist/components/tt-panel-select/src/components/PanelLeft.vue2.js +4 -0
  168. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.js +277 -0
  169. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue2.js +4 -0
  170. package/dist/components/tt-panel-select/src/components/PanelRight.vue.js +108 -0
  171. package/dist/components/tt-panel-select/src/components/PanelRight.vue2.js +4 -0
  172. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +184 -0
  173. package/dist/components/tt-panel-select/src/hooks/usePanelSelection.js +91 -0
  174. package/dist/components/tt-panel-select/src/index.vue.js +386 -0
  175. package/dist/components/tt-panel-select/src/index.vue2.js +4 -0
  176. package/dist/components/tt-select/index.js +8 -0
  177. package/dist/components/tt-select/src/Select.vue.js +315 -0
  178. package/dist/components/tt-select/src/Select.vue3.js +5 -0
  179. package/dist/components/tt-select/src/components/SelectTable.vue.js +86 -0
  180. package/dist/components/tt-select/src/components/SelectTable.vue3.js +5 -0
  181. package/dist/components/tt-select/src/components/Table.vue.js +307 -0
  182. package/dist/components/tt-select/src/components/Table.vue3.js +5 -0
  183. package/dist/components/tt-select/src/const.js +19 -0
  184. package/dist/components/tt-select/src/hooks/useDataSource.js +196 -0
  185. package/dist/components/tt-select/src/hooks/useGrid.js +97 -0
  186. package/dist/components/tt-select/src/hooks/useKeyboard.js +63 -0
  187. package/dist/components/tt-select/src/hooks/usePagination.js +45 -0
  188. package/dist/components/tt-select/src/hooks/useSelect.js +100 -0
  189. package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
  190. package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +345 -0
  191. package/dist/components/tt-select/src/props.js +201 -0
  192. package/dist/components/tt-select/src/utils/index.js +16 -0
  193. package/dist/components/tt-table/index.js +63 -0
  194. package/dist/components/tt-table/src/Table.vue.js +623 -0
  195. package/dist/components/tt-table/src/Table.vue3.js +5 -0
  196. package/dist/components/tt-table/src/TableForm.vue.js +356 -0
  197. package/dist/components/tt-table/src/TableForm.vue2.js +4 -0
  198. package/dist/components/tt-table/src/componentMap.js +4 -0
  199. package/dist/components/tt-table/src/components/RowContext.js +24 -0
  200. package/dist/components/tt-table/src/components/TableAction.vue.js +222 -0
  201. package/dist/components/tt-table/src/components/TableAction.vue2.js +4 -0
  202. package/dist/components/tt-table/src/components/TableButtons.js +117 -0
  203. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +234 -0
  204. package/dist/components/tt-table/src/components/TableColumnModal.vue3.js +5 -0
  205. package/dist/components/tt-table/src/components/TableToobalTools.vue.js +87 -0
  206. package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +4 -0
  207. package/dist/components/tt-table/src/emits.js +15 -0
  208. package/dist/components/tt-table/src/hooks/useCellArea.js +15 -0
  209. package/dist/components/tt-table/src/hooks/useColumns.js +275 -0
  210. package/dist/components/tt-table/src/hooks/useCustomColumns.js +53 -0
  211. package/dist/components/tt-table/src/hooks/useDataSource.js +224 -0
  212. package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +64 -0
  213. package/dist/components/tt-table/src/hooks/usePagination.js +44 -0
  214. package/dist/components/tt-table/src/hooks/useRowSelection.js +84 -0
  215. package/dist/components/tt-table/src/hooks/useTableContext.js +20 -0
  216. package/dist/components/tt-table/src/hooks/useTableEvent.js +197 -0
  217. package/dist/components/tt-table/src/hooks/useTableForm.js +60 -0
  218. package/dist/components/tt-table/src/hooks/useTableRender.js +33 -0
  219. package/dist/components/tt-table/src/hooks/useTableSlot.js +17 -0
  220. package/dist/components/tt-table/src/props.js +482 -0
  221. package/dist/components/tt-table/src/toolProps.js +30 -0
  222. package/dist/components/tt-table/src/utils/context.js +17 -0
  223. package/dist/components/tt-table/src/utils/table-api.js +386 -0
  224. package/dist/components/tt-table/src/utils/table-form-api.js +122 -0
  225. package/dist/components/tt-text/index.js +7 -0
  226. package/dist/components/tt-text/index.vue.js +7 -0
  227. package/dist/components/tt-text/index.vue2.js +73 -0
  228. package/dist/components/tt-upload/index.js +9 -0
  229. package/dist/components/tt-upload/src/TtUpload.vue.js +306 -0
  230. package/dist/components/tt-upload/src/TtUpload.vue2.js +4 -0
  231. package/dist/components/tt-upload/src/typing.js +107 -0
  232. package/dist/directives/auto-tip/index.js +62 -0
  233. package/dist/directives/dialog-resize/index.js +49 -0
  234. package/dist/directives/dialog-resize/use-css-variable.js +44 -0
  235. package/dist/directives/dialog-resize/use-draggable.js +35 -0
  236. package/dist/directives/dialog-resize/use-fullscreen.js +38 -0
  237. package/dist/directives/dialog-resize/use-parse-translate.js +9 -0
  238. package/dist/directives/dialog-resize/use-resizer.js +37 -0
  239. package/dist/directives/disabled-tip/index.js +78 -0
  240. package/dist/directives/index.js +8 -0
  241. package/dist/hooks/useDataPermissionOptions.js +142 -0
  242. package/dist/hooks/useFormSchemasLink.js +261 -0
  243. package/dist/hooks/useFormat.js +44 -0
  244. package/dist/hooks/useLoading.js +22 -0
  245. package/dist/hooks/useScreenshotOss.js +69 -0
  246. package/dist/hooks/useSetup.js +59 -0
  247. package/dist/hooks/useTable.js +13 -0
  248. package/dist/hooks/useTemplateSlot.js +13 -0
  249. package/dist/index.js +142 -60274
  250. package/dist/plugins/default/renderCellContent.js +58 -0
  251. package/dist/plugins/vxeTable/switchStatus.js +91 -0
  252. package/dist/plugins.js +4 -146
  253. package/dist/style.css +1 -1
  254. package/dist/utils/xhr.js +8 -0
  255. package/package.json +5 -3
  256. package/dist/index-NG5FNCLD.js +0 -3430
  257. package/dist/index.modern-4Cf3dcJP.js +0 -3069
@@ -0,0 +1,45 @@
1
+ import { ref as e, computed as c, unref as o } from "vue";
2
+ import { defaultPagination as P } from "../const.js";
3
+ function p() {
4
+ const t = e({}), a = e(!1), i = e(!1), f = c(() => ({
5
+ ...P,
6
+ // 合并用户传入的分页配置
7
+ ...o(t)
8
+ }));
9
+ function r(n) {
10
+ a.value = n;
11
+ }
12
+ function u() {
13
+ return o(f);
14
+ }
15
+ function s(n) {
16
+ t.value = {
17
+ // 合并现有配置
18
+ ...o(t),
19
+ // 合并传入的配置
20
+ ...n
21
+ };
22
+ }
23
+ function g(n) {
24
+ i.value = n;
25
+ }
26
+ return {
27
+ // 设置是否显示分页器的函数
28
+ setShowPager: r,
29
+ // 是否显示分页器的响应式引用
30
+ showPager: a,
31
+ // 计算分页信息的计算属性
32
+ getPaginationInfo: f,
33
+ // 获取当前分页配置的函数
34
+ getPagination: u,
35
+ // 设置分页配置的函数
36
+ setPagination: s,
37
+ // 是否有下一页数据的响应式引用
38
+ hasNextPage: i,
39
+ // 设置是否有下一页数据的函数
40
+ setHasNextPage: g
41
+ };
42
+ }
43
+ export {
44
+ p as usePagination
45
+ };
@@ -0,0 +1,100 @@
1
+ import { calcWordsWidth as W } from "@dazhicheng/utils";
2
+ import { get as I } from "lodash-es";
3
+ import { ref as w, computed as d, unref as t, watchEffect as L } from "vue";
4
+ function z(n, e) {
5
+ const S = w(1), h = /* @__PURE__ */ new Map(), g = w(0), b = w(!1), C = d(() => e.collapse ?? t(n).multiple), E = d(() => e.isFilterMethod ?? !0), p = d(() => e.searchField), v = d(() => {
6
+ if (e.autoSelectWidth && !t(n).multiple && t(e.selectOption)) {
7
+ const l = t(e.selectOption).label || "";
8
+ return `${W(l) + 45}px`;
9
+ }
10
+ return "100%";
11
+ });
12
+ function y(l) {
13
+ var r, f;
14
+ const a = (r = e.getKeyboardEvent) == null ? void 0 : r.call(e);
15
+ if (!l) {
16
+ e.options.value = t(e.dataList), e.setActiveIndex(-1), a.ArrowDown();
17
+ return;
18
+ }
19
+ let s = [];
20
+ const c = p.value;
21
+ if (c)
22
+ s = t(e.dataList).filter(
23
+ (o) => String(I(o, c)).toUpperCase().includes(String(l).toUpperCase())
24
+ );
25
+ else {
26
+ const o = (f = t(e.columnsFields)) != null && f.length ? t(e.columnsFields) : ["label"];
27
+ s = t(e.dataList).filter(
28
+ (i) => o.some((m) => String(i[m]).toUpperCase().includes(String(l).toUpperCase()))
29
+ );
30
+ }
31
+ if (e.allowCreate && l && !s.some((i) => String(i.label).toUpperCase() === String(l).toUpperCase())) {
32
+ const i = { label: l, value: l };
33
+ s = [{ ...i, item: i }, ...s];
34
+ }
35
+ e.options.value = s, e.setActiveIndex(-1), a.ArrowDown();
36
+ }
37
+ const T = d(() => t(e.showPager) ? e.setSearchValue : t(E) ? y : void 0), U = d(() => ({
38
+ // 是否折叠标签
39
+ collapseTags: t(C),
40
+ // 折叠标签时是否显示工具提示
41
+ collapseTagsTooltip: t(C),
42
+ // 最大折叠标签数
43
+ maxCollapseTags: t(n).maxCollapseTags ?? t(S),
44
+ // 占位符文本
45
+ placeholder: t(n).placeholder ?? (e.placeholder || "请选择"),
46
+ // 是否禁用选择器
47
+ disabled: t(e.disabled ?? t(n).disabled),
48
+ // 过滤方法
49
+ filterMethod: t(T)
50
+ }));
51
+ function O() {
52
+ var s;
53
+ const l = t(e.selectOption);
54
+ if (!t(n).multiple || !l || l.length <= 1) return;
55
+ const a = l.map((c) => c.label).filter(Boolean);
56
+ if (t(e.selectRef) && a.length) {
57
+ const c = (s = t(e.selectRef)) == null ? void 0 : s.$el.getElementsByClassName("el-select__selection")[0], r = window.getComputedStyle(c), f = Number(r.width.slice(0, -2)), o = r.fontFamily, i = r.fontSize;
58
+ h.clear(), a.forEach((u, R) => {
59
+ if (R >= 10)
60
+ return;
61
+ const A = W(u, i, o) + 32 + 4;
62
+ h.set(u, A);
63
+ });
64
+ const m = f - 43;
65
+ let F = 0, M = 0;
66
+ h.forEach((u) => {
67
+ if (F += u, F < m)
68
+ return M += 1, !1;
69
+ }), S.value = M || 1;
70
+ }
71
+ }
72
+ function x() {
73
+ var a, s;
74
+ const l = t(e.selectRef) ? (s = (a = t(e.selectRef)) == null ? void 0 : a.$el) == null ? void 0 : s.offsetWidth : 0;
75
+ return t(n).multiple ? l - 50 : l;
76
+ }
77
+ return L(() => {
78
+ t(g) === 0 && t(e.selectRef) && (g.value = x());
79
+ }), {
80
+ // 其他选择器属性
81
+ getOtherSelectProps: U,
82
+ // 计算最大折叠标签数的方法
83
+ calcMaxCollapseTags: O,
84
+ // 计算选择器宽度的计算属性
85
+ calcSelectWidth: v,
86
+ // 获取select宽度
87
+ getSelectWidth: x,
88
+ // select宽度
89
+ selectWidth: g,
90
+ // select 是否展开
91
+ showPopup: b,
92
+ // 设置select是否展开
93
+ setShowPopup: (l) => {
94
+ b.value = l;
95
+ }
96
+ };
97
+ }
98
+ export {
99
+ z as useSelect
100
+ };
@@ -3,7 +3,7 @@ import { ComputedRef, MaybeRef, Ref } from 'vue';
3
3
  import { VxeGridDefines, VxeGridPropTypes } from 'vxe-table';
4
4
  import { TtSelectProps } from '../props';
5
5
  import { TtSelectModelUnionType, TtSelectModelValueType, TtSelectSelectOptions, TtSelectDataOptions } from '../types';
6
- import { default as SelectTable } from './components/SelectTable.vue';
6
+ import { default as SelectTable } from '../components/SelectTable.vue';
7
7
  /**
8
8
  * 定义选项类型,包含表格、选择器、数据、分页等相关的引用和方法
9
9
  */
@@ -0,0 +1,345 @@
1
+ import { isEmpty as F, isNullOrUnDef as C, isArray as D, isFunction as N } from "@dazhicheng/utils";
2
+ import { cloneDeep as I, isEqual as x } from "lodash-es";
3
+ import { ref as M, computed as q, watch as O, unref as a, nextTick as f, toValue as g, watchEffect as G, toRaw as K } from "vue";
4
+ import { useKeyboard as U } from "./useKeyboard.js";
5
+ function J(r, e, b) {
6
+ const y = M({
7
+ scrollTop: 0
8
+ }), { keyboardCaptureEvent: m } = U({
9
+ // 获取表格实例的方法
10
+ tableInstance: () => {
11
+ var l;
12
+ return (l = a(e.tableRef)) == null ? void 0 : l.getGridInstance();
13
+ },
14
+ // 当前活动行的索引
15
+ activeIndex: e.activeIndex,
16
+ // 选项列表
17
+ options: e.options,
18
+ // 设置活动索引的方法
19
+ setActiveIndex: e.setActiveIndex,
20
+ // 当前选中的值
21
+ selectValue: e.selectValue,
22
+ // 是否为多选模式
23
+ multiple: q(() => e.multiple),
24
+ // 获取表格事件处理函数的对象
25
+ getGridEvent: () => A,
26
+ // 选择器实例的引用
27
+ selectRef: e.selectRef,
28
+ // 是否加载数据
29
+ loading: e.loading
30
+ });
31
+ async function S(l, t, n) {
32
+ var c;
33
+ const i = (c = a(e.tableRef)) == null ? void 0 : c.getGridInstance();
34
+ let s = !0;
35
+ if (a(r).beforeChange && N(a(r).beforeChange)) {
36
+ const u = t && n ? { ...K(t), actionType: n } : t;
37
+ s = await a(r).beforeChange(l ?? e.selectValue.value, a(r).modelValue, u);
38
+ }
39
+ return s || (e.setSelectValue(a(r).modelValue, w({ value: a(r).modelValue }), !1), i && i.clearCurrentRow()), s;
40
+ }
41
+ function w(l) {
42
+ var c;
43
+ const t = (c = a(e.tableRef)) == null ? void 0 : c.getGridInstance();
44
+ if (C(l.value)) {
45
+ t && t.clearCurrentRow();
46
+ return;
47
+ }
48
+ const n = g(e.options).find((u) => u.value === l.value);
49
+ if (a(e).dataNoBindValueClear && !n) {
50
+ k.clear();
51
+ return;
52
+ }
53
+ const s = a(e.selectOption) && a(e.selectOption).value === l.value ? a(e.selectOption) : void 0;
54
+ return n || s || void 0;
55
+ }
56
+ function h(l) {
57
+ var i;
58
+ const t = (i = a(e.tableRef)) == null ? void 0 : i.getGridInstance();
59
+ return D(l) ? l.reduce((s, c) => {
60
+ if (!C(c)) {
61
+ const u = g(e.options).find((T) => T.value === c), d = a(e.selectOption), R = d ? d.find((T) => T.value === c) : void 0, o = u || R;
62
+ o && s && s.push(o);
63
+ }
64
+ return s;
65
+ }, []) : (t && t.clearCurrentRow(), []);
66
+ }
67
+ function v(l) {
68
+ var n;
69
+ const t = (n = a(e.tableRef)) == null ? void 0 : n.getGridInstance();
70
+ t && (e.multiple ? (t.clearCheckboxRow(), t.setCheckboxRow(l || [], !0)) : (t.clearRadioRow(), t.setRadioRow(l)));
71
+ }
72
+ const A = {
73
+ /**
74
+ * 单选框改变事件处理函数
75
+ */
76
+ radioChange: async ({ oldValue: l, row: t }) => {
77
+ var c, u;
78
+ const n = (c = a(e.tableRef)) == null ? void 0 : c.getGridInstance();
79
+ if (t.isDelete)
80
+ return;
81
+ if (!await S(t.value, t, "add")) {
82
+ n && l ? n.setRadioRow(l) : n.clearRadioRow();
83
+ return;
84
+ }
85
+ const s = n == null ? void 0 : n.getCurrentRecord();
86
+ e.setActiveIndex(n == null ? void 0 : n.getRowIndex(s)), e.setSelectValue(t.value, w(t)), (u = a(e.selectRef)) == null || u.blur(), f(() => {
87
+ e.updateOptionsDisabled();
88
+ });
89
+ },
90
+ /**
91
+ * 复选框改变事件处理函数
92
+ */
93
+ checkboxChange: async ({ checked: l, row: t }) => {
94
+ var u;
95
+ const n = (u = a(e.tableRef)) == null ? void 0 : u.getGridInstance(), i = I(a(e.selectValue));
96
+ if (!await S(t.value, t, l ? "add" : "remove")) {
97
+ n && n.setCheckboxRow(t, !1);
98
+ return;
99
+ }
100
+ const c = D(i) ? i : [];
101
+ if (l)
102
+ c.push(t.value);
103
+ else {
104
+ const d = c.findIndex((R) => R === t.value);
105
+ c.splice(d, 1);
106
+ }
107
+ n == null || n.setCurrentRow(t), e.setActiveIndex(n == null ? void 0 : n.getRowIndex(t)), e.setSelectValue(c, h(c)), e.checkedClearSearchValue && g(e.searchValue) && (e.setSearchValue(""), e.reload(!0), f(() => {
108
+ const d = a(e.selectRef);
109
+ d && (d.isFocused = !0, d.states.inputValue = "");
110
+ })), f(() => {
111
+ e.updateOptionsDisabled();
112
+ });
113
+ },
114
+ /**
115
+ * 表格滚动事件处理函数
116
+ */
117
+ scroll: (l) => {
118
+ y.value = l, b("scroll", l);
119
+ },
120
+ scrollBoundary: (l) => {
121
+ const { scrollTop: t } = l;
122
+ if (t <= 100 || !a(e.showPager) || a(e.loading)) return;
123
+ const { total: n, currentPage: i = 0 } = e.getPagination();
124
+ (n && a(e.options).length < n || a(e.hasNextPage)) && (e.setPagination({ currentPage: i + 1 }), f(async () => {
125
+ await e.reload();
126
+ })), b("scroll-boundary", l);
127
+ },
128
+ /**
129
+ * 全选复选框改变事件处理函数
130
+ */
131
+ checkboxAll: ({ checked: l }) => {
132
+ if (l) {
133
+ const t = a(e.options).filter((n) => !n.disabled && !n.isDelete).map((n) => n.value);
134
+ if (a(r).selectProps.multipleLimit) {
135
+ const n = t.slice(0, a(r).selectProps.multipleLimit), i = h(n);
136
+ e.setSelectValue(n, i), v(i);
137
+ } else {
138
+ const n = h(t);
139
+ e.setSelectValue(t, n), v(n);
140
+ }
141
+ } else
142
+ e.setSelectValue([], void 0), v([]);
143
+ f(() => {
144
+ e.updateOptionsDisabled();
145
+ });
146
+ },
147
+ /**
148
+ * 键盘按下事件处理函数
149
+ * @param event 键盘事件对象
150
+ */
151
+ keydown: (l) => {
152
+ var t;
153
+ l.preventDefault(), (t = m[l.key]) == null || t.call(m);
154
+ }
155
+ };
156
+ function P(l) {
157
+ var n;
158
+ const t = (n = a(e.tableRef)) == null ? void 0 : n.getGridInstance();
159
+ if (e.multiple)
160
+ l = t == null ? void 0 : t.getCurrentRecord();
161
+ else {
162
+ const i = t == null ? void 0 : t.getRowIndex(l);
163
+ i !== -1 && l && (t == null || t.setCurrentRow(l), e.setActiveIndex(i));
164
+ }
165
+ }
166
+ function E(l, t = !1) {
167
+ var s;
168
+ const n = (s = a(e.tableRef)) == null ? void 0 : s.getGridInstance();
169
+ a(r).configProps.isOpenPopupScrollToTop || t ? n && n.scrollTo(0, 0) : setTimeout(() => {
170
+ var u;
171
+ const c = (u = a(y)) == null ? void 0 : u.scrollTop;
172
+ a(r).renderType === "table" ? n == null || n.scrollTo(0, c || 0) : l ? n == null || n.scrollToRow(l) : c && (n == null || n.scrollTo(0, c || 0));
173
+ }, 16);
174
+ }
175
+ function L(l) {
176
+ var i;
177
+ const t = (i = a(e.tableRef)) == null ? void 0 : i.getGridInstance();
178
+ if (!t) return;
179
+ let n = I(l);
180
+ if (e.persistent)
181
+ P(n);
182
+ else if (!l || l.length === 0 || l.length > 1) {
183
+ const s = t.getData(g(e.activeIndex));
184
+ s && t.setCurrentRow(s), n = s;
185
+ } else
186
+ f(() => {
187
+ const s = t.getRowIndex(l);
188
+ s !== -1 && (t.setCurrentRow(l), e.setActiveIndex(s));
189
+ });
190
+ return n;
191
+ }
192
+ function B(l, t, n) {
193
+ const i = Array.isArray(l) ? l : [], s = i.map((o) => o == null ? void 0 : o.value), c = D(t) ? t : [], u = s.length > c.length, d = u ? s.find((o) => !c.includes(o)) : c.find((o) => !s.includes(o)), R = u ? i.find((o) => (o == null ? void 0 : o.value) === d) : n.find((o) => (o == null ? void 0 : o.value) === d);
194
+ return {
195
+ isAdd: u,
196
+ actionValue: d,
197
+ actionRow: R,
198
+ newValues: s,
199
+ oldValues: c
200
+ };
201
+ }
202
+ function V(l, t = !1, n = !1, i = !1) {
203
+ let s, c;
204
+ e.multiple ? (s = h(l || []), c = s ? l : []) : (s = w({ value: l }), c = s ? l : void 0), e.setSelectValue(c, s, i);
205
+ const u = L(s);
206
+ n || E(u, t), v(s);
207
+ }
208
+ const k = {
209
+ /**
210
+ * 清空选择器事件处理函数
211
+ */
212
+ clear: () => {
213
+ var t;
214
+ const l = (t = a(e.tableRef)) == null ? void 0 : t.getGridInstance();
215
+ e.multiple ? (l && l.clearCheckboxRow(), e.setSelectValue([], void 0)) : (l && l.clearRadioRow(), e.setSelectValue(void 0, void 0)), e.setActiveIndex(-1), b("clear");
216
+ },
217
+ /**
218
+ * 选择器可见性改变事件处理函数
219
+ * @param bool 是否可见
220
+ */
221
+ visibleChange: (l) => {
222
+ var i;
223
+ const t = (i = a(e.tableRef)) == null ? void 0 : i.getGridInstance();
224
+ t && (e.multiple ? t == null || t.clearCheckboxRow() : t.clearRadioRow()), e.setShowPopup(l);
225
+ const n = a(e.isLoaded) || a(e.needLoad) || g(e.isExpandLoadData);
226
+ l ? (b("focus"), f(async () => {
227
+ n && e.reload(!0), V(a(r).modelValue, n), e.updateOptionsDisabled();
228
+ })) : b("blur"), b("visible-change", l);
229
+ },
230
+ /**
231
+ * 择器值改变事件处理函数(el 删除/清除会触发)
232
+ * beforeChangeCheck(val, row):val 为当前操作的值,row 为当前操作的响应式对象
233
+ * @param val 选中的选项(el-select 的 v-model:单选为对象,多选为对象数组)
234
+ */
235
+ change: async (l) => {
236
+ const t = I(a(e.selectValue));
237
+ if (e.multiple) {
238
+ const { actionValue: n, actionRow: i, newValues: s, oldValues: c, isAdd: u } = B(
239
+ l,
240
+ t,
241
+ g(e.options)
242
+ );
243
+ if (!await S(n, i, u ? "add" : "remove")) {
244
+ const o = h(c);
245
+ e.setSelectValue(c, o), v(o), f(() => e.updateOptionsDisabled());
246
+ return;
247
+ }
248
+ const R = h(s);
249
+ e.setSelectValue(s, R), v(R);
250
+ } else {
251
+ const n = l, i = (n == null ? void 0 : n.value) ?? void 0;
252
+ if (!await S(i, n, i === void 0 ? "remove" : "add")) {
253
+ const u = t, d = w({ value: u });
254
+ e.setSelectValue(u, d), v(d), f(() => e.updateOptionsDisabled());
255
+ return;
256
+ }
257
+ const c = w({ value: i });
258
+ e.setSelectValue(i, c), v(c);
259
+ }
260
+ f(() => {
261
+ e.updateOptionsDisabled();
262
+ });
263
+ },
264
+ /**
265
+ * 选择器键盘按下捕获事件处理函数
266
+ * @param event 键盘事件对象
267
+ */
268
+ keydownCapture: (l) => {
269
+ var t;
270
+ m[l.key] && (l.preventDefault(), l.stopPropagation(), (t = m[l.key]) == null || t.call(m));
271
+ },
272
+ removeTag: (l) => {
273
+ b("remove-tag", l);
274
+ }
275
+ };
276
+ return O(
277
+ () => I(a(r).modelValue),
278
+ (l, t) => {
279
+ if (!x(l, t)) {
280
+ const n = I(a(e.selectValue));
281
+ if (x(l, n))
282
+ return;
283
+ f(() => {
284
+ V(l, !1, !1, a(r).immediateEmitChange), e.updateOptionsDisabled();
285
+ });
286
+ }
287
+ },
288
+ { immediate: !g(e.getImmediate), deep: !0 }
289
+ ), O(
290
+ () => g(e.options),
291
+ (l, t = []) => {
292
+ x(l, t) || f(() => {
293
+ V(a(r).modelValue, !1, !0), e.updateOptionsDisabled();
294
+ });
295
+ },
296
+ { immediate: !g(e.getImmediate), deep: !0 }
297
+ ), O(
298
+ () => a(r).configProps.defaultChecked,
299
+ (l, t) => {
300
+ if (F(g(l))) return;
301
+ x(g(l), g(t)) || C(a(r).modelValue) || (V(a(r).modelValue), f(() => {
302
+ e.updateOptionsDisabled();
303
+ }));
304
+ },
305
+ { deep: !0 }
306
+ ), G(() => {
307
+ var l;
308
+ if (a(e.getDefaultSingle)) {
309
+ if (a(e.options).length === 0 || a(e.options).length > 1)
310
+ return;
311
+ const t = e.multiple ? a(e.options).map((n) => n.value) : (l = a(e.options)[0]) == null ? void 0 : l.value;
312
+ setTimeout(() => {
313
+ V(t, !1, !1, !0), e.updateOptionsDisabled();
314
+ });
315
+ }
316
+ }), G(() => {
317
+ var l;
318
+ if (a(e.getIsSelectFirstOption)) {
319
+ if (a(e.options).length === 0)
320
+ return;
321
+ const t = (l = a(e.options)[0]) == null ? void 0 : l.value, n = e.multiple ? [t] : t;
322
+ setTimeout(() => {
323
+ V(n, !0, !1, !0), e.updateOptionsDisabled();
324
+ });
325
+ }
326
+ }), f(() => {
327
+ setTimeout(async () => {
328
+ g(e.getImmediate) && (e.reload(!0), f(() => {
329
+ e.updateOptionsDisabled();
330
+ }));
331
+ }, 16);
332
+ }), {
333
+ // 表格事件处理对象
334
+ gridEvent: A,
335
+ // 选择器事件处理对象
336
+ selectEvent: k,
337
+ // 键盘事件处理对象
338
+ keyboardEvent: m,
339
+ // 默认选中数据
340
+ defaultDataSelect: V
341
+ };
342
+ }
343
+ export {
344
+ J as useSelectTableEvent
345
+ };
@@ -0,0 +1,201 @@
1
+ const e = {
2
+ pageSizeField: "pageSize",
3
+ currentPageField: "currentPage",
4
+ totalField: "total",
5
+ dataField: "data",
6
+ resultField: "result",
7
+ pageSizeFieldGrpc: "pageSize",
8
+ totalFieldGrpc: "total",
9
+ dataFieldGrpc: "data",
10
+ resultFieldGrpc: "result",
11
+ searchField: "keyword",
12
+ immediate: !1,
13
+ changeDataClearable: !1,
14
+ defaultSingle: !1,
15
+ collapse: !0,
16
+ autoSelectWidth: !1,
17
+ isExpandLoadData: !1,
18
+ isCopy: !1,
19
+ isSelectFirstOption: !1
20
+ }, t = {
21
+ /**
22
+ * 绑定值
23
+ */
24
+ modelValue: {
25
+ type: [String, Number, Boolean, Array],
26
+ default: void 0
27
+ },
28
+ /**
29
+ * el-select 的Props
30
+ */
31
+ selectProps: {
32
+ type: Object,
33
+ default: () => ({})
34
+ },
35
+ /**
36
+ * vxe-grid 的Props
37
+ */
38
+ gridProps: {
39
+ type: Object,
40
+ default: () => ({})
41
+ },
42
+ /**
43
+ * 渲染的类型
44
+ * @property select 下拉
45
+ * @property grid 表格
46
+ * @property tree 树
47
+ * @default select
48
+ */
49
+ renderType: {
50
+ type: String,
51
+ default: "table"
52
+ },
53
+ /** 数据相关的配置 */
54
+ configProps: {
55
+ type: Object,
56
+ default: () => e
57
+ },
58
+ extra: {
59
+ type: Object,
60
+ default: () => ({})
61
+ },
62
+ /**
63
+ * 改变前置函数
64
+ * @param val 改变后的值
65
+ * @param oVal 改变前的值
66
+ * @param option 配置项
67
+ * @returns 是否改变
68
+ */
69
+ beforeChange: {
70
+ type: Function,
71
+ default: null
72
+ },
73
+ /** 是否加载 */
74
+ loading: {
75
+ type: Boolean,
76
+ default: !1
77
+ },
78
+ /** 是否禁用 */
79
+ disabled: {
80
+ type: Boolean,
81
+ default: !1
82
+ },
83
+ /** 文本占位符 */
84
+ placeholder: {
85
+ type: String,
86
+ default: ""
87
+ },
88
+ /** 禁用提示 */
89
+ disabledTip: {
90
+ type: [Object],
91
+ default: void 0
92
+ },
93
+ maxCollapseTags: {
94
+ type: Number,
95
+ default: void 0
96
+ },
97
+ /**
98
+ * 外部值改变是否立即触发emit
99
+ * @deprecated 兼容旧代码,新开发不要使用
100
+ */
101
+ immediateEmitChange: {
102
+ type: Boolean,
103
+ default: !1
104
+ },
105
+ /** 是否显示边框 */
106
+ border: {
107
+ type: Boolean,
108
+ default: !0
109
+ }
110
+ }, l = {
111
+ /** configProps */
112
+ configProps: {
113
+ type: Object,
114
+ default: () => ({})
115
+ },
116
+ /** 表格的参数 */
117
+ grid: {
118
+ type: Object,
119
+ default: () => ({})
120
+ },
121
+ /** 数据源 */
122
+ list: {
123
+ type: Array,
124
+ default: () => []
125
+ },
126
+ /** 是否加载中 */
127
+ loading: {
128
+ type: Boolean,
129
+ default: !1
130
+ },
131
+ /** 是否分页 */
132
+ showPager: {
133
+ type: Boolean,
134
+ default: !1
135
+ },
136
+ /** 分页参数 */
137
+ pagination: {
138
+ type: Object,
139
+ default: () => ({})
140
+ },
141
+ /** 是否多选 */
142
+ multiple: {
143
+ type: Boolean,
144
+ default: !1
145
+ },
146
+ /** 禁用的方法 */
147
+ disableFn: {
148
+ type: Function,
149
+ default: null
150
+ },
151
+ /** 选中的值 */
152
+ selectValue: {
153
+ type: [String, Number, Boolean, Array],
154
+ default: () => []
155
+ },
156
+ /** 下拉框的宽度 */
157
+ selectWidth: {
158
+ type: Number,
159
+ default: 0
160
+ },
161
+ /** 删除Field */
162
+ deleteField: {
163
+ type: String,
164
+ default: ""
165
+ },
166
+ /** 设置分页配置 */
167
+ setPagination: {
168
+ type: Function,
169
+ default: null
170
+ },
171
+ /** 获取分页参数 */
172
+ getPagination: {
173
+ type: Function,
174
+ default: null
175
+ },
176
+ /** reload */
177
+ reload: {
178
+ type: Function,
179
+ default: null
180
+ },
181
+ /** 是否加载下一页 */
182
+ hasNextPage: {
183
+ type: Boolean,
184
+ default: !1
185
+ },
186
+ /** 是否展示复选框 */
187
+ showCheckbox: {
188
+ type: Boolean,
189
+ default: !0
190
+ },
191
+ /** multiple 属性设置为 true 时,代表多选场景下用户最多可以选择的项目数, 为 0 则不限制 */
192
+ multipleLimit: {
193
+ type: Number,
194
+ default: 0
195
+ }
196
+ };
197
+ export {
198
+ e as configDefault,
199
+ t as selectProps,
200
+ l as selectTableProps
201
+ };