@qin-ui/antd-vue-pro 1.1.0 → 1.1.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.
@@ -676,10 +676,10 @@ MapCache.prototype["delete"] = mapCacheDelete;
676
676
  MapCache.prototype.get = mapCacheGet;
677
677
  MapCache.prototype.has = mapCacheHas;
678
678
  MapCache.prototype.set = mapCacheSet;
679
- var FUNC_ERROR_TEXT$1 = "Expected a function";
679
+ var FUNC_ERROR_TEXT$2 = "Expected a function";
680
680
  function memoize(func, resolver) {
681
681
  if (typeof func != "function" || resolver != null && typeof resolver != "function") {
682
- throw new TypeError(FUNC_ERROR_TEXT$1);
682
+ throw new TypeError(FUNC_ERROR_TEXT$2);
683
683
  }
684
684
  var memoized = function() {
685
685
  var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
@@ -1477,12 +1477,12 @@ var now = function() {
1477
1477
  return root$1.Date.now();
1478
1478
  };
1479
1479
  const now$1 = now;
1480
- var FUNC_ERROR_TEXT = "Expected a function";
1480
+ var FUNC_ERROR_TEXT$1 = "Expected a function";
1481
1481
  var nativeMax$1 = Math.max, nativeMin$1 = Math.min;
1482
1482
  function debounce(func, wait, options) {
1483
1483
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
1484
1484
  if (typeof func != "function") {
1485
- throw new TypeError(FUNC_ERROR_TEXT);
1485
+ throw new TypeError(FUNC_ERROR_TEXT$1);
1486
1486
  }
1487
1487
  wait = toNumber(wait) || 0;
1488
1488
  if (isObject$2(options)) {
@@ -1651,6 +1651,26 @@ function parent(object4, path) {
1651
1651
  function isEqual(value, other) {
1652
1652
  return baseIsEqual(value, other);
1653
1653
  }
1654
+ var FUNC_ERROR_TEXT = "Expected a function";
1655
+ function negate(predicate) {
1656
+ if (typeof predicate != "function") {
1657
+ throw new TypeError(FUNC_ERROR_TEXT);
1658
+ }
1659
+ return function() {
1660
+ var args = arguments;
1661
+ switch (args.length) {
1662
+ case 0:
1663
+ return !predicate.call(this);
1664
+ case 1:
1665
+ return !predicate.call(this, args[0]);
1666
+ case 2:
1667
+ return !predicate.call(this, args[0], args[1]);
1668
+ case 3:
1669
+ return !predicate.call(this, args[0], args[1], args[2]);
1670
+ }
1671
+ return !predicate.apply(this, args);
1672
+ };
1673
+ }
1654
1674
  function baseUnset(object4, path) {
1655
1675
  path = castPath(path, object4);
1656
1676
  object4 = parent(object4, path);
@@ -1715,6 +1735,21 @@ function basePickBy(object4, paths, predicate) {
1715
1735
  }
1716
1736
  return result;
1717
1737
  }
1738
+ function pickBy(object4, predicate) {
1739
+ if (object4 == null) {
1740
+ return {};
1741
+ }
1742
+ var props = arrayMap(getAllKeysIn(object4), function(prop) {
1743
+ return [prop];
1744
+ });
1745
+ predicate = baseIteratee(predicate);
1746
+ return basePickBy(object4, props, function(value, path) {
1747
+ return predicate(value, path[0]);
1748
+ });
1749
+ }
1750
+ function omitBy(object4, predicate) {
1751
+ return pickBy(object4, negate(baseIteratee(predicate)));
1752
+ }
1718
1753
  function basePick(object4, paths) {
1719
1754
  return basePickBy(object4, paths, function(value, path) {
1720
1755
  return hasIn(object4, path);
@@ -15745,13 +15780,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
15745
15780
  useProviderDisabled(ref(props.disabled));
15746
15781
  const updateRefs = inject(UPDATE_REFS);
15747
15782
  const getPath = (fieldKey) => {
15748
- if (props.path) {
15749
- if (fieldKey) {
15750
- return `${props.path}.${fieldKey}`;
15751
- }
15752
- return props.path;
15753
- }
15754
- return fieldKey || "";
15783
+ return [props.path, fieldKey].filter(Boolean).join(".");
15755
15784
  };
15756
15785
  const setFormItemRef = (el, field) => {
15757
15786
  if (!el)
@@ -15767,53 +15796,44 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
15767
15796
  ];
15768
15797
  });
15769
15798
  const withDefault = (field) => {
15770
- const baseFormItemProps = pick$1(field, [
15771
- ...formItemPropKeys,
15772
- ...customItemPropsKeys
15773
- ]);
15774
- delete baseFormItemProps.className;
15799
+ const baseFormItemProps = pickBy(
15800
+ field,
15801
+ (v2, k2) => formItemPropKeys.includes(k2) || k2.startsWith("data-form-item")
15802
+ );
15775
15803
  const defaultProps = {
15776
- validateFirst: true
15804
+ validateFirst: true,
15805
+ showFeedback: !field.fields
15777
15806
  };
15778
- if (field.fields) {
15779
- Object.assign(defaultProps, {
15780
- showFeedback: false
15781
- });
15782
- }
15783
15807
  return {
15784
15808
  ...defaultProps,
15785
- ...baseFormItemProps,
15786
- container: void 0
15809
+ ...baseFormItemProps
15787
15810
  };
15788
15811
  };
15789
15812
  const omitFormItemProps = memoize((field) => {
15790
- return omit$1(field, proFormPropKeys.value);
15813
+ return omitBy(
15814
+ field,
15815
+ (v2, k2) => proFormPropKeys.value.includes(k2) || k2.startsWith("data-form-item")
15816
+ );
15791
15817
  });
15792
- const defaultGrid = {
15793
- gutter: 24
15794
- };
15795
15818
  const withDefaultGrid = computed(() => {
15796
15819
  if (props.grid) {
15797
- if (typeof props.grid === "boolean") {
15798
- return defaultGrid;
15799
- }
15800
- return { ...defaultGrid, ...props.grid };
15820
+ const defaultGrid = { gutter: 24 };
15821
+ return props.grid === true ? defaultGrid : { ...defaultGrid, ...props.grid };
15801
15822
  }
15802
- return void 0;
15823
+ return props.grid;
15803
15824
  });
15804
15825
  const withDefaultGridItem = memoize((field) => {
15805
- const defaultSpan = field.fields ? 24 : 8;
15806
15826
  const fieldGridItemProps = pick$1(field, gridItemPropKeys);
15807
15827
  return {
15808
- ...fieldGridItemProps,
15809
- span: field.span ?? defaultSpan
15828
+ span: field.fields ? 24 : 8,
15829
+ ...fieldGridItemProps
15810
15830
  };
15811
15831
  });
15812
15832
  return (_ctx, _cache) => {
15813
15833
  const _component_BaseFormItem = resolveComponent("BaseFormItem");
15814
15834
  return openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
15815
15835
  component: _ctx.grid ? unref(Row$1) : void 0
15816
- }, _ctx.grid ? withDefaultGrid.value : void 0), {
15836
+ }, withDefaultGrid.value), {
15817
15837
  default: withCtx(() => [
15818
15838
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fields, (field, index2) => {
15819
15839
  return openBlock(), createElementBlock(Fragment, {
@@ -15987,20 +16007,26 @@ const useFormData = (initFormData) => {
15987
16007
  return void 0;
15988
16008
  return get$1(formData.value, path);
15989
16009
  };
15990
- const setFormData = (path, value) => {
15991
- let newValue = value;
16010
+ const setFormData = (...args) => {
16011
+ let path;
16012
+ let value;
16013
+ if (args.length === 2) {
16014
+ [path, value] = args;
16015
+ } else {
16016
+ [value] = args;
16017
+ }
15992
16018
  if (path) {
15993
16019
  if (typeof value === "function") {
15994
16020
  const preValue = getFormData(path);
15995
- newValue = value(preValue);
16021
+ value = value(preValue);
15996
16022
  }
15997
- set$1(formData.value, path, newValue);
16023
+ set$1(formData.value, path, value);
15998
16024
  } else {
15999
16025
  if (typeof value === "function") {
16000
16026
  const preValue = formData.value;
16001
- newValue = value(preValue);
16027
+ value = value(preValue);
16002
16028
  }
16003
- formData.value = newValue;
16029
+ formData.value = value;
16004
16030
  }
16005
16031
  };
16006
16032
  return { formData, getFormData, setFormData, activePath, setActivePath };
@@ -16402,7 +16428,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16402
16428
  ...attrs,
16403
16429
  ...methods,
16404
16430
  onFocus: void 0,
16405
- disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled
16431
+ disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled,
16432
+ slots: void 0
16406
16433
  };
16407
16434
  });
16408
16435
  const is = computed(() => {
@@ -16457,7 +16484,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16457
16484
  };
16458
16485
  }
16459
16486
  });
16460
- const index_vue_vue_type_style_index_0_scoped_ae4b888f_lang = "";
16487
+ const index_vue_vue_type_style_index_0_scoped_b22e2d2e_lang = "";
16461
16488
  const _export_sfc = (sfc, props) => {
16462
16489
  const target = sfc.__vccOpts || sfc;
16463
16490
  for (const [key, val] of props) {
@@ -16465,7 +16492,7 @@ const _export_sfc = (sfc, props) => {
16465
16492
  }
16466
16493
  return target;
16467
16494
  };
16468
- const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-ae4b888f"]]);
16495
+ const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-b22e2d2e"]]);
16469
16496
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
16470
16497
  ...{
16471
16498
  name: "ContainerFragment",
package/es/form/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l, B, d, i, C, b, f, F, k, R, e, j, U, h, _, m, p, n, s, q, u, r, t } from "./index-f7d9290e.js";
1
+ import { l, B, d, i, C, b, f, F, k, R, e, j, U, h, _, m, p, n, s, q, u, r, t } from "./index-6f2704d5.js";
2
2
  import "vue";
3
3
  import "ant-design-vue";
4
4
  import "../component-provider/index.js";
package/es/index.d.ts CHANGED
@@ -304,6 +304,10 @@ export declare interface Common<D extends FormData_2 = FormData_2> {
304
304
  * @example (val) => val?.trim()
305
305
  */
306
306
  valueFormatter?: (val: any) => any;
307
+ /** 以data-form-item-开头的属性将会被渲染至formItem的dom节点 */
308
+ [key: `data-form-item-${string}`]: string;
309
+ /** 以data-component-开头的属性将会被渲染至component的dom节点 */
310
+ [key: `data-component-${string}`]: string;
307
311
  }
308
312
 
309
313
  export declare const COMPONENT_MAP: Map<BaseComponentStringName, Component>;
@@ -6011,7 +6015,10 @@ export declare type SetActivePath = (path: string | undefined) => void;
6011
6015
 
6012
6016
  export declare type SetField = (path: string | undefined, field: Field | ((preField: ReturnType<GetField>) => Field), updateType?: 'rewrite' | 'merge') => void;
6013
6017
 
6014
- export declare type SetFormData = (path: string | undefined, value: any | ((preValue: DeepReadonly<any>) => any)) => void;
6018
+ export declare type SetFormData = {
6019
+ (path: string, value: any | ((preValue: DeepReadonly<any>) => any)): void;
6020
+ (value: any | ((preValue: DeepReadonly<any>) => any)): void;
6021
+ };
6015
6022
 
6016
6023
  declare type SFCWithInstall<T> = T & Plugin_2;
6017
6024
 
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./style.css";
2
- import { _ as _sfc_main } from "./form/index-f7d9290e.js";
3
- import { l, B, d, i, C, b, f, F, k, R, e, j, U, h, m, p, n, s, q, u, r, t } from "./form/index-f7d9290e.js";
2
+ import { _ as _sfc_main } from "./form/index-6f2704d5.js";
3
+ import { l, B, d, i, C, b, f, F, k, R, e, j, U, h, m, p, n, s, q, u, r, t } from "./form/index-6f2704d5.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/style.css CHANGED
@@ -1,4 +1,4 @@
1
- .field-component[data-v-ae4b888f] {
1
+ .field-component[data-v-b22e2d2e] {
2
2
  width: 100%;
3
3
  min-width: 120px;
4
4
  }
@@ -41,11 +41,11 @@
41
41
  padding: 24px 24px 16px;
42
42
  background-color: #fff;
43
43
  }
44
- .pro-table[data-v-892661df] {
44
+ .pro-table[data-v-7e684411] {
45
45
  display: flex;
46
46
  flex-direction: column;
47
47
  min-width: 800px;
48
48
  }
49
- .pro-table[data-v-892661df] .ant-pagination .ant-pagination-total-text {
49
+ .pro-table[data-v-7e684411] .ant-pagination .ant-pagination-total-text {
50
50
  flex: 1;
51
51
  }
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-f7d9290e.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-6f2704d5.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) {
@@ -474,7 +474,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
474
474
  ...unref(pagination),
475
475
  ...unref(((_e = cache.get()) == null ? void 0 : _e.pagination) ?? {})
476
476
  });
477
- setSearchParam(void 0, {
477
+ setSearchParam({
478
478
  ...unref(searchParam),
479
479
  ...unref(((_f = cache.get()) == null ? void 0 : _f.searchParam) ?? {})
480
480
  });
@@ -604,8 +604,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
604
604
  };
605
605
  }
606
606
  });
607
- const Table_vue_vue_type_style_index_0_scoped_892661df_lang = "";
608
- const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-892661df"]]);
607
+ const Table_vue_vue_type_style_index_0_scoped_7e684411_lang = "";
608
+ const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7e684411"]]);
609
609
  const getDefaultPagination = () => ({ current: 1, pageSize: 10, total: 0 });
610
610
  const useTable = ({
611
611
  columns: initColumns = [],
@@ -651,7 +651,7 @@ const useTable = ({
651
651
  const setSearchField = setField;
652
652
  const resetQueryParams = () => {
653
653
  setPagination(getDefaultPagination());
654
- setSearchParam(void 0, cloneDeep(_initSearchParam));
654
+ setSearchParam(cloneDeep(_initSearchParam));
655
655
  };
656
656
  return {
657
657
  columns,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antd-vue-pro",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "二次封装antd vue组件",
5
5
  "type": "module",
6
6
  "main": "",