cnhis-design-vue 3.1.33-beta.1 → 3.1.33-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 -123
- package/es/components/big-table/src/components/edit-form/edit-time.js +2 -1
- package/es/components/form-render/src/FormRender.vue.js +1 -0
- package/es/components/form-render/src/FormRenderWrapper.vue.js +5 -1
- package/es/components/form-render/src/components/renderer/radio.js +10 -3
- package/es/components/form-render/src/types/index.d.ts +2 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +8 -22
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +9 -22
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +11 -24
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +8 -16
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +10 -16
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +10 -23
- package/es/components/iho-table/src/utils/index.d.ts +10 -0
- package/es/components/iho-table/src/utils/index.js +34 -7
- package/es/components/index.css +1 -1
- package/es/components/info-header/index.d.ts +2 -0
- package/es/components/info-header/src/InfoHeader.vue.d.ts +2 -0
- package/es/components/info-header/src/InfoHeader.vue.js +59 -47
- package/es/components/info-header/style/index.css +1 -1
- package/es/shared/assets/img/failure.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/icon-asc.js +1 -1
- package/es/shared/assets/img/icon-desc.js +1 -1
- package/es/shared/assets/img/no-permission.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/video.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/video_hover.js +1 -1
- package/es/shared/assets/img/video_play_hover.js +1 -1
- package/es/shared/assets/img/xb_big.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- 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,123 +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
|
-
```
|
|
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
|
+
```
|
|
@@ -38,6 +38,7 @@ var EditTime = defineComponent({
|
|
|
38
38
|
} = useCommon(props, attrs);
|
|
39
39
|
const __value = ref(attrs.formattedValue);
|
|
40
40
|
const onConfirm = (value) => {
|
|
41
|
+
__value.value = value;
|
|
41
42
|
emit("formChange", {
|
|
42
43
|
value,
|
|
43
44
|
row: props.row,
|
|
@@ -58,7 +59,7 @@ var EditTime = defineComponent({
|
|
|
58
59
|
const strInsert = (str2, length) => {
|
|
59
60
|
const reg = new RegExp("\\w{1," + length + "}", "g");
|
|
60
61
|
const ma = str2.match(reg);
|
|
61
|
-
return ma.join(":");
|
|
62
|
+
return ma == null ? void 0 : ma.join(":");
|
|
62
63
|
};
|
|
63
64
|
const result = valueFormat.includes(":") ? strInsert(str, 2) : str;
|
|
64
65
|
return result;
|
|
@@ -146,6 +146,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
expose({
|
|
149
|
+
formModel,
|
|
149
150
|
validate(path = "*") {
|
|
150
151
|
return formModel.validate(path).catch((err) => {
|
|
151
152
|
return Promise.reject(Array.isArray(err) ? err.reduce(errInfoNormalize, []) : err);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createBlock, nextTick } from 'vue';
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createBlock, nextTick } from 'vue';
|
|
2
2
|
import FormRender from './FormRender.vue.js';
|
|
3
3
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
4
4
|
|
|
@@ -29,6 +29,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
29
|
}, {});
|
|
30
30
|
expose({
|
|
31
31
|
...exposed,
|
|
32
|
+
formModel: computed(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
return (_a = formRenderRef.value) == null ? void 0 : _a.formModel;
|
|
35
|
+
}),
|
|
32
36
|
reload
|
|
33
37
|
});
|
|
34
38
|
return (_ctx, _cache) => {
|
|
@@ -4,8 +4,9 @@ import { isNumber } from 'lodash-es';
|
|
|
4
4
|
import { NRadioGroup, NSpace, NRadio } from 'naive-ui';
|
|
5
5
|
import '../../../index.js';
|
|
6
6
|
import '../../utils/index.js';
|
|
7
|
+
import { useFormField } from '../../hooks/useFormField.js';
|
|
7
8
|
import { useAutographOptions } from '../../hooks/useFormRenderOptions.js';
|
|
8
|
-
import { assignUpdateValue } from '../../utils/schema.js';
|
|
9
|
+
import { visitedDecorator, assignUpdateValue } from '../../utils/schema.js';
|
|
9
10
|
import { useCommonInjection } from '../../hooks/useCommonInjection.js';
|
|
10
11
|
|
|
11
12
|
function _isSlot(s) {
|
|
@@ -57,21 +58,27 @@ const script = defineComponent({
|
|
|
57
58
|
emit("update:value", v);
|
|
58
59
|
}
|
|
59
60
|
});
|
|
61
|
+
const {
|
|
62
|
+
field
|
|
63
|
+
} = useFormField();
|
|
60
64
|
const {
|
|
61
65
|
labelKey,
|
|
62
66
|
valueKey,
|
|
63
67
|
options
|
|
64
68
|
} = useAutographOptions(props, valueRef);
|
|
65
69
|
const {
|
|
66
|
-
injectValueBindKey
|
|
70
|
+
injectValueBindKey,
|
|
71
|
+
injectValueValidate
|
|
67
72
|
} = useCommonInjection();
|
|
73
|
+
injectValueValidate(valueRef);
|
|
68
74
|
const key = injectValueBindKey(valueRef);
|
|
69
75
|
return () => {
|
|
70
76
|
let _slot;
|
|
71
77
|
return createVNode(NRadioGroup, {
|
|
72
78
|
"key": key.value,
|
|
73
79
|
"value": valueRef.value,
|
|
74
|
-
"onUpdate:value": ($event) => valueRef.value = $event
|
|
80
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
81
|
+
"onClick": visitedDecorator(field)
|
|
75
82
|
}, {
|
|
76
83
|
default: () => [createVNode(NSpace, {
|
|
77
84
|
"vertical": props.vertical
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyObject, UndefinedAble } from '../../../../../es/shared/types';
|
|
2
|
-
import { DataField, Field } from '@formily/core';
|
|
2
|
+
import { DataField, Field, Form } from '@formily/core';
|
|
3
3
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
4
4
|
import { Component, FunctionalComponent } from 'vue';
|
|
5
5
|
import { FIELD_BUSINESS_TYPE } from '../../../../../es/components/form-render/src/constants';
|
|
@@ -26,6 +26,7 @@ export declare type FormAsyncQueue = AsyncQueue<FormAsyncQueueItem, any, AnyObje
|
|
|
26
26
|
export declare type AgeContext = Record<'age' | 'day' | 'month' | 'year' | 'hours', number>;
|
|
27
27
|
export declare type IdCardParseInfo = Record<'sex' | 'birthday', string> & AgeContext;
|
|
28
28
|
export declare type FormRenderExpose = {
|
|
29
|
+
formModel: Form;
|
|
29
30
|
validate(path?: string): Promise<unknown>;
|
|
30
31
|
getFormValues(needCombineExtendKey?: boolean): AnyObject;
|
|
31
32
|
setFormValues(values: AnyObject, needSplitExtendKey?: boolean): AnyObject;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createVNode, mergeProps } from 'vue';
|
|
2
2
|
import '../../../../../index.js';
|
|
3
3
|
import { EDITABLE_WIDGET_TYPE } from '../../../../constants/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { IhoTableRenderHelper } from '../../../../utils/index.js';
|
|
5
5
|
import EditDate from './editDate.vue.js';
|
|
6
6
|
import { defineTablePlugin } from '../../../../hooks/useTablePlugin.js';
|
|
7
7
|
|
|
@@ -11,38 +11,24 @@ function dateRendererPlugin() {
|
|
|
11
11
|
name: pluginName,
|
|
12
12
|
vxe(instance) {
|
|
13
13
|
instance.renderer.add(EDITABLE_WIDGET_TYPE.DATE, {
|
|
14
|
-
renderCell(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
column
|
|
19
|
-
}) {
|
|
20
|
-
return [createVNode("span", null, [row[column.field]])];
|
|
21
|
-
},
|
|
22
|
-
renderEdit({
|
|
23
|
-
props
|
|
24
|
-
}, {
|
|
14
|
+
renderCell: IhoTableRenderHelper.createDefaultRenderCell(),
|
|
15
|
+
renderEdit: IhoTableRenderHelper.createRenderEdit(({
|
|
16
|
+
fieldItem,
|
|
17
|
+
emitFormClick,
|
|
25
18
|
row,
|
|
26
19
|
column,
|
|
27
20
|
$rowIndex
|
|
28
|
-
}) {
|
|
29
|
-
const {
|
|
30
|
-
emitFormClick
|
|
31
|
-
} = useIhoTableFormEvent({
|
|
32
|
-
row,
|
|
33
|
-
column,
|
|
34
|
-
$rowIndex
|
|
35
|
-
});
|
|
21
|
+
}) => {
|
|
36
22
|
return [createVNode(EditDate, mergeProps({
|
|
37
23
|
"value": row[column.field],
|
|
38
24
|
"onUpdate:value": ($event) => row[column.field] = $event
|
|
39
|
-
},
|
|
25
|
+
}, fieldItem.componentProps, {
|
|
40
26
|
"column": column,
|
|
41
27
|
"row": row,
|
|
42
28
|
"index": $rowIndex,
|
|
43
29
|
"onClick": emitFormClick
|
|
44
30
|
}), null)];
|
|
45
|
-
}
|
|
31
|
+
})
|
|
46
32
|
});
|
|
47
33
|
}
|
|
48
34
|
});
|
package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createVNode, mergeProps } from 'vue';
|
|
|
2
2
|
import { NInput } from 'naive-ui';
|
|
3
3
|
import '../../../../index.js';
|
|
4
4
|
import { EDITABLE_WIDGET_TYPE } from '../../../constants/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { IhoTableRenderHelper } from '../../../utils/index.js';
|
|
6
6
|
import { defineTablePlugin } from '../../../hooks/useTablePlugin.js';
|
|
7
7
|
|
|
8
8
|
function inputRendererPlugin() {
|
|
@@ -11,34 +11,21 @@ function inputRendererPlugin() {
|
|
|
11
11
|
name: pluginName,
|
|
12
12
|
vxe(instance) {
|
|
13
13
|
instance.renderer.add(EDITABLE_WIDGET_TYPE.INPUT, {
|
|
14
|
-
renderCell(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) {
|
|
18
|
-
return [createVNode("span", null, [row[column.field]])];
|
|
19
|
-
},
|
|
20
|
-
renderEdit({
|
|
21
|
-
props
|
|
22
|
-
}, {
|
|
14
|
+
renderCell: IhoTableRenderHelper.createDefaultRenderCell(),
|
|
15
|
+
renderEdit: IhoTableRenderHelper.createRenderEdit(({
|
|
16
|
+
fieldItem,
|
|
23
17
|
row,
|
|
24
18
|
column,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
emitFormClick,
|
|
29
|
-
emitFormChange
|
|
30
|
-
} = useIhoTableFormEvent({
|
|
31
|
-
row,
|
|
32
|
-
column,
|
|
33
|
-
$rowIndex
|
|
34
|
-
});
|
|
19
|
+
emitFormChange,
|
|
20
|
+
emitFormClick
|
|
21
|
+
}) => {
|
|
35
22
|
return [createVNode(NInput, mergeProps({
|
|
36
23
|
"value": row[column.field],
|
|
37
24
|
"onUpdate:value": ($event) => row[column.field] = $event,
|
|
38
25
|
"onBlur": emitFormChange,
|
|
39
26
|
"onClick": emitFormClick
|
|
40
|
-
},
|
|
41
|
-
}
|
|
27
|
+
}, fieldItem.componentProps), null)];
|
|
28
|
+
})
|
|
42
29
|
});
|
|
43
30
|
}
|
|
44
31
|
});
|
package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createVNode, mergeProps } from 'vue';
|
|
|
2
2
|
import { NInputNumber } from 'naive-ui';
|
|
3
3
|
import '../../../../index.js';
|
|
4
4
|
import { EDITABLE_WIDGET_TYPE } from '../../../constants/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { IhoTableRenderHelper } from '../../../utils/index.js';
|
|
6
6
|
import { defineTablePlugin } from '../../../hooks/useTablePlugin.js';
|
|
7
7
|
|
|
8
8
|
function numberRendererPlugin() {
|
|
@@ -11,33 +11,20 @@ function numberRendererPlugin() {
|
|
|
11
11
|
name: pluginName,
|
|
12
12
|
vxe(instance) {
|
|
13
13
|
instance.renderer.add(EDITABLE_WIDGET_TYPE.NUMBER, {
|
|
14
|
-
renderCell(
|
|
15
|
-
|
|
16
|
-
column
|
|
17
|
-
}) {
|
|
18
|
-
return [createVNode("span", null, [row[column.field]])];
|
|
19
|
-
},
|
|
20
|
-
renderEdit({
|
|
21
|
-
props
|
|
22
|
-
}, {
|
|
14
|
+
renderCell: IhoTableRenderHelper.createDefaultRenderCell(),
|
|
15
|
+
renderEdit: IhoTableRenderHelper.createRenderEdit(({
|
|
23
16
|
row,
|
|
24
17
|
column,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
createCustomEvent
|
|
31
|
-
} = useIhoTableFormEvent({
|
|
32
|
-
row,
|
|
33
|
-
column,
|
|
34
|
-
$rowIndex
|
|
35
|
-
});
|
|
18
|
+
fieldItem,
|
|
19
|
+
emitFormClick,
|
|
20
|
+
emitFormChange,
|
|
21
|
+
createCustomEvent
|
|
22
|
+
}) => {
|
|
36
23
|
const {
|
|
37
24
|
placeholder = "\u8BF7\u8F93\u5165"
|
|
38
|
-
} =
|
|
25
|
+
} = fieldItem.componentProps || {};
|
|
39
26
|
const config = {
|
|
40
|
-
...
|
|
27
|
+
...fieldItem.componentProps || {},
|
|
41
28
|
clearable: true,
|
|
42
29
|
placeholder,
|
|
43
30
|
onBlur: createCustomEvent("formChange", {
|
|
@@ -50,7 +37,7 @@ function numberRendererPlugin() {
|
|
|
50
37
|
"value": row[column.field],
|
|
51
38
|
"onUpdate:value": ($event) => row[column.field] = $event
|
|
52
39
|
}, config), null)];
|
|
53
|
-
}
|
|
40
|
+
})
|
|
54
41
|
});
|
|
55
42
|
}
|
|
56
43
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createVNode, mergeProps } from 'vue';
|
|
2
2
|
import '../../../../../index.js';
|
|
3
3
|
import { EDITABLE_WIDGET_TYPE } from '../../../../constants/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { IhoTableRenderHelper } from '../../../../utils/index.js';
|
|
5
5
|
import EditSelect from './editSelect.js';
|
|
6
6
|
import { getDefaultValue } from './selectUtils.js';
|
|
7
7
|
import { defineTablePlugin } from '../../../../hooks/useTablePlugin.js';
|
|
@@ -15,26 +15,18 @@ function selectRendererPlugin() {
|
|
|
15
15
|
renderCell({
|
|
16
16
|
props
|
|
17
17
|
}, {
|
|
18
|
-
row
|
|
19
|
-
column
|
|
18
|
+
row
|
|
20
19
|
}) {
|
|
21
20
|
return [createVNode("span", null, [getDefaultValue(row, props)])];
|
|
22
21
|
},
|
|
23
|
-
renderEdit({
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
renderEdit: IhoTableRenderHelper.createRenderEdit(({
|
|
23
|
+
fieldItem,
|
|
24
|
+
emitFormClick,
|
|
26
25
|
row,
|
|
27
26
|
column,
|
|
28
27
|
$rowIndex
|
|
29
|
-
}) {
|
|
30
|
-
|
|
31
|
-
emitFormClick
|
|
32
|
-
} = useIhoTableFormEvent({
|
|
33
|
-
row,
|
|
34
|
-
column,
|
|
35
|
-
$rowIndex
|
|
36
|
-
});
|
|
37
|
-
return [createVNode(EditSelect, mergeProps((props == null ? void 0 : props.componentProps) || {}, {
|
|
28
|
+
}) => {
|
|
29
|
+
return [createVNode(EditSelect, mergeProps(fieldItem.componentProps, {
|
|
38
30
|
"column": column,
|
|
39
31
|
"row": row,
|
|
40
32
|
"index": $rowIndex,
|
|
@@ -42,7 +34,7 @@ function selectRendererPlugin() {
|
|
|
42
34
|
"onUpdate:value": ($event) => row[column.field] = $event,
|
|
43
35
|
"onClick": emitFormClick
|
|
44
36
|
}), null)];
|
|
45
|
-
}
|
|
37
|
+
})
|
|
46
38
|
});
|
|
47
39
|
}
|
|
48
40
|
});
|
|
@@ -3,7 +3,7 @@ import { traverse } from '../../../../../../../shared/utils/index.js';
|
|
|
3
3
|
import { isFunction, isObject } from 'lodash-es';
|
|
4
4
|
import '../../../../../index.js';
|
|
5
5
|
import { EDITABLE_WIDGET_TYPE, InjectionIhoTableUUID } from '../../../../constants/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { IhoTableRenderHelper, getRowHeight, getColumnRenderWidth } from '../../../../utils/index.js';
|
|
7
7
|
import { isSeparateColumn, contentSeparate, getColumnInfoMaxLength, generateSeparateRowData } from './separateUtils.js';
|
|
8
8
|
import EditSeparate from './editSeparate.vue.js';
|
|
9
9
|
import { defineTablePlugin } from '../../../../hooks/useTablePlugin.js';
|
|
@@ -35,27 +35,21 @@ function separateRendererPlugins() {
|
|
|
35
35
|
};
|
|
36
36
|
return createVNode("section", null, [separateRow.separateData[column.field]]);
|
|
37
37
|
},
|
|
38
|
-
renderEdit(
|
|
38
|
+
renderEdit: IhoTableRenderHelper.createRenderEdit(({
|
|
39
|
+
fieldItem,
|
|
39
40
|
column,
|
|
40
41
|
row,
|
|
41
|
-
|
|
42
|
-
}) {
|
|
43
|
-
var _a
|
|
42
|
+
emitFormClick
|
|
43
|
+
}) => {
|
|
44
|
+
var _a;
|
|
44
45
|
const uuid = inject(InjectionIhoTableUUID);
|
|
45
46
|
const separateRow = getSeparateRowData(uuid, row);
|
|
46
47
|
const height = getRowHeight();
|
|
47
48
|
const slots = {};
|
|
48
|
-
if (
|
|
49
|
-
const separate = toRaw(
|
|
49
|
+
if (fieldItem.separateSlot) {
|
|
50
|
+
const separate = toRaw(fieldItem.separateSlot);
|
|
50
51
|
slots.menu = isFunction(separate) ? separate : isObject(separate) ? (props) => h(separate, props) : void 0;
|
|
51
52
|
}
|
|
52
|
-
const {
|
|
53
|
-
emitFormClick
|
|
54
|
-
} = useIhoTableFormEvent({
|
|
55
|
-
row,
|
|
56
|
-
column,
|
|
57
|
-
$rowIndex
|
|
58
|
-
});
|
|
59
53
|
return [createVNode(EditSeparate, {
|
|
60
54
|
"value": row[column.field],
|
|
61
55
|
"onUpdate:value": ($event) => row[column.field] = $event,
|
|
@@ -63,10 +57,10 @@ function separateRendererPlugins() {
|
|
|
63
57
|
"height": height,
|
|
64
58
|
"column": column,
|
|
65
59
|
"row": row,
|
|
66
|
-
"displayContent": (
|
|
60
|
+
"displayContent": (_a = separateRow == null ? void 0 : separateRow.separateData) == null ? void 0 : _a[column.field],
|
|
67
61
|
"onClick": emitFormClick
|
|
68
62
|
}, slots)];
|
|
69
|
-
}
|
|
63
|
+
})
|
|
70
64
|
});
|
|
71
65
|
},
|
|
72
66
|
apply(hooks) {
|