tanxin-ui 1.3.2 → 1.3.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.
@@ -1836,6 +1836,8 @@ function setProperty(formData, valuePath, value) {
1836
1836
  const arr = path.split(".");
1837
1837
  let obj = formData;
1838
1838
  for (let i2 = 0; i2 < arr.length - 1; i2++) {
1839
+ if (!obj.hasOwnProperty(arr[i2]))
1840
+ obj[arr[i2]] = {};
1839
1841
  obj = obj[arr[i2]];
1840
1842
  }
1841
1843
  obj[arr[arr.length - 1]] = value;
@@ -1847,7 +1849,7 @@ const iconProps = {
1847
1849
  rotate: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
1848
1850
  prefixCls: PropTypes.string
1849
1851
  };
1850
- var Icon = defineComponent({
1852
+ var TIcon$1 = defineComponent({
1851
1853
  name: "TIcon",
1852
1854
  props: iconProps,
1853
1855
  setup(props, {
@@ -1880,7 +1882,7 @@ var Icon = defineComponent({
1880
1882
  };
1881
1883
  }
1882
1884
  });
1883
- const TIcon = withInstall(Icon);
1885
+ const TIcon = withInstall(TIcon$1);
1884
1886
  const linkProps$1 = Object.assign({
1885
1887
  to: {
1886
1888
  type: [Object, String]
@@ -5705,7 +5707,8 @@ var Input = defineComponent({
5705
5707
  EyeOffOutline,
5706
5708
  EyeOutline,
5707
5709
  CloseCircleOutline,
5708
- ChevronDown
5710
+ ChevronDown,
5711
+ TIcon: TIcon$1
5709
5712
  },
5710
5713
  props: inputProps,
5711
5714
  emits: ["input", "update:value", "change", "focus", "blur", "keydown", "clear"],
@@ -5921,17 +5924,17 @@ var Input = defineComponent({
5921
5924
  }, controlProps), null), hasSuffix.value ? createVNode("span", {
5922
5925
  "ref": "refSuffix",
5923
5926
  "class": `${prefixCls.value}-suffix`
5924
- }, [props.showPassword ? createVNode(resolveComponent("t-icon"), {
5927
+ }, [props.showPassword ? createVNode(TIcon$1, {
5925
5928
  "class": "is-action",
5926
5929
  "onClick": handlePasswordIconClick
5927
5930
  }, {
5928
5931
  default: () => [showPlain.value ? createVNode(EyeOffOutline, null, null) : createVNode(EyeOutline, null, null)]
5929
- }) : null, showClear.value && currentValue.value ? createVNode(resolveComponent("t-icon"), {
5932
+ }) : null, showClear.value && currentValue.value ? createVNode(TIcon$1, {
5930
5933
  "class": "is-action",
5931
5934
  "onClick": handleClearClick
5932
5935
  }, {
5933
5936
  default: () => [createVNode(CloseCircleOutline, null, null)]
5934
- }) : null, props.showArrow ? createVNode(resolveComponent("t-icon"), {
5937
+ }) : null, props.showArrow ? createVNode(TIcon$1, {
5935
5938
  "class": "is-action right-arrow",
5936
5939
  "rotate": -90
5937
5940
  }, {
@@ -6368,6 +6371,60 @@ const replacer = (_key, val) => {
6368
6371
  }
6369
6372
  return val;
6370
6373
  };
6374
+ function equals(obj1, obj2, keys2 = []) {
6375
+ if (!obj1 && !obj2)
6376
+ return true;
6377
+ else if (!obj1 || !obj2)
6378
+ return false;
6379
+ if (typeof obj1 != typeof obj2)
6380
+ return false;
6381
+ if (obj1 instanceof Array && obj2 instanceof Array) {
6382
+ return arrayEquals(obj1, obj2, keys2);
6383
+ } else if (obj1 instanceof Object && obj2 instanceof Object) {
6384
+ return objectEquals(obj1, obj2, keys2);
6385
+ } else
6386
+ return obj1 == obj2;
6387
+ }
6388
+ function arrayEquals(array1, array22, keys2 = []) {
6389
+ if (!array1 && !array22)
6390
+ return true;
6391
+ if (!array1 || !array22)
6392
+ return false;
6393
+ if (array1.length != array22.length)
6394
+ return false;
6395
+ for (let i2 = 0, l2 = array1.length; i2 < l2; i2++) {
6396
+ if (!equals(array1[i2], array22[i2], keys2))
6397
+ return false;
6398
+ }
6399
+ return true;
6400
+ }
6401
+ function objectEquals(object1, object22, keys2 = []) {
6402
+ if (!object1 && !object22)
6403
+ return true;
6404
+ else if (!object1 || !object22)
6405
+ return false;
6406
+ for (const propName in object1) {
6407
+ if (object1.hasOwnProperty(propName) != object22.hasOwnProperty(propName)) {
6408
+ return false;
6409
+ } else if (typeof object1[propName] != typeof object22[propName]) {
6410
+ return false;
6411
+ }
6412
+ }
6413
+ for (const propName in object22) {
6414
+ if (keys2.length > 0 && !keys2.includes(propName))
6415
+ continue;
6416
+ if (object1.hasOwnProperty(propName) != object22.hasOwnProperty(propName)) {
6417
+ return false;
6418
+ } else if (typeof object1[propName] != typeof object22[propName]) {
6419
+ return false;
6420
+ }
6421
+ if (!object1.hasOwnProperty(propName))
6422
+ return false;
6423
+ if (!equals(object1[propName], object22[propName], keys2))
6424
+ return false;
6425
+ }
6426
+ return true;
6427
+ }
6371
6428
  const inputNumberProps = {
6372
6429
  placeholder: PropTypes.string.def("\u8BF7\u8F93\u5165"),
6373
6430
  textAlign: PropTypes.oneOf(["left", "right", "center"]).def("left"),
@@ -6620,13 +6677,18 @@ var InputNumber = defineComponent({
6620
6677
  });
6621
6678
  if (dynamicForm.value) {
6622
6679
  watch(() => props.formData, () => {
6623
- currentValue.value = getProperty(props.formData, props.valuePath);
6680
+ const value = getProperty(props.formData, props.valuePath);
6681
+ if (equals(value, currentValue.value))
6682
+ return;
6683
+ currentValue.value = value;
6624
6684
  checkInvalid();
6625
6685
  }, {
6626
6686
  deep: true
6627
6687
  });
6628
6688
  } else {
6629
6689
  watch(() => props.value, () => {
6690
+ if (equals(props.value, currentValue.value))
6691
+ return;
6630
6692
  currentValue.value = props.value;
6631
6693
  checkInvalid();
6632
6694
  });
@@ -7564,7 +7626,7 @@ var Radio = defineComponent({
7564
7626
  const currentValue = ref();
7565
7627
  onMounted(() => {
7566
7628
  currentValue.value = getValue2.value !== "" ? getValue2.value : getGroupContext("value");
7567
- setCheckStatus2();
7629
+ setCheckStatus();
7568
7630
  });
7569
7631
  const refRadio = ref();
7570
7632
  const validateStatus = ref("");
@@ -7613,7 +7675,7 @@ var Radio = defineComponent({
7613
7675
  emit("input", props.itemValue);
7614
7676
  emit("change", props.itemValue);
7615
7677
  currentValue.value = props.itemValue;
7616
- setCheckStatus2();
7678
+ setCheckStatus();
7617
7679
  if (groupContext && groupContext.onChange) {
7618
7680
  groupContext.onChange(props.itemValue);
7619
7681
  }
@@ -7628,19 +7690,19 @@ var Radio = defineComponent({
7628
7690
  };
7629
7691
  if (dynamicForm.value) {
7630
7692
  watch(() => props.formData, () => {
7631
- if (getValue2.value === currentValue.value)
7693
+ if (equals(getValue2.value, currentValue.value))
7632
7694
  return;
7633
7695
  currentValue.value = getValue2.value;
7634
- setCheckStatus2();
7696
+ setCheckStatus();
7635
7697
  }, {
7636
7698
  deep: true
7637
7699
  });
7638
7700
  } else {
7639
7701
  watch(() => props.value, () => {
7640
- if (props.value === currentValue.value)
7702
+ if (equals(props.value, currentValue.value))
7641
7703
  return;
7642
7704
  currentValue.value = props.value;
7643
- setCheckStatus2();
7705
+ setCheckStatus();
7644
7706
  });
7645
7707
  }
7646
7708
  if (groupContext) {
@@ -7648,13 +7710,13 @@ var Radio = defineComponent({
7648
7710
  if (groupContext.value.value === currentValue.value)
7649
7711
  return;
7650
7712
  currentValue.value = groupContext.value.value;
7651
- setCheckStatus2();
7713
+ setCheckStatus();
7652
7714
  });
7653
7715
  }
7654
7716
  const handleClick = (event) => {
7655
7717
  event.stopPropagation();
7656
7718
  };
7657
- const setCheckStatus2 = () => {
7719
+ const setCheckStatus = () => {
7658
7720
  isChecked.value = props.itemValue === currentValue.value;
7659
7721
  refRadio.value.checked = isChecked.value;
7660
7722
  };
@@ -7801,60 +7863,6 @@ const provideCheckboxGroup = (data) => {
7801
7863
  const injectCheckboxGroup = () => {
7802
7864
  return inject(CheckboxGroupContextKey, void 0);
7803
7865
  };
7804
- function equals(obj1, obj2, keys2 = []) {
7805
- if (!obj1 && !obj2)
7806
- return true;
7807
- else if (!obj1 || !obj2)
7808
- return false;
7809
- if (typeof obj1 != typeof obj2)
7810
- return false;
7811
- if (obj1 instanceof Array && obj2 instanceof Array) {
7812
- return arrayEquals(obj1, obj2, keys2);
7813
- } else if (obj1 instanceof Object && obj2 instanceof Object) {
7814
- return objectEquals(obj1, obj2, keys2);
7815
- } else
7816
- return obj1 == obj2;
7817
- }
7818
- function arrayEquals(array1, array22, keys2 = []) {
7819
- if (!array1 && !array22)
7820
- return true;
7821
- if (!array1 || !array22)
7822
- return false;
7823
- if (array1.length != array22.length)
7824
- return false;
7825
- for (let i2 = 0, l2 = array1.length; i2 < l2; i2++) {
7826
- if (!equals(array1[i2], array22[i2], keys2))
7827
- return false;
7828
- }
7829
- return true;
7830
- }
7831
- function objectEquals(object1, object22, keys2 = []) {
7832
- if (!object1 && !object22)
7833
- return true;
7834
- else if (!object1 || !object22)
7835
- return false;
7836
- for (const propName in object1) {
7837
- if (object1.hasOwnProperty(propName) != object22.hasOwnProperty(propName)) {
7838
- return false;
7839
- } else if (typeof object1[propName] != typeof object22[propName]) {
7840
- return false;
7841
- }
7842
- }
7843
- for (const propName in object22) {
7844
- if (keys2.length > 0 && !keys2.includes(propName))
7845
- continue;
7846
- if (object1.hasOwnProperty(propName) != object22.hasOwnProperty(propName)) {
7847
- return false;
7848
- } else if (typeof object1[propName] != typeof object22[propName]) {
7849
- return false;
7850
- }
7851
- if (!object1.hasOwnProperty(propName))
7852
- return false;
7853
- if (!equals(object1[propName], object22[propName], keys2))
7854
- return false;
7855
- }
7856
- return true;
7857
- }
7858
7866
  const checkboxProps$1 = {
7859
7867
  value: {
7860
7868
  type: [Array, Boolean, Number],
@@ -7898,7 +7906,7 @@ var Checkbox = defineComponent({
7898
7906
  const value = getValue2.value !== void 0 ? props.value : getGroupContext("value");
7899
7907
  if (!initCurrentValue(value))
7900
7908
  return false;
7901
- setCheckStatus2();
7909
+ setCheckStatus();
7902
7910
  });
7903
7911
  const initCurrentValue = (value) => {
7904
7912
  if (value === void 0) {
@@ -7983,7 +7991,7 @@ var Checkbox = defineComponent({
7983
7991
  return;
7984
7992
  const checked = event.target.checked;
7985
7993
  changeValue(checked);
7986
- setCheckStatus2();
7994
+ setCheckStatus();
7987
7995
  const nowValue = currentValue.value;
7988
7996
  console.log("nowValue=", nowValue);
7989
7997
  emitValue(nowValue);
@@ -8018,27 +8026,27 @@ var Checkbox = defineComponent({
8018
8026
  }
8019
8027
  const watchAction = () => {
8020
8028
  if ((props.bool || props.switch) && getValue2.value == currentValue.value) {
8021
- setCheckStatus2();
8029
+ setCheckStatus();
8022
8030
  return;
8023
8031
  }
8024
- if (!props.bool && arrayEquals(props.value, currentValue.value)) {
8025
- setCheckStatus2();
8032
+ if (!props.bool && arrayEquals(getValue2.value, currentValue.value)) {
8033
+ setCheckStatus();
8026
8034
  return;
8027
8035
  }
8028
- initCurrentValue(props.value);
8029
- setCheckStatus2();
8036
+ initCurrentValue(getValue2.value);
8037
+ setCheckStatus();
8030
8038
  };
8031
8039
  if (groupContext) {
8032
8040
  watch(() => groupContext.value.value, () => {
8033
8041
  if (arrayEquals(props.value, currentValue.value)) {
8034
- setCheckStatus2();
8042
+ setCheckStatus();
8035
8043
  return;
8036
8044
  }
8037
8045
  initCurrentValue(groupContext.value.value);
8038
- setCheckStatus2();
8046
+ setCheckStatus();
8039
8047
  });
8040
8048
  }
8041
- const setCheckStatus2 = () => {
8049
+ const setCheckStatus = () => {
8042
8050
  var _a;
8043
8051
  if (props.bool) {
8044
8052
  isChecked.value = !!currentValue.value;
@@ -10374,7 +10382,7 @@ var Tag = defineComponent({
10374
10382
  isChecked.value = !isChecked.value;
10375
10383
  emitValue();
10376
10384
  };
10377
- const setCheckStatus2 = () => {
10385
+ const setCheckStatus = () => {
10378
10386
  isChecked.value = currentValue.value.includes(props.itemValue);
10379
10387
  };
10380
10388
  onMounted(() => {
@@ -10382,14 +10390,14 @@ var Tag = defineComponent({
10382
10390
  const value = props.value;
10383
10391
  if (!initCurrentValue(value))
10384
10392
  return false;
10385
- setCheckStatus2();
10393
+ setCheckStatus();
10386
10394
  }
10387
10395
  });
10388
10396
  watch(() => props.value, () => {
10389
10397
  if (arrayEquals(props.value, currentValue.value))
10390
10398
  return;
10391
10399
  initCurrentValue(props.value);
10392
- setCheckStatus2();
10400
+ setCheckStatus();
10393
10401
  }, {
10394
10402
  deep: true
10395
10403
  });
@@ -11034,13 +11042,17 @@ var Cascader = defineComponent({
11034
11042
  });
11035
11043
  if (dynamicForm.value) {
11036
11044
  watch(() => props.formData, () => {
11037
- currentValue.value = getProperty(props.formData, props.valuePath);
11045
+ const value = getProperty(props.formData, props.valuePath);
11046
+ if (value == currentValue.value)
11047
+ return;
11038
11048
  initCascaderValue();
11039
11049
  }, {
11040
11050
  deep: true
11041
11051
  });
11042
11052
  } else {
11043
11053
  watch(() => props.value, () => {
11054
+ if (props.value == currentValue.value)
11055
+ return;
11044
11056
  currentValue.value = props.value;
11045
11057
  initCascaderValue();
11046
11058
  });
@@ -11309,13 +11321,19 @@ var TreeSelect = defineComponent({
11309
11321
  });
11310
11322
  if (dynamicForm.value) {
11311
11323
  watch(() => props.formData, () => {
11312
- currentValue.value = getProperty(props.formData, props.valuePath);
11324
+ const value = getProperty(props.formData, props.valuePath);
11325
+ if (equals(value, currentValue.value))
11326
+ return;
11327
+ currentValue.value = value;
11313
11328
  initTreeValue();
11314
11329
  }, {
11315
11330
  deep: true
11316
11331
  });
11317
11332
  } else {
11318
11333
  watch(() => props.value, () => {
11334
+ const value = props.value;
11335
+ if (equals(value, currentValue.value))
11336
+ return;
11319
11337
  currentValue.value = props.value;
11320
11338
  initTreeValue();
11321
11339
  });
@@ -13708,6 +13726,8 @@ var DatePicker = defineComponent({
13708
13726
  return dayjs(value);
13709
13727
  };
13710
13728
  const initValue = () => {
13729
+ if (equals(getValue2.value, currentValue.value))
13730
+ return;
13711
13731
  if (isArray$2(getValue2.value)) {
13712
13732
  currentValue.value = [formatValue(getValue2.value[0] || null), formatValue(getValue2.value[1] || null)];
13713
13733
  } else
@@ -15969,10 +15989,8 @@ var Slider = defineComponent({
15969
15989
  };
15970
15990
  if (dynamicForm.value) {
15971
15991
  watch(() => props.formData, () => {
15972
- if (getValue2.value === currentValue.value)
15973
- return;
15974
- currentValue.value = getValue2.value;
15975
- setCheckStatus();
15992
+ currentValue.value = props.range ? getValue2.value : [getValue2.value, void 0];
15993
+ initPosition();
15976
15994
  }, {
15977
15995
  deep: true
15978
15996
  });