workdesktop-ai 1.0.2 → 1.1.1

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 (224) hide show
  1. package/CHANGELOG.md +155 -93
  2. package/README.md +123 -25
  3. package/dist/api-button/index.mjs +7 -0
  4. package/dist/api-button/index.mjs.map +1 -0
  5. package/dist/assets/Select-CNzSyvlZ.css +1 -0
  6. package/dist/auto-complete/index.mjs +7 -0
  7. package/dist/auto-complete/index.mjs.map +1 -0
  8. package/dist/auto-complete/style.css +1 -0
  9. package/dist/base.css +1 -0
  10. package/dist/checkbox-list/index.mjs +7 -0
  11. package/dist/checkbox-list/index.mjs.map +1 -0
  12. package/dist/checkbox-list/style.css +1 -0
  13. package/dist/chunks/ApiButton.vue_vue_type_script_setup_true_lang-KKzJxwpV.mjs +80 -0
  14. package/dist/chunks/ApiButton.vue_vue_type_script_setup_true_lang-KKzJxwpV.mjs.map +1 -0
  15. package/dist/chunks/AutoComplete-CLV_PwcZ.mjs +80 -0
  16. package/dist/chunks/AutoComplete-CLV_PwcZ.mjs.map +1 -0
  17. package/dist/chunks/CheckboxList-Bx3Ce1q5.mjs +129 -0
  18. package/dist/chunks/CheckboxList-Bx3Ce1q5.mjs.map +1 -0
  19. package/dist/chunks/ConfirmButton.vue_vue_type_script_setup_true_lang-D4w6G2Kv.mjs +99 -0
  20. package/dist/chunks/ConfirmButton.vue_vue_type_script_setup_true_lang-D4w6G2Kv.mjs.map +1 -0
  21. package/dist/chunks/DataForm-C5MBVdei.mjs +305 -0
  22. package/dist/chunks/DataForm-C5MBVdei.mjs.map +1 -0
  23. package/dist/chunks/DataGrid-HUzKWuQx.mjs +1124 -0
  24. package/dist/chunks/DataGrid-HUzKWuQx.mjs.map +1 -0
  25. package/dist/chunks/DialogButton.vue_vue_type_script_setup_true_lang-CTXP79zc.mjs +117 -0
  26. package/dist/chunks/DialogButton.vue_vue_type_script_setup_true_lang-CTXP79zc.mjs.map +1 -0
  27. package/dist/chunks/Drawer-ucXKUecL.mjs +259 -0
  28. package/dist/chunks/Drawer-ucXKUecL.mjs.map +1 -0
  29. package/dist/chunks/DrawerButton.vue_vue_type_script_setup_true_lang-DUda4p7_.mjs +125 -0
  30. package/dist/chunks/DrawerButton.vue_vue_type_script_setup_true_lang-DUda4p7_.mjs.map +1 -0
  31. package/dist/chunks/EditableGrid-C8A-nJZv.mjs +1783 -0
  32. package/dist/chunks/EditableGrid-C8A-nJZv.mjs.map +1 -0
  33. package/dist/chunks/FormItem-C1q0opnk.mjs +79 -0
  34. package/dist/chunks/FormItem-C1q0opnk.mjs.map +1 -0
  35. package/dist/chunks/Iframe-CeSiMnvR.mjs +65 -0
  36. package/dist/chunks/Iframe-CeSiMnvR.mjs.map +1 -0
  37. package/dist/chunks/ImageUpload-DGehzaYa.mjs +193 -0
  38. package/dist/chunks/ImageUpload-DGehzaYa.mjs.map +1 -0
  39. package/dist/chunks/Panel-CrRqBTj6.mjs +115 -0
  40. package/dist/chunks/Panel-CrRqBTj6.mjs.map +1 -0
  41. package/dist/chunks/PromptButton.vue_vue_type_script_setup_true_lang-Gck1QAHc.mjs +118 -0
  42. package/dist/chunks/PromptButton.vue_vue_type_script_setup_true_lang-Gck1QAHc.mjs.map +1 -0
  43. package/dist/chunks/RadioList-vE8JOuST.mjs +129 -0
  44. package/dist/chunks/RadioList-vE8JOuST.mjs.map +1 -0
  45. package/dist/chunks/Requester.vue_vue_type_script_setup_true_lang-B8TwXbYR.mjs +80 -0
  46. package/dist/chunks/Requester.vue_vue_type_script_setup_true_lang-B8TwXbYR.mjs.map +1 -0
  47. package/dist/chunks/RouteButton.vue_vue_type_script_setup_true_lang-Da0D3tKA.mjs +73 -0
  48. package/dist/chunks/RouteButton.vue_vue_type_script_setup_true_lang-Da0D3tKA.mjs.map +1 -0
  49. package/dist/chunks/SearchItem-pFO57lEO.mjs +79 -0
  50. package/dist/chunks/SearchItem-pFO57lEO.mjs.map +1 -0
  51. package/dist/chunks/SearchPanel-xQ1hPaNq.mjs +158 -0
  52. package/dist/chunks/SearchPanel-xQ1hPaNq.mjs.map +1 -0
  53. package/dist/chunks/Select-DAGZDXvI.mjs +114 -0
  54. package/dist/chunks/Select-DAGZDXvI.mjs.map +1 -0
  55. package/dist/chunks/Station-BF_QlQ8c.mjs +796 -0
  56. package/dist/chunks/Station-BF_QlQ8c.mjs.map +1 -0
  57. package/dist/chunks/Switch.vue_vue_type_script_setup_true_lang-CulPqp7M.mjs +71 -0
  58. package/dist/chunks/Switch.vue_vue_type_script_setup_true_lang-CulPqp7M.mjs.map +1 -0
  59. package/dist/chunks/Tips-IWCZcR1K.mjs +63 -0
  60. package/dist/chunks/Tips-IWCZcR1K.mjs.map +1 -0
  61. package/dist/chunks/TipsButton.vue_vue_type_script_setup_true_lang-DvcpRSV1.mjs +51 -0
  62. package/dist/chunks/TipsButton.vue_vue_type_script_setup_true_lang-DvcpRSV1.mjs.map +1 -0
  63. package/dist/chunks/Upload.vue_vue_type_script_setup_true_lang-D07Bhllc.mjs +200 -0
  64. package/dist/chunks/Upload.vue_vue_type_script_setup_true_lang-D07Bhllc.mjs.map +1 -0
  65. package/dist/chunks/Viewer-iub6TjoD.mjs +381 -0
  66. package/dist/chunks/Viewer-iub6TjoD.mjs.map +1 -0
  67. package/dist/chunks/_plugin-vue_export-helper-CHgC5LLL.mjs +10 -0
  68. package/dist/chunks/_plugin-vue_export-helper-CHgC5LLL.mjs.map +1 -0
  69. package/dist/chunks/containerContext-BgphFDeH.mjs +13 -0
  70. package/dist/chunks/containerContext-BgphFDeH.mjs.map +1 -0
  71. package/dist/chunks/http-Bs-dM076.mjs +2951 -0
  72. package/dist/chunks/http-Bs-dM076.mjs.map +1 -0
  73. package/dist/chunks/linkage-FbL1mcz3.mjs +66 -0
  74. package/dist/chunks/linkage-FbL1mcz3.mjs.map +1 -0
  75. package/dist/chunks/props-DAytpx7D.mjs +65 -0
  76. package/dist/chunks/props-DAytpx7D.mjs.map +1 -0
  77. package/dist/chunks/useApiAction-6_vvf5Fd.mjs +30 -0
  78. package/dist/chunks/useApiAction-6_vvf5Fd.mjs.map +1 -0
  79. package/dist/chunks/useColumnSettings-BYDQdk4o.mjs +216 -0
  80. package/dist/chunks/useColumnSettings-BYDQdk4o.mjs.map +1 -0
  81. package/dist/chunks/useOptionsLoader-Bi8oqNbG.mjs +64 -0
  82. package/dist/chunks/useOptionsLoader-Bi8oqNbG.mjs.map +1 -0
  83. package/dist/confirm-button/index.mjs +7 -0
  84. package/dist/confirm-button/index.mjs.map +1 -0
  85. package/dist/data-form/index.mjs +7 -0
  86. package/dist/data-form/index.mjs.map +1 -0
  87. package/dist/data-form/style.css +1 -0
  88. package/dist/data-grid/index.mjs +7 -0
  89. package/dist/data-grid/index.mjs.map +1 -0
  90. package/dist/data-grid/style.css +1 -0
  91. package/dist/dialog-button/index.mjs +7 -0
  92. package/dist/dialog-button/index.mjs.map +1 -0
  93. package/dist/drawer/index.mjs +7 -0
  94. package/dist/drawer/index.mjs.map +1 -0
  95. package/dist/drawer/style.css +1 -0
  96. package/dist/drawer-button/index.mjs +7 -0
  97. package/dist/drawer-button/index.mjs.map +1 -0
  98. package/dist/editable-grid/index.mjs +7 -0
  99. package/dist/editable-grid/index.mjs.map +1 -0
  100. package/dist/editable-grid/style.css +1 -0
  101. package/dist/form-item/index.mjs +7 -0
  102. package/dist/form-item/index.mjs.map +1 -0
  103. package/dist/form-item/style.css +1 -0
  104. package/dist/iframe/index.mjs +7 -0
  105. package/dist/iframe/index.mjs.map +1 -0
  106. package/dist/iframe/style.css +1 -0
  107. package/dist/image-upload/index.mjs +7 -0
  108. package/dist/image-upload/index.mjs.map +1 -0
  109. package/dist/image-upload/style.css +1 -0
  110. package/dist/index.esm.js +318 -6495
  111. package/dist/index.esm.js.map +1 -1
  112. package/dist/index.umd.js +20 -9
  113. package/dist/index.umd.js.map +1 -1
  114. package/dist/panel/index.mjs +7 -0
  115. package/dist/panel/index.mjs.map +1 -0
  116. package/dist/panel/style.css +1 -0
  117. package/dist/prompt-button/index.mjs +7 -0
  118. package/dist/prompt-button/index.mjs.map +1 -0
  119. package/dist/radio-list/index.mjs +7 -0
  120. package/dist/radio-list/index.mjs.map +1 -0
  121. package/dist/radio-list/style.css +1 -0
  122. package/dist/requester/index.mjs +7 -0
  123. package/dist/requester/index.mjs.map +1 -0
  124. package/dist/route-button/index.mjs +7 -0
  125. package/dist/route-button/index.mjs.map +1 -0
  126. package/dist/search-item/index.mjs +7 -0
  127. package/dist/search-item/index.mjs.map +1 -0
  128. package/dist/search-item/style.css +1 -0
  129. package/dist/search-panel/index.mjs +7 -0
  130. package/dist/search-panel/index.mjs.map +1 -0
  131. package/dist/search-panel/style.css +1 -0
  132. package/dist/select/index.mjs +7 -0
  133. package/dist/select/index.mjs.map +1 -0
  134. package/dist/station/index.mjs +7 -0
  135. package/dist/station/index.mjs.map +1 -0
  136. package/dist/station/style.css +1 -0
  137. package/dist/style.css +1 -1
  138. package/dist/switch/index.mjs +7 -0
  139. package/dist/switch/index.mjs.map +1 -0
  140. package/dist/tips/index.mjs +7 -0
  141. package/dist/tips/index.mjs.map +1 -0
  142. package/dist/tips/style.css +1 -0
  143. package/dist/tips-button/index.mjs +7 -0
  144. package/dist/tips-button/index.mjs.map +1 -0
  145. package/dist/types/src/components/buttons/ApiButton.vue.d.ts +35 -6
  146. package/dist/types/src/components/buttons/ConfirmButton.vue.d.ts +37 -8
  147. package/dist/types/src/components/buttons/DialogButton.vue.d.ts +89 -29
  148. package/dist/types/src/components/buttons/DrawerButton.vue.d.ts +99 -31
  149. package/dist/types/src/components/buttons/PopconfirmButton.vue.d.ts +317 -0
  150. package/dist/types/src/components/buttons/PromptButton.vue.d.ts +45 -14
  151. package/dist/types/src/components/buttons/RouteButton.vue.d.ts +34 -5
  152. package/dist/types/src/components/buttons/TipsButton.vue.d.ts +8 -15
  153. package/dist/types/src/components/common/props.d.ts +32 -2
  154. package/dist/types/src/components/containers/Drawer.vue.d.ts +61 -8
  155. package/dist/types/src/components/containers/Iframe.vue.d.ts +39 -2
  156. package/dist/types/src/components/containers/containerContext.d.ts +1 -1
  157. package/dist/types/src/components/containers/useContainerController.d.ts +5 -0
  158. package/dist/types/src/components/containers/useIframeContainer.d.ts +20 -0
  159. package/dist/types/src/components/core/Requester.vue.d.ts +41 -0
  160. package/dist/types/src/components/data/datagrid/DataGrid.vue.d.ts +212 -5
  161. package/dist/types/src/components/data/datagrid/useColumnSettings.d.ts +14 -0
  162. package/dist/types/src/components/data/editable-grid/EditableGrid.vue.d.ts +586 -0
  163. package/dist/types/src/components/data/viewer/Viewer.vue.d.ts +187 -0
  164. package/dist/types/src/components/form/FormItem.vue.d.ts +62 -0
  165. package/dist/types/src/components/form/SearchItem.vue.d.ts +62 -0
  166. package/dist/types/src/components/{containers → form}/SearchPanel.vue.d.ts +17 -2
  167. package/dist/types/src/components/form/data-form/DataForm.vue.d.ts +6 -6
  168. package/dist/types/src/components/index.d.ts +10 -6
  169. package/dist/types/src/components/inputs/AutoComplete.vue.d.ts +10 -1
  170. package/dist/types/src/components/inputs/CheckboxList.vue.d.ts +28 -3
  171. package/dist/types/src/components/inputs/RadioList.vue.d.ts +28 -3
  172. package/dist/types/src/components/inputs/Select.vue.d.ts +11 -1
  173. package/dist/types/src/components/inputs/Switch.vue.d.ts +2 -2
  174. package/dist/types/src/components/inputs/useOptionsLoader.d.ts +3 -0
  175. package/dist/types/src/components/layout/Station.vue.d.ts +302 -0
  176. package/dist/types/src/components/layout/StationMenuNode.vue.d.ts +20 -0
  177. package/dist/types/src/components/layout/types.d.ts +54 -0
  178. package/dist/types/src/components/styles/Panel.vue.d.ts +58 -5
  179. package/dist/types/src/components/upload/ImageUpload.vue.d.ts +4 -4
  180. package/dist/types/src/components/upload/Upload.vue.d.ts +1 -1
  181. package/dist/types/src/entries/api-button.d.ts +9 -0
  182. package/dist/types/src/entries/auto-complete.d.ts +9 -0
  183. package/dist/types/src/entries/checkbox-list.d.ts +9 -0
  184. package/dist/types/src/entries/components-map.d.ts +8 -0
  185. package/dist/types/src/entries/confirm-button.d.ts +9 -0
  186. package/dist/types/src/entries/data-form.d.ts +9 -0
  187. package/dist/types/src/entries/data-grid.d.ts +9 -0
  188. package/dist/types/src/entries/dialog-button.d.ts +9 -0
  189. package/dist/types/src/entries/drawer-button.d.ts +9 -0
  190. package/dist/types/src/entries/drawer.d.ts +9 -0
  191. package/dist/types/src/entries/editable-grid.d.ts +9 -0
  192. package/dist/types/src/entries/form-item.d.ts +9 -0
  193. package/dist/types/src/entries/iframe.d.ts +9 -0
  194. package/dist/types/src/entries/image-upload.d.ts +9 -0
  195. package/dist/types/src/entries/panel.d.ts +9 -0
  196. package/dist/types/src/entries/prompt-button.d.ts +9 -0
  197. package/dist/types/src/entries/radio-list.d.ts +9 -0
  198. package/dist/types/src/entries/requester.d.ts +9 -0
  199. package/dist/types/src/entries/route-button.d.ts +9 -0
  200. package/dist/types/src/entries/search-item.d.ts +9 -0
  201. package/dist/types/src/entries/search-panel.d.ts +9 -0
  202. package/dist/types/src/entries/select.d.ts +9 -0
  203. package/dist/types/src/entries/station.d.ts +9 -0
  204. package/dist/types/src/entries/switch.d.ts +9 -0
  205. package/dist/types/src/entries/tips-button.d.ts +9 -0
  206. package/dist/types/src/entries/tips.d.ts +9 -0
  207. package/dist/types/src/entries/upload.d.ts +9 -0
  208. package/dist/types/src/entries/viewer.d.ts +9 -0
  209. package/dist/types/src/index.d.ts +2 -1
  210. package/dist/types/src/lib/composables/useDataGrid.d.ts +15 -0
  211. package/dist/types/src/lib/core/http.d.ts +21 -4
  212. package/dist/types/src/lib/core/station-linkage.d.ts +41 -0
  213. package/dist/types/src/types/config.d.ts +20 -3
  214. package/dist/types/vite.config.d.ts +6 -1
  215. package/dist/upload/index.mjs +7 -0
  216. package/dist/upload/index.mjs.map +1 -0
  217. package/dist/viewer/index.mjs +7 -0
  218. package/dist/viewer/index.mjs.map +1 -0
  219. package/dist/viewer/style.css +1 -0
  220. package/llms.txt +658 -0
  221. package/package.json +200 -68
  222. package/dist/types/src/components/containers/Dialog.vue.d.ts +0 -112
  223. package/dist/types/src/components/data/editable-table/EditableTable.vue.d.ts +0 -306
  224. package/dist/types/src/components/utils/Viewer.vue.d.ts +0 -131
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiButton.vue_vue_type_script_setup_true_lang-KKzJxwpV.mjs","sources":["../../src/components/buttons/ApiButton.vue"],"sourcesContent":["<template>\r\n <el-tooltip\r\n v-if=\"tips\"\r\n :content=\"tips\"\r\n :effect=\"tipsType\"\r\n :placement=\"placement\"\r\n >\r\n <el-button v-bind=\"$attrs\" :loading=\"loading\" @click=\"onClick\">\r\n <slot>{{ label }}</slot>\r\n </el-button>\r\n </el-tooltip>\r\n <el-button v-else v-bind=\"$attrs\" :loading=\"loading\" @click=\"onClick\">\r\n <slot>{{ label }}</slot>\r\n </el-button>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { useApiAction } from './useApiAction'\r\nimport { filterProp, headRefreshDatagridProp, apiProps, buttonTextProp, tipsProp } from '../common/props'\r\n\r\ndefineOptions({ name: 'WdApiButton', inheritAttrs: false })\r\n\r\nconst props = defineProps({\r\n ...filterProp,\r\n ...headRefreshDatagridProp,\r\n ...apiProps,\r\n ...buttonTextProp,\r\n ...tipsProp,\r\n /** 按钮级 loading(默认 true);false 时按钮不转圈 */\r\n buttonLoading: { type: Boolean, default: true },\r\n /** 页面级 loading(全局遮罩 ElLoading) */\r\n pageLoading: { type: Boolean, default: false }\r\n})\r\n\r\nconst emit = defineEmits([\r\n 'click',\r\n 'apiBefore',\r\n 'apiSuccess',\r\n 'apiFail',\r\n 'apiException',\r\n 'apiAfter'\r\n])\r\n\r\nconst { loading, doRequest } = useApiAction({\r\n getApi: () => props.api,\r\n getMethod: () => props.apiMethod,\r\n getParam: () => props.apiParam,\r\n getFilter: () => props.filter,\r\n getHeadRefresh: () => props.headRefreshDatagrid,\r\n emit,\r\n buttonLoading: () => props.buttonLoading,\r\n getReqOptions: () => ({ showLoading: props.pageLoading })\r\n})\r\n\r\nasync function onClick(event: MouseEvent) {\r\n emit('click', event)\r\n await doRequest()\r\n}\r\n</script>\r\n"],"names":["props","__props","emit","__emit","loading","doRequest","useApiAction","onClick","event","tips","_createBlock","_component_el_tooltip","tipsType","placement","_createVNode","_component_el_button","_mergeProps","_ctx","_unref","_renderSlot","label","$attrs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,UAAMA,IAAQC,GAYRC,IAAOC,GASP,EAAE,SAAAC,GAAS,WAAAC,EAAA,IAAcC,EAAa;AAAA,MAC1C,QAAQ,MAAMN,EAAM;AAAA,MACpB,WAAW,MAAMA,EAAM;AAAA,MACvB,UAAU,MAAMA,EAAM;AAAA,MACtB,WAAW,MAAMA,EAAM;AAAA,MACvB,gBAAgB,MAAMA,EAAM;AAAA,MAC5B,MAAAE;AAAA,MACA,eAAe,MAAMF,EAAM;AAAA,MAC3B,eAAe,OAAO,EAAE,aAAaA,EAAM,YAAA;AAAA,IAAY,CACxD;AAED,mBAAeO,EAAQC,GAAmB;AACxC,MAAAN,EAAK,SAASM,CAAK,GACnB,MAAMH,EAAA;AAAA,IACR;;;aAvDUI,EAAAA,aADRC,EASaC,GAAA;AAAA;QAPV,SAASF,EAAAA;AAAAA,QACT,QAAQG,EAAAA;AAAAA,QACR,WAAWC,EAAAA;AAAAA,MAAAA;mBAEZ,MAEY;AAAA,UAFZC,EAEYC,GAFZC,EAEYC,EAAA,QAFa;AAAA,YAAG,SAASC,EAAAd,CAAA;AAAA,YAAU,SAAAG;AAAA,UAAA;uBAC7C,MAAwB;AAAA,cAAxBY,EAAwBF,yBAAxB,MAAwB;AAAA,oBAAfG,EAAAA,KAAK,GAAA,CAAA;AAAA,cAAA;;;;;;yDAGlBV,EAEYK,GAFZC,EAEY,EAAA,KAAA,EAAA,GAFcK,EAAAA,QAAM;AAAA,QAAG,SAASH,EAAAd,CAAA;AAAA,QAAU,SAAAG;AAAA,MAAA;mBACpD,MAAwB;AAAA,UAAxBY,EAAwBF,yBAAxB,MAAwB;AAAA,gBAAfG,EAAAA,KAAK,GAAA,CAAA;AAAA,UAAA;;;;;;;"}
@@ -0,0 +1,80 @@
1
+ import { defineComponent as h, toRefs as S, computed as w, resolveComponent as K, resolveDirective as V, withDirectives as C, openBlock as P, createElementBlock as k, createVNode as x, mergeProps as D, withCtx as _, renderSlot as A, createElementVNode as b, toDisplayString as B, unref as L } from "vue";
2
+ import { u as W } from "./useOptionsLoader-Bi8oqNbG.mjs";
3
+ import { o as E } from "./props-DAytpx7D.mjs";
4
+ import { _ as M } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
5
+ const N = { class: "wd-auto-complete" }, O = /* @__PURE__ */ h({
6
+ name: "WdAutoComplete",
7
+ inheritAttrs: !1,
8
+ __name: "AutoComplete",
9
+ props: {
10
+ ...E,
11
+ modelValue: { type: String, default: "" },
12
+ /** 选项值字段 */
13
+ valueKey: { type: String, default: "value" },
14
+ /** 选项显示字段 */
15
+ labelKey: { type: String, default: "text" },
16
+ keywordKey: { type: String, default: "keyword" }
17
+ },
18
+ emits: ["update:modelValue", "change", "select", "apiBefore", "apiSuccess", "apiFail", "apiAfter"],
19
+ setup(n, { emit: d }) {
20
+ const a = n, o = d, t = S(a), { options: u, loading: c, remoteSearch: m, fetchOptions: f } = W({
21
+ api: t.api,
22
+ apiMethod: t.apiMethod,
23
+ apiParam: t.apiParam,
24
+ active: t.active,
25
+ dataSource: t.dataSource,
26
+ textProp: t.textProp,
27
+ valueProp: t.valueProp,
28
+ addData: t.addData,
29
+ appendData: t.appendData,
30
+ emit: o
31
+ }), p = w({
32
+ get: () => a.modelValue,
33
+ set: (e) => o("update:modelValue", e)
34
+ });
35
+ async function v(e, i) {
36
+ a.api && a.active ? await m(e, a.keywordKey) : u.value.length || await f();
37
+ const r = u.value.filter(
38
+ (s) => e ? String(s.text).toLowerCase().includes(String(e).toLowerCase()) : !0
39
+ );
40
+ i(r);
41
+ }
42
+ function g(e) {
43
+ o("update:modelValue", e[a.valueKey]), o("select", e.raw), o("change", e[a.valueKey]);
44
+ }
45
+ function y(e) {
46
+ o("change", e);
47
+ }
48
+ return (e, i) => {
49
+ const r = K("el-autocomplete"), s = V("loading");
50
+ return C((P(), k("div", N, [
51
+ x(r, D({
52
+ modelValue: p.value,
53
+ "onUpdate:modelValue": i[0] || (i[0] = (l) => p.value = l),
54
+ "fetch-suggestions": v,
55
+ "value-key": n.labelKey
56
+ }, e.$attrs, {
57
+ onSelect: g,
58
+ onChange: y
59
+ }), {
60
+ default: _(({ item: l }) => [
61
+ A(e.$slots, "default", {
62
+ option: l.raw,
63
+ text: l[n.valueKey],
64
+ value: l[n.valueKey]
65
+ }, () => [
66
+ b("span", null, B(l[n.labelKey]), 1)
67
+ ], !0)
68
+ ]),
69
+ _: 3
70
+ }, 16, ["modelValue", "value-key"])
71
+ ])), [
72
+ [s, L(c)]
73
+ ]);
74
+ };
75
+ }
76
+ }), U = /* @__PURE__ */ M(O, [["__scopeId", "data-v-e01593cf"]]);
77
+ export {
78
+ U as W
79
+ };
80
+ //# sourceMappingURL=AutoComplete-CLV_PwcZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoComplete-CLV_PwcZ.mjs","sources":["../../src/components/inputs/AutoComplete.vue"],"sourcesContent":["<template>\n <div v-loading=\"loading\" class=\"wd-auto-complete\">\n <el-autocomplete\n v-model=\"inner\"\n :fetch-suggestions=\"fetchSuggestions\"\n :value-key=\"labelKey\"\n v-bind=\"$attrs\"\n @select=\"onSelect\"\n @change=\"onChange\"\n >\n <template #default=\"{ item }\">\n <slot :option=\"item.raw\" :text=\"item[valueKey]\" :value=\"item[valueKey]\">\n <span>{{ item[labelKey] }}</span>\n </slot>\n </template>\n </el-autocomplete>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, toRefs, type PropType } from 'vue'\nimport { useOptionsLoader } from './useOptionsLoader'\nimport { optionsProps } from '../common/props'\n\ndefineOptions({ name: 'WdAutoComplete', inheritAttrs: false })\n\nconst props = defineProps({\n ...optionsProps,\n modelValue: { type: String, default: '' },\n /** 选项值字段 */\n valueKey: { type: String, default: 'value' },\n /** 选项显示字段 */\n labelKey: { type: String, default: 'text' },\n keywordKey: { type: String, default: 'keyword' }\n})\n\nconst emit = defineEmits(['update:modelValue', 'change', 'select', 'apiBefore', 'apiSuccess', 'apiFail', 'apiAfter'])\n\nconst refs = toRefs(props)\nconst { options, loading, remoteSearch, fetchOptions } = useOptionsLoader({\n api: refs.api,\n apiMethod: refs.apiMethod as any,\n apiParam: refs.apiParam,\n active: refs.active,\n dataSource: refs.dataSource as any,\n textProp: refs.textProp,\n valueProp: refs.valueProp,\n addData: refs.addData as any,\n appendData: refs.appendData as any,\n emit\n})\n\nconst inner = computed({\n get: () => props.modelValue,\n set: (val) => emit('update:modelValue', val)\n})\n\n/** el-autocomplete 回调式建议加载 */\nasync function fetchSuggestions(query: string, cb: (results: any[]) => void) {\n if (props.api && props.active) {\n await remoteSearch(query, props.keywordKey)\n } else if (!options.value.length) {\n await fetchOptions()\n }\n // 本地过滤\n const list = options.value.filter((o) =>\n query ? String(o.text).toLowerCase().includes(String(query).toLowerCase()) : true\n )\n cb(list as any)\n}\n\nfunction onSelect(item: any) {\n emit('update:modelValue', item[props.valueKey])\n emit('select', item.raw)\n emit('change', item[props.valueKey])\n}\n\nfunction onChange(val: any) {\n emit('change', val)\n}\n</script>\n\n<style scoped>\n.wd-auto-complete {\n width: 100%;\n}\n.wd-auto-complete :deep(.el-autocomplete) {\n width: 100%;\n}\n</style>\n"],"names":["props","__props","emit","__emit","refs","toRefs","options","loading","remoteSearch","fetchOptions","useOptionsLoader","inner","computed","val","fetchSuggestions","query","cb","list","o","onSelect","item","onChange","_withDirectives","_openBlock","_createElementBlock","_hoisted_1","_createVNode","_component_el_autocomplete","_mergeProps","$event","$attrs","_withCtx","_renderSlot","_ctx","_createElementVNode","_toDisplayString","_unref"],"mappings":";;;;;;;;;;;;;;;;;;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PjB,EAAA;AAAA,wDAAAA,EAAK,QAAAkB;AAAA,UACb,qBAAmBf;AAAA,UACnB,aAAWb,EAAA;AAAA,QAAA,GACJ6B,EAAAA,QAAM;AAAA,UACb,UAAAX;AAAA,UACA,UAAAE;AAAA,QAAA;UAEU,SAAOU,EAChB,CAEO,EAHa,MAAAX,QAAI;AAAA,YACxBY,EAEOC,EAAA,QAAA,WAAA;AAAA,cAFA,QAAQb,EAAK;AAAA,cAAM,MAAMA,EAAKnB,EAAA,QAAQ;AAAA,cAAI,OAAOmB,EAAKnB,EAAA,QAAQ;AAAA,YAAA,GAArE,MAEO;AAAA,cADLiC,EAAiC,QAAA,MAAAC,EAAxBf,EAAKnB,EAAA,QAAQ,CAAA,GAAA,CAAA;AAAA,YAAA;;;;;YAXdmC,EAAA7B,CAAA,CAAO;AAAA,MAAA;;;;"}
@@ -0,0 +1,129 @@
1
+ import { defineComponent as D, toRefs as B, computed as L, resolveComponent as s, resolveDirective as $, withDirectives as A, openBlock as o, createBlock as n, mergeProps as W, withCtx as l, createElementBlock as _, Fragment as x, renderList as E, unref as h, createElementVNode as k, renderSlot as r, createTextVNode as i, toDisplayString as u } from "vue";
2
+ import { u as F } from "./useOptionsLoader-Bi8oqNbG.mjs";
3
+ import { o as M } from "./props-DAytpx7D.mjs";
4
+ import { _ as N } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
5
+ const I = { class: "wd-option-text" }, O = { class: "wd-option-text" }, R = /* @__PURE__ */ D({
6
+ name: "WdCheckboxList",
7
+ inheritAttrs: !1,
8
+ __name: "CheckboxList",
9
+ props: {
10
+ ...M,
11
+ modelValue: { type: Array, default: () => [] },
12
+ /** 按钮样式 */
13
+ buttonStyle: { type: Boolean, default: !1 }
14
+ },
15
+ emits: ["update:modelValue", "change", "apiBefore", "apiSuccess", "apiFail", "apiAfter"],
16
+ setup(d, { emit: b }) {
17
+ const p = d, c = b, t = B(p), { options: g, loading: y } = F({
18
+ api: t.api,
19
+ apiMethod: t.apiMethod,
20
+ apiParam: t.apiParam,
21
+ active: t.active,
22
+ dataSource: t.dataSource,
23
+ textProp: t.textProp,
24
+ valueProp: t.valueProp,
25
+ tipsProp: t.tipsProp,
26
+ addData: t.addData,
27
+ appendData: t.appendData,
28
+ emit: c
29
+ }), m = L({
30
+ get: () => p.modelValue,
31
+ set: (a) => c("update:modelValue", a)
32
+ });
33
+ function w(a) {
34
+ c("change", a);
35
+ }
36
+ return (a, f) => {
37
+ const v = s("el-tooltip"), P = s("el-checkbox-button"), V = s("el-checkbox"), S = s("el-checkbox-group"), C = $("loading");
38
+ return A((o(), n(S, W({
39
+ modelValue: m.value,
40
+ "onUpdate:modelValue": f[0] || (f[0] = (e) => m.value = e)
41
+ }, a.$attrs, { onChange: w }), {
42
+ default: l(() => [
43
+ (o(!0), _(x, null, E(h(g), (e) => (o(), _(x, {
44
+ key: String(e.value)
45
+ }, [
46
+ d.buttonStyle ? (o(), n(P, {
47
+ key: 0,
48
+ value: e.value
49
+ }, {
50
+ default: l(() => [
51
+ e.tips ? (o(), n(v, {
52
+ key: 0,
53
+ content: e.tips,
54
+ placement: "top",
55
+ effect: "dark",
56
+ "show-after": 200
57
+ }, {
58
+ default: l(() => [
59
+ k("span", I, [
60
+ r(a.$slots, "default", {
61
+ option: e.raw,
62
+ text: e.text,
63
+ value: e.value,
64
+ tips: e.tips
65
+ }, () => [
66
+ i(u(e.text), 1)
67
+ ], !0)
68
+ ])
69
+ ]),
70
+ _: 2
71
+ }, 1032, ["content"])) : r(a.$slots, "default", {
72
+ option: e.raw,
73
+ text: e.text,
74
+ value: e.value,
75
+ tips: e.tips
76
+ }, () => [
77
+ i(u(e.text), 1)
78
+ ], !0, 1)
79
+ ]),
80
+ _: 2
81
+ }, 1032, ["value"])) : (o(), n(V, {
82
+ key: 1,
83
+ value: e.value
84
+ }, {
85
+ default: l(() => [
86
+ e.tips ? (o(), n(v, {
87
+ key: 0,
88
+ content: e.tips,
89
+ placement: "top",
90
+ effect: "dark",
91
+ "show-after": 200
92
+ }, {
93
+ default: l(() => [
94
+ k("span", O, [
95
+ r(a.$slots, "default", {
96
+ option: e.raw,
97
+ text: e.text,
98
+ value: e.value,
99
+ tips: e.tips
100
+ }, () => [
101
+ i(u(e.text), 1)
102
+ ], !0)
103
+ ])
104
+ ]),
105
+ _: 2
106
+ }, 1032, ["content"])) : r(a.$slots, "default", {
107
+ option: e.raw,
108
+ text: e.text,
109
+ value: e.value,
110
+ tips: e.tips
111
+ }, () => [
112
+ i(u(e.text), 1)
113
+ ], !0, 1)
114
+ ]),
115
+ _: 2
116
+ }, 1032, ["value"]))
117
+ ], 64))), 128))
118
+ ]),
119
+ _: 3
120
+ }, 16, ["modelValue"])), [
121
+ [C, h(y)]
122
+ ]);
123
+ };
124
+ }
125
+ }), z = /* @__PURE__ */ N(R, [["__scopeId", "data-v-b633634d"]]);
126
+ export {
127
+ z as W
128
+ };
129
+ //# sourceMappingURL=CheckboxList-Bx3Ce1q5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxList-Bx3Ce1q5.mjs","sources":["../../src/components/inputs/CheckboxList.vue"],"sourcesContent":["<template>\n <el-checkbox-group\n v-model=\"inner\"\n v-loading=\"loading\"\n v-bind=\"$attrs\"\n @change=\"onChange\"\n >\n <template v-for=\"opt in options\" :key=\"String(opt.value)\">\n <el-checkbox-button v-if=\"buttonStyle\" :value=\"opt.value\">\n <el-tooltip\n v-if=\"opt.tips\"\n :content=\"opt.tips\"\n placement=\"top\"\n effect=\"dark\"\n :show-after=\"200\"\n >\n <span class=\"wd-option-text\">\n <slot :option=\"opt.raw\" :text=\"opt.text\" :value=\"opt.value\" :tips=\"opt.tips\">{{ opt.text }}</slot>\n </span>\n </el-tooltip>\n <slot v-else :option=\"opt.raw\" :text=\"opt.text\" :value=\"opt.value\" :tips=\"opt.tips\">{{ opt.text }}</slot>\n </el-checkbox-button>\n <el-checkbox v-else :value=\"opt.value\">\n <el-tooltip\n v-if=\"opt.tips\"\n :content=\"opt.tips\"\n placement=\"top\"\n effect=\"dark\"\n :show-after=\"200\"\n >\n <span class=\"wd-option-text\">\n <slot :option=\"opt.raw\" :text=\"opt.text\" :value=\"opt.value\" :tips=\"opt.tips\">{{ opt.text }}</slot>\n </span>\n </el-tooltip>\n <slot v-else :option=\"opt.raw\" :text=\"opt.text\" :value=\"opt.value\" :tips=\"opt.tips\">{{ opt.text }}</slot>\n </el-checkbox>\n </template>\n </el-checkbox-group>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, toRefs, type PropType } from 'vue'\nimport { useOptionsLoader } from './useOptionsLoader'\nimport { optionsProps } from '../common/props'\n\ndefineOptions({ name: 'WdCheckboxList', inheritAttrs: false })\n\nconst props = defineProps({\n ...optionsProps,\n modelValue: { type: Array as PropType<any[]>, default: () => [] },\n /** 按钮样式 */\n buttonStyle: { type: Boolean, default: false }\n})\n\nconst emit = defineEmits(['update:modelValue', 'change', 'apiBefore', 'apiSuccess', 'apiFail', 'apiAfter'])\n\nconst refs = toRefs(props)\nconst { options, loading } = useOptionsLoader({\n api: refs.api,\n apiMethod: refs.apiMethod as any,\n apiParam: refs.apiParam,\n active: refs.active,\n dataSource: refs.dataSource as any,\n textProp: refs.textProp,\n valueProp: refs.valueProp,\n tipsProp: refs.tipsProp,\n addData: refs.addData as any,\n appendData: refs.appendData as any,\n emit\n})\n\nconst inner = computed({\n get: () => props.modelValue,\n set: (val) => emit('update:modelValue', val)\n})\n\nfunction onChange(val: any) {\n emit('change', val)\n}\n</script>\n\n<style scoped>\n.wd-option-text {\n display: inline-block;\n}\n</style>\n"],"names":["props","__props","emit","__emit","refs","toRefs","options","loading","useOptionsLoader","inner","computed","val","onChange","_withDirectives","_openBlock","_createBlock","_component_el_checkbox_group","_mergeProps","$event","$attrs","_createElementBlock","_Fragment","_renderList","_unref","opt","_component_el_checkbox_button","_component_el_tooltip","_createElementVNode","_hoisted_1","_renderSlot","_ctx","_createTextVNode","_toDisplayString","_component_el_checkbox","_hoisted_2"],"mappings":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A;;;;"}
@@ -0,0 +1,99 @@
1
+ import { defineComponent as B, resolveComponent as l, openBlock as p, createBlock as s, withCtx as a, createVNode as b, mergeProps as c, unref as f, renderSlot as d, createTextVNode as m, toDisplayString as u } from "vue";
2
+ import { ElMessageBox as P } from "element-plus";
3
+ import { u as k } from "./useApiAction-6_vvf5Fd.mjs";
4
+ import { t as C, b as L, a as S, h as _, f as w } from "./props-DAytpx7D.mjs";
5
+ const M = /* @__PURE__ */ B({
6
+ name: "WdConfirmButton",
7
+ inheritAttrs: !1,
8
+ __name: "ConfirmButton",
9
+ props: {
10
+ ...w,
11
+ ..._,
12
+ ...S,
13
+ ...L,
14
+ ...C,
15
+ /** 确认文案 */
16
+ confirmText: { type: String, default: "确认执行该操作?" },
17
+ /** 取消按钮文案(空则不显示取消按钮) */
18
+ cancelText: { type: String, default: "取消" },
19
+ /** 确认框标题 */
20
+ confirmTitle: { type: String, default: "提示" },
21
+ /** 按钮级 loading */
22
+ buttonLoading: { type: Boolean, default: !0 },
23
+ pageLoading: { type: Boolean, default: !1 }
24
+ },
25
+ emits: [
26
+ "click",
27
+ "confirm",
28
+ "cancel",
29
+ "apiBefore",
30
+ "apiSuccess",
31
+ "apiFail",
32
+ "apiException",
33
+ "apiAfter"
34
+ ],
35
+ setup(g, { emit: h }) {
36
+ const t = g, o = h, { loading: n, doRequest: y } = k({
37
+ getApi: () => t.api,
38
+ getMethod: () => t.apiMethod,
39
+ getParam: () => t.apiParam,
40
+ getFilter: () => t.filter,
41
+ getHeadRefresh: () => t.headRefreshDatagrid,
42
+ emit: o,
43
+ buttonLoading: () => t.buttonLoading,
44
+ getReqOptions: () => ({ showLoading: t.pageLoading })
45
+ });
46
+ async function i(e) {
47
+ o("click", e);
48
+ try {
49
+ await P.confirm(t.confirmText, t.confirmTitle, {
50
+ confirmButtonText: "确定",
51
+ cancelButtonText: t.cancelText,
52
+ type: "warning"
53
+ });
54
+ } catch {
55
+ o("cancel");
56
+ return;
57
+ }
58
+ o("confirm"), await y();
59
+ }
60
+ return (e, A) => {
61
+ const r = l("el-button"), T = l("el-tooltip");
62
+ return e.tips ? (p(), s(T, {
63
+ key: 0,
64
+ content: e.tips,
65
+ effect: e.tipsType,
66
+ placement: e.placement
67
+ }, {
68
+ default: a(() => [
69
+ b(r, c(e.$attrs, {
70
+ loading: f(n),
71
+ onClick: i
72
+ }), {
73
+ default: a(() => [
74
+ d(e.$slots, "default", {}, () => [
75
+ m(u(e.label), 1)
76
+ ])
77
+ ]),
78
+ _: 3
79
+ }, 16, ["loading"])
80
+ ]),
81
+ _: 3
82
+ }, 8, ["content", "effect", "placement"])) : (p(), s(r, c({ key: 1 }, e.$attrs, {
83
+ loading: f(n),
84
+ onClick: i
85
+ }), {
86
+ default: a(() => [
87
+ d(e.$slots, "default", {}, () => [
88
+ m(u(e.label), 1)
89
+ ])
90
+ ]),
91
+ _: 3
92
+ }, 16, ["loading"]));
93
+ };
94
+ }
95
+ });
96
+ export {
97
+ M as _
98
+ };
99
+ //# sourceMappingURL=ConfirmButton.vue_vue_type_script_setup_true_lang-D4w6G2Kv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmButton.vue_vue_type_script_setup_true_lang-D4w6G2Kv.mjs","sources":["../../src/components/buttons/ConfirmButton.vue"],"sourcesContent":["<template>\r\n <el-tooltip\r\n v-if=\"tips\"\r\n :content=\"tips\"\r\n :effect=\"tipsType\"\r\n :placement=\"placement\"\r\n >\r\n <el-button v-bind=\"$attrs\" :loading=\"loading\" @click=\"onClick\">\r\n <slot>{{ label }}</slot>\r\n </el-button>\r\n </el-tooltip>\r\n <el-button v-else v-bind=\"$attrs\" :loading=\"loading\" @click=\"onClick\">\r\n <slot>{{ label }}</slot>\r\n </el-button>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElMessageBox } from 'element-plus'\r\nimport { useApiAction } from './useApiAction'\r\nimport { filterProp, headRefreshDatagridProp, apiProps, buttonTextProp, tipsProp } from '../common/props'\r\n\r\ndefineOptions({ name: 'WdConfirmButton', inheritAttrs: false })\r\n\r\nconst props = defineProps({\r\n ...filterProp,\r\n ...headRefreshDatagridProp,\r\n ...apiProps,\r\n ...buttonTextProp,\r\n ...tipsProp,\r\n /** 确认文案 */\r\n confirmText: { type: String, default: '确认执行该操作?' },\r\n /** 取消按钮文案(空则不显示取消按钮) */\r\n cancelText: { type: String, default: '取消' },\r\n /** 确认框标题 */\r\n confirmTitle: { type: String, default: '提示' },\r\n /** 按钮级 loading */\r\n buttonLoading: { type: Boolean, default: true },\r\n pageLoading: { type: Boolean, default: false }\r\n})\r\n\r\nconst emit = defineEmits([\r\n 'click',\r\n 'confirm',\r\n 'cancel',\r\n 'apiBefore',\r\n 'apiSuccess',\r\n 'apiFail',\r\n 'apiException',\r\n 'apiAfter'\r\n])\r\n\r\nconst { loading, doRequest } = useApiAction({\r\n getApi: () => props.api,\r\n getMethod: () => props.apiMethod,\r\n getParam: () => props.apiParam,\r\n getFilter: () => props.filter,\r\n getHeadRefresh: () => props.headRefreshDatagrid,\r\n emit,\r\n buttonLoading: () => props.buttonLoading,\r\n getReqOptions: () => ({ showLoading: props.pageLoading })\r\n})\r\n\r\nasync function onClick(event: MouseEvent) {\r\n emit('click', event)\r\n try {\r\n await ElMessageBox.confirm(props.confirmText, props.confirmTitle, {\r\n confirmButtonText: '确定',\r\n cancelButtonText: props.cancelText,\r\n type: 'warning'\r\n })\r\n } catch {\r\n emit('cancel')\r\n return\r\n }\r\n emit('confirm')\r\n await doRequest()\r\n}\r\n</script>\r\n"],"names":["props","__props","emit","__emit","loading","doRequest","useApiAction","onClick","event","ElMessageBox","tips","_createBlock","_component_el_tooltip","tipsType","placement","_createVNode","_component_el_button","_mergeProps","_ctx","_unref","_renderSlot","label","$attrs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,UAAMA,IAAQC,GAiBRC,IAAOC,GAWP,EAAE,SAAAC,GAAS,WAAAC,EAAA,IAAcC,EAAa;AAA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ineComponent as z, ref as F, reactive as Q, computed as b, getCurrentInstance as X, provide as Y, watch as Z, onMounted as ee, onBeforeUnmount as te, resolveComponent as L, resolveDirective as ae, openBlock as w, createElementBlock as V, withDirectives as oe, createBlock as A, mergeProps as re, withModifiers as ie, withCtx as S, renderSlot as W, createTextVNode as O, toDisplayString as T, createCommentVNode as M, createVNode as le } from "vue";
2
+ import { ElMessageBox as _, ElMessage as ne } from "element-plus";
3
+ import { d as se, r as N } from "./http-Bs-dM076.mjs";
4
+ import { r as ue } from "./linkage-FbL1mcz3.mjs";
5
+ import { u as fe } from "./containerContext-BgphFDeH.mjs";
6
+ import { _ as de } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
7
+ const ce = { class: "wd-data-form" }, me = {
8
+ key: 0,
9
+ class: "wd-data-form__footer"
10
+ }, pe = /* @__PURE__ */ z({
11
+ name: "WdDataForm",
12
+ inheritAttrs: !1,
13
+ __name: "DataForm",
14
+ props: {
15
+ /** 模式:create 新增 / edit 编辑 */
16
+ mode: { type: String, default: "create" },
17
+ /** 详情数据接口(edit 模式回填) */
18
+ api: { type: String, default: "" },
19
+ apiMethod: { type: String, default: "get" },
20
+ apiParam: { type: Object, default: () => ({}) },
21
+ /** 提交接口 */
22
+ submitApi: { type: String, default: "" },
23
+ submitMethod: { type: String, default: "post" },
24
+ /** 提交字段白名单 */
25
+ submitKeys: { type: [String, Array], default: void 0 },
26
+ /** 提交字段黑名单 */
27
+ submitExcludeKeys: { type: [String, Array], default: void 0 },
28
+ /** 是否自动请求详情 */
29
+ active: { type: Boolean, default: !1 },
30
+ /** 有未保存修改时离开确认 */
31
+ confirmLeave: { type: Boolean, default: !0 },
32
+ /** 是否显示底部操作按钮区 */
33
+ withActions: { type: Boolean, default: !0 },
34
+ /** 底部按钮文案配置 */
35
+ actionConfig: {
36
+ type: Object,
37
+ default: () => ({})
38
+ },
39
+ /** 提交后关闭抽屉 */
40
+ headCloseDrawer: { type: [Boolean, String], default: !0 },
41
+ /** 提交后刷新表格 */
42
+ headRefreshDatagrid: { type: [Boolean, String], default: !1 },
43
+ /** 显示连续操作按钮 */
44
+ keepFormButton: { type: Boolean, default: !0 },
45
+ /** 表单规则(透传 el-form rules) */
46
+ rules: { type: Object, default: () => ({}) },
47
+ labelWidth: { type: [String, Number], default: "100px" },
48
+ labelPosition: { type: String, default: "right" },
49
+ inline: { type: Boolean, default: !1 },
50
+ /** 联动分组 */
51
+ filter: { type: String, default: "" },
52
+ /** 外部传入的初始数据(DrawerButton data 等) */
53
+ data: { type: Object, default: void 0 }
54
+ },
55
+ emits: [
56
+ "submit-success",
57
+ "submit-fail",
58
+ "load-success",
59
+ "change",
60
+ "close",
61
+ "apiBefore",
62
+ "apiAfter"
63
+ ],
64
+ setup(m, { expose: $, emit: K }) {
65
+ const a = m, s = K, d = F(null), f = F(!1), i = Q({}), C = F({}), P = b(() => a.mode !== "edit"), y = b(
66
+ () => se(
67
+ {
68
+ resetText: "重置",
69
+ submitText: "保存",
70
+ continueText: "保存并继续",
71
+ closeText: "关闭",
72
+ showReset: !0,
73
+ showContinue: !0
74
+ },
75
+ a.actionConfig || {}
76
+ )
77
+ ), I = b(() => y.value.closeText), v = X();
78
+ Y("wdDataForm", {
79
+ model: i,
80
+ formRef: d
81
+ });
82
+ function p(e) {
83
+ Object.keys(i).forEach((t) => delete i[t]), e && typeof e == "object" && Object.assign(i, JSON.parse(JSON.stringify(e))), C.value = JSON.parse(JSON.stringify(i));
84
+ }
85
+ async function j(e) {
86
+ if (!a.api) {
87
+ p(a.data || {});
88
+ return;
89
+ }
90
+ f.value = !0, s("apiBefore", { type: "load" });
91
+ try {
92
+ const t = { ...a.apiParam, ...(e == null ? void 0 : e.apiParam) || {} }, o = a.apiMethod === "get" ? await N.get(a.api, t) : await N.post(a.api, t);
93
+ o.success && (p(o.data || {}), s("load-success", o.data));
94
+ } finally {
95
+ f.value = !1, s("apiAfter", { type: "load" });
96
+ }
97
+ }
98
+ function h() {
99
+ return { ...i };
100
+ }
101
+ function G() {
102
+ const e = h(), t = (n) => n == null ? null : Array.isArray(n) ? n : String(n).split(",").map((c) => c.trim()).filter(Boolean), o = t(a.submitKeys), r = t(a.submitExcludeKeys);
103
+ let u = e;
104
+ return o && (u = o.reduce((n, c) => (n[c] = e[c], n), {})), r && (u = Object.keys(u).reduce((n, c) => (r.includes(c) || (n[c] = u[c]), n), {})), u;
105
+ }
106
+ async function J() {
107
+ if (!d.value) return !0;
108
+ try {
109
+ return await d.value.validate(), !0;
110
+ } catch {
111
+ return !1;
112
+ }
113
+ }
114
+ async function B(e = !1) {
115
+ if (!await J()) {
116
+ ne.warning("请完善表单必填项");
117
+ return;
118
+ }
119
+ if (!a.submitApi) {
120
+ s("submit-success", h()), E(h(), e);
121
+ return;
122
+ }
123
+ f.value = !0, s("apiBefore", { type: "submit" });
124
+ try {
125
+ const o = G(), r = a.submitMethod === "put" ? await N.put(a.submitApi, o) : await N.post(a.submitApi, o);
126
+ r.success ? (s("submit-success", r.data), E(r.data, e)) : s("submit-fail", r);
127
+ } finally {
128
+ f.value = !1, s("apiAfter", { type: "submit" });
129
+ }
130
+ }
131
+ function E(e, t) {
132
+ a.headRefreshDatagrid && ue(a.headRefreshDatagrid, a.filter), t && P.value ? x(!0) : a.headCloseDrawer && (l != null && l.requestClose ? l.requestClose("submit") : s("close", { reason: "submit" })), C.value = JSON.parse(JSON.stringify(i));
133
+ }
134
+ function x(e = !1) {
135
+ var t, o, r, u;
136
+ P.value || e ? (Object.keys(i).forEach((n) => delete i[n]), (o = (t = d.value) == null ? void 0 : t.clearValidate) == null || o.call(t)) : (p(C.value), (u = (r = d.value) == null ? void 0 : r.clearValidate) == null || u.call(r));
137
+ }
138
+ function k() {
139
+ return JSON.stringify(i) !== JSON.stringify(C.value);
140
+ }
141
+ function H() {
142
+ var e;
143
+ if (l != null && l.requestClose) {
144
+ l.requestClose("manual");
145
+ return;
146
+ }
147
+ if (R.value) {
148
+ (e = window.parent) == null || e.postMessage({ type: "wd-container:close" }, "*");
149
+ return;
150
+ }
151
+ if (a.confirmLeave && k()) {
152
+ _.confirm("有未保存的修改,确认离开?", "提示", {
153
+ confirmButtonText: "确认离开",
154
+ cancelButtonText: "继续编辑",
155
+ type: "warning"
156
+ }).then(() => s("close", { reason: "manual" })).catch(() => {
157
+ });
158
+ return;
159
+ }
160
+ s("close", { reason: "manual" });
161
+ }
162
+ async function U() {
163
+ if (!a.confirmLeave || !k()) return !0;
164
+ try {
165
+ return await _.confirm("有未保存的修改,确认离开?", "提示", {
166
+ confirmButtonText: "确认离开",
167
+ cancelButtonText: "继续编辑",
168
+ type: "warning"
169
+ }), !0;
170
+ } catch {
171
+ return !1;
172
+ }
173
+ }
174
+ Z(
175
+ i,
176
+ () => {
177
+ s("change", h());
178
+ },
179
+ { deep: !0 }
180
+ );
181
+ const l = fe();
182
+ let D = null;
183
+ const g = b(() => a.data || (l == null ? void 0 : l.data)), R = b(() => {
184
+ if (typeof window > "u") return !1;
185
+ try {
186
+ return window.self !== window.top;
187
+ } catch {
188
+ return !0;
189
+ }
190
+ }), q = b(() => !!l || R.value);
191
+ return g.value && p(g.value), ee(() => {
192
+ var t, o;
193
+ const e = v == null ? void 0 : v.appContext;
194
+ if (e) {
195
+ e.config.globalProperties.model = i;
196
+ const r = (o = (t = e.app) == null ? void 0 : t.config) == null ? void 0 : o.globalProperties;
197
+ r && (r.model = i);
198
+ }
199
+ l != null && l.addBeforeClose && (D = l.addBeforeClose(async () => {
200
+ if (!a.confirmLeave || !k()) return !0;
201
+ try {
202
+ return await _.confirm("有未保存的修改,确认离开?", "提示", {
203
+ confirmButtonText: "确认离开",
204
+ cancelButtonText: "继续编辑",
205
+ type: "warning"
206
+ }), !0;
207
+ } catch {
208
+ return !1;
209
+ }
210
+ })), a.mode === "edit" ? (g.value && p(g.value), a.active && a.api && j()) : g.value && p(g.value);
211
+ }), te(() => {
212
+ var t, o;
213
+ D == null || D();
214
+ const e = v == null ? void 0 : v.appContext;
215
+ ((o = (t = e == null ? void 0 : e.config) == null ? void 0 : t.globalProperties) == null ? void 0 : o.model) === i && delete e.config.globalProperties.model;
216
+ }), $({
217
+ requestApi: j,
218
+ submitForm: B,
219
+ resetForm: x,
220
+ validate: J,
221
+ getFormData: h,
222
+ isDirty: k,
223
+ beforeLeave: U,
224
+ fillForm: p,
225
+ formRef: d
226
+ }), (e, t) => {
227
+ const o = L("el-button"), r = L("el-form"), u = ae("loading");
228
+ return w(), V("div", ce, [
229
+ oe((w(), A(r, re({
230
+ ref_key: "formRef",
231
+ ref: d,
232
+ model: i,
233
+ rules: m.rules,
234
+ "label-width": m.labelWidth,
235
+ "label-position": m.labelPosition,
236
+ inline: m.inline,
237
+ disabled: f.value
238
+ }, e.$attrs, {
239
+ onSubmit: t[2] || (t[2] = ie(() => {
240
+ }, ["prevent"]))
241
+ }), {
242
+ default: S(() => [
243
+ W(e.$slots, "default", {
244
+ model: i,
245
+ form: d.value
246
+ }, void 0, !0),
247
+ m.withActions ? (w(), V("div", me, [
248
+ W(e.$slots, "footer", {
249
+ submit: B,
250
+ reset: x,
251
+ loading: f.value
252
+ }, () => [
253
+ q.value ? (w(), A(o, {
254
+ key: 0,
255
+ onClick: H
256
+ }, {
257
+ default: S(() => [
258
+ O(T(I.value), 1)
259
+ ]),
260
+ _: 1
261
+ })) : M("", !0),
262
+ y.value.showReset ? (w(), A(o, {
263
+ key: 1,
264
+ onClick: x
265
+ }, {
266
+ default: S(() => [
267
+ O(T(y.value.resetText), 1)
268
+ ]),
269
+ _: 1
270
+ })) : M("", !0),
271
+ q.value && P.value && m.keepFormButton && y.value.showContinue ? (w(), A(o, {
272
+ key: 2,
273
+ loading: f.value,
274
+ onClick: t[0] || (t[0] = (n) => B(!0))
275
+ }, {
276
+ default: S(() => [
277
+ O(T(y.value.continueText), 1)
278
+ ]),
279
+ _: 1
280
+ }, 8, ["loading"])) : M("", !0),
281
+ le(o, {
282
+ type: "primary",
283
+ loading: f.value,
284
+ onClick: t[1] || (t[1] = (n) => B(!1))
285
+ }, {
286
+ default: S(() => [
287
+ O(T(y.value.submitText), 1)
288
+ ]),
289
+ _: 1
290
+ }, 8, ["loading"])
291
+ ], !0)
292
+ ])) : M("", !0)
293
+ ]),
294
+ _: 3
295
+ }, 16, ["model", "rules", "label-width", "label-position", "inline", "disabled"])), [
296
+ [u, f.value]
297
+ ])
298
+ ]);
299
+ };
300
+ }
301
+ }), Se = /* @__PURE__ */ de(pe, [["__scopeId", "data-v-ad5b00d6"]]);
302
+ export {
303
+ Se as W
304
+ };
305
+ //# sourceMappingURL=DataForm-C5MBVdei.mjs.map