cnhis-design-vue 3.1.36-beta.6 → 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.
@@ -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, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './src/utils/business.js';
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
 
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, computed, createVNode, mergeProps } from 'vue';
2
- import { widthAppend } from '../../../../../shared/utils/index.js';
2
+ import { arrayed, widthAppend } from '../../../../../shared/utils/index.js';
3
3
  import { isVoidField } from '@formily/core';
4
4
  import { useField, connect, mapProps } from '@formily/vue';
5
5
  import { isString } from 'lodash-es';
@@ -92,7 +92,7 @@ const script = defineComponent({
92
92
  const FORM_ITEM = connect(script, mapProps({
93
93
  title: "label"
94
94
  }, (props, field) => {
95
- const feedback = !isVoidField(field) ? field.selfErrors.length ? parseFeedback(field.selfErrors, props.fieldItem) : void 0 : void 0;
95
+ const feedback = !isVoidField(field) ? arrayed(field.selfErrors).length ? parseFeedback(arrayed(field.selfErrors), props.fieldItem) : void 0 : void 0;
96
96
  return {
97
97
  ...props,
98
98
  fieldItem: void 0,
@@ -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, parseAge2FromContext, parseBirthday, parseAge2Birthday } from '../utils/business.js';
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 } = parseAge2FromContext(info);
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 } = parseAge2FromContext(parseBirthday(birthday));
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 parseAge2FromContext(context: AgeContext): {
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 parseAge2FromContext(context) {
99
- return context.hours < 24 ? { ageUnit: FIELD_AGE_UNIT.HOUR, age: context.hours < 2 ? 1 : context.hours } : context.day < 30 ? { ageUnit: FIELD_AGE_UNIT.DAY, age: context.day } : context.day < 365 ? { ageUnit: FIELD_AGE_UNIT.MONTH, age: context.month } : { ageUnit: FIELD_AGE_UNIT.YEAR, age: context.year };
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, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat };
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 './rowGroupSettingPlugin/index.js';
19
- import * as index$9 from './virtualTreePlugin/index.js';
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
- "./rowGroupSettingPlugin/index.ts": index$8,
41
- "./virtualTreePlugin/index.ts": index$9
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 };
@@ -86,6 +86,7 @@ export declare type IhoTableFormChangePayload = {
86
86
  value: unknown;
87
87
  index: number;
88
88
  type?: string;
89
+ oldValue?: unknown;
89
90
  };
90
91
  export declare type IhoTableEmits = <T extends typeof IhoTableEventNameTuple[number]>(event: T, ...args: IhoTableEmitPayload<T>) => void;
91
92
  export declare type EventListenerToEventName<T extends string> = T extends `on${infer R}` ? R extends `${infer F}${infer L}` ? `${Lowercase<F>}${L}` : never : never;
@@ -43,7 +43,6 @@ async function getColumnRenderWidth(column, $table) {
43
43
  if (!prev) {
44
44
  await promiseTimeout(0);
45
45
  }
46
- console.log("get_width=>", column.field);
47
46
  return getRenderWidth() || getColumnWidth();
48
47
  function getRenderWidth() {
49
48
  var _a, _b;
@@ -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, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './form-render/src/utils/business.js';
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.6",
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": "262d11985bd131d4c55803a25c026d0ab685472b"
64
+ "gitHead": "96eb37738e228a49e2e4b51b2060963239129fff"
65
65
  }