cnhis-design-vue 3.1.41-beta.15 → 3.1.41-beta.17

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 (39) hide show
  1. package/README.md +87 -87
  2. package/es/components/button-print/src/utils/print.js +1 -1
  3. package/es/components/field-set/index.d.ts +8 -0
  4. package/es/components/field-set/src/FieldSet.vue.d.ts +5 -0
  5. package/es/components/field-set/src/FieldSet.vue.js +1 -1
  6. package/es/components/field-set/style/index.css +1 -1
  7. package/es/components/form-config/src/components/FormConfigEdit.vue.js +1 -1
  8. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  9. package/es/components/form-render/src/FormRender.vue.js +1 -1
  10. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  11. package/es/components/index.css +1 -1
  12. package/es/components/info-header/index.d.ts +213 -121
  13. package/es/components/info-header/src/InfoDescription.vue.d.ts +265 -0
  14. package/es/components/info-header/src/InfoDescription.vue.js +1 -0
  15. package/es/components/info-header/src/InfoHeader.vue.d.ts +217 -125
  16. package/es/components/info-header/src/InfoHeader.vue.js +1 -1
  17. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  18. package/es/components/table-filter/index.d.ts +10 -6
  19. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.d.ts +4 -2
  20. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.js +1 -1
  21. package/es/components/table-filter/src/classification/Classification-com.vue.d.ts +2 -2
  22. package/es/components/table-filter/src/classification/Classification-com.vue.js +1 -1
  23. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +2 -2
  24. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +2 -2
  25. package/es/components/table-filter/src/components/search-filter/index.vue.d.ts +2 -2
  26. package/es/components/table-filter/src/components/set-classification/index.vue.d.ts +2 -2
  27. package/es/components/table-filter/src/hooks/useMixins.js +1 -1
  28. package/es/components/table-filter/src/quick-search/QuickSearch.vue.d.ts +4 -2
  29. package/es/components/table-filter/src/quick-search/QuickSearch.vue.js +1 -1
  30. package/es/components/table-filter/style/index.css +1 -1
  31. package/es/env.d.ts +24 -24
  32. package/package.json +2 -2
  33. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  34. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  35. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  36. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  37. package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
  38. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  39. package/es/shared/utils/tapable/index.d.ts +0 -139
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=t.create({withCredentials:!1}),c=`${window.location.protocol}//${window.location.host}`,p=`${c}/fdp-api/print/assembly/printIReport`,u=`${c}/bi-api/reprot/print/open/client/getRemote`,m=`${c}/printService/file`;let w=null;class f{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],w)return w;w=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):h({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else this.isRemote&&(d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${l(new Date,"yyyyMMddHHmmss")}`});return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=c+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({method:"post",url:p,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-1],o=await s(`${m}/${a}`),l=r(null,e,o);if("preview"===e)return l}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),d&&d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):h.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{f as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],m)return m;m=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-1],o=await s(`${u}/${a}`),l=r(null,e,o);if("preview"===e)return l}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),d&&d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
@@ -19,6 +19,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
19
19
  }, {
20
20
  fieldsMapping: Record<string, string>;
21
21
  selectOptions: Record<string, string>[];
22
+ sortOptions: {
23
+ label: string;
24
+ value: string;
25
+ }[];
22
26
  emit: (event: "onSave" | "onClose" | "reset", ...args: any[]) => void;
23
27
  settingView: any;
24
28
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -56,6 +60,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
56
60
  name: string;
57
61
  show: boolean;
58
62
  sort: boolean;
63
+ sortDirection: "NONE" | "ASC" | "DESC";
59
64
  title: string;
60
65
  alias: string;
61
66
  fixedShow: boolean;
@@ -76,6 +81,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
76
81
  name: string;
77
82
  show: boolean;
78
83
  sort: boolean;
84
+ sortDirection: "NONE" | "ASC" | "DESC";
79
85
  title: string;
80
86
  alias: string;
81
87
  fixedShow: boolean;
@@ -103,6 +109,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
103
109
  name: string;
104
110
  show: boolean;
105
111
  sort: boolean;
112
+ sortDirection: "NONE" | "ASC" | "DESC";
106
113
  title: string;
107
114
  alias: string;
108
115
  fixedShow: boolean;
@@ -120,6 +127,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
120
127
  name: string;
121
128
  show: boolean;
122
129
  sort: boolean;
130
+ sortDirection: "NONE" | "ASC" | "DESC";
123
131
  title: string;
124
132
  alias: string;
125
133
  fixedShow: boolean;
@@ -4,6 +4,7 @@ declare type Ifields = {
4
4
  name: string;
5
5
  show: boolean;
6
6
  sort: boolean;
7
+ sortDirection: 'NONE' | 'ASC' | 'DESC';
7
8
  title: string;
8
9
  alias: string;
9
10
  fixedShow: boolean;
@@ -46,6 +47,10 @@ declare const _default: import("vue").DefineComponent<{
46
47
  }, {
47
48
  fieldsMapping: Record<string, string>;
48
49
  selectOptions: Record<string, string>[];
50
+ sortOptions: {
51
+ label: string;
52
+ value: string;
53
+ }[];
49
54
  emit: (event: "onSave" | "onClose" | "reset", ...args: any[]) => void;
50
55
  settingView: any;
51
56
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as c,unref as n,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as k,withDirectives as y,vShow as v,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as x,NInput as S,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import F from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const q={class:"fields-set-content"},C={class:"fields-table"},N=r("span",{class:"width-show",style:{width:"4%"}},null,-1),P=r("span",{class:"width-large"},"所有字段",-1),j={class:"width-show"},R={key:0,class:"width-show"},I={key:1,class:"width-show"},L={class:"width-show"},T={class:"width-show"},D=r("span",{class:"width-showed"},"固定",-1),z=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),A={class:"width-show"},K={key:0,class:"width-show"},M={key:1,class:"width-show"},Q={class:"width-show"},X={class:"width-show"},Y={class:"width-showed"},Z={class:"width-word"},ee={class:"width-showed"},le={key:0,class:"check-options"},te={class:"btn-operate"};var ie=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:ie}){const se=e,de={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ae=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],oe=l(null);function ce(){const e=se.fields?JSON.parse(JSON.stringify(se.fields)):[];return Object.keys(de).forEach((l=>{e.forEach((e=>{"old"==se.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[de[l]]=1==e[l]:e[de[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),e}const ne=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),he=e=>ne.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),re=()=>{if("old"==se.type){let e=[];return ne.fields.length>0&&ne.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,...se.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ne.fields},ue=()=>{ie("onSave",{tableFields:re()})},pe=()=>{ie("onClose")};function fe(){ne.fields=ce(),ie("reset")}const we=e=>!!ne.fields.length&&ne.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ye(l,e))||l[e])),ke=(e,l)=>{const t=e,i=ne.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ye(e,l)&&(e[l]=t),e)));ne.fields=i};function ye(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]}return i((()=>se.fields),(e=>{(null==e?void 0:e.length)>0&&(ne.fields=ce())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=oe.value)||e.style.setProperty("margin","auto"),se.isEdit&&(ne.widthShow="8%",ne.widthLarge="13%")})),O({getTableFields:re}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:oe,class:"c-field-set",style:o({"--width-show":ne.widthShow,"--width-large":ne.widthLarge})},[c(n(g),{show:ne.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",q,[r("div",C,[r("div",{class:u(["setting-title",{"seting-title-api":!ne.isCustomSearch}])},[N,p(" 字段名称 "),P,p(" 显示 "),r("span",j,[he("show")?(d(),f(n(m),{key:0,checked:we("show"),"onUpdate:checked":t[0]||(t[0]=e=>ke(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",R,[he("editable")?(d(),f(n(m),{key:0,checked:we("editable"),"onUpdate:checked":t[1]||(t[1]=e=>ke(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",I,[he("required")?(d(),f(n(m),{key:0,checked:we("required"),"onUpdate:checked":t[2]||(t[2]=e=>ke(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",L,[he("sort")?(d(),f(n(m),{key:0,checked:we("sort"),"onUpdate:checked":t[3]||(t[3]=e=>ke(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",T,[c(n(m),{checked:we("bold"),"onUpdate:checked":t[4]||(t[4]=e=>ke(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 固定 "),D,p(" 自定义标题 "),z,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ne.isCustomSearch}])},[c(n(F),{list:ne.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ne.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ne.clickItem=t);var t}},[r("span",H,[c(n(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,k(l.title),1)],2),p(" 显示 "),r("span",A,[y(c(n(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[v,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",K,[y(c(n(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[v,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",M,[y(c(n(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[v,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",Q,[y(c(n(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[v,"0001"!=l.id]])]),p(" 加粗 "),r("span",X,[y(c(n(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[v,"0001"!=l.id]])]),p(" 固定 "),r("span",Y,[c(n(x),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ae,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",Z,[y(c(n(S),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[v,"0001"!=l.id]])]),p(" 列宽 "),r("span",ee,[c(n(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,style:{width:"120px"},clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),se.footerFlag?(d(),a("div",le,[r("div",te,[b(l.$slots,"footer",{},(()=>[c(n(_),{onPositiveClick:fe},{trigger:h((()=>[c(n(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),c(n(W),{style:{"margin-right":"8px"},onClick:pe},{default:h((()=>[w("取消")])),_:1}),c(n(W),{type:"primary",onClick:ue},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{ie as default};
1
+ import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as n,unref as c,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as v,withDirectives as k,vShow as y,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as S,NInput as x,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import C from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const F={class:"fields-set-content"},q={class:"fields-table"},D=r("span",{class:"width-show",style:{width:"4%"}},null,-1),N=r("span",{class:"width-large"},"所有字段",-1),P={class:"width-show"},j={key:0,class:"width-show"},R={key:1,class:"width-show"},I={class:"width-show"},L={class:"width-show"},T=r("span",{class:"width-showed"},"默认排序",-1),z=r("span",{class:"width-showed"},"固定",-1),A=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),K={class:"width-show"},M={key:0,class:"width-show"},Q={key:1,class:"width-show"},X={class:"width-show"},Y={class:"width-show"},Z={class:"width-showed"},ee={class:"width-showed"},le={class:"width-word"},te={class:"width-showed"},ie={key:0,class:"check-options"},se={class:"btn-operate"};var de=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:de}){const ae=e,oe={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ne=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],ce=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],he=l(null);function re(){const e=ae.fields?JSON.parse(JSON.stringify(ae.fields)):[];return Object.keys(oe).forEach((l=>{e.forEach((e=>{"old"==ae.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[oe[l]]=1==e[l]:e[oe[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),e}const ue=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),pe=e=>ue.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),fe=()=>{if("old"==ae.type){let e=[];return ue.fields.length>0&&ue.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,sortDirection:l.sortDirection,...ae.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ue.fields},we=()=>{de("onSave",{tableFields:fe()})},ve=()=>{de("onClose")};function ke(){ue.fields=re(),de("reset")}const ye=e=>!!ue.fields.length&&ue.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ge(l,e))||l[e])),be=(e,l)=>{const t=e,i=ue.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ge(e,l)&&(e[l]=t),e)));ue.fields=i};function ge(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]}return i((()=>ae.fields),(e=>{(null==e?void 0:e.length)>0&&(ue.fields=re())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=he.value)||e.style.setProperty("margin","auto"),ae.isEdit&&(ue.widthShow="8%",ue.widthLarge="13%")})),O({getTableFields:fe}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:he,class:"c-field-set",style:o({"--width-show":ue.widthShow,"--width-large":ue.widthLarge})},[n(c(g),{show:ue.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",F,[r("div",q,[r("div",{class:u(["setting-title",{"seting-title-api":!ue.isCustomSearch}])},[D,p(" 字段名称 "),N,p(" 显示 "),r("span",P,[pe("show")?(d(),f(c(m),{key:0,checked:ye("show"),"onUpdate:checked":t[0]||(t[0]=e=>be(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",j,[pe("editable")?(d(),f(c(m),{key:0,checked:ye("editable"),"onUpdate:checked":t[1]||(t[1]=e=>be(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",R,[pe("required")?(d(),f(c(m),{key:0,checked:ye("required"),"onUpdate:checked":t[2]||(t[2]=e=>be(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",I,[pe("sort")?(d(),f(c(m),{key:0,checked:ye("sort"),"onUpdate:checked":t[3]||(t[3]=e=>be(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",L,[n(c(m),{checked:ye("bold"),"onUpdate:checked":t[4]||(t[4]=e=>be(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 默认排序 "),T,p(" 固定 "),z,p(" 自定义标题 "),A,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ue.isCustomSearch}])},[n(c(C),{list:ue.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ue.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ue.clickItem=t);var t}},[r("span",H,[n(c(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,v(l.title),1)],2),p(" 显示 "),r("span",K,[k(n(c(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",M,[k(n(c(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",Q,[k(n(c(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",X,[k(n(c(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[y,"0001"!=l.id]])]),p(" 加粗 "),r("span",Y,[k(n(c(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 默认排序 "),r("span",Z,[k(n(c(S),{value:l.sortDirection,"onUpdate:value":e=>l.sortDirection=e,options:ce,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 固定 "),r("span",ee,[n(c(S),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ne,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",le,[k(n(c(x),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 列宽 "),r("span",te,[n(c(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),ae.footerFlag?(d(),a("div",ie,[r("div",se,[b(l.$slots,"footer",{},(()=>[n(c(_),{onPositiveClick:ke},{trigger:h((()=>[n(c(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),n(c(W),{style:{"margin-right":"8px"},onClick:ve},{default:h((()=>[w("取消")])),_:1}),n(c(W),{type:"primary",onClick:we},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{de as default};
@@ -1 +1 @@
1
- .c-field-set{height:100%;position:relative}.c-field-set ul{margin:0;padding:0}.c-field-set .fields-set-content{display:flex;flex-direction:column;height:100%;overflow:hidden}.c-field-set .fields-set-content .fields-table{display:flex;flex:1;flex-direction:column;overflow:auto}.c-field-set .n-spin-container{height:100%;width:100%}.c-field-set .n-spin-content{height:100%}.c-field-set .setting-title{background:#f2f2f4;border:1px solid #f2f2f2;height:52px;line-height:52px}.c-field-set .setting-title span{display:inline-block}.c-field-set .setting-title.seting-title-api .width-large{width:15%}.c-field-set .set-show{min-height:100px;overflow-y:auto}.c-field-set .set-show.set-show-api .width-large{width:15%}.c-field-set .set-show .left-style.sortable-chosen{background:#fafafa;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .set-show li{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:52px;line-height:52px;padding:5px 0}.c-field-set .set-show .is-sort-style{border:1px solid #d5d5d5;border-radius:4px;color:#38454f;height:32px;margin-right:5px;outline:none;text-indent:6px;width:87px}.c-field-set .set-show .is-sort-style:disabled{background:#f5f5f5;cursor:not-allowed}.c-field-set .set-show .col-width-style{width:70px}.c-field-set .set-show .title-item{align-items:center;display:inline-flex;justify-content:flex-start;text-align:left}.c-field-set .set-show .title-item>span{display:inline-block;max-width:calc(100% - 20px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-field-set .alias-style{border:1px solid #d4dee5;border-radius:4px;color:#38454f;height:32px;outline:none;text-indent:16px}.c-field-set .btn-operate{border-top:1px solid #d5d5d5;padding:12px 0}.c-field-set .width-show{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-show)}.c-field-set .drag-icon-wrap{cursor:pointer;text-align:center;width:5%!important}.c-field-set .width-showed{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:15%}.c-field-set .width-showed select{width:90%!important}.c-field-set .width-word{display:inline-block;line-height:52px;overflow:hidden;white-space:nowrap;width:var(--width-large)}.c-field-set .width-word input{width:90%!important}.c-field-set .width-large{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-large)}
1
+ .c-field-set{height:100%;position:relative}.c-field-set ul{margin:0;padding:0}.c-field-set .fields-set-content{display:flex;flex-direction:column;height:100%;overflow:hidden}.c-field-set .fields-set-content .fields-table{display:flex;flex:1;flex-direction:column;overflow:auto}.c-field-set .n-spin-container{height:100%;width:100%}.c-field-set .n-spin-content{height:100%}.c-field-set .setting-title{background:#f2f2f4;border:1px solid #f2f2f2;height:52px;line-height:52px}.c-field-set .setting-title span{display:inline-block}.c-field-set .setting-title.seting-title-api .width-large{width:15%}.c-field-set .set-show{min-height:100px;overflow-y:auto}.c-field-set .set-show.set-show-api .width-large{width:15%}.c-field-set .set-show .left-style.sortable-chosen{background:#fafafa;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .set-show li{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:52px;line-height:52px;padding:5px 0}.c-field-set .set-show .is-sort-style{border:1px solid #d5d5d5;border-radius:4px;color:#38454f;height:32px;margin-right:5px;outline:none;text-indent:6px;width:87px}.c-field-set .set-show .is-sort-style:disabled{background:#f5f5f5;cursor:not-allowed}.c-field-set .set-show .col-width-style{width:70px}.c-field-set .set-show .title-item{align-items:center;display:inline-flex;justify-content:flex-start;text-align:left}.c-field-set .set-show .title-item>span{display:inline-block;max-width:calc(100% - 20px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-field-set .alias-style{border:1px solid #d4dee5;border-radius:4px;color:#38454f;height:32px;outline:none;text-indent:16px}.c-field-set .btn-operate{border-top:1px solid #d5d5d5;padding:12px 0}.c-field-set .width-show{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-show)}.c-field-set .drag-icon-wrap{cursor:pointer;text-align:center;width:5%!important}.c-field-set .width-showed{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:10%}.c-field-set .width-showed select{width:90%!important}.c-field-set .width-word{display:inline-block;line-height:52px;overflow:hidden;white-space:nowrap;width:var(--width-large)}.c-field-set .width-word input{width:90%!important}.c-field-set .width-large{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-large)}
@@ -1 +1 @@
1
- import{defineComponent as e,computed as i,ref as o,inject as l,watch as t,toRaw as a,openBlock as r,createElementBlock as n,Fragment as u,createBlock as s,unref as m,createVNode as d,nextTick as v}from"vue";import{cloneDeep as f}from"lodash-es";import{InjectionActiveFieldItem as p}from"../constants/index.js";import"../../../../shared/components/VueDraggable/src/vuedraggable.js";import{findFieldItemByKey as c}from"../utils/index.js";import g from"../../../../_virtual/plugin-vue_export-helper.js";import"@vicons/ionicons5";import{NModal as h}from"naive-ui";import"../../../../shared/utils/index.js";import{useConfigurationField as y}from"../hooks/useConfigurationField.js";import"../../../index.js";import j from"../../../form-render/index.js";var x=g(e({__name:"FormConfigEdit",props:{uuid:{type:String,required:!0},formRenderRef:{type:Object}},setup(e,{expose:g}){const x=e,_=i((()=>`#${x.uuid} .form-config__config`)),F=o(0),b=o(),k=l(p),C=o([]),R=o({}),{generateFieldListByFormConfigItem:w}=y(),E=o(!1);async function L(){var e;k.value=P,await v(),null==(e=b.value)||e.validate()}let P=null;function q({fieldKey:e,value:i}){k.value&&(k.value[e]=i)}return t(k,(async(e,i)=>{var o,l;if(!e)return C.value=[];if(i&&e!==P)try{await(null==(o=b.value)?void 0:o.validate())}catch(e){return E.value=!0}P=e,R.value={editable:!0,...f(a(e))};const t=null==(l=x.formRenderRef)?void 0:l.getFieldList();C.value=w(e,c(t,e.key)).map((e=>({...e,componentProps:{to:_.value}}))),F.value++}),{immediate:!0}),g({validate(){var e;return null==(e=b.value)?void 0:e.validate()}}),(e,i)=>(r(),n(u,null,[(r(),s(m(j),{key:F.value,column:12,ref_key:"formRenderRef",ref:b,size:"small",onFormChange:q,"field-list":C.value,"initial-data":R.value},null,8,["field-list","initial-data"])),d(m(h),{show:E.value,"onUpdate:show":i[0]||(i[0]=e=>E.value=e),preset:"dialog",to:m(_),"close-on-esc":!1,"mask-closable":!1,closable:!1,title:"存在填写错误的字段","positive-text":"继续编辑",onPositiveClick:L},null,8,["show","to"])],64))}}),[["__file","FormConfigEdit.vue"]]);export{x as default};
1
+ import{defineComponent as e,computed as i,ref as o,inject as t,watch as l,toRaw as a,openBlock as r,createElementBlock as n,Fragment as u,createBlock as s,unref as m,createVNode as d,nextTick as v}from"vue";import{cloneDeep as f}from"lodash-es";import{InjectionActiveFieldItem as p}from"../constants/index.js";import"../../../../shared/components/VueDraggable/src/vuedraggable.js";import{findFieldItemByKey as c}from"../utils/index.js";import g from"../../../../_virtual/plugin-vue_export-helper.js";import"@vicons/ionicons5";import{NModal as h}from"naive-ui";import"../../../../shared/utils/index.js";import{useConfigurationField as y}from"../hooks/useConfigurationField.js";import"../../../index.js";import j from"../../../form-render/index.js";var x=g(e({__name:"FormConfigEdit",props:{uuid:{type:String,required:!0},formRenderRef:{type:Object}},setup(e,{expose:g}){const x=e,_=i((()=>`#${x.uuid} .form-config__config`)),F=o(0),b=o(),k=t(p),C=o([]),R=o({}),{generateFieldListByFormConfigItem:w}=y(),P=o(!1);async function E(){var e;k.value=L,await v(),null==(e=b.value)||e.validate()}let L=null;function q({fieldKey:e,value:i}){k.value&&(k.value[e]=i)}return l(k,(async(e,i)=>{var o,t;if(!e)return C.value=[];if(i&&e!==L)try{await(null==(o=b.value)?void 0:o.validate())}catch(e){return P.value=!0}L=e,R.value={editable:!0,...f(a(e))};const l=null==(t=x.formRenderRef)?void 0:t.getFieldList();C.value=w(e,c(l,e.key)).map((e=>({...e,componentProps:{...e.componentProps,to:_.value}}))),F.value++}),{immediate:!0}),g({validate(){var e;return null==(e=b.value)?void 0:e.validate()}}),(e,i)=>(r(),n(u,null,[(r(),s(m(j),{key:F.value,column:12,ref_key:"formRenderRef",ref:b,size:"small",onFormChange:q,"field-list":C.value,"initial-data":R.value},null,8,["field-list","initial-data"])),d(m(h),{show:P.value,"onUpdate:show":i[0]||(i[0]=e=>P.value=e),preset:"dialog",to:m(_),"close-on-esc":!1,"mask-closable":!1,closable:!1,title:"存在填写错误的字段","positive-text":"继续编辑",onPositiveClick:E},null,8,["show","to"])],64))}}),[["__file","FormConfigEdit.vue"]]);export{x as default};
@@ -1 +1 @@
1
- import{pick as e}from"lodash-es";import{EditAbleField as t,widgetWidthOptionConfig as l,isShowOptionConfig as i,isNotFoldOptionConfig as a,isEditOptionConfig as _,isNullOptionConfig as r}from"../constants/index.js";import"../../../form-render/index.js";import{useFieldNormalize as o}from"../../../form-render/src/hooks/useFieldNormalize.js";const{FieldNormalizeWaterfallHook:m}=o();function n(){const o=new Map([[t.NAME,()=>({alias:"名称",elem_width:6,is_null:"0",html_type:"INPUT"})],[t.NOTES,()=>({alias:"问号提示",elem_width:6,html_type:"INPUT",is_empty:"0"})],[t.DEFAULT_VALUE,(t,l)=>{const i=m.call(Object.assign({},null==t?void 0:t.originalSetting,l));return{alias:"默认值",elem_width:6,html_type:"INPUT",is_empty:"0",...e(i,["html_type","validate","option","multi_select","multi_select_value","wordbook","open","close","date_format","step_length","urlConfig","autograph","defined_error_msg","free_entry","validator"])}}],[t.LAYOUT_WIDTH_ENUM,()=>({alias:"宽度",fieldType:"number",html_type:"SELECT",elem_width:6,...l()})],[t.DESC,()=>({alias:"说明文本",elem_width:6,html_type:"INPUT",is_empty:"0",validate:{max_length:30}})],[t.DEFAULT_EXPAND,()=>({alias:"是否默认展开",html_type:"SWITCH",elem_width:6,...i()})],[t.FOLD,()=>({alias:"是否可折叠",html_type:"SWITCH",elem_width:6,...a()})],[t.EDITABLE,e=>({alias:"是否可编辑",html_type:"SWITCH",elem_width:6,is_edit:(null==e?void 0:e.editableDisabled)?"0":"1",..._()})],[t.REQUIRED,e=>({alias:"是否必填",html_type:"SWITCH",elem_width:6,is_edit:(null==e?void 0:e.requiredDisabled)?"0":"1",...r()})]]);function n(e,t,l){return e.map((e=>{var i,a;return{...null!=(a=null==(i=o.get(e))?void 0:i(t,l))?a:{},val_key:e}}))}return{generateFieldListByKeys:n,generateFieldListByFormConfigItem:function(e,l){const i=new Map([["LINE_BAR",[t.NAME,t.LAYOUT_WIDTH_ENUM,t.NOTES,t.DEFAULT_EXPAND,t.FOLD]],...["NEWLINE","COMPLEX","COMBINATION"].map((e=>[e,[t.NAME,t.LAYOUT_WIDTH_ENUM]]))]),a=[t.NAME,t.DEFAULT_VALUE,t.LAYOUT_WIDTH_ENUM,t.DESC,t.NOTES,t.EDITABLE,t.REQUIRED];return n(i.get(e.type)||a,e,l)}}}export{n as useConfigurationField};
1
+ import{omit as e,pick as t}from"lodash-es";import{EditAbleField as l,widgetWidthOptionConfig as i,isShowOptionConfig as a,isNotFoldOptionConfig as o,isEditOptionConfig as r,isNullOptionConfig as _}from"../constants/index.js";import"../../../form-render/index.js";import{useFieldNormalize as n}from"../../../form-render/src/hooks/useFieldNormalize.js";const{FieldNormalizeWaterfallHook:s}=n();function m(){const n=new Map([[l.NAME,()=>({alias:"名称",elem_width:6,is_null:"0",html_type:"INPUT"})],[l.NOTES,()=>({alias:"问号提示",elem_width:6,html_type:"INPUT",is_empty:"0"})],[l.DEFAULT_VALUE,(l,i)=>{const a=s.call(Object.assign({},null==l?void 0:l.originalSetting,i));return{alias:"默认值",elem_width:6,html_type:"INPUT",is_empty:"0",componentProps:e(a.componentProps,["class","style","disabled"]),...t(a,["html_type","validate","option","multi_select","multi_select_value","wordbook","open","close","date_format","step_length","urlConfig","autograph","defined_error_msg","free_entry","validator"])}}],[l.LAYOUT_WIDTH_ENUM,()=>({alias:"宽度",fieldType:"number",html_type:"SELECT",elem_width:6,...i()})],[l.DESC,()=>({alias:"说明文本",elem_width:6,html_type:"INPUT",is_empty:"0",validate:{max_length:30}})],[l.DEFAULT_EXPAND,()=>({alias:"是否默认展开",html_type:"SWITCH",elem_width:6,...a()})],[l.FOLD,()=>({alias:"是否可折叠",html_type:"SWITCH",elem_width:6,...o()})],[l.EDITABLE,e=>({alias:"是否可编辑",html_type:"SWITCH",elem_width:6,is_edit:(null==e?void 0:e.editableDisabled)?"0":"1",...r()})],[l.REQUIRED,e=>({alias:"是否必填",html_type:"SWITCH",elem_width:6,is_edit:(null==e?void 0:e.requiredDisabled)?"0":"1",..._()})]]);function m(e,t,l){return e.map((e=>{var i,a;return{...null!=(a=null==(i=n.get(e))?void 0:i(t,l))?a:{},val_key:e}}))}return{generateFieldListByKeys:m,generateFieldListByFormConfigItem:function(e,t){const i=new Map([["LINE_BAR",[l.NAME,l.LAYOUT_WIDTH_ENUM,l.NOTES,l.DEFAULT_EXPAND,l.FOLD]],...["NEWLINE","COMPLEX","COMBINATION"].map((e=>[e,[l.NAME,l.LAYOUT_WIDTH_ENUM]]))]),a=[l.NAME,l.DEFAULT_VALUE,l.LAYOUT_WIDTH_ENUM,l.DESC,l.NOTES,l.EDITABLE,l.REQUIRED];return m(i.get(e.type)||a,e,t)}}}export{m as useConfigurationField};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,openBlock as i,createBlock as l,unref as n,withCtx as m,createElementBlock as p,createVNode as u,isRef as d,Fragment as c,renderList as f,createCommentVNode as h,createElementVNode as y,normalizeStyle as j,withKeys as g,withModifiers as v,toDisplayString as b}from"vue";import{createForm as k,onFieldValueChange as F,onFieldMount as x,onFieldUnmount as C,onFieldReact as H,onFormMount as S}from"@formily/core";import{FormProvider as A,FormConsumer as R}from"@formily/vue";import{isNumber as L,cloneDeep as _}from"lodash-es";import{NForm as O,NTabs as w,NTabPane as B,NConfigProvider as V}from"naive-ui";import{InjectionFormGraph as I}from"./constants/index.js";import{useAutoHidden as N}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as D}from"./hooks/useComplexOptions.js";import{useFormDomEvent as q,useFormExposeEvent as U}from"./hooks/useFormEvent.js";import{useFormGraph as W}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as G}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeReactions as K}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as M}from"./hooks/useNuiThemeOverrides.js";import"./utils/index.js";import{useFieldListAdaptor as T}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/index.js";import"../index.js";import{useFieldVisitor as E}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as P}from"./hooks/useFormValidator.js";import"@vueuse/core";import"date-fns";import{useAnchor as J}from"./hooks/useAnchor.js";import{useFormContext as z}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";import Q from"../../../_virtual/plugin-vue_export-helper.js";import{createObjSchema as X}from"./utils/schema.js";const Y={key:0,style:{height:"54px"}},Z={style:{"white-space":"pre"}};var $=Q(e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},linebarAutoHidden:{type:Boolean}},emits:["formChange","annotationChange","scroll"],setup(e,{expose:Q,emit:$}){const ee=e,{nuiThemeOverrides:oe}=M();P();const te=o(),re=t((()=>L(ee.maxHeight)?ee.maxHeight+"px":ee.maxHeight)),{SchemaField:se,businessCollector:ae,formItemDepsCollector:ie,changeContextCollector:le,formUUID:ne}=z(ee,$),{anchorBarRef:me,currentAnchor:pe,generateAnchorList:ue,updateAnchorList:de,anchorIdList:ce,onScroll:fe}=J(ee,$,te,ie);G(ee).callLifeCycle("onSetup");const{trigger:he}=N(),{observeFormGraph:ye,setGraph:je,removeGraph:ge}=W();r(I,ye);const ve=k({initialValues:ee.initialData,effects(e){F("*",(o=>{const t=o.props.name.toString();ae.trigger(e,t),ie.trigger(t),$("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:le.getContext(t,o.value)}),be(t,o.value)})),x("*",je),C("*",ge),ee.linebarAutoHidden&&(H("*",he),S((e=>e.query("*").forEach(he)))),ee.anchor&&(H("*",de),S(ue))}}),{lowCodeReactionsHandler:be,triggerAllReactionsHandler:ke}=K(t((()=>ee.lowCodeReactions)),ve);s(ke);const{schemaAdaptor:Fe}=T(ae);let xe=ee.fieldList||[];const Ce=t((()=>ee.schema?ee.schema:ee.fieldList?(xe=E().traverse(_(ee.fieldList),ee.fieldVisitor),X(Fe(xe))):X({}))),{onKeydown:He}=q({formModel:ve,formRenderRef:te,props:ee}),{clearSpan:Se}=D();a((()=>Se(ne)));const Ae=U({formModel:ve,formRenderRef:te,formItemDepsCollector:ie,getFieldList:()=>xe,formUUID:ne});return Q({formModel:ve,validate:(e="*")=>Ae.validate(e),getFormValues:(e=!0)=>Ae.getFormValues(e),setFormValues:(e,o=!0)=>Ae.setFormValues(e,o),setFieldState(e,o){Ae.setFieldState(e,o)},resetFields(e="*"){Ae.resetFields(e)},queryWidget:async e=>Ae.queryWidget(e),getFieldList:()=>xe,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(i(),l(n(O),{class:"form-render","require-mark-placement":"left"},{default:m((()=>[e.anchor?(i(),p("section",Y,[u(n(w),{value:n(pe),"onUpdate:value":t[0]||(t[0]=e=>d(pe)?pe.value=e:null),type:"line",ref_key:"anchorBarRef",ref:me},{default:m((()=>[(i(!0),p(c,null,f(n(ce),(e=>(i(),l(n(B),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):h("v-if",!0),u(n(V),{"theme-overrides":n(oe)},{default:m((()=>[y("section",{class:"form-render__wrapper",style:j({"--column":e.column,"--form-height":n(re)}),ref_key:"formRenderRef",ref:te,onScroll:t[1]||(t[1]=(...e)=>n(fe)&&n(fe)(...e)),onKeydownCapture:t[2]||(t[2]=g(v(((...e)=>n(He)&&n(He)(...e)),["prevent"]),["enter"]))},[u(n(A),{form:n(ve)},{default:m((()=>[u(n(se),{schema:n(Ce)},null,8,["schema"]),e.consumer?(i(),l(n(R),{key:0},{default:m((({form:e})=>[y("div",Z,b(JSON.stringify(e.values,null,2)),1)])),_:1})):h("v-if",!0)])),_:1},8,["form"])],36)])),_:1},8,["theme-overrides"])])),_:1}))}}),[["__file","FormRender.vue"]]);export{$ as default};
1
+ import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,openBlock as i,createBlock as l,unref as n,withCtx as m,createElementBlock as p,createVNode as u,isRef as d,Fragment as c,renderList as f,createCommentVNode as h,createElementVNode as y,normalizeStyle as j,withKeys as g,withModifiers as v,toDisplayString as b,renderSlot as k}from"vue";import{createForm as F,onFieldValueChange as x,onFieldMount as C,onFieldUnmount as H,onFieldReact as S,onFormMount as A}from"@formily/core";import{FormProvider as R,FormConsumer as L}from"@formily/vue";import{isNumber as _,cloneDeep as O}from"lodash-es";import{NForm as w,NTabs as B,NTabPane as V,NConfigProvider as I}from"naive-ui";import{InjectionFormGraph as N}from"./constants/index.js";import{useAutoHidden as D}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as q}from"./hooks/useComplexOptions.js";import{useFormDomEvent as U,useFormExposeEvent as W}from"./hooks/useFormEvent.js";import{useFormGraph as G}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as K}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeReactions as M}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as T}from"./hooks/useNuiThemeOverrides.js";import"./utils/index.js";import{useFieldListAdaptor as E}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/index.js";import"../index.js";import{useFieldVisitor as P}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as J}from"./hooks/useFormValidator.js";import"@vueuse/core";import"date-fns";import{useAnchor as $}from"./hooks/useAnchor.js";import{useFormContext as z}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";import Q from"../../../_virtual/plugin-vue_export-helper.js";import{createObjSchema as X}from"./utils/schema.js";const Y={key:0,style:{height:"54px"}},Z={style:{"white-space":"pre"}};var ee=Q(e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},linebarAutoHidden:{type:Boolean}},emits:["formChange","annotationChange","scroll"],setup(e,{expose:Q,emit:ee}){const oe=e,{nuiThemeOverrides:te}=T();J();const re=o(),se=t((()=>_(oe.maxHeight)?oe.maxHeight+"px":oe.maxHeight)),{SchemaField:ae,businessCollector:ie,formItemDepsCollector:le,changeContextCollector:ne,formUUID:me}=z(oe,ee),{anchorBarRef:pe,currentAnchor:ue,generateAnchorList:de,updateAnchorList:ce,anchorIdList:fe,onScroll:he}=$(oe,ee,re,le);K(oe).callLifeCycle("onSetup");const{trigger:ye}=D(),{observeFormGraph:je,setGraph:ge,removeGraph:ve}=G();r(N,je);const be=F({initialValues:oe.initialData,effects(e){x("*",(o=>{const t=o.props.name.toString();ie.trigger(e,t),le.trigger(t),ee("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:ne.getContext(t,o.value)}),ke(t,o.value)})),C("*",ge),H("*",ve),oe.linebarAutoHidden&&(S("*",ye),A((e=>e.query("*").forEach(ye)))),oe.anchor&&(S("*",ce),A(de))}}),{lowCodeReactionsHandler:ke,triggerAllReactionsHandler:Fe}=M(t((()=>oe.lowCodeReactions)),be);s(Fe);const{schemaAdaptor:xe}=E(ie);let Ce=oe.fieldList||[];const He=t((()=>oe.schema?oe.schema:oe.fieldList?(Ce=P().traverse(O(oe.fieldList),oe.fieldVisitor),X(xe(Ce))):X({}))),{onKeydown:Se}=U({formModel:be,formRenderRef:re,props:oe}),{clearSpan:Ae}=q();a((()=>Ae(me)));const Re=W({formModel:be,formRenderRef:re,formItemDepsCollector:le,getFieldList:()=>Ce,formUUID:me});return Q({formModel:be,validate:(e="*")=>Re.validate(e),getFormValues:(e=!0)=>Re.getFormValues(e),setFormValues:(e,o=!0)=>Re.setFormValues(e,o),setFieldState(e,o){Re.setFieldState(e,o)},resetFields(e="*"){Re.resetFields(e)},queryWidget:async e=>Re.queryWidget(e),getFieldList:()=>Ce,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(i(),l(n(w),{class:"form-render","require-mark-placement":"left"},{default:m((()=>[e.anchor?(i(),p("section",Y,[u(n(B),{value:n(ue),"onUpdate:value":t[0]||(t[0]=e=>d(ue)?ue.value=e:null),type:"line",ref_key:"anchorBarRef",ref:pe},{default:m((()=>[(i(!0),p(c,null,f(n(fe),(e=>(i(),l(n(V),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):h("v-if",!0),u(n(I),{"theme-overrides":n(te)},{default:m((()=>[y("section",{class:"form-render__wrapper",style:j({"--column":e.column,"--form-height":n(se)}),ref_key:"formRenderRef",ref:re,onScroll:t[1]||(t[1]=(...e)=>n(he)&&n(he)(...e)),onKeydownCapture:t[2]||(t[2]=g(v(((...e)=>n(Se)&&n(Se)(...e)),["prevent"]),["enter"]))},[u(n(R),{form:n(be)},{default:m((()=>[u(n(ae),{schema:n(He)},null,8,["schema"]),e.consumer?(i(),l(n(L),{key:0},{default:m((({form:e})=>[y("div",Z,b(JSON.stringify(e.values,null,2)),1)])),_:1})):h("v-if",!0),k(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3}))}}),[["__file","FormRender.vue"]]);export{ee as default};
@@ -1 +1 @@
1
- import{createVNode as r}from"vue";import{isString as e}from"lodash-es";import"../../../../index.js";import{WIDGET_TYPE as n}from"../../../constants/index.js";import{IhoTableWarn as t}from"../../../utils/index.js";import{defineTablePlugin as o}from"../../../hooks/useTablePlugin.js";function i(){return o({name:"defaultRendererPlugin",vxe(o){o.renderer.add(n.DEFAULT,{renderCell(n,{row:o,column:i}){const l=o[i.field];return e(c=l)&&c.match(/^###\{[^{}]+}$/)?function(e){const n=function(r){try{return JSON.parse(r.replace(/^###/,""))}catch(e){return t(`invalid json-content ${r}`),{}}}(e);return[r("div",{style:{color:n.background}},[function(e){if(!e)return null;if(e.match(/#[\da-f]{6}|[\da-f]{3}/i))return r("i",{class:"icon-dot",style:{"--table-icon-color":e,"--table-icon-shadow":e}},null);return r("i",{class:n.icon},null)}(n.icon),n.change_text])]}(l):[l];var c}}),o.renderer.add(n.STATUS,o.renderer.get(n.DEFAULT))}})}export{i as defaultRendererPlugin};
1
+ import{createVNode as r}from"vue";import{isString as n}from"lodash-es";import"../../../../index.js";import{WIDGET_TYPE as e}from"../../../constants/index.js";import{IhoTableWarn as o}from"../../../utils/index.js";import{defineTablePlugin as t}from"../../../hooks/useTablePlugin.js";function i(){return t({name:"defaultRendererPlugin",vxe(t){t.renderer.add(e.DEFAULT,{renderCell(e,{row:t,column:i}){const c=t[i.field];return n(l=c)&&l.match(/^###\{[^{}]+}$/)?function(n){const e=function(r){try{return JSON.parse(r.replace(/^###/,""))}catch(n){return o(`invalid json-content ${r}`),{}}}(n);return[r("div",{style:{color:e.background||e.icon}},[function(n){if(!n)return null;if(n.match(/#[\da-f]{6}|[\da-f]{3}/i))return r("i",{class:"icon-dot",style:{"--table-icon-color":n,"--table-icon-shadow":n}},null);return r("i",{class:e.icon},null)}(e.icon),e.change_text])]}(c):[c];var l}}),t.renderer.add(e.STATUS,t.renderer.get(e.DEFAULT))}})}export{i as defaultRendererPlugin};