cnhis-design-vue 3.1.36-beta.7 → 3.1.36-beta.9

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.
@@ -1047,6 +1047,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1047
1047
  valueOf: () => boolean;
1048
1048
  } | undefined;
1049
1049
  display?: "flex" | "grid" | undefined;
1050
+ slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
1050
1051
  wrapperStyle?: Record<string, string> | {
1051
1052
  [x: `--${string}`]: string | number | undefined;
1052
1053
  accentColor?: string | undefined;
@@ -1048,6 +1048,7 @@ declare const _default: import("vue").DefineComponent<{
1048
1048
  valueOf: () => boolean;
1049
1049
  } | undefined;
1050
1050
  display?: "flex" | "grid" | undefined;
1051
+ slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
1051
1052
  wrapperStyle?: Record<string, string> | {
1052
1053
  [x: `--${string}`]: string | number | undefined;
1053
1054
  accentColor?: string | undefined;
@@ -131,6 +131,7 @@ declare const _default: import("vue").DefineComponent<{
131
131
  valueOf: () => boolean;
132
132
  } | undefined;
133
133
  display?: "flex" | "grid" | undefined;
134
+ slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
134
135
  wrapperStyle?: Record<string, string> | {
135
136
  [x: `--${string}`]: string | number | undefined;
136
137
  accentColor?: string | undefined;
@@ -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
 
@@ -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
  }
@@ -37,6 +37,7 @@ function useFieldListAdaptor(collector) {
37
37
  (_b = (_a2 = item.componentProps) == null ? void 0 : _a2.onBlur) == null ? void 0 : _b.call(_a2, ...args);
38
38
  }
39
39
  },
40
+ "x-content": item.slots,
40
41
  "x-display": item.is_show === "0" ? "hidden" : "visible",
41
42
  "x-pattern": item.is_edit === "0" ? "disabled" : "editable"
42
43
  };
@@ -241,6 +241,10 @@ export declare type FieldItem = {
241
241
  * COMPLEX控件布局类型
242
242
  */
243
243
  display: 'grid' | 'flex';
244
+ /**
245
+ * 控件插槽
246
+ */
247
+ slots: Record<string, (...args: unknown[]) => unknown>;
244
248
  /**
245
249
  * COMPLEX控件额外样式
246
250
  */
@@ -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 };
@@ -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';
@@ -150,6 +150,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
150
150
  valueOf: () => boolean;
151
151
  } | undefined;
152
152
  display?: "flex" | "grid" | undefined;
153
+ slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
153
154
  wrapperStyle?: Record<string, string> | {
154
155
  [x: `--${string}`]: string | number | undefined;
155
156
  accentColor?: string | undefined;
@@ -152,6 +152,7 @@ declare const _default: import("vue").DefineComponent<{
152
152
  valueOf: () => boolean;
153
153
  } | undefined;
154
154
  display?: "flex" | "grid" | undefined;
155
+ slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
155
156
  wrapperStyle?: Record<string, string> | {
156
157
  [x: `--${string}`]: string | number | undefined;
157
158
  accentColor?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.36-beta.7",
3
+ "version": "3.1.36-beta.9",
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": "cf41f82d40014e9fe32e9ac85a366c5237cfde32"
64
+ "gitHead": "dd5ee131ad939cbb8ff2bc74bcc33e3dcb1cb09b"
65
65
  }