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

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) {
@@ -12,7 +12,7 @@ const UploadComputed = (props, state, config) => {
12
12
  };
13
13
  const handleProcessParams = (params, file) => {
14
14
  let res = {
15
- channel,
15
+ channel: channel.value,
16
16
  md5: file.uniqueIdentifier,
17
17
  name: params.filename,
18
18
  chunk: params.chunkNumber - 1,
@@ -43,10 +43,12 @@ const UploadComputed = (props, state, config) => {
43
43
  };
44
44
  });
45
45
  const channel = computed(() => {
46
- if (Object.keys(state.uploadConfig || {}).length === 0) {
46
+ let obj = state.uploadConfig;
47
+ if (Object.keys(obj || {}).length === 0) {
47
48
  return void 0;
48
49
  }
49
- return props.uploaderType === "file" ? state.uploadConfig.fileChannel : state.uploadConfig.channel;
50
+ let res = props.uploaderType === "file" ? obj.fileChannel : obj.channel;
51
+ return res || obj.fileChannel;
50
52
  });
51
53
  const uploadArguments = computed(() => {
52
54
  return {
@@ -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,31 @@ 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
+ var _a;
105
+ if (isField(field)) {
106
+ field.modified = false;
107
+ field.visited = false;
108
+ field.feedbacks = [];
109
+ field.selfModified = false;
110
+ field.caches = {};
111
+ field.value = (_a = field.initialValue) != null ? _a : null;
112
+ }
113
+ });
114
+ }
103
115
  });
104
116
  return (_ctx, _cache) => {
105
117
  return openBlock(), createBlock(unref(NForm), null, {
@@ -1,13 +1,32 @@
1
+ import { CSSProperties, PropType } from 'vue';
1
2
  export declare const COMPLEX: import("vue").DefineComponent<{
2
3
  span: {
3
4
  type: NumberConstructor;
4
5
  default: number;
5
6
  };
7
+ display: {
8
+ type: PropType<"flex" | "grid">;
9
+ default: string;
10
+ };
11
+ wrapperStyle: {
12
+ type: PropType<CSSProperties>;
13
+ default: () => {};
14
+ };
6
15
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
7
16
  span: {
8
17
  type: NumberConstructor;
9
18
  default: number;
10
19
  };
20
+ display: {
21
+ type: PropType<"flex" | "grid">;
22
+ default: string;
23
+ };
24
+ wrapperStyle: {
25
+ type: PropType<CSSProperties>;
26
+ default: () => {};
27
+ };
11
28
  }>>, {
12
29
  span: number;
30
+ display: "flex" | "grid";
31
+ wrapperStyle: CSSProperties;
13
32
  }>;
@@ -7,11 +7,18 @@ const script = defineComponent({
7
7
  span: {
8
8
  type: Number,
9
9
  default: 6
10
+ },
11
+ display: {
12
+ type: String,
13
+ default: "grid"
14
+ },
15
+ wrapperStyle: {
16
+ type: Object,
17
+ default: () => ({})
10
18
  }
11
19
  },
12
20
  setup(props, {
13
- slots,
14
- attrs
21
+ slots
15
22
  }) {
16
23
  function onChange(e) {
17
24
  e.stopPropagation();
@@ -20,7 +27,8 @@ const script = defineComponent({
20
27
  return createVNode("section", {
21
28
  "class": "form-render__complex"
22
29
  }, [createVNode("section", {
23
- "class": "form-render__complexContent",
30
+ "class": `form-render__complexContent--${props.display}`,
31
+ "style": props.wrapperStyle,
24
32
  "onChange": onChange
25
33
  }, [slots.default && slots.default()])]);
26
34
  };
@@ -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,7 @@
1
+ import { pick } from 'lodash-es';
1
2
  import { arrayed, transformDateFormat } from '../utils/index.js';
2
- import { useFormValidator } from './useFormValidator.js';
3
+ import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
3
4
  import { isObject } from '@vueuse/core';
4
- import { useTypeNormalize } from './useTypeNormalize.js';
5
5
 
6
6
  function useFieldList2Schema(collector) {
7
7
  const { createValidatorSchema } = useFormValidator();
@@ -133,6 +133,8 @@ function useFieldList2Schema(collector) {
133
133
  const properties = Array.isArray(item.properties) ? transform(item.properties) : {};
134
134
  schema.type = item.fieldType || "void";
135
135
  schema.properties = properties;
136
+ Object.assign(schema["x-decorator-props"], { showFeedback: false });
137
+ Object.assign(schema["x-component-props"], pick(item, ["wrapperStyle", "display"]));
136
138
  return schema;
137
139
  };
138
140
  const creatorMap = /* @__PURE__ */ new Map([
@@ -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;
@@ -88,8 +88,12 @@
88
88
  .form-render__complex {
89
89
  width: 100%;
90
90
  }
91
- .form-render__complexContent {
91
+ .form-render__complexContent--grid {
92
92
  display: grid !important;
93
93
  grid-template-columns: repeat(var(--column), minmax(0px, 1fr));
94
94
  gap: 0 8px;
95
95
  }
96
+ .form-render__complexContent--flex {
97
+ display: flex !important;
98
+ gap: 0 8px;
99
+ }
@@ -2704,8 +2704,12 @@ body > .vxe-table--tooltip-wrapper {
2704
2704
  .form-render__complex {
2705
2705
  width: 100%;
2706
2706
  }
2707
- .form-render__complexContent {
2707
+ .form-render__complexContent--grid {
2708
2708
  display: grid !important;
2709
2709
  grid-template-columns: repeat(var(--column), minmax(0px, 1fr));
2710
2710
  gap: 0 8px;
2711
2711
  }
2712
+ .form-render__complexContent--flex {
2713
+ display: flex !important;
2714
+ gap: 0 8px;
2715
+ }
@@ -260,11 +260,14 @@ var script = /* @__PURE__ */ defineComponent({
260
260
  const confirmSubmit = (message2) => {
261
261
  dialog.warning({
262
262
  title: "\u6E29\u99A8\u63D0\u793A",
263
- content: message2,
263
+ content: () => h("div", { style: {
264
+ paddingLeft: "30px"
265
+ } }, message2),
264
266
  positiveText: "\u786E\u5B9A",
265
267
  negativeText: "\u53D6\u6D88",
266
268
  maskClosable: false,
267
269
  closable: false,
270
+ positiveButtonProps: { type: "primary" },
268
271
  onPositiveClick: () => {
269
272
  onSubmitForm();
270
273
  },
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.4",
5
5
  "license": "ISC",
6
6
  "module": "es/packages/index.js",
7
7
  "main": "es/packages/index.js",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "naive-ui": "^2.29.0",
29
- "vue": ">=3.2.0"
29
+ "vue": "^3.2.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@formily/core": "^2.1.9",