@qin-ui/antd-vue-pro 1.1.11 → 1.1.12

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
@@ -226,8 +226,8 @@ ant-design-vue ui组件库form组件的二次封装
226
226
  appendField: AppendField;
227
227
  /** 在指定字段数据路径的字段配置前插入新的字段配置 */
228
228
  prependField: PrependField;
229
- /** 获取指定字段数据路径的字段所在分组字段的配置 */
230
- getParentField: GetParentField;
229
+ /** 获取指定字段数据路径的字段所在字段分组 */
230
+ getParentFields: GetParentFields;
231
231
  };
232
232
 
233
233
  /**
@@ -15779,7 +15779,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
15779
15779
  "hideFeedback"
15780
15780
  ];
15781
15781
  const props = __props;
15782
- useProviderDisabled(ref(props.disabled));
15782
+ useProviderDisabled(computed(() => props.disabled));
15783
15783
  const updateRefs = inject(UPDATE_REFS);
15784
15784
  const getPath = (fieldKey) => {
15785
15785
  return [props.path, fieldKey].filter(Boolean).join(".");
@@ -15896,86 +15896,70 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
15896
15896
  }
15897
15897
  });
15898
15898
  const index_vue_vue_type_style_index_0_lang = "";
15899
- const generateFieldMap = (fields, prePath = "", preFieldPath = "", fieldMap = {}) => {
15900
- fields.forEach((field, index2) => {
15901
- let path;
15902
- if (prePath) {
15903
- path = field.key ? `${prePath}.${field.key}` : prePath;
15904
- } else {
15905
- path = field.key || "";
15906
- }
15907
- const fieldPath = `${preFieldPath || ""}[${index2}]`;
15908
- if (path && !fieldMap[path]) {
15909
- fieldMap[path] = { field, fieldPath };
15910
- }
15911
- if (field.fields) {
15912
- generateFieldMap(
15913
- field.fields,
15914
- path,
15915
- `${fieldPath}.fields`,
15916
- fieldMap
15917
- );
15918
- }
15919
- });
15920
- return fieldMap;
15921
- };
15922
15899
  const useFields = (initFields) => {
15923
15900
  const fields = ref(initFields);
15924
- const fieldMap = computed(() => {
15925
- return generateFieldMap(fields.value);
15926
- });
15927
- const getField = (path) => {
15928
- var _a;
15901
+ const updateField = (path, updater, fieldList = fields.value, parentPath = "", parentFieldPath = "", parsedPath = toPath(path).join(".")) => {
15929
15902
  if (!path)
15930
- return void 0;
15931
- return (_a = fieldMap.value[path]) == null ? void 0 : _a.field;
15903
+ return false;
15904
+ for (let i2 = 0; i2 < fieldList.length; i2 += 1) {
15905
+ const field = fieldList[i2];
15906
+ const { key = "" } = field;
15907
+ const concatPath = `${parentPath}${parentPath && key ? "." : ""}${key}`;
15908
+ const selfPath = toPath(concatPath).join(".");
15909
+ if (!parsedPath.startsWith(selfPath))
15910
+ continue;
15911
+ const fieldPath = `${parentFieldPath}[${i2}]`;
15912
+ if (selfPath && selfPath === parsedPath) {
15913
+ updater({ field, fieldIndex: i2, parentFields: fieldList, fieldPath });
15914
+ return true;
15915
+ }
15916
+ if (field.fields && updateField(
15917
+ path,
15918
+ updater,
15919
+ field.fields,
15920
+ selfPath,
15921
+ `${fieldPath}.fields`,
15922
+ parsedPath
15923
+ )) {
15924
+ return true;
15925
+ }
15926
+ }
15927
+ return false;
15932
15928
  };
15933
- const getFieldPath = (path) => {
15934
- var _a;
15929
+ const getField = (path) => {
15935
15930
  if (!path)
15936
15931
  return void 0;
15937
- return (_a = fieldMap.value[path]) == null ? void 0 : _a.fieldPath;
15932
+ let res;
15933
+ updateField(path, ({ field }) => {
15934
+ res = field;
15935
+ });
15936
+ return res;
15938
15937
  };
15939
15938
  const setField = (path, field, updateType = "merge") => {
15940
- const fieldPath = getFieldPath(path);
15941
- if (!fieldPath)
15942
- return;
15943
- let value = field;
15944
- const preField = getField(path);
15945
- if (typeof field === "function") {
15946
- value = field(preField);
15947
- }
15948
- const newField = updateType === "rewrite" ? value : { ...preField, ...value };
15949
- set$1(fields.value, fieldPath, newField);
15950
- };
15951
- function findFieldIndex(path) {
15952
- var _a;
15953
- const fieldPath = getFieldPath(path);
15954
- if (!fieldPath)
15955
- return -1;
15956
- return +(((_a = fieldPath.split(".").at(-1)) == null ? void 0 : _a.replaceAll(/.*\[(\d+)\]/g, "$1")) || -1);
15957
- }
15958
- const getParentField = (path) => {
15959
15939
  if (!path)
15960
- return void 0;
15961
- const groupFieldPath = path.split(".").slice(0, -1).join(".");
15962
- return getField(groupFieldPath);
15940
+ return;
15941
+ updateField(path, ({ field: preField, fieldIndex, parentFields }) => {
15942
+ let value = field;
15943
+ if (typeof field === "function") {
15944
+ value = field(preField);
15945
+ }
15946
+ const newField = updateType === "rewrite" ? value : { ...preField, ...value };
15947
+ parentFields[fieldIndex] = newField;
15948
+ });
15963
15949
  };
15964
15950
  const deleteField = (path) => {
15965
15951
  if (!path)
15966
15952
  return;
15967
- const fieldIndex = findFieldIndex(path);
15968
- const group = getParentField(path);
15969
- const groupFields = group ? group.fields : fields.value;
15970
- groupFields == null ? void 0 : groupFields.splice(fieldIndex, 1);
15953
+ updateField(path, ({ fieldIndex, parentFields }) => {
15954
+ parentFields.splice(fieldIndex, 1);
15955
+ });
15971
15956
  };
15972
15957
  const addField = (path, field, placement) => {
15973
15958
  if (path) {
15974
- const fieldIndex = findFieldIndex(path);
15975
- const group = getParentField(path);
15976
- const groupFields = group ? group.fields : fields.value;
15977
- const index2 = placement === "after" ? fieldIndex + 1 : fieldIndex;
15978
- groupFields.splice(index2, 0, field);
15959
+ updateField(path, ({ fieldIndex, parentFields }) => {
15960
+ const index2 = placement === "after" ? fieldIndex + 1 : fieldIndex;
15961
+ parentFields.splice(index2, 0, field);
15962
+ });
15979
15963
  } else if (placement === "after") {
15980
15964
  fields.value.push(field);
15981
15965
  } else {
@@ -15988,15 +15972,33 @@ const useFields = (initFields) => {
15988
15972
  const prependField = (path, field) => {
15989
15973
  addField(path, field, "before");
15990
15974
  };
15975
+ const getFieldPath = (path) => {
15976
+ if (!path)
15977
+ return void 0;
15978
+ let res;
15979
+ updateField(path, ({ fieldPath }) => {
15980
+ res = fieldPath;
15981
+ });
15982
+ return res;
15983
+ };
15984
+ const getParentFields = (path) => {
15985
+ if (!path)
15986
+ return void 0;
15987
+ let res;
15988
+ updateField(path, ({ parentFields }) => {
15989
+ res = parentFields;
15990
+ });
15991
+ return res;
15992
+ };
15991
15993
  return {
15992
15994
  fields,
15993
15995
  getField,
15994
- getParentField,
15995
15996
  setField,
15996
15997
  deleteField,
15997
- getFieldPath,
15998
15998
  appendField,
15999
- prependField
15999
+ prependField,
16000
+ getFieldPath,
16001
+ getParentFields
16000
16002
  };
16001
16003
  };
16002
16004
  const useFormData = (initFormData) => {
package/es/form/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l, B, d, i, C, b, f, F, k, G, R, e, j, U, h, _, m, p, n, s, q, u, r, t } from "./index-2a04ad4a.js";
1
+ import { l, B, d, i, C, b, f, F, k, G, R, e, j, U, h, _, m, p, n, s, q, u, r, t } from "./index-b2d126ee.js";
2
2
  import "vue";
3
3
  import "ant-design-vue";
4
4
  import "../component-provider/index.js";
package/es/index.d.ts CHANGED
@@ -718,14 +718,14 @@ declare const _default_3: <D extends Record<string, any>>(__VLS_props: {
718
718
  }>>) => void;
719
719
  resetQueryParams: () => void;
720
720
  }) | undefined;
721
- tableLayout?: TableLayout | undefined;
722
- columns?: ColumnsType<any> | undefined;
723
721
  scroll?: ({
724
722
  x?: string | number | true | undefined;
725
723
  y?: string | number | undefined;
726
724
  } & {
727
725
  scrollToFirstRowOnChange?: boolean | undefined;
728
726
  }) | undefined;
727
+ columns?: ColumnsType<any> | undefined;
728
+ tableLayout?: TableLayout | undefined;
729
729
  rowClassName?: string | RowClassName<any> | undefined;
730
730
  showHeader?: boolean | undefined;
731
731
  customRow?: GetComponentProps<any> | undefined;
@@ -1161,14 +1161,14 @@ declare const _default_3: <D extends Record<string, any>>(__VLS_props: {
1161
1161
  }>>) => void;
1162
1162
  resetQueryParams: () => void;
1163
1163
  }) | undefined;
1164
- tableLayout?: TableLayout | undefined;
1165
- columns?: ColumnsType<any> | undefined;
1166
1164
  scroll?: ({
1167
1165
  x?: string | number | true | undefined;
1168
1166
  y?: string | number | undefined;
1169
1167
  } & {
1170
1168
  scrollToFirstRowOnChange?: boolean | undefined;
1171
1169
  }) | undefined;
1170
+ columns?: ColumnsType<any> | undefined;
1171
+ tableLayout?: TableLayout | undefined;
1172
1172
  rowClassName?: string | RowClassName<any> | undefined;
1173
1173
  showHeader?: boolean | undefined;
1174
1174
  customRow?: GetComponentProps<any> | undefined;
@@ -1608,14 +1608,14 @@ declare const _default_3: <D extends Record<string, any>>(__VLS_props: {
1608
1608
  }>>) => void;
1609
1609
  resetQueryParams: () => void;
1610
1610
  }) | undefined;
1611
- tableLayout?: TableLayout | undefined;
1612
- columns?: ColumnsType<any> | undefined;
1613
1611
  scroll?: ({
1614
1612
  x?: string | number | true | undefined;
1615
1613
  y?: string | number | undefined;
1616
1614
  } & {
1617
1615
  scrollToFirstRowOnChange?: boolean | undefined;
1618
1616
  }) | undefined;
1617
+ columns?: ColumnsType<any> | undefined;
1618
+ tableLayout?: TableLayout | undefined;
1619
1619
  rowClassName?: string | RowClassName<any> | undefined;
1620
1620
  showHeader?: boolean | undefined;
1621
1621
  customRow?: GetComponentProps<any> | undefined;
@@ -1890,7 +1890,7 @@ export declare type GetFieldPath = (path?: string) => string | undefined;
1890
1890
 
1891
1891
  export declare type GetFormData = (path?: string) => DeepReadonly<any>;
1892
1892
 
1893
- export declare type GetParentField = (path?: string) => Field | undefined;
1893
+ export declare type GetParentFields = (path?: string) => Field | undefined;
1894
1894
 
1895
1895
  export declare type GetRef = {
1896
1896
  (type: 'formItemRefs', path: string): FormItemInstance;
@@ -4947,14 +4947,14 @@ export declare const ProTable: SFCWithInstall<(<D extends Record<string, any>>(_
4947
4947
  }>>) => void;
4948
4948
  resetQueryParams: () => void;
4949
4949
  }) | undefined;
4950
- tableLayout?: TableLayout | undefined;
4951
- columns?: TableColumnsType<any> | undefined;
4952
4950
  scroll?: ({
4953
4951
  x?: string | number | true | undefined;
4954
4952
  y?: string | number | undefined;
4955
4953
  } & {
4956
4954
  scrollToFirstRowOnChange?: boolean | undefined;
4957
4955
  }) | undefined;
4956
+ columns?: TableColumnsType<any> | undefined;
4957
+ tableLayout?: TableLayout | undefined;
4958
4958
  rowClassName?: string | RowClassName<any> | undefined;
4959
4959
  showHeader?: boolean | undefined;
4960
4960
  customRow?: GetComponentProps<any> | undefined;
@@ -5390,14 +5390,14 @@ export declare const ProTable: SFCWithInstall<(<D extends Record<string, any>>(_
5390
5390
  }>>) => void;
5391
5391
  resetQueryParams: () => void;
5392
5392
  }) | undefined;
5393
- tableLayout?: TableLayout | undefined;
5394
- columns?: TableColumnsType<any> | undefined;
5395
5393
  scroll?: ({
5396
5394
  x?: string | number | true | undefined;
5397
5395
  y?: string | number | undefined;
5398
5396
  } & {
5399
5397
  scrollToFirstRowOnChange?: boolean | undefined;
5400
5398
  }) | undefined;
5399
+ columns?: TableColumnsType<any> | undefined;
5400
+ tableLayout?: TableLayout | undefined;
5401
5401
  rowClassName?: string | RowClassName<any> | undefined;
5402
5402
  showHeader?: boolean | undefined;
5403
5403
  customRow?: GetComponentProps<any> | undefined;
@@ -5837,14 +5837,14 @@ export declare const ProTable: SFCWithInstall<(<D extends Record<string, any>>(_
5837
5837
  }>>) => void;
5838
5838
  resetQueryParams: () => void;
5839
5839
  }) | undefined;
5840
- tableLayout?: TableLayout | undefined;
5841
- columns?: TableColumnsType<any> | undefined;
5842
5840
  scroll?: ({
5843
5841
  x?: string | number | true | undefined;
5844
5842
  y?: string | number | undefined;
5845
5843
  } & {
5846
5844
  scrollToFirstRowOnChange?: boolean | undefined;
5847
5845
  }) | undefined;
5846
+ columns?: TableColumnsType<any> | undefined;
5847
+ tableLayout?: TableLayout | undefined;
5848
5848
  rowClassName?: string | RowClassName<any> | undefined;
5849
5849
  showHeader?: boolean | undefined;
5850
5850
  customRow?: GetComponentProps<any> | undefined;
@@ -6104,8 +6104,8 @@ export declare type UseFields = (initFields: Fields) => {
6104
6104
  appendField: AppendField;
6105
6105
  /** 在指定字段数据路径的字段配置前插入新的字段配置 */
6106
6106
  prependField: PrependField;
6107
- /** 获取指定字段数据路径的字段所在分组字段的配置 */
6108
- getParentField: GetParentField;
6107
+ /** 获取指定字段数据路径的字段所在字段分组 */
6108
+ getParentFields: GetParentFields;
6109
6109
  };
6110
6110
 
6111
6111
  export declare const useFields: UseFields;
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./style.css";
2
- import { _ as _sfc_main } from "./form/index-2a04ad4a.js";
3
- import { l, B, d, i, C, b, f, F, k, G, R, e, j, U, h, m, p, n, s, q, u, r, t } from "./form/index-2a04ad4a.js";
2
+ import { _ as _sfc_main } from "./form/index-b2d126ee.js";
3
+ import { l, B, d, i, C, b, f, F, k, G, R, e, j, U, h, m, p, n, s, q, u, r, t } from "./form/index-b2d126ee.js";
4
4
  import BaseTable from "./table/index.js";
5
5
  import { useTable } from "./table/index.js";
6
6
  import _sfc_main$1 from "./component-provider/index.js";
package/es/table/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createVNode, defineComponent, ref, onMounted, openBlock, createElementBlock, unref, normalizeStyle, createElementVNode, withCtx, createTextVNode, createBlock, toDisplayString, createCommentVNode, mergeModels, useModel, computed, watch, Fragment, renderList, withModifiers, renderSlot, useAttrs, useSlots, mergeProps, createSlots, normalizeProps, guardReactiveProps, nextTick } from "vue";
2
2
  import { Button, Space, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
3
3
  import { useInjectProps, INJECT_KEYS } from "../component-provider/index.js";
4
- import { A as AntdIcon, _ as _sfc_main$6, g as get, a as _export_sfc, o as omit, b as _sfc_main$7, c as cloneDeep, u as useForm } from "../form/index-2a04ad4a.js";
4
+ import { A as AntdIcon, _ as _sfc_main$6, g as get, a as _export_sfc, o as omit, b as _sfc_main$7, c as cloneDeep, u as useForm } from "../form/index-b2d126ee.js";
5
5
  var ColumnHeightOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840 836H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm0-724H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM610.8 378c6 0 9.4-7 5.7-11.7L515.7 238.7a7.14 7.14 0 00-11.3 0L403.6 366.3a7.23 7.23 0 005.7 11.7H476v268h-62.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V378h62.8z" } }] }, "name": "column-height", "theme": "outlined" };
6
6
  const ColumnHeightOutlinedSvg = ColumnHeightOutlined$2;
7
7
  function _objectSpread$2(target) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antd-vue-pro",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "二次封装antd vue组件",
5
5
  "type": "module",
6
6
  "main": "",
@@ -14,6 +14,9 @@
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/dufan3715/pro-components.git"
16
16
  },
17
+ "scripts": {
18
+ "build": "vue-tsc && vite build"
19
+ },
17
20
  "keywords": [
18
21
  "vue",
19
22
  "ant-design-vue",
@@ -35,8 +38,5 @@
35
38
  },
36
39
  "dependencies": {
37
40
  "@ant-design/icons-vue": "^7.0.1"
38
- },
39
- "scripts": {
40
- "build": "vue-tsc && vite build"
41
41
  }
42
- }
42
+ }
package/LICENSE DELETED
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023-present pro-components
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.