cnhis-design-vue 3.1.19-beta.1 → 3.1.19-beta.3
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 +123 -0
- package/es/components/big-table/index.d.ts +1 -1
- package/es/components/big-table/src/BigTable.vue.d.ts +1 -1
- package/es/components/big-table/src/components/edit-form/edit-date.js +2 -1
- package/es/components/big-table/src/hooks/useEvent2.js +18 -24
- package/es/components/button-print/index.d.ts +1 -1
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +1 -1
- package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +1 -1
- package/es/components/button-print/src/utils/print2.js +1 -1
- package/es/components/drag-layout/index.d.ts +1 -1
- package/es/components/drag-layout/src/DragLayout.vue.d.ts +1 -1
- package/es/components/form-config/index.d.ts +2 -2
- package/es/components/form-config/src/FormConfig.vue.d.ts +2 -2
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +1 -1
- package/es/components/form-render/index.d.ts +1 -1
- package/es/components/form-render/src/FormRender.vue.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/cascader.d.ts +9 -2
- package/es/components/form-render/src/components/renderer/cascader.js +38 -5
- package/es/components/form-render/src/components/renderer/inputGroup.d.ts +1 -1
- package/es/components/form-table/index.d.ts +1 -1
- package/es/components/form-table/src/FormTable.vue.d.ts +1 -1
- package/es/components/form-table/src/components/index.d.ts +1 -1
- package/es/components/form-table/src/components/table-age.vue.d.ts +1 -1
- package/es/components/grid/src/hooks2.js +1 -0
- package/es/components/index.css +1 -1
- package/es/components/info-header/index.d.ts +1 -1
- package/es/components/info-header/src/InfoHeader.vue.d.ts +1 -1
- package/es/components/scale-view/index.d.ts +1 -1
- package/es/components/scale-view/src/ScaleView.vue.d.ts +1 -1
- package/es/components/scale-view/src/hooks/use-component.d.ts +2 -2
- package/es/components/select-label/index.d.ts +4 -4
- package/es/components/select-label/src/LabelFormContent.vue.d.ts +2 -2
- package/es/components/select-label/src/SelectLabel.vue.d.ts +2 -2
- package/es/components/select-person/index.d.ts +1 -1
- package/es/components/select-person/src/SelectPerson.vue.d.ts +1 -1
- package/es/components/shortcut-setter/index.d.ts +1 -1
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
- package/es/components/steps-wheel/index.d.ts +17 -0
- package/es/components/steps-wheel/src/StepsWheel.js +133 -97
- package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +17 -0
- package/es/components/steps-wheel/style/index.css +1 -1
- package/es/components/time-line/index.d.ts +1 -1
- package/es/components/time-line/src/TimeLine.vue.d.ts +1 -1
- package/package.json +6 -5
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
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. 注意
|
|
65
|
+
|
|
66
|
+
由于 vxe-table 目前的引入方式是由组件 install 触发的,所以如果需要使用 c-grid/c-big-table 组件,需要全局注册二者任意一个
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// main.ts
|
|
70
|
+
import { createApp } from 'vue';
|
|
71
|
+
import App from './App.vue';
|
|
72
|
+
|
|
73
|
+
import { CGrid } from 'cnhis-design-vue';
|
|
74
|
+
// 或者
|
|
75
|
+
import { CBigTable } from 'cnhis-design-vue';
|
|
76
|
+
|
|
77
|
+
const app = createApp(App);
|
|
78
|
+
app.use(CGrid);
|
|
79
|
+
// 或者
|
|
80
|
+
app.use(CBigTable);
|
|
81
|
+
app.mount('#app');
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 4.FAQ
|
|
85
|
+
|
|
86
|
+
### 4.1 项目打包后样式丢失
|
|
87
|
+
|
|
88
|
+
> 处理方法, 将 cnhis-design-vue 从 vendor 包中移除
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// vite.config.ts
|
|
92
|
+
import { defineConfig } from 'vite';
|
|
93
|
+
|
|
94
|
+
export default defineConfig({
|
|
95
|
+
rollupOptions: {
|
|
96
|
+
// ..otherOptions
|
|
97
|
+
output: {
|
|
98
|
+
dir: './dist',
|
|
99
|
+
manualChunks(id: string) {
|
|
100
|
+
if (id.includes('node_modules') && !id.includes('cnhis-design-vue')) {
|
|
101
|
+
return 'vendor';
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 4.2 找不到文件
|
|
110
|
+
|
|
111
|
+
> 由于组件库输出文件类型由 js 修改成了 mjs, 如果配置了 resolve 属性的项目, 需要将 mjs 文件类型添加至 extensions 中
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
// vite.config.ts
|
|
115
|
+
const config = {
|
|
116
|
+
// ...otherOptions
|
|
117
|
+
resolve: {
|
|
118
|
+
// ...otherOptions
|
|
119
|
+
// 如果没有配置, 则不用考虑
|
|
120
|
+
extensions: ['.js', '.ts', '.vue', '.json', '.mjs']
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
```
|
|
@@ -883,7 +883,7 @@ declare const BigTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
883
883
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
884
884
|
class: import("vue").Ref<string | undefined>;
|
|
885
885
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
886
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
886
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
887
887
|
readonly tab: import("vue").PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
888
888
|
[key: string]: any;
|
|
889
889
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -881,7 +881,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
881
881
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
882
882
|
class: import("vue").Ref<string | undefined>;
|
|
883
883
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
884
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
884
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
885
885
|
readonly tab: import("vue").PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
886
886
|
[key: string]: any;
|
|
887
887
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -108,7 +108,8 @@ var EditDate = defineComponent({
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
const formatConfig = computed(() => {
|
|
111
|
-
|
|
111
|
+
var _a;
|
|
112
|
+
const valueFormat = ((_a = props.col.componentProps) == null ? void 0 : _a.valueFormat) || props.col.valueFormat || "yyyy-MM-dd HH:mm:ss";
|
|
112
113
|
return {
|
|
113
114
|
valueFormat,
|
|
114
115
|
format: valueFormat,
|
|
@@ -16,14 +16,20 @@ const useEvent = (props, state, emit, xGrid, anchorEvent) => {
|
|
|
16
16
|
let activeIndex = index || 0;
|
|
17
17
|
if (!activeRow && !isEdit)
|
|
18
18
|
return;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
if (isEdit) {
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
const { row, column, $rowIndex } = xGridRef.getSelectedCell() || {};
|
|
22
|
+
row && emit("keyboard", {
|
|
23
|
+
key: $event.key,
|
|
24
|
+
index: $rowIndex,
|
|
25
|
+
row,
|
|
26
|
+
column
|
|
27
|
+
});
|
|
28
|
+
["Tab", "Enter"].includes($event.key) && xGridRef.setEditCell(row, column);
|
|
24
29
|
});
|
|
30
|
+
return;
|
|
25
31
|
}
|
|
26
|
-
if (isArrow &&
|
|
32
|
+
if (isArrow && ["ArrowUp", "ArrowDown"].includes($event.key)) {
|
|
27
33
|
if ($event.key === "ArrowUp" && index > 0) {
|
|
28
34
|
activeIndex = index - 1;
|
|
29
35
|
}
|
|
@@ -33,32 +39,20 @@ const useEvent = (props, state, emit, xGrid, anchorEvent) => {
|
|
|
33
39
|
const row = xGridRef.getData(activeIndex);
|
|
34
40
|
xGridRef.scrollToRow(row);
|
|
35
41
|
xGridRef.setCurrentRow(row);
|
|
36
|
-
emitKeyBoard();
|
|
37
|
-
return;
|
|
38
42
|
}
|
|
39
43
|
if (isChecked && $event.key === " ") {
|
|
40
44
|
$event.preventDefault();
|
|
41
45
|
xGridRef.scrollToRow(activeRow);
|
|
42
46
|
xGridRef.setCheckboxRow(activeRow, true);
|
|
43
|
-
emitKeyBoard();
|
|
44
|
-
return;
|
|
45
47
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
index: $rowIndex,
|
|
53
|
-
row,
|
|
54
|
-
column
|
|
55
|
-
});
|
|
56
|
-
xGridRef.scrollToRow(row);
|
|
57
|
-
xGridRef.setEditCell(row, column);
|
|
48
|
+
emitKeyBoard();
|
|
49
|
+
function emitKeyBoard() {
|
|
50
|
+
emit("keyboard", {
|
|
51
|
+
key: $event.key,
|
|
52
|
+
index: activeIndex,
|
|
53
|
+
row: xGridRef.getCurrentRecord()
|
|
58
54
|
});
|
|
59
|
-
return;
|
|
60
55
|
}
|
|
61
|
-
emitKeyBoard();
|
|
62
56
|
}
|
|
63
57
|
let scrollEvent = (params) => {
|
|
64
58
|
emit("scroll", params);
|
|
@@ -383,7 +383,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
383
383
|
key: string;
|
|
384
384
|
render: () => import("vue").VNodeChild;
|
|
385
385
|
}[]>;
|
|
386
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
386
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
387
387
|
readonly label: StringConstructor;
|
|
388
388
|
readonly labelWidth: import("vue").PropType<string | number>;
|
|
389
389
|
readonly labelStyle: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
@@ -387,7 +387,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
387
387
|
key: string;
|
|
388
388
|
render: () => import("vue").VNodeChild;
|
|
389
389
|
}[]>;
|
|
390
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
390
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
391
391
|
readonly label: StringConstructor;
|
|
392
392
|
readonly labelWidth: import("vue").PropType<string | number>;
|
|
393
393
|
readonly labelStyle: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
@@ -210,7 +210,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
210
210
|
key: string;
|
|
211
211
|
render: () => import("vue").VNodeChild;
|
|
212
212
|
}[]>;
|
|
213
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
213
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
214
214
|
readonly label: StringConstructor;
|
|
215
215
|
readonly labelWidth: import("vue").PropType<string | number>;
|
|
216
216
|
readonly labelStyle: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
@@ -259,7 +259,7 @@ class Print {
|
|
|
259
259
|
}
|
|
260
260
|
_downloadPDF(inputData) {
|
|
261
261
|
if (this.webview) {
|
|
262
|
-
return this.postMessage({ exec: "pdf", data: { inputData } });
|
|
262
|
+
return this.postMessage({ exec: "pdf", data: { file: inputData } });
|
|
263
263
|
}
|
|
264
264
|
return httpFn.get(PDF_URL, { params: { inputData } }).then(({ data }) => data);
|
|
265
265
|
}
|
|
@@ -205,7 +205,7 @@ declare const DragLayout: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
205
205
|
} | null>;
|
|
206
206
|
validate: import("naive-ui/es/form/src/interface").FormItemValidate;
|
|
207
207
|
restoreValidation: () => void;
|
|
208
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
208
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
209
209
|
readonly label: StringConstructor;
|
|
210
210
|
readonly labelWidth: import("vue").PropType<string | number>;
|
|
211
211
|
readonly labelStyle: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
@@ -205,7 +205,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
205
205
|
} | null>;
|
|
206
206
|
validate: import("naive-ui/es/form/src/interface").FormItemValidate;
|
|
207
207
|
restoreValidation: () => void;
|
|
208
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
208
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
209
209
|
readonly label: StringConstructor;
|
|
210
210
|
readonly labelWidth: import("vue").PropType<string | number>;
|
|
211
211
|
readonly labelStyle: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
@@ -609,7 +609,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
609
609
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
610
610
|
class: import("vue").Ref<string | undefined>;
|
|
611
611
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
612
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
612
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
613
613
|
readonly tab: import("vue").PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
614
614
|
[key: string]: any;
|
|
615
615
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -3022,7 +3022,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3022
3022
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
3023
3023
|
class: import("vue").Ref<string | undefined>;
|
|
3024
3024
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
3025
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
3025
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
3026
3026
|
readonly tab: import("vue").PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3027
3027
|
[key: string]: any;
|
|
3028
3028
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -611,7 +611,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
611
611
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
612
612
|
class: import("vue").Ref<string | undefined>;
|
|
613
613
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
614
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
614
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
615
615
|
readonly tab: PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
616
616
|
[key: string]: any;
|
|
617
617
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -3024,7 +3024,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3024
3024
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
3025
3025
|
class: import("vue").Ref<string | undefined>;
|
|
3026
3026
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
3027
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
3027
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
3028
3028
|
readonly tab: PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3029
3029
|
[key: string]: any;
|
|
3030
3030
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -471,7 +471,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
471
471
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
472
472
|
class: import("vue").Ref<string | undefined>;
|
|
473
473
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
474
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
474
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
475
475
|
readonly tab: import("vue").PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
476
476
|
[key: string]: any;
|
|
477
477
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -2151,7 +2151,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
2151
2151
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
2152
2152
|
class: import("vue").Ref<string | undefined>;
|
|
2153
2153
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
2154
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
2154
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
2155
2155
|
readonly tab: import("vue").PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
2156
2156
|
[key: string]: any;
|
|
2157
2157
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -457,7 +457,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
457
457
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
458
458
|
class: import("vue").Ref<string | undefined>;
|
|
459
459
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
460
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
460
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
461
461
|
readonly tab: import("vue").PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
462
462
|
[key: string]: any;
|
|
463
463
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -457,7 +457,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
457
457
|
style: import("vue").Ref<string | import("vue").CSSProperties | undefined>;
|
|
458
458
|
class: import("vue").Ref<string | undefined>;
|
|
459
459
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
460
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
460
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
461
461
|
readonly tab: PropType<string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
462
462
|
[key: string]: any;
|
|
463
463
|
}> | (() => import("vue").VNodeChild)>;
|
|
@@ -8,7 +8,6 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
8
8
|
};
|
|
9
9
|
depth: {
|
|
10
10
|
type: (NumberConstructor | StringConstructor)[];
|
|
11
|
-
required: true;
|
|
12
11
|
};
|
|
13
12
|
urlConfig: {
|
|
14
13
|
type: PropType<UrlConfig>;
|
|
@@ -16,6 +15,10 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
16
15
|
onFocus: {
|
|
17
16
|
type: PropType<Func<any[], any>>;
|
|
18
17
|
};
|
|
18
|
+
filterable: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
19
22
|
onChange: {};
|
|
20
23
|
value: {};
|
|
21
24
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -25,7 +28,6 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
25
28
|
};
|
|
26
29
|
depth: {
|
|
27
30
|
type: (NumberConstructor | StringConstructor)[];
|
|
28
|
-
required: true;
|
|
29
31
|
};
|
|
30
32
|
urlConfig: {
|
|
31
33
|
type: PropType<UrlConfig>;
|
|
@@ -33,10 +35,15 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
33
35
|
onFocus: {
|
|
34
36
|
type: PropType<Func<any[], any>>;
|
|
35
37
|
};
|
|
38
|
+
filterable: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: boolean;
|
|
41
|
+
};
|
|
36
42
|
onChange: {};
|
|
37
43
|
value: {};
|
|
38
44
|
}>> & {
|
|
39
45
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
40
46
|
}, {
|
|
41
47
|
options: AnyObject[];
|
|
48
|
+
filterable: boolean;
|
|
42
49
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import { isEqual } from 'lodash-es';
|
|
3
|
+
import { isEqual, isArray } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../hooks/useCommonInjection2.js';
|
|
5
5
|
import { InjectAsyncQueue } from '../../constants/index2.js';
|
|
6
6
|
import '@vueuse/core';
|
|
@@ -48,8 +48,7 @@ const script = defineComponent({
|
|
|
48
48
|
default: () => []
|
|
49
49
|
},
|
|
50
50
|
depth: {
|
|
51
|
-
type: [Number, String]
|
|
52
|
-
required: true
|
|
51
|
+
type: [Number, String]
|
|
53
52
|
},
|
|
54
53
|
urlConfig: {
|
|
55
54
|
type: Object
|
|
@@ -57,6 +56,10 @@ const script = defineComponent({
|
|
|
57
56
|
onFocus: {
|
|
58
57
|
type: Function
|
|
59
58
|
},
|
|
59
|
+
filterable: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
60
63
|
onChange: {},
|
|
61
64
|
value: {}
|
|
62
65
|
},
|
|
@@ -100,7 +103,35 @@ const script = defineComponent({
|
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
103
|
-
|
|
106
|
+
function fetchData(option) {
|
|
107
|
+
return props.filterable ? fetchFullData() : fetchGradeData(option);
|
|
108
|
+
}
|
|
109
|
+
async function fetchFullData() {
|
|
110
|
+
if (!props.urlConfig || remoteOptions.value)
|
|
111
|
+
return;
|
|
112
|
+
const data = await asyncQueue.addAsync({
|
|
113
|
+
...props.urlConfig,
|
|
114
|
+
params: {
|
|
115
|
+
lvlnr: 1 + ""
|
|
116
|
+
},
|
|
117
|
+
key: title.value
|
|
118
|
+
});
|
|
119
|
+
remoteOptions.value = data.map((item) => optionNormalize(item, 0));
|
|
120
|
+
function optionNormalize(data2, depth) {
|
|
121
|
+
const result = {
|
|
122
|
+
[labelKey.value]: data2[labelKey.value],
|
|
123
|
+
[valueKey.value]: data2[valueKey.value],
|
|
124
|
+
depth: depth + 1,
|
|
125
|
+
isLeaf: true
|
|
126
|
+
};
|
|
127
|
+
if (isArray(data2.children)) {
|
|
128
|
+
result.children = data2.children.map((child) => optionNormalize(child, depth + 1));
|
|
129
|
+
result.isLeaf = !data2.children.length;
|
|
130
|
+
}
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function fetchGradeData(option) {
|
|
104
135
|
if (notNeedToFetchData(props, option))
|
|
105
136
|
return;
|
|
106
137
|
const data = await asyncQueue.addAsync(createRequestParams(deepFor(option), configFor(props), title.value, option));
|
|
@@ -184,9 +215,11 @@ const script = defineComponent({
|
|
|
184
215
|
onFocus == null ? void 0 : onFocus(...args);
|
|
185
216
|
};
|
|
186
217
|
}
|
|
218
|
+
const remote = computed(() => !props.filterable);
|
|
187
219
|
return () => {
|
|
188
220
|
return createVNode(NCascader, {
|
|
189
|
-
"remote":
|
|
221
|
+
"remote": remote.value,
|
|
222
|
+
"filterable": props.filterable,
|
|
190
223
|
"checkStrategy": "child",
|
|
191
224
|
"show": !!show.value,
|
|
192
225
|
"onUpdate:show": updateShow,
|
|
@@ -4,7 +4,7 @@ export declare const INPUT_GROUP: import("vue").DefineComponent<{
|
|
|
4
4
|
[x: symbol]: never;
|
|
5
5
|
}, {
|
|
6
6
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
7
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
7
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
8
|
[x: string]: never;
|
|
9
9
|
[x: number]: never;
|
|
10
10
|
[x: symbol]: never;
|
|
@@ -217,7 +217,7 @@ declare const FormTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
217
217
|
[x: symbol]: never;
|
|
218
218
|
}, {
|
|
219
219
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
220
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
220
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
221
221
|
[x: string]: never;
|
|
222
222
|
[x: number]: never;
|
|
223
223
|
[x: symbol]: never;
|
|
@@ -217,7 +217,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
217
217
|
[x: symbol]: never;
|
|
218
218
|
}, {
|
|
219
219
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
220
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
220
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
221
221
|
[x: string]: never;
|
|
222
222
|
[x: number]: never;
|
|
223
223
|
[x: symbol]: never;
|
|
@@ -170,7 +170,7 @@ export declare function useComponents(): {
|
|
|
170
170
|
[x: symbol]: never;
|
|
171
171
|
}, {
|
|
172
172
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
173
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
173
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
174
174
|
[x: string]: never;
|
|
175
175
|
[x: number]: never;
|
|
176
176
|
[x: symbol]: never;
|
|
@@ -170,7 +170,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
170
170
|
[x: symbol]: never;
|
|
171
171
|
}, {
|
|
172
172
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
173
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
173
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
174
174
|
[x: string]: never;
|
|
175
175
|
[x: number]: never;
|
|
176
176
|
[x: symbol]: never;
|