@fangzhongya/fang-ui 0.1.17 → 0.1.18

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.
@@ -53,11 +53,50 @@ function getFormRule(obj) {
53
53
  }
54
54
  }
55
55
  }
56
+ function setComputed(obj, v) {
57
+ if (obj.computed) {
58
+ if (obj.default) {
59
+ const value = obj.default;
60
+ if (obj.computed instanceof Array) {
61
+ obj.computed.forEach((k, i) => {
62
+ if (value instanceof Array) {
63
+ v[k] = value[i];
64
+ } else {
65
+ v[k] = value ? value[k] : void 0;
66
+ }
67
+ });
68
+ } else if (obj.computed.set) {
69
+ obj.computed.set(value, v, obj);
70
+ }
71
+ } else {
72
+ if (obj.prop) {
73
+ const r = v[obj.prop];
74
+ if (obj.computed instanceof Array) {
75
+ v[obj.prop] = obj.computed.map((k) => {
76
+ return v[k];
77
+ });
78
+ } else if (obj.computed.get) {
79
+ v[obj.prop] = obj.computed.get(r, v, obj);
80
+ }
81
+ obj.default = v[obj.prop];
82
+ } else {
83
+ if (obj.computed instanceof Array) {
84
+ obj.default = obj.computed.map((k) => {
85
+ return v[k];
86
+ });
87
+ } else if (obj.computed.get) {
88
+ obj.default = obj.computed.get(void 0, v, obj);
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
56
94
  function setFormDefaultValue(obj, value) {
57
95
  let v = util.getChildrenData(obj, value, true) ?? {};
58
96
  if (obj.orig) {
59
97
  v = value;
60
98
  }
99
+ setComputed(obj, v);
61
100
  const prop = obj.prop;
62
101
  if (prop) {
63
102
  if (obj.pars) {
@@ -51,11 +51,50 @@ function getFormRule(obj) {
51
51
  }
52
52
  }
53
53
  }
54
+ function setComputed(obj, v) {
55
+ if (obj.computed) {
56
+ if (obj.default) {
57
+ const value = obj.default;
58
+ if (obj.computed instanceof Array) {
59
+ obj.computed.forEach((k, i) => {
60
+ if (value instanceof Array) {
61
+ v[k] = value[i];
62
+ } else {
63
+ v[k] = value ? value[k] : void 0;
64
+ }
65
+ });
66
+ } else if (obj.computed.set) {
67
+ obj.computed.set(value, v, obj);
68
+ }
69
+ } else {
70
+ if (obj.prop) {
71
+ const r = v[obj.prop];
72
+ if (obj.computed instanceof Array) {
73
+ v[obj.prop] = obj.computed.map((k) => {
74
+ return v[k];
75
+ });
76
+ } else if (obj.computed.get) {
77
+ v[obj.prop] = obj.computed.get(r, v, obj);
78
+ }
79
+ obj.default = v[obj.prop];
80
+ } else {
81
+ if (obj.computed instanceof Array) {
82
+ obj.default = obj.computed.map((k) => {
83
+ return v[k];
84
+ });
85
+ } else if (obj.computed.get) {
86
+ obj.default = obj.computed.get(void 0, v, obj);
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
54
92
  function setFormDefaultValue(obj, value) {
55
93
  let v = getChildrenData(obj, value, true) ?? {};
56
94
  if (obj.orig) {
57
95
  v = value;
58
96
  }
97
+ setComputed(obj, v);
59
98
  const prop = obj.prop;
60
99
  if (prop) {
61
100
  if (obj.pars) {
@@ -1,7 +1,7 @@
1
- /**
2
- * @config cover=true
3
- */
4
- @use 'element-plus/theme-chalk/src/base.scss' as *;
5
- // @use '../../date-picker-panel/style/index2.scss' as *;
6
- @use 'element-plus/theme-chalk/src/popper.scss' as *;
7
- @use 'element-plus/theme-chalk/src/date-picker.scss' as *;
1
+ /**
2
+ * @config cover=true
3
+ */
4
+ @use 'element-plus/theme-chalk/src/base.scss' as *;
5
+ // @use '../../date-picker-panel/style/index2.scss' as *;
6
+ @use 'element-plus/theme-chalk/src/popper.scss' as *;
7
+ @use 'element-plus/theme-chalk/src/date-picker.scss' as *;
@@ -95,6 +95,20 @@ function setUp(props, emit, cs, refForm, getLocale) {
95
95
  }
96
96
  return setObjStyle.setObjStyle(vst, obj);
97
97
  }
98
+ function setReset() {
99
+ const setListValue = (arr, listobj) => {
100
+ arr == null ? void 0 : arr.forEach((obj) => {
101
+ if (listobj) {
102
+ obj.father = obj.father ?? listobj;
103
+ }
104
+ if (obj.children) {
105
+ setListValue(obj.children, obj);
106
+ }
107
+ use.setFormDefaultValue(obj, dataForm.value);
108
+ });
109
+ };
110
+ setListValue(props.list);
111
+ }
98
112
  function getRules() {
99
113
  const rules = {};
100
114
  const setListValue = (arr, listobj) => {
@@ -106,9 +120,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
106
120
  if (obj.children) {
107
121
  setListValue(obj.children, obj);
108
122
  }
109
- if (obj.prop) {
110
- use.setFormDefaultValue(obj, dataForm.value);
111
- }
123
+ use.setFormDefaultValue(obj, dataForm.value);
112
124
  let trigger = 1;
113
125
  if (typeof obj.compon == "string") {
114
126
  if (Changes.includes(lineToLargeHump.lineToLargeHump(obj.compon))) {
@@ -199,6 +211,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
199
211
  function resetFields() {
200
212
  var _a;
201
213
  (_a = refForm.value) == null ? void 0 : _a.resetFields();
214
+ setReset();
202
215
  }
203
216
  function validateField(...arr) {
204
217
  var _a;
@@ -93,6 +93,20 @@ function setUp(props, emit, cs, refForm, getLocale) {
93
93
  }
94
94
  return setObjStyle(vst, obj);
95
95
  }
96
+ function setReset() {
97
+ const setListValue = (arr, listobj) => {
98
+ arr == null ? void 0 : arr.forEach((obj) => {
99
+ if (listobj) {
100
+ obj.father = obj.father ?? listobj;
101
+ }
102
+ if (obj.children) {
103
+ setListValue(obj.children, obj);
104
+ }
105
+ setFormDefaultValue(obj, dataForm.value);
106
+ });
107
+ };
108
+ setListValue(props.list);
109
+ }
96
110
  function getRules() {
97
111
  const rules = {};
98
112
  const setListValue = (arr, listobj) => {
@@ -104,9 +118,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
104
118
  if (obj.children) {
105
119
  setListValue(obj.children, obj);
106
120
  }
107
- if (obj.prop) {
108
- setFormDefaultValue(obj, dataForm.value);
109
- }
121
+ setFormDefaultValue(obj, dataForm.value);
110
122
  let trigger = 1;
111
123
  if (typeof obj.compon == "string") {
112
124
  if (Changes.includes(lineToLargeHump(obj.compon))) {
@@ -197,6 +209,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
197
209
  function resetFields() {
198
210
  var _a;
199
211
  (_a = refForm.value) == null ? void 0 : _a.resetFields();
212
+ setReset();
200
213
  }
201
214
  function validateField(...arr) {
202
215
  var _a;
@@ -5,6 +5,7 @@ const data = require("./data.cjs");
5
5
  require("../../../utils/index.cjs");
6
6
  const index = require("../../../hooks/cssname/index.cjs");
7
7
  const use = require("../../common/use.cjs");
8
+ const isEqual = require("@fangzhongya/utils/basic/object/isEqual");
8
9
  const index$1 = require("../../../hooks/props-default/index.cjs");
9
10
  const data$1 = require("../../forms/src/data.cjs");
10
11
  const objValue = require("@fangzhongya/utils/basic/object/objValue");
@@ -20,7 +21,6 @@ const _sfc_main = vue.defineComponent({
20
21
  const prs = index$1.usePropsDefault(data.name, p, data.dataProps);
21
22
  index$1.viewProps(prs, data.name);
22
23
  const props = prs.listobj;
23
- console.log("props", props);
24
24
  const compons = vue.inject(data$1.provides.compons, {});
25
25
  const formvalue = vue.computed(() => {
26
26
  const o = {};
@@ -59,13 +59,24 @@ const _sfc_main = vue.defineComponent({
59
59
  r = z;
60
60
  }
61
61
  if (props.computed) {
62
+ let c;
62
63
  if (props.computed instanceof Array) {
63
- r = props.computed.map((k) => {
64
+ c = props.computed.map((k) => {
64
65
  return v[k];
65
66
  });
66
67
  } else if (props.computed.get) {
67
- r = props.computed.get(r, v, props);
68
+ c = props.computed.get(r, v, props);
68
69
  }
70
+ if (prop) {
71
+ if (!isEqual.isEqual(c, r)) {
72
+ if (props.pars) {
73
+ objValue.setObjValue(v, prop, c);
74
+ } else {
75
+ v[prop] = c;
76
+ }
77
+ }
78
+ }
79
+ r = c;
69
80
  }
70
81
  return r;
71
82
  },
@@ -3,6 +3,7 @@ import { name, dataProps, dataEmits, dataExpose } from "./data.js";
3
3
  import "../../../utils/index.js";
4
4
  import { useCssName } from "../../../hooks/cssname/index.js";
5
5
  import { getOnObjs } from "../../common/use.js";
6
+ import { isEqual } from "@fangzhongya/utils/basic/object/isEqual";
6
7
  import { usePropsDefault, viewProps, getProps } from "../../../hooks/props-default/index.js";
7
8
  import { provides } from "../../forms/src/data.js";
8
9
  import { setObjValue, getObjValue } from "@fangzhongya/utils/basic/object/objValue";
@@ -18,7 +19,6 @@ const _sfc_main = defineComponent({
18
19
  const prs = usePropsDefault(name, p, dataProps);
19
20
  viewProps(prs, name);
20
21
  const props = prs.listobj;
21
- console.log("props", props);
22
22
  const compons = inject(provides.compons, {});
23
23
  const formvalue = computed(() => {
24
24
  const o = {};
@@ -57,13 +57,24 @@ const _sfc_main = defineComponent({
57
57
  r = z;
58
58
  }
59
59
  if (props.computed) {
60
+ let c;
60
61
  if (props.computed instanceof Array) {
61
- r = props.computed.map((k) => {
62
+ c = props.computed.map((k) => {
62
63
  return v[k];
63
64
  });
64
65
  } else if (props.computed.get) {
65
- r = props.computed.get(r, v, props);
66
+ c = props.computed.get(r, v, props);
66
67
  }
68
+ if (prop) {
69
+ if (!isEqual(c, r)) {
70
+ if (props.pars) {
71
+ setObjValue(v, prop, c);
72
+ } else {
73
+ v[prop] = c;
74
+ }
75
+ }
76
+ }
77
+ r = c;
67
78
  }
68
79
  return r;
69
80
  },
@@ -481,7 +481,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
481
481
  function getFrontPaginatValue(obj) {
482
482
  var _a2;
483
483
  if (paginat.is && paginat.front) {
484
- const list = obj.value;
484
+ const list = obj.value || [];
485
485
  const total = list.length;
486
486
  const c = paginat.current;
487
487
  const z = paginat.pageSize;
@@ -479,7 +479,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
479
479
  function getFrontPaginatValue(obj) {
480
480
  var _a2;
481
481
  if (paginat.is && paginat.front) {
482
- const list = obj.value;
482
+ const list = obj.value || [];
483
483
  const total = list.length;
484
484
  const c = paginat.current;
485
485
  const z = paginat.pageSize;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1762755193836,
4
+ "lastModified": 1762769052882,
5
5
  "icons": {
6
6
  "bar": {
7
7
  "body": " <path fill=\"currentColor\" d=\"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z\" ></path> "
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/fang-ui",
3
3
  "private": false,
4
- "version": "0.1.17",
4
+ "version": "0.1.18",
5
5
  "type": "module",
6
6
  "description ": "fang-ui",
7
7
  "keywords": [
@@ -24,7 +24,7 @@
24
24
  "fangui": "bin/fang-ui.js"
25
25
  },
26
26
  "dependencies": {
27
- "@fangzhongya/utils": "0.0.45"
27
+ "@fangzhongya/utils": "0.0.46"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@fangzhongya/create": "0.2.41",
@@ -48,14 +48,14 @@
48
48
  "vue": "^3.5.24",
49
49
  "vue-tsc": "^3.1.3",
50
50
  "vuedraggable": "4.1.0",
51
- "vxe-table": "4.17.12",
51
+ "vxe-table": "4.17.13",
52
+ "@fang-ui/hooks": "0.0.1-0",
52
53
  "@fang-ui/components": "0.0.1-0",
54
+ "@fang-ui/locale": "0.0.1-0",
53
55
  "@fang-ui/icons": "0.0.1-0",
54
- "@fang-ui/hooks": "0.0.1-0",
56
+ "@fang-ui/utils": "0.0.1-0",
55
57
  "@fang-ui/directives": "0.0.1-0",
56
- "@fang-ui/locale": "0.0.1-0",
57
58
  "@fang-ui/theme": "0.0.1-0",
58
- "@fang-ui/utils": "0.0.1-0",
59
59
  "@fang-ui/types": "0.0.1-0"
60
60
  },
61
61
  "main": "./dist/index.cjs",
File without changes
File without changes