cnhis-design-vue 3.1.36-beta.7 → 3.1.36-beta.8
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/es/components/form-render/index.js +1 -1
- package/es/components/form-render/src/hooks/useBusinessBinding.js +3 -3
- package/es/components/form-render/src/utils/business.d.ts +1 -1
- package/es/components/form-render/src/utils/business.js +5 -3
- package/es/components/iho-table/src/plugins/index.js +6 -4
- package/es/components/iho-table/src/plugins/rowClickPlugin/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rowClickPlugin/index.js +34 -0
- package/es/components/iho-table/src/utils/index.js +0 -1
- package/es/components/index.js +1 -1
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ export { useCommonInjection, useSelectOptionProps } from './src/hooks/useCommonI
|
|
|
18
18
|
export { useAutographOptions, useRecommendOptions, useUrlConfigOptions } from './src/hooks/useFormRenderOptions.js';
|
|
19
19
|
export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcherWithKeyword, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './src/utils/index.js';
|
|
20
20
|
export * from '@formily/core';
|
|
21
|
-
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday,
|
|
21
|
+
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat } from './src/utils/business.js';
|
|
22
22
|
export { findNextWidget, queryDecorator, queryInput } from './src/utils/dom.js';
|
|
23
23
|
export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, createVisitedSetter, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema } from './src/utils/schema.js';
|
|
24
24
|
|
|
@@ -4,7 +4,7 @@ import { format } from 'date-fns';
|
|
|
4
4
|
import { isFunction, isNumber } from 'lodash-es';
|
|
5
5
|
import { FIELD_BUSINESS_TYPE } from '../constants/index.js';
|
|
6
6
|
import '../utils/index.js';
|
|
7
|
-
import { isIdCard, parseIdCard,
|
|
7
|
+
import { isIdCard, parseIdCard, parseAgeFromContext, parseBirthday, parseAge2Birthday } from '../utils/business.js';
|
|
8
8
|
|
|
9
9
|
class BusinessCollector {
|
|
10
10
|
constructor(formModel, businessFormatter) {
|
|
@@ -85,7 +85,7 @@ function useBusinessBinding() {
|
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
const info = parseIdCard(idCard);
|
|
88
|
-
const { age, ageUnit } =
|
|
88
|
+
const { age, ageUnit } = parseAgeFromContext(info);
|
|
89
89
|
this.setValueByType(FIELD_BUSINESS_TYPE.AGE_UNIT, ageUnit);
|
|
90
90
|
this.setValueByType(FIELD_BUSINESS_TYPE.AGE, age);
|
|
91
91
|
this.setValueByType(FIELD_BUSINESS_TYPE.SEX, info.sex);
|
|
@@ -95,7 +95,7 @@ function useBusinessBinding() {
|
|
|
95
95
|
const birthday = this.getValueByType(FIELD_BUSINESS_TYPE.BIRTHDAY);
|
|
96
96
|
if (!isString(birthday))
|
|
97
97
|
return;
|
|
98
|
-
const { age, ageUnit } =
|
|
98
|
+
const { age, ageUnit } = parseAgeFromContext(parseBirthday(birthday));
|
|
99
99
|
this.setValueByType(FIELD_BUSINESS_TYPE.AGE_UNIT, ageUnit);
|
|
100
100
|
this.setValueByType(FIELD_BUSINESS_TYPE.AGE, age);
|
|
101
101
|
}
|
|
@@ -6,7 +6,7 @@ export declare function isIdCard(idCardNo: string): boolean;
|
|
|
6
6
|
export declare function isMobile(mobile: string): boolean;
|
|
7
7
|
export declare function parseBirthday(birthday: string): AgeContext;
|
|
8
8
|
export declare function parseAge2Birthday(age: number, ageUnit: string, formatter?: string): string;
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function parseAgeFromContext(context: AgeContext): {
|
|
10
10
|
ageUnit: FIELD_AGE_UNIT;
|
|
11
11
|
age: number;
|
|
12
12
|
};
|
|
@@ -95,8 +95,10 @@ function parseAge2Birthday(age, ageUnit, formatter = "yyyy-MM-dd HH:mm") {
|
|
|
95
95
|
return date;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
98
|
+
function parseAgeFromContext(context) {
|
|
99
|
+
const result = context.hours < 24 ? { ageUnit: FIELD_AGE_UNIT.HOUR, age: Math.max(context.hours, 1) } : context.day < 30 ? { ageUnit: FIELD_AGE_UNIT.DAY, age: Math.max(context.day, 1) } : context.day < 365 ? { ageUnit: FIELD_AGE_UNIT.MONTH, age: Math.max(context.month, 1) } : { ageUnit: FIELD_AGE_UNIT.YEAR, age: Math.max(context.year, 1) };
|
|
100
|
+
result.age = Math.max(result.age, 1);
|
|
101
|
+
return result;
|
|
100
102
|
}
|
|
101
103
|
const businessDateMatcher = /^(\d{4})-?(\d{2})-?(\d{2})?\s?(\d{2})?:?(\d{2})?:?(\d{2})?$/;
|
|
102
104
|
function businessDateParser(dateString) {
|
|
@@ -109,4 +111,4 @@ function businessDateParser(dateString) {
|
|
|
109
111
|
return new Date(`${year}-${month}-${day || "01"} ${hour || "00"}:${minute || "00"}:${second || "00"}`);
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday,
|
|
114
|
+
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat };
|
|
@@ -15,8 +15,9 @@ import * as defaultRendererPlugin from './rendererPlugins/widgets/defaultRendere
|
|
|
15
15
|
import * as labelRendererPlugin from './rendererPlugins/widgets/labelRendererPlugin.js';
|
|
16
16
|
import * as pictureRendererPlugin from './rendererPlugins/widgets/pictureRendererPlugin.js';
|
|
17
17
|
import * as seqRendererPlugin from './rendererPlugins/widgets/seqRendererPlugin.js';
|
|
18
|
-
import * as index$8 from './
|
|
19
|
-
import * as index$9 from './
|
|
18
|
+
import * as index$8 from './rowClickPlugin/index.js';
|
|
19
|
+
import * as index$9 from './rowGroupSettingPlugin/index.js';
|
|
20
|
+
import * as index$a from './virtualTreePlugin/index.js';
|
|
20
21
|
import { separateMetaModule } from '../../../../shared/utils/index.js';
|
|
21
22
|
|
|
22
23
|
const modules = Object.assign({
|
|
@@ -37,8 +38,9 @@ const modules = Object.assign({
|
|
|
37
38
|
"./rendererPlugins/widgets/labelRendererPlugin.tsx": labelRendererPlugin,
|
|
38
39
|
"./rendererPlugins/widgets/pictureRendererPlugin.tsx": pictureRendererPlugin,
|
|
39
40
|
"./rendererPlugins/widgets/seqRendererPlugin.tsx": seqRendererPlugin,
|
|
40
|
-
"./
|
|
41
|
-
"./
|
|
41
|
+
"./rowClickPlugin/index.ts": index$8,
|
|
42
|
+
"./rowGroupSettingPlugin/index.ts": index$9,
|
|
43
|
+
"./virtualTreePlugin/index.ts": index$a
|
|
42
44
|
});
|
|
43
45
|
var PluginPresets = separateMetaModule(modules);
|
|
44
46
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function rowClickPlugin(): import("../../../../../../es/components/iho-table").TablePlugin;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { onBeforeUnmount } from 'vue';
|
|
2
|
+
import '../../../index.js';
|
|
3
|
+
import { defineTablePlugin } from '../../hooks/useTablePlugin.js';
|
|
4
|
+
|
|
5
|
+
function rowClickPlugin() {
|
|
6
|
+
const pluginName = "rowClickPlugin";
|
|
7
|
+
const lockMap = /* @__PURE__ */ new Map();
|
|
8
|
+
return defineTablePlugin({
|
|
9
|
+
name: pluginName,
|
|
10
|
+
apply(hooks) {
|
|
11
|
+
hooks.eventHooks.onCurrentChange.tap(pluginName, (_, { uuid }) => {
|
|
12
|
+
if (!uuid)
|
|
13
|
+
return;
|
|
14
|
+
lockMap.set(uuid, true);
|
|
15
|
+
});
|
|
16
|
+
hooks.eventHooks.onCellClick.tap(pluginName, async ({ $table }, { uuid }) => {
|
|
17
|
+
if (!uuid)
|
|
18
|
+
return;
|
|
19
|
+
if (lockMap.get(uuid)) {
|
|
20
|
+
lockMap.set(uuid, false);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
$table.clearCurrentRow();
|
|
24
|
+
});
|
|
25
|
+
hooks.setupHooks.setup.tap(pluginName, (config) => {
|
|
26
|
+
onBeforeUnmount(() => {
|
|
27
|
+
config.value.uuid && lockMap.delete(config.value.uuid);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { rowClickPlugin };
|
package/es/components/index.js
CHANGED
|
@@ -62,7 +62,7 @@ export { useAnchor } from './form-render/src/hooks/useAnchor.js';
|
|
|
62
62
|
export { useFormContext } from './form-render/src/hooks/useFormContext.js';
|
|
63
63
|
export { useCommonInjection, useSelectOptionProps } from './form-render/src/hooks/useCommonInjection.js';
|
|
64
64
|
export { useAutographOptions, useRecommendOptions, useUrlConfigOptions } from './form-render/src/hooks/useFormRenderOptions.js';
|
|
65
|
-
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday,
|
|
65
|
+
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat } from './form-render/src/utils/business.js';
|
|
66
66
|
export { findNextWidget, queryDecorator, queryInput } from './form-render/src/utils/dom.js';
|
|
67
67
|
export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, createVisitedSetter, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema } from './form-render/src/utils/schema.js';
|
|
68
68
|
export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcherWithKeyword, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './form-render/src/utils/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.36-beta.
|
|
3
|
+
"version": "3.1.36-beta.8",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"iOS 7",
|
|
62
62
|
"last 3 iOS versions"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "96eb37738e228a49e2e4b51b2060963239129fff"
|
|
65
65
|
}
|