@fangzhongya/fang-ui 0.1.17 → 0.1.19

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;
@@ -29,6 +29,12 @@ const dataProps = {
29
29
  valueobj: {
30
30
  type: Object
31
31
  },
32
+ compon: {
33
+ type: [String, Object]
34
+ },
35
+ componValueName: {
36
+ type: String
37
+ },
32
38
  /**
33
39
  * 传入值
34
40
  * @props { Object } modelValue={} ( )
@@ -27,6 +27,12 @@ export declare const dataProps: {
27
27
  valueobj: {
28
28
  type: ObjectConstructor;
29
29
  };
30
+ compon: {
31
+ type: (ObjectConstructor | StringConstructor)[];
32
+ };
33
+ componValueName: {
34
+ type: StringConstructor;
35
+ };
30
36
  /**
31
37
  * 传入值
32
38
  * @props { Object } modelValue={} ( )
@@ -27,6 +27,12 @@ const dataProps = {
27
27
  valueobj: {
28
28
  type: Object
29
29
  },
30
+ compon: {
31
+ type: [String, Object]
32
+ },
33
+ componValueName: {
34
+ type: String
35
+ },
30
36
  /**
31
37
  * 传入值
32
38
  * @props { Object } modelValue={} ( )
@@ -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 = {};
@@ -32,6 +32,31 @@ const _sfc_main = vue.defineComponent({
32
32
  }
33
33
  return o;
34
34
  });
35
+ const record = vue.ref();
36
+ const setPropComputedValue = (prop, computed2, value2) => {
37
+ if (!isEqual.isEqual(prop, computed2)) {
38
+ if (prop !== record.value) {
39
+ if (props.computed instanceof Array) {
40
+ props.computed.forEach((k, i) => {
41
+ if (prop instanceof Array) {
42
+ value2[k] = prop[i];
43
+ } else {
44
+ value2[k] = prop ? prop[k] : void 0;
45
+ }
46
+ });
47
+ } else if (props.computed.set) {
48
+ props.computed.set(prop, value2, props);
49
+ }
50
+ } else {
51
+ if (props.pars) {
52
+ objValue.setObjValue(value2, props.prop, computed2);
53
+ } else {
54
+ value2[props.prop] = computed2;
55
+ }
56
+ }
57
+ }
58
+ record.value = prop;
59
+ };
35
60
  const binds = vue.computed(() => {
36
61
  const obj = { ...props.config, ...formvalue.value };
37
62
  const binds2 = {};
@@ -59,13 +84,18 @@ const _sfc_main = vue.defineComponent({
59
84
  r = z;
60
85
  }
61
86
  if (props.computed) {
87
+ let c;
62
88
  if (props.computed instanceof Array) {
63
- r = props.computed.map((k) => {
89
+ c = props.computed.map((k) => {
64
90
  return v[k];
65
91
  });
66
92
  } else if (props.computed.get) {
67
- r = props.computed.get(r, v, props);
93
+ c = props.computed.get(r, v, props);
94
+ }
95
+ if (prop) {
96
+ setPropComputedValue(r, c, v);
68
97
  }
98
+ r = c;
69
99
  }
70
100
  return r;
71
101
  },
@@ -116,8 +146,8 @@ const _sfc_main = vue.defineComponent({
116
146
  }
117
147
  });
118
148
  const render = () => {
119
- const compon = props.compon || "input";
120
- const componValueName = "modelValue";
149
+ const compon = props.compon || prs.compon || "input";
150
+ const componValueName = prs.componValueName || "modelValue";
121
151
  const componObj = {
122
152
  ...binds.value,
123
153
  ...use.getOnObjs(
@@ -1,8 +1,9 @@
1
- import { defineComponent, inject, computed, h, resolveComponent } from "vue";
1
+ import { defineComponent, inject, computed, ref, h, resolveComponent } from "vue";
2
2
  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 = {};
@@ -30,6 +30,31 @@ const _sfc_main = defineComponent({
30
30
  }
31
31
  return o;
32
32
  });
33
+ const record = ref();
34
+ const setPropComputedValue = (prop, computed2, value2) => {
35
+ if (!isEqual(prop, computed2)) {
36
+ if (prop !== record.value) {
37
+ if (props.computed instanceof Array) {
38
+ props.computed.forEach((k, i) => {
39
+ if (prop instanceof Array) {
40
+ value2[k] = prop[i];
41
+ } else {
42
+ value2[k] = prop ? prop[k] : void 0;
43
+ }
44
+ });
45
+ } else if (props.computed.set) {
46
+ props.computed.set(prop, value2, props);
47
+ }
48
+ } else {
49
+ if (props.pars) {
50
+ setObjValue(value2, props.prop, computed2);
51
+ } else {
52
+ value2[props.prop] = computed2;
53
+ }
54
+ }
55
+ }
56
+ record.value = prop;
57
+ };
33
58
  const binds = computed(() => {
34
59
  const obj = { ...props.config, ...formvalue.value };
35
60
  const binds2 = {};
@@ -57,13 +82,18 @@ const _sfc_main = defineComponent({
57
82
  r = z;
58
83
  }
59
84
  if (props.computed) {
85
+ let c;
60
86
  if (props.computed instanceof Array) {
61
- r = props.computed.map((k) => {
87
+ c = props.computed.map((k) => {
62
88
  return v[k];
63
89
  });
64
90
  } else if (props.computed.get) {
65
- r = props.computed.get(r, v, props);
91
+ c = props.computed.get(r, v, props);
92
+ }
93
+ if (prop) {
94
+ setPropComputedValue(r, c, v);
66
95
  }
96
+ r = c;
67
97
  }
68
98
  return r;
69
99
  },
@@ -114,8 +144,8 @@ const _sfc_main = defineComponent({
114
144
  }
115
145
  });
116
146
  const render = () => {
117
- const compon = props.compon || "input";
118
- const componValueName = "modelValue";
147
+ const compon = props.compon || prs.compon || "input";
148
+ const componValueName = prs.componValueName || "modelValue";
119
149
  const componObj = {
120
150
  ...binds.value,
121
151
  ...getOnObjs(
@@ -117,4 +117,5 @@
117
117
  @use './tables/index.scss' as *;
118
118
  @use './tablesp/index.scss' as *;
119
119
  @use './tabless/index.scss' as *;
120
- @use './tablesv/index.scss' as *;
120
+ @use './tablesv/index.scss' as *;
121
+ @use './tablesvp/index.scss' as *;
@@ -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;
@@ -1772,4 +1772,26 @@
1772
1772
  left: 0;
1773
1773
  z-index: 1;
1774
1774
  opacity: 0;
1775
+ }
1776
+
1777
+ .tablesvp {
1778
+ width: 100%;
1779
+ height: var(--tablesvp-height);
1780
+ display: flex;
1781
+ flex-direction: column;
1782
+ }
1783
+ .tablesvp-main {
1784
+ display: flex;
1785
+ flex-direction: column;
1786
+ flex: 1;
1787
+ width: 100%;
1788
+ }
1789
+ .tablesvp-main.is-radio .el-table__header .el-table-column--selection .el-checkbox {
1790
+ display: none;
1791
+ }
1792
+ .tablesvp-paginat {
1793
+ overflow: hidden;
1794
+ }
1795
+ .tablesvp-paginat .el-pagination {
1796
+ justify-content: flex-end;
1775
1797
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1762755193836,
4
+ "lastModified": 1762779395198,
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/dist/index.css CHANGED
@@ -1772,4 +1772,26 @@
1772
1772
  left: 0;
1773
1773
  z-index: 1;
1774
1774
  opacity: 0;
1775
+ }
1776
+
1777
+ .tablesvp {
1778
+ width: 100%;
1779
+ height: var(--tablesvp-height);
1780
+ display: flex;
1781
+ flex-direction: column;
1782
+ }
1783
+ .tablesvp-main {
1784
+ display: flex;
1785
+ flex-direction: column;
1786
+ flex: 1;
1787
+ width: 100%;
1788
+ }
1789
+ .tablesvp-main.is-radio .el-table__header .el-table-column--selection .el-checkbox {
1790
+ display: none;
1791
+ }
1792
+ .tablesvp-paginat {
1793
+ overflow: hidden;
1794
+ }
1795
+ .tablesvp-paginat .el-pagination {
1796
+ justify-content: flex-end;
1775
1797
  }
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.19",
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,15 +48,15 @@
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
52
  "@fang-ui/components": "0.0.1-0",
53
+ "@fang-ui/directives": "0.0.1-0",
53
54
  "@fang-ui/icons": "0.0.1-0",
54
55
  "@fang-ui/hooks": "0.0.1-0",
55
- "@fang-ui/directives": "0.0.1-0",
56
56
  "@fang-ui/locale": "0.0.1-0",
57
57
  "@fang-ui/theme": "0.0.1-0",
58
- "@fang-ui/utils": "0.0.1-0",
59
- "@fang-ui/types": "0.0.1-0"
58
+ "@fang-ui/types": "0.0.1-0",
59
+ "@fang-ui/utils": "0.0.1-0"
60
60
  },
61
61
  "main": "./dist/index.cjs",
62
62
  "module": "./dist/index.js",
File without changes
File without changes