cnhis-design-vue 3.1.41-release.2 → 3.1.41-release.4
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.
- package/README.md +87 -87
- package/es/components/button-print/src/utils/print.d.ts +1 -1
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/form-config/index.d.ts +7 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +7 -0
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +3 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +4 -0
- package/es/components/form-render/index.d.ts +3 -0
- package/es/components/form-render/src/FormRender.vue.d.ts +3 -0
- package/es/components/form-render/src/FormRender.vue.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +3 -0
- package/es/components/form-render/src/components/renderer/date.d.ts +2 -0
- package/es/components/form-render/src/components/renderer/formItem.d.ts +7 -0
- package/es/components/form-render/src/components/renderer/formItem.js +1 -1
- package/es/components/form-render/src/components/renderer/select.d.ts +3 -0
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/constants/index.d.ts +2 -0
- package/es/components/form-render/src/constants/index.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
- package/es/components/form-render/src/hooks/useFormGraph.d.ts +6 -0
- package/es/components/form-render/src/hooks/useFormGraph.js +1 -0
- package/es/components/form-render/src/types/fieldItem.d.ts +3 -1
- package/es/components/index.css +1 -1
- package/es/components/info-header/src/InfoHeader.vue.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue.d.ts +0 -3
- package/es/components/scale-view/src/ScaleView.vue.js +1 -1
- package/es/components/shortcut-setter/index.d.ts +4 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +4 -0
- package/es/components/table-filter/index.d.ts +418 -251
- package/es/components/table-filter/src/base-search-com/BaseSearch.vue.d.ts +43 -256
- package/es/components/table-filter/src/base-search-com/BaseSearch.vue.js +1 -1
- package/es/components/table-filter/src/classification/Classification-com.vue.d.ts +385 -4
- package/es/components/table-filter/src/classification/Classification-com.vue.js +1 -1
- package/es/components/table-filter/src/classification/search-class-name.vue.d.ts +19 -0
- package/es/components/table-filter/src/classification/search-class-name.vue.js +1 -1
- package/es/components/table-filter/src/classification/search-professional-model.vue.d.ts +353 -3
- package/es/components/table-filter/src/classification/search-professional-model.vue.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/hooks/useDisplayCategory.d.ts +1 -1
- package/es/components/table-filter/src/components/classify-filter/hooks/useDisplayCategory.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +27 -0
- package/es/components/table-filter/src/components/classify-filter/index.vue.js +1 -1
- package/es/components/table-filter/src/components/out-quick-search/out-quick-search.vue.js +1 -1
- package/es/components/table-filter/src/components/render-widget/index.vue.js +1 -1
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
- package/es/components/table-filter/src/components/search-filter/SearchFilter.vue.d.ts +28 -1
- package/es/components/table-filter/src/components/search-modal/set-classification.vue.d.ts +28 -1
- package/es/components/table-filter/src/hooks/useAdvanced.d.ts +1 -1
- package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
- package/es/components/table-filter/src/hooks/useMixins.d.ts +2 -1
- package/es/components/table-filter/src/hooks/useRenderWidget.js +1 -1
- package/es/components/table-filter/src/quick-search/QuickSearch.vue.d.ts +4 -3
- package/es/components/table-filter/style/index.css +1 -1
- package/es/env.d.ts +24 -24
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- 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
|
+
```
|
|
@@ -42,7 +42,7 @@ export declare class Print {
|
|
|
42
42
|
_queryPrintFile(formatId: string, params?: string): Promise<any>;
|
|
43
43
|
_browserPrint(result: AnyObject, mode: string): Promise<string | void>;
|
|
44
44
|
preview({ templateId, formatId, params, btnprint }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<any>;
|
|
45
|
-
printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
|
|
45
|
+
printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode, isDownloadFile }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
|
|
46
46
|
private _downloadPDF;
|
|
47
47
|
/**
|
|
48
48
|
* 下载pdf
|
|
@@ -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:"6",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
|
|
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:"6",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};
|
|
@@ -452,6 +452,9 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
452
452
|
}[]>;
|
|
453
453
|
onScroll: (scrollEvent: Event) => void;
|
|
454
454
|
triggerAutoHidden: (field: import("@formily/core").GeneralField) => Promise<void>;
|
|
455
|
+
observeFormGraph: Record<string, import("@formily/core").GeneralField>;
|
|
456
|
+
setGraph: (field: import("@formily/core").GeneralField) => void;
|
|
457
|
+
removeGraph: (field: import("@formily/core").GeneralField) => void;
|
|
455
458
|
formModel: import("@formily/core").Form<{
|
|
456
459
|
[x: string]: any;
|
|
457
460
|
}>;
|
|
@@ -1056,6 +1059,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1056
1059
|
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
|
|
1057
1060
|
} | undefined;
|
|
1058
1061
|
regular_error_tip?: string | undefined;
|
|
1062
|
+
message?: string | undefined;
|
|
1059
1063
|
} | undefined;
|
|
1060
1064
|
option?: {
|
|
1061
1065
|
text: string;
|
|
@@ -3015,6 +3019,9 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3015
3019
|
}[]>;
|
|
3016
3020
|
onScroll: (scrollEvent: Event) => void;
|
|
3017
3021
|
triggerAutoHidden: (field: import("@formily/core").GeneralField) => Promise<void>;
|
|
3022
|
+
observeFormGraph: Record<string, import("@formily/core").GeneralField>;
|
|
3023
|
+
setGraph: (field: import("@formily/core").GeneralField) => void;
|
|
3024
|
+
removeGraph: (field: import("@formily/core").GeneralField) => void;
|
|
3018
3025
|
formModel: import("@formily/core").Form<{
|
|
3019
3026
|
[x: string]: any;
|
|
3020
3027
|
}>;
|
|
@@ -453,6 +453,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
453
453
|
}[]>;
|
|
454
454
|
onScroll: (scrollEvent: Event) => void;
|
|
455
455
|
triggerAutoHidden: (field: import("@formily/core").GeneralField) => Promise<void>;
|
|
456
|
+
observeFormGraph: Record<string, import("@formily/core").GeneralField>;
|
|
457
|
+
setGraph: (field: import("@formily/core").GeneralField) => void;
|
|
458
|
+
removeGraph: (field: import("@formily/core").GeneralField) => void;
|
|
456
459
|
formModel: import("@formily/core").Form<{
|
|
457
460
|
[x: string]: any;
|
|
458
461
|
}>;
|
|
@@ -1057,6 +1060,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1057
1060
|
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
|
|
1058
1061
|
} | undefined;
|
|
1059
1062
|
regular_error_tip?: string | undefined;
|
|
1063
|
+
message?: string | undefined;
|
|
1060
1064
|
} | undefined;
|
|
1061
1065
|
option?: {
|
|
1062
1066
|
text: string;
|
|
@@ -3016,6 +3020,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3016
3020
|
}[]>;
|
|
3017
3021
|
onScroll: (scrollEvent: Event) => void;
|
|
3018
3022
|
triggerAutoHidden: (field: import("@formily/core").GeneralField) => Promise<void>;
|
|
3023
|
+
observeFormGraph: Record<string, import("@formily/core").GeneralField>;
|
|
3024
|
+
setGraph: (field: import("@formily/core").GeneralField) => void;
|
|
3025
|
+
removeGraph: (field: import("@formily/core").GeneralField) => void;
|
|
3019
3026
|
formModel: import("@formily/core").Form<{
|
|
3020
3027
|
[x: string]: any;
|
|
3021
3028
|
}>;
|
|
@@ -302,6 +302,9 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
302
302
|
}[]>;
|
|
303
303
|
onScroll: (scrollEvent: Event) => void;
|
|
304
304
|
triggerAutoHidden: (field: import("../../../../../es/components/form-render").GeneralField) => Promise<void>;
|
|
305
|
+
observeFormGraph: Record<string, import("../../../../../es/components/form-render").GeneralField>;
|
|
306
|
+
setGraph: (field: import("../../../../../es/components/form-render").GeneralField) => void;
|
|
307
|
+
removeGraph: (field: import("../../../../../es/components/form-render").GeneralField) => void;
|
|
305
308
|
formModel: import("../../../../../es/components/form-render").Form<{
|
|
306
309
|
[x: string]: any;
|
|
307
310
|
}>;
|
|
@@ -64,6 +64,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
64
64
|
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
|
|
65
65
|
} | undefined;
|
|
66
66
|
regular_error_tip?: string | undefined;
|
|
67
|
+
message?: string | undefined;
|
|
67
68
|
} | undefined;
|
|
68
69
|
option?: {
|
|
69
70
|
text: string;
|
|
@@ -2023,6 +2024,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2023
2024
|
}[]>;
|
|
2024
2025
|
onScroll: (scrollEvent: Event) => void;
|
|
2025
2026
|
triggerAutoHidden: (field: import("../../../../../es/components/form-render").GeneralField) => Promise<void>;
|
|
2027
|
+
observeFormGraph: Record<string, import("../../../../../es/components/form-render").GeneralField>;
|
|
2028
|
+
setGraph: (field: import("../../../../../es/components/form-render").GeneralField) => void;
|
|
2029
|
+
removeGraph: (field: import("../../../../../es/components/form-render").GeneralField) => void;
|
|
2026
2030
|
formModel: import("../../../../../es/components/form-render").Form<{
|
|
2027
2031
|
[x: string]: any;
|
|
2028
2032
|
}>;
|
|
@@ -289,6 +289,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
|
|
|
289
289
|
}[]>;
|
|
290
290
|
onScroll: (scrollEvent: Event) => void;
|
|
291
291
|
triggerAutoHidden: (field: import("@formily/core/esm/types").GeneralField) => Promise<void>;
|
|
292
|
+
observeFormGraph: Record<string, import("@formily/core/esm/types").GeneralField>;
|
|
293
|
+
setGraph: (field: import("@formily/core/esm/types").GeneralField) => void;
|
|
294
|
+
removeGraph: (field: import("@formily/core/esm/types").GeneralField) => void;
|
|
292
295
|
formModel: import("@formily/core/esm/models/Form").Form<{
|
|
293
296
|
[x: string]: any;
|
|
294
297
|
}>;
|
|
@@ -283,6 +283,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
283
283
|
}[]>;
|
|
284
284
|
onScroll: (scrollEvent: Event) => void;
|
|
285
285
|
triggerAutoHidden: (field: import("@formily/core").GeneralField) => Promise<void>;
|
|
286
|
+
observeFormGraph: Record<string, import("@formily/core").GeneralField>;
|
|
287
|
+
setGraph: (field: import("@formily/core").GeneralField) => void;
|
|
288
|
+
removeGraph: (field: import("@formily/core").GeneralField) => void;
|
|
286
289
|
formModel: import("@formily/core").Form<{
|
|
287
290
|
[x: string]: any;
|
|
288
291
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as o,computed as t,
|
|
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 v,withModifiers as g,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 _,cloneDeep as L}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((()=>_(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:ve}=W();r(I,ye);const ge=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("*",ve),ee.linebarAutoHidden&&(H("*",he),S((e=>e.query("*").forEach(he)))),ee.anchor&&(H("*",de),S(ue))}}),{lowCodeReactionsHandler:be,triggerAllReactionsHandler:ke}=K(t((()=>ee.lowCodeReactions)),ge);s(ke);const{schemaAdaptor:Fe}=T(ae);let xe=ee.fieldList||[];const Ce=t((()=>ee.schema?ee.schema:ee.fieldList?(xe=E().traverse(L(ee.fieldList),ee.fieldVisitor),X(Fe(xe))):X({}))),{onKeydown:He}=q({formModel:ge,formRenderRef:te,props:ee}),{clearSpan:Se}=D();a((()=>Se(ne)));const Ae=U({formModel:ge,formRenderRef:te,formItemDepsCollector:ie,getFieldList:()=>xe,formUUID:ne});return Q({formModel:ge,validate:(e="*")=>Ae.validate(e),getFormValues:(e=!0,o=!0)=>Ae.getFormValues(e,o),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),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]=v(g(((...e)=>n(He)&&n(He)(...e)),["prevent"]),["enter"]))},[u(n(A),{form:n(ge)},{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};
|
|
@@ -286,6 +286,9 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
286
286
|
}[]>;
|
|
287
287
|
onScroll: (scrollEvent: Event) => void;
|
|
288
288
|
triggerAutoHidden: (field: import("../../../../es/components/form-render").GeneralField) => Promise<void>;
|
|
289
|
+
observeFormGraph: Record<string, import("../../../../es/components/form-render").GeneralField>;
|
|
290
|
+
setGraph: (field: import("../../../../es/components/form-render").GeneralField) => void;
|
|
291
|
+
removeGraph: (field: import("../../../../es/components/form-render").GeneralField) => void;
|
|
289
292
|
formModel: import("../../../../es/components/form-render").Form<{
|
|
290
293
|
[x: string]: any;
|
|
291
294
|
}>;
|
|
@@ -16,6 +16,7 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
16
16
|
decimal_length: string | number;
|
|
17
17
|
regular_expression: string | RegExp;
|
|
18
18
|
regular_error_tip: string;
|
|
19
|
+
message: string;
|
|
19
20
|
}>>;
|
|
20
21
|
};
|
|
21
22
|
valueFormat: {
|
|
@@ -39,6 +40,7 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
39
40
|
decimal_length: string | number;
|
|
40
41
|
regular_expression: string | RegExp;
|
|
41
42
|
regular_error_tip: string;
|
|
43
|
+
message: string;
|
|
42
44
|
}>>;
|
|
43
45
|
};
|
|
44
46
|
valueFormat: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
1
2
|
export declare const FORM_ITEM: import("vue").DefineComponent<{
|
|
2
3
|
label: StringConstructor;
|
|
3
4
|
propertyKey: StringConstructor;
|
|
@@ -6,6 +7,9 @@ export declare const FORM_ITEM: import("vue").DefineComponent<{
|
|
|
6
7
|
type: NumberConstructor;
|
|
7
8
|
default: number;
|
|
8
9
|
};
|
|
10
|
+
suffixFields: {
|
|
11
|
+
type: PropType<string[]>;
|
|
12
|
+
};
|
|
9
13
|
annotation: {};
|
|
10
14
|
fieldItem: {};
|
|
11
15
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -16,6 +20,9 @@ export declare const FORM_ITEM: import("vue").DefineComponent<{
|
|
|
16
20
|
type: NumberConstructor;
|
|
17
21
|
default: number;
|
|
18
22
|
};
|
|
23
|
+
suffixFields: {
|
|
24
|
+
type: PropType<string[]>;
|
|
25
|
+
};
|
|
19
26
|
annotation: {};
|
|
20
27
|
fieldItem: {};
|
|
21
28
|
}>>, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,inject as r,computed as o,
|
|
1
|
+
import{defineComponent as e,inject as r,computed as o,ref as t,onUnmounted as l,createVNode as i,mergeProps as s}from"vue";import{arrayed as a,widthAppend as m}from"../../../../../shared/utils/index.js";import{isVoidField as n}from"@formily/core";import{observe as u,autorun as f}from"@formily/reactive";import{connect as d,mapProps as p}from"@formily/vue";import{useDebounceFn as v}from"@vueuse/core";import{isArray as c,isString as y}from"lodash-es";import{NFormItem as _}from"naive-ui";import g from"../../../../annotation-edit/index.js";import"../../../index.js";import b from"../tooltipMessage.vue.js";import{InjectionFormUUID as x,InjectionFormGraph as j,InjectionAnnotation as I}from"../../constants/index.js";import{useComplexOptionsSpan as k}from"../../hooks/useComplexOptions.js";import{dotEscape as h}from"../../utils/schema.js";import{useFormField as F}from"../../hooks/useFormField.js";import{validateMessageParser as L}from"../../utils/index.js";const q=d(e({props:{label:String,propertyKey:String,remark:String,span:{type:Number,default:6},suffixFields:{type:Array},annotation:{},fieldItem:{}},setup(e,{slots:a}){const{field:d,fieldKey:p}=F(),y=r(x),L=o((()=>h(`${y}-${p.value}`))),q=t(!1);if(n(d.value)&&c(e.suffixFields)){const o=r(j);l(u(o,v((()=>{n(d.value)&&c(e.suffixFields)&&(q.value=e.suffixFields.some((e=>{const r=d.value.form.query(e).take();return r&&Reflect.get(r,"required")})))}),100)))}else l(f((()=>{q.value=Reflect.get(d.value,"required")})));const K=r(I),S=o({get(){var r,o;return null!=(o=null==(r=K.value)?void 0:r[e.propertyKey])?o:""},set(r){K.value={property:e.propertyKey,value:r}}});const R=o((()=>K.value&&!1!==e.annotation)),E=o((()=>e.label&&" "!==e.label)),V=o((()=>{let r=0;return R.value&&(r+=18),e.remark&&(r+=18),r}));function $(){return E.value?i("section",{class:"form-render__formItemLabel"},[i("span",{class:"form-render__formItemLabel--text",style:{marginRight:m(V.value)}},[e.label]),V.value?i("section",{class:"form-render__formItemLabel--operation"},[e.remark?i("div",{class:"form-render__formItemLabel--tooltip"},[i(b,{message:e.remark},null)]):null,R.value?i(g,{class:"form-render__formItemLabel--annotation",modelValue:S.value,"onUpdate:modelValue":e=>S.value=e},null):null]):null]):null}const{getSpan:w}=k();return()=>i(_,s({class:"form-render__formItem",style:{"--form-item-column":w(y,d.value.address)+e.span}},{id:L.value,"widget-type":d.value.componentType,"form-field":p.value,required:q.value}),{...a,label:$})}}),p({title:"label"},((e,r)=>{const o=n(r)?void 0:a(r.selfErrors).length?function(e,r){if(!y(r.defined_error_msg)||!r.defined_error_msg)return e.map((e=>L(e,r))).join(",");return L(r.defined_error_msg,r)}(a(r.selfErrors),e.fieldItem):void 0;return{...e,fieldItem:void 0,feedback:o,"validation-status":o?"error":void 0}})));export{q as FORM_ITEM};
|
|
@@ -20,6 +20,7 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
20
20
|
default: () => never[];
|
|
21
21
|
};
|
|
22
22
|
onChange: {};
|
|
23
|
+
allowCreate: BooleanConstructor;
|
|
23
24
|
urlConfig: {
|
|
24
25
|
type: PropType<UrlConfig>;
|
|
25
26
|
};
|
|
@@ -82,6 +83,7 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
82
83
|
default: () => never[];
|
|
83
84
|
};
|
|
84
85
|
onChange: {};
|
|
86
|
+
allowCreate: BooleanConstructor;
|
|
85
87
|
urlConfig: {
|
|
86
88
|
type: PropType<UrlConfig>;
|
|
87
89
|
};
|
|
@@ -137,4 +139,5 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
137
139
|
recommend: boolean;
|
|
138
140
|
recommendCache: boolean;
|
|
139
141
|
recommendNum: number;
|
|
142
|
+
allowCreate: boolean;
|
|
140
143
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,computed as o,inject as t,createVNode as r}from"vue";import{useDebounceFn as
|
|
1
|
+
import{defineComponent as e,computed as o,inject as t,ref as a,createVNode as r}from"vue";import{useDebounceFn as l}from"@vueuse/core";import{cloneDeep as s,isString as i}from"lodash-es";import{useCommonInjection as n,useSelectOptionProps as u}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as p}from"../../constants/index.js";import"../../../../../shared/utils/index.js";import"../../../index.js";import"../../utils/index.js";import{useFormField as m}from"../../hooks/useFormField.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"../../hooks/useFormValidator.js";import"@formily/core";import"date-fns";import"@formily/reactive";import{connect as c,mapProps as d}from"@formily/vue";import"@vue/shared";import"./index.js";import{useUrlConfigOptions as y,useAutographOptions as v,useRecommendOptions as f,searchContentMatcher as h}from"../../hooks/useFormRenderOptions.js";import{NSelect as j}from"naive-ui";import{createVisitedSetter as b,assignUpdateValue as k,assignClearBindVisited as S}from"../../utils/schema.js";const g=c(e({name:"FormSelect",props:{value:{type:[String,Array]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},allowCreate:Boolean,urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},recommendNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1}},emits:["update:value","postRecommend"],setup(e,{slots:c,emit:d}){const k=o({get:()=>e.value,async set(e){d("update:value",e),B(e)}}),{labelKey:S,valueKey:g,fetchData:A,options:F}=e.urlConfig?y(e,k):v(e,k),{getRecommend:H,postRecommend:B,sortedOptions:C}=f(e,F,d,S,g),{field:x,fieldKey:R}=m();t(p).setContext(R.value,(e=>{return{currentOption:s((o=e,C.value.find((e=>e[g.value]===o))))};var o}));const L=a(""),O=l((async(e="")=>{L.value=e,A(e),H(e)}),300),{injectValueValidate:V,injectValueWatchFromEmpty:w,injectValueBindKey:K}=n();w(k,O),V(k);const P=K(k),{menuProps:W,nodeProps:q}=u();function I(e){const o=e[S.value];if(!o||!i(o))return"";const t=h(L.value,o);return t?r("section",null,[t.map(((e,o)=>0!==o&&e?r("span",{style:{color:o%2==0?"var(--n-option-text-color-active)":""}},[e]):null))]):o}const N=o((()=>C.value.length||!e.allowCreate?C.value:L.value?[{[S.value]:L.value,[g.value]:L.value},...C.value]:C.value));return()=>r(j,{key:P.value,remote:!0,filterable:!0,value:k.value,"onUpdate:value":e=>k.value=e,"menu-props":W,"node-props":q,labelField:S.value,valueField:g.value,options:N.value,onSearch:O,"onUpdate:show":e=>e&&O(),onFocus:b(x),renderLabel:I},c)}}),d({dataSource:"options"},k,S));export{g as SELECT};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Nullable } from '../../../../../es/shared/types';
|
|
2
|
+
import { GeneralField } from '@formily/core';
|
|
2
3
|
import { AnnotationItem } from '../../../../../es/components/annotation-edit/src/type';
|
|
3
4
|
import { ContextCollector } from '../../../../../es/components/form-render/src/hooks/useChangeContext';
|
|
4
5
|
import { BusinessCollector, FormItemDepsCollector } from '../hooks';
|
|
@@ -10,6 +11,7 @@ export declare const InjectionBusinessCollector: InjectionKey<BusinessCollector>
|
|
|
10
11
|
export declare const InjectionChangeContextCollector: InjectionKey<ContextCollector>;
|
|
11
12
|
export declare const InjectionFormItemDepsCollector: InjectionKey<FormItemDepsCollector>;
|
|
12
13
|
export declare const InjectionFormUUID: InjectionKey<string>;
|
|
14
|
+
export declare const InjectionFormGraph: InjectionKey<Record<string, GeneralField>>;
|
|
13
15
|
export declare const InjectionAnnotation: InjectionKey<WritableComputedRef<Nullable<Record<string, AnnotationItem>>>>;
|
|
14
16
|
export declare const FormItemLineBarDepKeyPrepend = "__dep_LINEBAR_";
|
|
15
17
|
export declare enum FIELD_BUSINESS_TYPE {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=Symbol("InjectionAsyncQueue"),E=Symbol("InjectionSchemaField"),o=Symbol("InjectionBusinessCollector"),n=Symbol("InjectionChangeContextCollector"),t=Symbol("InjectionFormItemDepsCollector"),I=Symbol("InjectionFormUUID"),S=Symbol("
|
|
1
|
+
const e=Symbol("InjectionAsyncQueue"),E=Symbol("InjectionSchemaField"),o=Symbol("InjectionBusinessCollector"),n=Symbol("InjectionChangeContextCollector"),t=Symbol("InjectionFormItemDepsCollector"),I=Symbol("InjectionFormUUID"),S=Symbol("InjectionFormGraph"),L=Symbol("InjectionAnnotation"),A="__dep_LINEBAR_";var N=(e=>(e.PASSWORD="password",e.ID_CARD="id_card",e.AGE="age",e.AGE_UNIT="age_unit",e.MOBILE="mobile",e.TELEPHONE="telephone",e.EMAIL="email",e.SEX="sex",e.BIRTHDAY="birthday",e.BANK_CARD="bank_card",e.WEBSITE="website",e.GESTATIONAL_WEEKS="gestational_weeks",e.GESTATIONAL_STAGE="gestational_stage",e.CUSTOMER_NAME="customer_name",e))(N||{}),l=(e=>(e.MALE="1",e.FEMALE="2",e))(l||{}),a=(e=>(e.DAY="D",e.MONTH="M",e.YEAR="Y",e.HOUR="H",e.WEEK="W",e.MINUTE="N",e))(a||{}),i=(e=>(e.EQ="EQ",e.NEQ="NEQ",e.CL="CL",e.NC="NC",e.NULL="NULL",e.NOT_NULL="NOT_NULL",e.BIG="BIG",e.BIGEQ="BIGEQ",e.LESS="LESS",e.LESSEQ="LESSEQ",e))(i||{});const c=["COMPLEX","COMBINATION"];export{a as FIELD_AGE_UNIT,N as FIELD_BUSINESS_TYPE,l as FIELD_SEX_VALUE,A as FormItemLineBarDepKeyPrepend,L as InjectionAnnotation,e as InjectionAsyncQueue,o as InjectionBusinessCollector,n as InjectionChangeContextCollector,S as InjectionFormGraph,t as InjectionFormItemDepsCollector,I as InjectionFormUUID,E as InjectionSchemaField,i as LOW_CODE_VALUE_RELATION,c as NESTED_FORM_ITEM_TYPE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function
|
|
1
|
+
import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function d(d){const{createValidatorSchema:u}=l(),x=e=>{var t;const n={name:e.val_key,type:null!=(t=e.fieldType)?t:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable"};e.reactions&&(n["x-reactions"]=e.reactions),e.noDecorator||Object.assign(n,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:o(e,["reactions"]),span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const r=u(e);return r&&(n["x-validator"]=r),"0"===e.is_null&&(n.required=!0),n},f=e=>{const o=x(e);e.urlConfig?function(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig"])})}(o,e):e.autograph&&m(o,e);const t="0"===e.multi_select;return Object.assign(o["x-component-props"],{multiple:t,options:e.option,maxTagCount:r(e.multi_select_value),...n(e,["lazyRequest","requestCache"])}),t&&(o.type="array"),o},_=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,vertical:e.__vertical}),m(o,e),o},h=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},g=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),y=new Map([["LINEBAR",g],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n}=e;return Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",f],["REMOTE_SEARCH",f],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,getProperties:()=>e.children||[]}),o}],["RADIO",_],["CHECKBOX",_],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&i("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?C(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),b=e=>{if(e.suffixConfig)return v(e);return(y.get(e.html_type)||h)(e)},v=o=>{if(!o.suffixConfig)return b(o);const t=e(o.suffixConfig),n=[{...o,is_show:"1",hide_title:"1",suffixConfig:void 0}].concat(t.map((e=>({...e,hide_title:"1",is_show:"1"})))),r=x(o);return Object.assign(r,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:2*(o.elem_width||3)},"x-decorator-props":{...r["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:C(n)}),r},{FieldNormalizeWaterfallHook:O}=s();function C(o){let n=null;return o.reduce(((e,o,s)=>{var a;const p=null==(a=(o=O.call(t(o))).validate)?void 0:a.obj_type;return p&&d.collect(p,t(o)),"LINEBAR"===o.html_type?(e[i(o)]=r(g(o),s),n=e[i(o)].properties={}):n?n[i(o)]=r(b(o),s):(n=null,e[i(o)]=r(b(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function i(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:C}}export{d as useFieldListAdaptor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as n}from"@vue/shared";import{isArray as i,isFunction as s}from"lodash-es";import{nextTick as m}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as a,NESTED_FORM_ITEM_TYPE as
|
|
1
|
+
import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as n}from"@vue/shared";import{isArray as i,isFunction as s}from"lodash-es";import{nextTick as m}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as a,NESTED_FORM_ITEM_TYPE as l}from"../constants/index.js";import{useComplexOptionsKey as u}from"./useComplexOptions.js";import{queryDecorator as f,queryInput as d,findNextWidget as c}from"../utils/dom.js";import{validateMessageParser as p,combineExtendKey as g,splitExtendKey as v}from"../utils/index.js";import{getParentLinebar as y}from"../utils/schema.js";function h({formModel:t,formRenderRef:s,formUUID:l,getFieldList:c,formItemDepsCollector:h}){const{combineComplexOptionKey:x}=u();return{validate(r="*"){return t.validate(r).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(o,[]):e)));function o(t,r){if(!n(r))return t;let o=!1;return i(r.messages)&&r.messages.forEach((r=>{n(r)&&(t.push(...e(r).map(m)),o=!0)})),!o&&t.push(m(r)),t}function m(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),i=e.messages.map((e=>function(e,t){var r;return t&&n(t.fieldItem)?p(null!=(r=t.fieldItem.defined_error_msg)?r:e,t.fieldItem):e}(e,r.get("decoratorProps")))),m=f(e.path,s.value,l);return{...e,messages:i,title:o,decoratorElement:m,...d(e.decoratorElement)}}},getFormValues(e=!0,r=!0){let o=t.getFormState().values;return e&&(o=g(c(),o)),r&&(o=x(c(),o)),o},setFormValues(e,n=!0){n&&(e=v(c(),e)),t.setFieldState("*",(t=>{r(t)&&(t.value=o.getIn(e,t.path))}))},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>s.value?await async function(e,t,r){if(!s.value)return i();const o=f(e,t,l);if(o)return i(o);const n=y(e,r);return n?(h.trigger(a+n,!0),await m(),i(f(e,t,l))):i();function i(e){return{decoratorElement:e,...d(e)}}}(e,s.value,c()):null}}function x({props:e,formRenderRef:r,formModel:o}){return{onKeydown:function n(i){var m;if(!e.enterToNextWidget||!r.value)return;const a=t(i.target,(e=>e.classList.contains("form-render__formItem")));if(!a)return;const u=`.form-render__formItem${l.map((e=>`:not([widget-type=${e}])`)).join("")}`,f=Array.from(r.value.querySelectorAll(u)),d=f.findIndex((e=>e.id===a.id));if(!~d)return;const{widget:p,field:g}=c(f,d,i.target);if(!p)return;const v=g&&o.query(g).take();v&&s(e.enterToNextWidget)&&(e.enterToNextWidget(null==(m=v.decoratorProps)?void 0:m.fieldItem)?null==p||p.focus():n({target:p}))}}}export{x as useFormDomEvent,h as useFormExposeEvent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{observable as r}from"@formily/reactive";function e(){const e=r.shallow({});return{setGraph:function(r){e[r.address.toString()]=r},removeGraph:function(r){Reflect.deleteProperty(e,r.address.toString())},observeFormGraph:e}}export{e as useFormGraph};
|