cnhis-design-vue 3.1.11-beta.1 → 3.1.11-beta.2

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 CHANGED
@@ -1,23 +1,23 @@
1
- # Vue 3 + Typescript + Vite
2
-
3
- This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
-
5
- ## Recommended IDE Setup
6
-
7
- - [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
8
-
9
- ## Type Support For `.vue` Imports in TS
10
-
11
- Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's `.vue` type support plugin by running `Volar: Switch TS Plugin on/off` from VSCode command palette.
12
-
13
- ## 使用
14
- ```JavaScript
15
- import { createApp } from "vue";
16
- import App from "./App.vue";
17
- import cui from "cnhis-design-vue";
18
- import "cnhis-design-vue/es/index.css";
19
-
20
- const app = createApp(App);
21
- app.use(cui);
22
- app.mount("#app");
1
+ # Vue 3 + Typescript + Vite
2
+
3
+ This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ - [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
8
+
9
+ ## Type Support For `.vue` Imports in TS
10
+
11
+ Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's `.vue` type support plugin by running `Volar: Switch TS Plugin on/off` from VSCode command palette.
12
+
13
+ ## 使用
14
+ ```JavaScript
15
+ import { createApp } from "vue";
16
+ import App from "./App.vue";
17
+ import cui from "cnhis-design-vue";
18
+ import "cnhis-design-vue/es/index.css";
19
+
20
+ const app = createApp(App);
21
+ app.use(cui);
22
+ app.mount("#app");
23
23
  ```
@@ -975,11 +975,10 @@ var script = /* @__PURE__ */ defineComponent({
975
975
  if (index === 0) {
976
976
  return null;
977
977
  } else if (index === 1) {
978
- return getFooterGroup(columns, data, props);
978
+ return groupText;
979
979
  }
980
980
  return null;
981
981
  });
982
- console.log("\u603B\u8BA1", groupText);
983
982
  emit("setGroupText", groupText);
984
983
  state.groupText = groupText;
985
984
  return [groupColumns];
@@ -2226,6 +2225,7 @@ var script = /* @__PURE__ */ defineComponent({
2226
2225
  "tree-config": unref(treeConfig),
2227
2226
  "row-id": unref(handleRowId),
2228
2227
  "row-class-name": getRowClassName,
2228
+ "cell-class-name": _ctx.columnConfig.cellClassName || null,
2229
2229
  "row-config": state.rowConfig,
2230
2230
  "show-footer": _ctx.showFooter && !props.isInlineOperating,
2231
2231
  "footer-method": footerMethod,
@@ -2328,7 +2328,7 @@ var script = /* @__PURE__ */ defineComponent({
2328
2328
  }
2329
2329
  })]),
2330
2330
  _: 3
2331
- }, 16, ["seq-config", "tree-config", "row-id", "row-config", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config", "edit-rules", "onScroll", "onKeydown"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
2331
+ }, 16, ["seq-config", "tree-config", "row-id", "cell-class-name", "row-config", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config", "edit-rules", "onScroll", "onKeydown"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
2332
2332
  class: "refresh",
2333
2333
  onClick: hanldeClickRefresh
2334
2334
  }, [createVNode(unref(NIcon), {
@@ -32,7 +32,9 @@ var EditSelect = defineComponent({
32
32
  options: [],
33
33
  loading: false,
34
34
  keyword: "",
35
- config: {}
35
+ config: {
36
+ multiple: props.col.multiple || false
37
+ }
36
38
  });
37
39
  const setOptions = async () => {
38
40
  if (props.col.options) {
@@ -101,12 +101,11 @@ declare const _default: import("vue").DefineComponent<{
101
101
  readonly default: 24;
102
102
  };
103
103
  readonly itemResponsive: BooleanConstructor;
104
- readonly collapsed: BooleanConstructor;
104
+ readonly collapsed: BooleanConstructor; /** line 类型 */
105
105
  readonly collapsedRows: {
106
106
  readonly type: NumberConstructor;
107
107
  readonly default: 1;
108
108
  };
109
- /** line 类型 */
110
109
  readonly itemStyle: import("vue").PropType<string | import("vue").CSSProperties>;
111
110
  readonly xGap: {
112
111
  readonly type: import("vue").PropType<string | number>;
@@ -15327,7 +15326,7 @@ declare const _default: import("vue").DefineComponent<{
15327
15326
  dotColorActive: string;
15328
15327
  dotColorDisabled: string;
15329
15328
  buttonBorderColor: string;
15330
- buttonBorderColorActive: string;
15329
+ buttonBorderColorActive: string; /** line 类型 */
15331
15330
  buttonBorderColorHover: string;
15332
15331
  buttonColor: string;
15333
15332
  buttonColorActive: string;
@@ -393,11 +393,6 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
393
393
  onScroll: () => Promise<void>;
394
394
  updateCurrentAnchor: (id: string) => Promise<void>;
395
395
  bindTitle: (info: import("../../../es/src/types").AnyObject) => import("../../../es/src/types").AnyObject;
396
- validate: () => Promise<void>;
397
- getFormValues: () => {
398
- [x: string]: any;
399
- };
400
- setFieldState: import("@formily/core").IFieldStateSetter;
401
396
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
402
397
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
403
398
  form: any;
@@ -393,11 +393,6 @@ declare const _default: import("vue").DefineComponent<{
393
393
  onScroll: () => Promise<void>;
394
394
  updateCurrentAnchor: (id: string) => Promise<void>;
395
395
  bindTitle: (info: AnyObject) => AnyObject;
396
- validate: () => Promise<void>;
397
- getFormValues: () => {
398
- [x: string]: any;
399
- };
400
- setFieldState: import("@formily/core").IFieldStateSetter;
401
396
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
402
397
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
403
398
  form: any;
@@ -1,13 +1,13 @@
1
1
  import { defineComponent, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, Fragment, renderList, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString } from 'vue';
2
- import { createForm, onFieldValueChange } from '@formily/core';
2
+ import { createForm, onFieldValueChange, isField } from '@formily/core';
3
3
  import { FormProvider, FormConsumer } from '@formily/vue';
4
4
  import { cloneDeep } from 'lodash-es';
5
5
  import { NForm, NTabs, NTabPane } from 'naive-ui';
6
6
  import { useFormContext } from './hooks/useFormContext.js';
7
7
  import { useInitialData } from './hooks/useInitialData.js';
8
+ import { useFieldList2Schema } from './hooks/useFieldList2Schema.js';
8
9
  import { useAnchor } from './hooks/useAnchor.js';
9
10
  import { useFieldVisitor } from './hooks/useFieldVisitor.js';
10
- import { useFieldList2Schema } from './hooks/useFieldList2Schema.js';
11
11
 
12
12
  const _hoisted_1 = {
13
13
  key: 0,
@@ -87,19 +87,26 @@ var script = /* @__PURE__ */ defineComponent({
87
87
  info.title = formModel.query(info.path).get("title");
88
88
  return info;
89
89
  }
90
- function validate() {
91
- return formModel.validate().catch((err) => {
92
- return Promise.reject(Array.isArray(err) ? err.map(bindTitle) : err);
93
- });
94
- }
95
- function getFormValues() {
96
- return formModel.getFormState().values;
97
- }
98
- const setFieldState = formModel.setFieldState.bind(formModel);
99
90
  expose({
100
- validate,
101
- getFormValues,
102
- setFieldState
91
+ validate(path = "*") {
92
+ return formModel.validate(path).catch((err) => {
93
+ return Promise.reject(Array.isArray(err) ? err.map(bindTitle) : err);
94
+ });
95
+ },
96
+ getFormValues() {
97
+ return formModel.getFormState().values;
98
+ },
99
+ setFieldState(path, handler) {
100
+ formModel.setFieldState(path, handler);
101
+ },
102
+ resetFields(path = "*") {
103
+ formModel.setFieldState(path, async (field) => {
104
+ if (isField(field)) {
105
+ field.value = field.initialValue;
106
+ await formModel.reset(field.path);
107
+ }
108
+ });
109
+ }
103
110
  });
104
111
  return (_ctx, _cache) => {
105
112
  return openBlock(), createBlock(unref(NForm), null, {
@@ -1,5 +1,4 @@
1
- import { useCommonLog } from './useCommonLog.js';
2
- import { useFormRequest } from './useFormRequest.js';
1
+ import { useFormRequest, useCommonLog } from '../../../../packages/form-render';
3
2
 
4
3
  class AsyncQueueEntry {
5
4
  constructor(item, key, callback) {
@@ -1,5 +1,5 @@
1
1
  import { FieldItem } from '../types';
2
- import { BusinessCollector } from './useBusinessBinding';
2
+ import { BusinessCollector } from '../../../../../es/packages/form-render';
3
3
  /**
4
4
  * @description 胶水层, 将低代码平台中的fieldList转换为JSONSchema
5
5
  */
@@ -1,7 +1,6 @@
1
1
  import { arrayed, transformDateFormat } from '../utils/index.js';
2
- import { useFormValidator } from './useFormValidator.js';
2
+ import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
3
3
  import { isObject } from '@vueuse/core';
4
- import { useTypeNormalize } from './useTypeNormalize.js';
5
4
 
6
5
  function useFieldList2Schema(collector) {
7
6
  const { createValidatorSchema } = useFormValidator();
@@ -1,9 +1,9 @@
1
- import { createSchemaField } from '@formily/vue';
2
1
  import { provide } from 'vue';
2
+ import { createSchemaField } from '@formily/vue';
3
3
  import { useAsyncQueue, useBusinessBinding, useChangeContext, useFormItemDeps } from '../../../../packages/form-render';
4
4
  import * as components from '../../../../packages/form-render/src/components/renderer';
5
- import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../../../packages/form-render/src/constants';
6
5
  import { injectOrProvide } from '../../../../packages/form-render/src/utils';
6
+ import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../../../packages/form-render/src/constants';
7
7
 
8
8
  function useFormContext(props) {
9
9
  const asyncQueue = injectOrProvide(InjectAsyncQueue, () => useAsyncQueue().create(props.parallelism));
@@ -23,6 +23,7 @@ export declare type FormRenderExpose = {
23
23
  validate(): Promise<void>;
24
24
  getFormValues(): AnyObject;
25
25
  setFieldState(path: string, setter: (field: Field) => void): void;
26
+ resetFields(path?: string): void;
26
27
  };
27
28
  export declare type FormChangeContext = Partial<{
28
29
  currentOption: AnyObject;
package/global.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import * as NaiveUI from 'naive-ui';
2
-
3
- declare module 'naive-ui' {
4
- // @ts-ignore
5
- export const NTree: any;
6
- }
7
-
8
- export {};
1
+ import * as NaiveUI from 'naive-ui';
2
+
3
+ declare module 'naive-ui' {
4
+ // @ts-ignore
5
+ export const NTree: any;
6
+ }
7
+
8
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.1.11-beta.1",
4
+ "version": "3.1.11-beta.2",
5
5
  "license": "ISC",
6
6
  "module": "es/packages/index.js",
7
7
  "main": "es/packages/index.js",