@fangzhongya/fang-ui 0.1.1 → 0.1.3

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.
@@ -190,7 +190,7 @@ function setComponString(value, obj, componObj, data, optionss, compons) {
190
190
  if (Object.keys(compons).includes(tcom)) {
191
191
  return vue.h(compons[tcom], componObj);
192
192
  } else {
193
- return vue.h(compon, componObj);
193
+ return vue.h(vue.resolveComponent(compon), componObj);
194
194
  }
195
195
  }
196
196
  function getOnObjs(obj, data, emit, ...arrs) {
@@ -204,15 +204,15 @@ function getOnObjs(obj, data, emit, ...arrs) {
204
204
  ml = firstLower.firstLower(lineToLargeHump.lineToLargeHump(ml));
205
205
  objs[ml] = (...v) => {
206
206
  if (es[key] && typeof es[key] == "function") {
207
- es[key](...v, data, obj);
207
+ es[key](...v, data, obj, ...arrs);
208
208
  } else {
209
- emit("list-events", key, ...v, data, obj, ...arrs);
209
+ emit("list-events", es[key] || key, ...v, data, obj, ...arrs);
210
210
  }
211
211
  };
212
212
  });
213
213
  return objs;
214
214
  }
215
- function useSetSlot(obj, data, slots, index) {
215
+ function useSetSlot(obj, data, slots, index, scope) {
216
216
  const slotname = obj.slot ?? obj.prop;
217
217
  if (slotname) {
218
218
  const slot = slots[slotname];
@@ -226,6 +226,7 @@ function useSetSlot(obj, data, slots, index) {
226
226
  }
227
227
  });
228
228
  return slot({
229
+ comscope: scope,
229
230
  column: obj,
230
231
  row: data,
231
232
  value,
@@ -234,18 +235,21 @@ function useSetSlot(obj, data, slots, index) {
234
235
  }
235
236
  }
236
237
  }
237
- function useSetCompon(obj, data, optionss, compons, emit, index) {
238
+ function useSetCompon(obj, data, optionss, compons, emit, index, scope) {
238
239
  if (obj.compon) {
239
240
  const value = getValue(obj, data, index);
240
241
  const componValueName = obj.componValueName || "modelValue";
242
+ const attrs = vue.useAttrs();
241
243
  const componObj = {
244
+ ...attrs,
242
245
  ...obj.config,
243
- ...getOnObjs(obj, data, emit),
246
+ ...getOnObjs(obj, data, emit, scope),
244
247
  multiple: obj.multiple,
245
248
  [componValueName]: value,
246
249
  ["onUpdate:" + componValueName]: (v) => setValue(v, obj, data),
247
250
  listobj: obj,
248
- valueobj: data
251
+ valueobj: data,
252
+ comscope: scope
249
253
  };
250
254
  if (typeof obj.compon == "string") {
251
255
  return setComponString(
@@ -10,8 +10,8 @@ export declare function getOnObjs(obj: ListObj, data: ObjAny, emit: Function, ..
10
10
  type Compons = {
11
11
  [key: string]: Component;
12
12
  };
13
- export declare function useSetSlot(obj: ListObj, data: ObjAny, slots: ObjAny, index?: number): any;
14
- export declare function useSetCompon(obj: ListObj, data: ObjAny, optionss: ObjAny, compons: Compons, emit: Function, index?: number): VNode<RendererNode, RendererElement, {
13
+ export declare function useSetSlot(obj: ListObj, data: ObjAny, slots: ObjAny, index?: number, scope?: ObjAny): any;
14
+ export declare function useSetCompon(obj: ListObj, data: ObjAny, optionss: ObjAny, compons: Compons, emit: Function, index?: number, scope?: ObjAny): VNode<RendererNode, RendererElement, {
15
15
  [key: string]: any;
16
16
  }> | undefined;
17
17
  export declare const useGetDomValue: (obj: ListObj, data: ObjAny, options: ObjAny, index?: number) => any;
@@ -1,4 +1,4 @@
1
- import { h, computed } from "vue";
1
+ import { h, resolveComponent, computed, useAttrs } from "vue";
2
2
  import "../../utils/index.js";
3
3
  import { isObject } from "@fangzhongya/utils/basic/object/isObject";
4
4
  import { getFathers, getChildrenData } from "../../utils/util.js";
@@ -188,7 +188,7 @@ function setComponString(value, obj, componObj, data, optionss, compons) {
188
188
  if (Object.keys(compons).includes(tcom)) {
189
189
  return h(compons[tcom], componObj);
190
190
  } else {
191
- return h(compon, componObj);
191
+ return h(resolveComponent(compon), componObj);
192
192
  }
193
193
  }
194
194
  function getOnObjs(obj, data, emit, ...arrs) {
@@ -202,15 +202,15 @@ function getOnObjs(obj, data, emit, ...arrs) {
202
202
  ml = firstLower(lineToLargeHump(ml));
203
203
  objs[ml] = (...v) => {
204
204
  if (es[key] && typeof es[key] == "function") {
205
- es[key](...v, data, obj);
205
+ es[key](...v, data, obj, ...arrs);
206
206
  } else {
207
- emit("list-events", key, ...v, data, obj, ...arrs);
207
+ emit("list-events", es[key] || key, ...v, data, obj, ...arrs);
208
208
  }
209
209
  };
210
210
  });
211
211
  return objs;
212
212
  }
213
- function useSetSlot(obj, data, slots, index) {
213
+ function useSetSlot(obj, data, slots, index, scope) {
214
214
  const slotname = obj.slot ?? obj.prop;
215
215
  if (slotname) {
216
216
  const slot = slots[slotname];
@@ -224,6 +224,7 @@ function useSetSlot(obj, data, slots, index) {
224
224
  }
225
225
  });
226
226
  return slot({
227
+ comscope: scope,
227
228
  column: obj,
228
229
  row: data,
229
230
  value,
@@ -232,18 +233,21 @@ function useSetSlot(obj, data, slots, index) {
232
233
  }
233
234
  }
234
235
  }
235
- function useSetCompon(obj, data, optionss, compons, emit, index) {
236
+ function useSetCompon(obj, data, optionss, compons, emit, index, scope) {
236
237
  if (obj.compon) {
237
238
  const value = getValue(obj, data, index);
238
239
  const componValueName = obj.componValueName || "modelValue";
240
+ const attrs = useAttrs();
239
241
  const componObj = {
242
+ ...attrs,
240
243
  ...obj.config,
241
- ...getOnObjs(obj, data, emit),
244
+ ...getOnObjs(obj, data, emit, scope),
242
245
  multiple: obj.multiple,
243
246
  [componValueName]: value,
244
247
  ["onUpdate:" + componValueName]: (v) => setValue(v, obj, data),
245
248
  listobj: obj,
246
- valueobj: data
249
+ valueobj: data,
250
+ comscope: scope
247
251
  };
248
252
  if (typeof obj.compon == "string") {
249
253
  return setComponString(
@@ -116,5 +116,5 @@
116
116
  @use './paging/index.scss' as *;
117
117
  @use './tables/index.scss' as *;
118
118
  @use './tablesp/index.scss' as *;
119
- @use './tabless/index.scss' as *;
120
- @use './tablesv/index.scss' as *;
119
+ @use './tablesv/index.scss' as *;
120
+ @use './tablesvp/index.scss' as *;
@@ -110,11 +110,11 @@
110
110
  @use './switchs/style/index2.scss' as *;
111
111
  @use './texts/style/index2.scss' as *;
112
112
  @use './uploads/style/index2.scss' as *;
113
- @use './list/style/index.scss' as *;
113
+ @use './list/style/index2.scss' as *;
114
114
  @use './lists/style/index2.scss' as *;
115
115
  @use './listsp/style/index2.scss' as *;
116
116
  @use './paging/style/index2.scss' as *;
117
117
  @use './tables/style/index2.scss' as *;
118
118
  @use './tablesp/style/index2.scss' as *;
119
- @use './tabless/style/index2.scss' as *;
120
- @use './tablesv/style/index2.scss' as *;
119
+ @use './tablesv/style/index2.scss' as *;
120
+ @use './tablesvp/style/index2.scss' as *;
@@ -0,0 +1 @@
1
+ @use '../index.scss' as *;
@@ -3,22 +3,18 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  const vue = require("vue");
4
4
  const index = require("../../button/index.cjs");
5
5
  const util = require("./util.cjs");
6
- const isObject = require("@fangzhongya/utils/basic/object/isObject");
7
- const isArray = require("@fangzhongya/utils/basic/array/isArray");
8
6
  const _hoisted_1 = { class: "table-but" };
9
7
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
10
8
  __name: "table-but",
11
9
  props: {
12
- /**
13
- * table列表
14
- * {
15
- * label:"列表名称"
16
- * prop:"列表取值"
17
- * type:"列表类型"
18
- * }
19
- *
20
- */
21
- tableListObj: {
10
+ list: {
11
+ type: Array
12
+ },
13
+ isText: { type: Boolean },
14
+ isHide: {
15
+ type: Boolean
16
+ },
17
+ listobj: {
22
18
  type: Object,
23
19
  default() {
24
20
  return {};
@@ -29,82 +25,95 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
29
25
  * row, column, $index
30
26
  *
31
27
  */
32
- tableScope: {
28
+ valueobj: {
29
+ type: Object,
30
+ default() {
31
+ return {};
32
+ }
33
+ },
34
+ comscope: {
33
35
  type: Object,
34
36
  default() {
35
37
  return {};
36
38
  }
37
39
  }
38
40
  },
39
- emits: ["scope-click"],
41
+ emits: ["but"],
40
42
  setup(__props, { emit: __emit }) {
41
43
  const props = __props;
42
44
  const emit = __emit;
43
- function setValue(v) {
44
- if (isArray.isArray(v)) {
45
- return v;
46
- } else if (isObject.isObject(v)) {
47
- return [v];
45
+ function setShow(item) {
46
+ if (item.formatter) {
47
+ return item.formatter(
48
+ props.valueobj,
49
+ props.listobj,
50
+ item,
51
+ 0,
52
+ props.comscope
53
+ );
54
+ } else {
55
+ return false;
56
+ }
57
+ }
58
+ function getHide(item) {
59
+ if (props.isHide) {
60
+ return !setShow(item);
48
61
  } else {
49
- return [
50
- {
51
- value: v
52
- }
53
- ];
62
+ if (item.hide) {
63
+ return item.hide;
64
+ } else {
65
+ return true;
66
+ }
54
67
  }
55
68
  }
56
- function getValue(row, column, cellValue, index2, formatter) {
57
- if (formatter) {
58
- const v = formatter(row, column, cellValue, index2);
59
- return setValue(v);
69
+ function getDisabled(item) {
70
+ if (props.isHide) {
71
+ if (item.disabled) {
72
+ return item.disabled;
73
+ } else {
74
+ return false;
75
+ }
60
76
  } else {
61
- return setValue(cellValue);
77
+ return setShow(item);
62
78
  }
63
79
  }
64
80
  function onClick(obj, $event) {
81
+ var _a;
65
82
  util.eventAliass(
66
83
  (callback) => {
67
- callback(obj, props.tableScope, props.tableListObj, "but");
84
+ callback(
85
+ "but",
86
+ obj,
87
+ props.valueobj,
88
+ props.listobj,
89
+ props.comscope
90
+ );
68
91
  },
69
92
  "click",
70
- props.tableListObj,
93
+ ((_a = props.listobj) == null ? void 0 : _a.events) || {},
71
94
  $event
72
95
  );
73
- emit("scope-click", obj, props.tableScope, props.tableListObj, "but");
96
+ emit("but", obj);
74
97
  }
75
- const valueArr = vue.computed(() => {
76
- var _a;
77
- const prop = props.tableListObj.prop || "";
78
- const row = props.tableScope.row || {};
79
- const column = props.tableScope.column || {};
80
- const cellValue = row[prop];
81
- const index2 = props.tableScope.$index;
82
- const formatter = props.tableListObj.formatter;
83
- const configFormatter = (_a = props.tableListObj.config) == null ? void 0 : _a.formatter;
84
- if (configFormatter) {
85
- const arr = configFormatter(row, column, cellValue, index2);
86
- return setValue(arr);
87
- } else {
88
- return getValue(row, column, cellValue, index2, formatter);
89
- }
90
- });
91
98
  return (_ctx, _cache) => {
92
99
  return vue.openBlock(), vue.createElementBlock("span", _hoisted_1, [
93
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(valueArr.value, (item, index$1) => {
94
- return vue.openBlock(), vue.createBlock(vue.unref(index.Button), {
95
- class: vue.normalizeClass(["table-but-li", item.class]),
96
- key: index$1,
97
- style: vue.normalizeStyle(item.style),
98
- onClick: ($event) => onClick(item, $event),
99
- type: item.type,
100
- round: item.round,
101
- text: typeof item.text == "undefined" ? true : item.text
102
- }, {
103
- default: vue.withCtx(() => [
104
- vue.createTextVNode(vue.toDisplayString(item.value), 1)
105
- ]),
106
- _: 2
107
- }, 1032, ["class", "style", "onClick", "type", "round", "text"]);
100
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.list, (item, index$1) => {
101
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: index$1 }, [
102
+ getHide(item) ? (vue.openBlock(), vue.createBlock(vue.unref(index.Button), vue.mergeProps({
103
+ key: 0,
104
+ class: "table-but-li"
105
+ }, { ref_for: true }, item, {
106
+ link: props.isText ? true : item.link,
107
+ type: item.type ?? "primary",
108
+ disabled: getDisabled(item),
109
+ onClick: ($event) => onClick(item, $event)
110
+ }), {
111
+ default: vue.withCtx(() => [
112
+ vue.createTextVNode(vue.toDisplayString(item.label), 1)
113
+ ]),
114
+ _: 2
115
+ }, 1040, ["link", "type", "disabled", "onClick"])) : vue.createCommentVNode("", true)
116
+ ], 64);
108
117
  }), 128))
109
118
  ]);
110
119
  };
@@ -1,22 +1,18 @@
1
- import { defineComponent, computed, createElementBlock, openBlock, Fragment, renderList, createBlock, unref, normalizeStyle, normalizeClass, withCtx, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, createElementBlock, openBlock, Fragment, renderList, createBlock, createCommentVNode, unref, mergeProps, withCtx, createTextVNode, toDisplayString } from "vue";
2
2
  import { Button } from "../../button/index.js";
3
3
  import { eventAliass } from "./util.js";
4
- import { isObject } from "@fangzhongya/utils/basic/object/isObject";
5
- import { isArray } from "@fangzhongya/utils/basic/array/isArray";
6
4
  const _hoisted_1 = { class: "table-but" };
7
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
6
  __name: "table-but",
9
7
  props: {
10
- /**
11
- * table列表
12
- * {
13
- * label:"列表名称"
14
- * prop:"列表取值"
15
- * type:"列表类型"
16
- * }
17
- *
18
- */
19
- tableListObj: {
8
+ list: {
9
+ type: Array
10
+ },
11
+ isText: { type: Boolean },
12
+ isHide: {
13
+ type: Boolean
14
+ },
15
+ listobj: {
20
16
  type: Object,
21
17
  default() {
22
18
  return {};
@@ -27,82 +23,95 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
23
  * row, column, $index
28
24
  *
29
25
  */
30
- tableScope: {
26
+ valueobj: {
27
+ type: Object,
28
+ default() {
29
+ return {};
30
+ }
31
+ },
32
+ comscope: {
31
33
  type: Object,
32
34
  default() {
33
35
  return {};
34
36
  }
35
37
  }
36
38
  },
37
- emits: ["scope-click"],
39
+ emits: ["but"],
38
40
  setup(__props, { emit: __emit }) {
39
41
  const props = __props;
40
42
  const emit = __emit;
41
- function setValue(v) {
42
- if (isArray(v)) {
43
- return v;
44
- } else if (isObject(v)) {
45
- return [v];
43
+ function setShow(item) {
44
+ if (item.formatter) {
45
+ return item.formatter(
46
+ props.valueobj,
47
+ props.listobj,
48
+ item,
49
+ 0,
50
+ props.comscope
51
+ );
52
+ } else {
53
+ return false;
54
+ }
55
+ }
56
+ function getHide(item) {
57
+ if (props.isHide) {
58
+ return !setShow(item);
46
59
  } else {
47
- return [
48
- {
49
- value: v
50
- }
51
- ];
60
+ if (item.hide) {
61
+ return item.hide;
62
+ } else {
63
+ return true;
64
+ }
52
65
  }
53
66
  }
54
- function getValue(row, column, cellValue, index, formatter) {
55
- if (formatter) {
56
- const v = formatter(row, column, cellValue, index);
57
- return setValue(v);
67
+ function getDisabled(item) {
68
+ if (props.isHide) {
69
+ if (item.disabled) {
70
+ return item.disabled;
71
+ } else {
72
+ return false;
73
+ }
58
74
  } else {
59
- return setValue(cellValue);
75
+ return setShow(item);
60
76
  }
61
77
  }
62
78
  function onClick(obj, $event) {
79
+ var _a;
63
80
  eventAliass(
64
81
  (callback) => {
65
- callback(obj, props.tableScope, props.tableListObj, "but");
82
+ callback(
83
+ "but",
84
+ obj,
85
+ props.valueobj,
86
+ props.listobj,
87
+ props.comscope
88
+ );
66
89
  },
67
90
  "click",
68
- props.tableListObj,
91
+ ((_a = props.listobj) == null ? void 0 : _a.events) || {},
69
92
  $event
70
93
  );
71
- emit("scope-click", obj, props.tableScope, props.tableListObj, "but");
94
+ emit("but", obj);
72
95
  }
73
- const valueArr = computed(() => {
74
- var _a;
75
- const prop = props.tableListObj.prop || "";
76
- const row = props.tableScope.row || {};
77
- const column = props.tableScope.column || {};
78
- const cellValue = row[prop];
79
- const index = props.tableScope.$index;
80
- const formatter = props.tableListObj.formatter;
81
- const configFormatter = (_a = props.tableListObj.config) == null ? void 0 : _a.formatter;
82
- if (configFormatter) {
83
- const arr = configFormatter(row, column, cellValue, index);
84
- return setValue(arr);
85
- } else {
86
- return getValue(row, column, cellValue, index, formatter);
87
- }
88
- });
89
96
  return (_ctx, _cache) => {
90
97
  return openBlock(), createElementBlock("span", _hoisted_1, [
91
- (openBlock(true), createElementBlock(Fragment, null, renderList(valueArr.value, (item, index) => {
92
- return openBlock(), createBlock(unref(Button), {
93
- class: normalizeClass(["table-but-li", item.class]),
94
- key: index,
95
- style: normalizeStyle(item.style),
96
- onClick: ($event) => onClick(item, $event),
97
- type: item.type,
98
- round: item.round,
99
- text: typeof item.text == "undefined" ? true : item.text
100
- }, {
101
- default: withCtx(() => [
102
- createTextVNode(toDisplayString(item.value), 1)
103
- ]),
104
- _: 2
105
- }, 1032, ["class", "style", "onClick", "type", "round", "text"]);
98
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props.list, (item, index) => {
99
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
100
+ getHide(item) ? (openBlock(), createBlock(unref(Button), mergeProps({
101
+ key: 0,
102
+ class: "table-but-li"
103
+ }, { ref_for: true }, item, {
104
+ link: props.isText ? true : item.link,
105
+ type: item.type ?? "primary",
106
+ disabled: getDisabled(item),
107
+ onClick: ($event) => onClick(item, $event)
108
+ }), {
109
+ default: withCtx(() => [
110
+ createTextVNode(toDisplayString(item.label), 1)
111
+ ]),
112
+ _: 2
113
+ }, 1040, ["link", "type", "disabled", "onClick"])) : createCommentVNode("", true)
114
+ ], 64);
106
115
  }), 128))
107
116
  ]);
108
117
  };
@@ -2,21 +2,23 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const vue = require("vue");
4
4
  const util = require("./util.cjs");
5
- const isObject = require("@fangzhongya/utils/basic/object/isObject");
6
- const _hoisted_1 = { class: "table-color-value" };
7
5
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
8
6
  __name: "table-color",
9
7
  props: {
10
- /**
11
- * table列表
12
- * {
13
- * label:"列表名称"
14
- * prop:"列表取值"
15
- * type:"列表类型"
16
- * }
17
- *
18
- */
19
- tableListObj: {
8
+ class: {
9
+ type: [String, Function]
10
+ },
11
+ style: {
12
+ type: [String, Object]
13
+ },
14
+ isWhite: Boolean,
15
+ isBackg: Boolean,
16
+ color: String,
17
+ formatter: Function,
18
+ modelValue: {
19
+ type: String
20
+ },
21
+ listobj: {
20
22
  type: Object,
21
23
  default() {
22
24
  return {};
@@ -27,92 +29,100 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
27
29
  * row, column, $index
28
30
  *
29
31
  */
30
- tableScope: {
32
+ valueobj: {
33
+ type: Object,
34
+ default() {
35
+ return {};
36
+ }
37
+ },
38
+ comscope: {
31
39
  type: Object,
32
40
  default() {
33
41
  return {};
34
42
  }
35
43
  }
36
44
  },
37
- emits: ["scope-click"],
45
+ emits: ["color"],
38
46
  setup(__props, { emit: __emit }) {
39
47
  const props = __props;
40
48
  const emit = __emit;
41
- function setValue(v) {
42
- if (isObject.isObject(v)) {
43
- return v;
44
- } else {
45
- return {
46
- value: v
47
- };
48
- }
49
- }
50
- function getValue(row, column, cellValue, index, formatter) {
51
- if (formatter) {
52
- const v = formatter(row, column, cellValue, index);
53
- return setValue(v);
54
- } else {
55
- return setValue(cellValue);
56
- }
57
- }
58
- const valueObj = vue.computed(() => {
59
- var _a, _b, _c, _d;
60
- const prop = props.tableListObj.prop || "";
61
- const row = ((_a = props.tableScope) == null ? void 0 : _a.row) || {};
62
- const column = ((_b = props.tableScope) == null ? void 0 : _b.column) || {};
63
- const cellValue = row[prop];
64
- const index = (_c = props.tableScope) == null ? void 0 : _c.$index;
65
- const formatter = props.tableListObj.formatter;
66
- const configFormatter = (_d = props.tableListObj.config) == null ? void 0 : _d.formatter;
67
- if (configFormatter) {
68
- const obj = configFormatter(row, column, cellValue, index);
69
- let css;
70
- let value = "";
71
- let style;
72
- if (isObject.isObject(obj)) {
73
- value = obj.value;
74
- css = obj.class;
75
- style = obj.style;
49
+ const className = vue.computed(() => {
50
+ if (props.class) {
51
+ if (typeof props.class == "function") {
52
+ return props.class(
53
+ props.valueobj,
54
+ props.listobj,
55
+ props.modelValue,
56
+ 0,
57
+ props.comscope
58
+ );
76
59
  } else {
77
- css = obj;
60
+ return props.class;
78
61
  }
79
- if (!value) {
80
- value = getValue(
81
- row,
82
- column,
83
- cellValue,
84
- index,
85
- formatter
86
- ).value;
62
+ }
63
+ return;
64
+ });
65
+ const color = vue.computed(() => {
66
+ if (props.isBackg) {
67
+ if (props.isWhite) {
68
+ return "#fff";
87
69
  }
88
- return {
89
- class: css,
90
- value,
91
- style
92
- };
93
70
  } else {
94
- return getValue(row, column, cellValue, index, formatter);
71
+ return getValue();
72
+ }
73
+ return;
74
+ });
75
+ const backgroundColor = vue.computed(() => {
76
+ if (props.isBackg) {
77
+ return getValue();
95
78
  }
79
+ return;
96
80
  });
81
+ function getValue() {
82
+ if (props.formatter) {
83
+ return props.formatter(
84
+ props.valueobj,
85
+ props.listobj,
86
+ props.color,
87
+ 0,
88
+ props.comscope
89
+ );
90
+ } else {
91
+ return props.color;
92
+ }
93
+ }
97
94
  function onClick($event) {
98
- let obj = valueObj.value;
95
+ var _a;
96
+ const obj = {};
99
97
  util.eventAliass(
100
98
  (callback) => {
101
- callback(obj, props.tableScope, props.tableListObj, "color");
99
+ callback(
100
+ "color",
101
+ obj,
102
+ props.valueobj,
103
+ props.listobj,
104
+ props.comscope
105
+ );
102
106
  },
103
107
  "click",
104
- props.tableListObj,
108
+ ((_a = props.listobj) == null ? void 0 : _a.events) || {},
105
109
  $event
106
110
  );
107
- emit("scope-click", obj, props.tableScope, props.tableListObj, "color");
111
+ emit("color", obj);
108
112
  }
109
113
  return (_ctx, _cache) => {
110
114
  return vue.openBlock(), vue.createElementBlock("span", {
111
- class: vue.normalizeClass(["table-color", valueObj.value.class]),
115
+ class: vue.normalizeClass(["table-color", className.value]),
112
116
  onClick: _cache[0] || (_cache[0] = ($event) => onClick($event)),
113
- style: vue.normalizeStyle(valueObj.value.style)
117
+ style: vue.normalizeStyle(props.style)
114
118
  }, [
115
- vue.createElementVNode("span", _hoisted_1, vue.toDisplayString(valueObj.value.value), 1)
119
+ vue.createElementVNode("span", {
120
+ style: vue.normalizeStyle({
121
+ color: color.value,
122
+ backgroundColor: backgroundColor.value
123
+ }),
124
+ class: "table-color-value"
125
+ }, vue.toDisplayString(props.modelValue), 5)
116
126
  ], 6);
117
127
  };
118
128
  }
@@ -1,20 +1,22 @@
1
1
  import { defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, toDisplayString } from "vue";
2
2
  import { eventAliass } from "./util.js";
3
- import { isObject } from "@fangzhongya/utils/basic/object/isObject";
4
- const _hoisted_1 = { class: "table-color-value" };
5
3
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
4
  __name: "table-color",
7
5
  props: {
8
- /**
9
- * table列表
10
- * {
11
- * label:"列表名称"
12
- * prop:"列表取值"
13
- * type:"列表类型"
14
- * }
15
- *
16
- */
17
- tableListObj: {
6
+ class: {
7
+ type: [String, Function]
8
+ },
9
+ style: {
10
+ type: [String, Object]
11
+ },
12
+ isWhite: Boolean,
13
+ isBackg: Boolean,
14
+ color: String,
15
+ formatter: Function,
16
+ modelValue: {
17
+ type: String
18
+ },
19
+ listobj: {
18
20
  type: Object,
19
21
  default() {
20
22
  return {};
@@ -25,92 +27,100 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25
27
  * row, column, $index
26
28
  *
27
29
  */
28
- tableScope: {
30
+ valueobj: {
31
+ type: Object,
32
+ default() {
33
+ return {};
34
+ }
35
+ },
36
+ comscope: {
29
37
  type: Object,
30
38
  default() {
31
39
  return {};
32
40
  }
33
41
  }
34
42
  },
35
- emits: ["scope-click"],
43
+ emits: ["color"],
36
44
  setup(__props, { emit: __emit }) {
37
45
  const props = __props;
38
46
  const emit = __emit;
39
- function setValue(v) {
40
- if (isObject(v)) {
41
- return v;
42
- } else {
43
- return {
44
- value: v
45
- };
46
- }
47
- }
48
- function getValue(row, column, cellValue, index, formatter) {
49
- if (formatter) {
50
- const v = formatter(row, column, cellValue, index);
51
- return setValue(v);
52
- } else {
53
- return setValue(cellValue);
54
- }
55
- }
56
- const valueObj = computed(() => {
57
- var _a, _b, _c, _d;
58
- const prop = props.tableListObj.prop || "";
59
- const row = ((_a = props.tableScope) == null ? void 0 : _a.row) || {};
60
- const column = ((_b = props.tableScope) == null ? void 0 : _b.column) || {};
61
- const cellValue = row[prop];
62
- const index = (_c = props.tableScope) == null ? void 0 : _c.$index;
63
- const formatter = props.tableListObj.formatter;
64
- const configFormatter = (_d = props.tableListObj.config) == null ? void 0 : _d.formatter;
65
- if (configFormatter) {
66
- const obj = configFormatter(row, column, cellValue, index);
67
- let css;
68
- let value = "";
69
- let style;
70
- if (isObject(obj)) {
71
- value = obj.value;
72
- css = obj.class;
73
- style = obj.style;
47
+ const className = computed(() => {
48
+ if (props.class) {
49
+ if (typeof props.class == "function") {
50
+ return props.class(
51
+ props.valueobj,
52
+ props.listobj,
53
+ props.modelValue,
54
+ 0,
55
+ props.comscope
56
+ );
74
57
  } else {
75
- css = obj;
58
+ return props.class;
76
59
  }
77
- if (!value) {
78
- value = getValue(
79
- row,
80
- column,
81
- cellValue,
82
- index,
83
- formatter
84
- ).value;
60
+ }
61
+ return;
62
+ });
63
+ const color = computed(() => {
64
+ if (props.isBackg) {
65
+ if (props.isWhite) {
66
+ return "#fff";
85
67
  }
86
- return {
87
- class: css,
88
- value,
89
- style
90
- };
91
68
  } else {
92
- return getValue(row, column, cellValue, index, formatter);
69
+ return getValue();
70
+ }
71
+ return;
72
+ });
73
+ const backgroundColor = computed(() => {
74
+ if (props.isBackg) {
75
+ return getValue();
93
76
  }
77
+ return;
94
78
  });
79
+ function getValue() {
80
+ if (props.formatter) {
81
+ return props.formatter(
82
+ props.valueobj,
83
+ props.listobj,
84
+ props.color,
85
+ 0,
86
+ props.comscope
87
+ );
88
+ } else {
89
+ return props.color;
90
+ }
91
+ }
95
92
  function onClick($event) {
96
- let obj = valueObj.value;
93
+ var _a;
94
+ const obj = {};
97
95
  eventAliass(
98
96
  (callback) => {
99
- callback(obj, props.tableScope, props.tableListObj, "color");
97
+ callback(
98
+ "color",
99
+ obj,
100
+ props.valueobj,
101
+ props.listobj,
102
+ props.comscope
103
+ );
100
104
  },
101
105
  "click",
102
- props.tableListObj,
106
+ ((_a = props.listobj) == null ? void 0 : _a.events) || {},
103
107
  $event
104
108
  );
105
- emit("scope-click", obj, props.tableScope, props.tableListObj, "color");
109
+ emit("color", obj);
106
110
  }
107
111
  return (_ctx, _cache) => {
108
112
  return openBlock(), createElementBlock("span", {
109
- class: normalizeClass(["table-color", valueObj.value.class]),
113
+ class: normalizeClass(["table-color", className.value]),
110
114
  onClick: _cache[0] || (_cache[0] = ($event) => onClick($event)),
111
- style: normalizeStyle(valueObj.value.style)
115
+ style: normalizeStyle(props.style)
112
116
  }, [
113
- createElementVNode("span", _hoisted_1, toDisplayString(valueObj.value.value), 1)
117
+ createElementVNode("span", {
118
+ style: normalizeStyle({
119
+ color: color.value,
120
+ backgroundColor: backgroundColor.value
121
+ }),
122
+ class: "table-color-value"
123
+ }, toDisplayString(props.modelValue), 5)
114
124
  ], 6);
115
125
  };
116
126
  }
@@ -29,7 +29,7 @@ function setProps(obj, props) {
29
29
  return robj;
30
30
  }
31
31
  function setSslot(obj, scope, emit, slots, props, index2) {
32
- const slot = use.useSetSlot(obj, scope.row, slots, index2);
32
+ const slot = use.useSetSlot(obj, scope.row, slots, index2, scope);
33
33
  if (slot) {
34
34
  return slot;
35
35
  }
@@ -44,7 +44,8 @@ function setSslot(obj, scope, emit, slots, props, index2) {
44
44
  optionss,
45
45
  compons.getCompons(compons$1),
46
46
  emit,
47
- index2
47
+ index2,
48
+ scope
48
49
  );
49
50
  if (column) {
50
51
  return column;
@@ -27,7 +27,7 @@ function setProps(obj, props) {
27
27
  return robj;
28
28
  }
29
29
  function setSslot(obj, scope, emit, slots, props, index) {
30
- const slot = useSetSlot(obj, scope.row, slots, index);
30
+ const slot = useSetSlot(obj, scope.row, slots, index, scope);
31
31
  if (slot) {
32
32
  return slot;
33
33
  }
@@ -42,7 +42,8 @@ function setSslot(obj, scope, emit, slots, props, index) {
42
42
  optionss,
43
43
  getCompons(compons),
44
44
  emit,
45
- index
45
+ index,
46
+ scope
46
47
  );
47
48
  if (column) {
48
49
  return column;
@@ -1,4 +1,5 @@
1
1
  @use '../../loading/style/index2.scss' as *;
2
2
  @use '../../table-column/style/index2.scss' as *;
3
3
  @use '../../table/style/index2.scss' as *;
4
+ @use '../../button/style/index2.scss' as *;
4
5
  @use '../index.scss' as *;
@@ -1615,28 +1615,6 @@
1615
1615
  justify-content: flex-end;
1616
1616
  }
1617
1617
 
1618
- .tabless {
1619
- width: 100%;
1620
- flex: 1;
1621
- display: flex;
1622
- flex-direction: column;
1623
- }
1624
- .tabless-main {
1625
- display: flex;
1626
- flex-direction: column;
1627
- flex: 1;
1628
- width: 100%;
1629
- }
1630
- .tabless-main.is-radio .el-table__header .el-table-column--selection .el-checkbox {
1631
- display: none;
1632
- }
1633
- .tabless-paginat {
1634
- overflow: hidden;
1635
- }
1636
- .tabless-paginat .el-pagination {
1637
- justify-content: flex-end;
1638
- }
1639
-
1640
1618
  .tablesv {
1641
1619
  width: 100%;
1642
1620
  min-height: 100px;
@@ -1718,4 +1696,26 @@
1718
1696
  left: 0;
1719
1697
  z-index: 1;
1720
1698
  opacity: 0;
1699
+ }
1700
+
1701
+ .tablesvp {
1702
+ width: 100%;
1703
+ height: var(--tablesvp-height);
1704
+ display: flex;
1705
+ flex-direction: column;
1706
+ }
1707
+ .tablesvp-main {
1708
+ display: flex;
1709
+ flex-direction: column;
1710
+ flex: 1;
1711
+ width: 100%;
1712
+ }
1713
+ .tablesvp-main.is-radio .el-table__header .el-table-column--selection .el-checkbox {
1714
+ display: none;
1715
+ }
1716
+ .tablesvp-paginat {
1717
+ overflow: hidden;
1718
+ }
1719
+ .tablesvp-paginat .el-pagination {
1720
+ justify-content: flex-end;
1721
1721
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1762478722954,
4
+ "lastModified": 1762497579365,
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
@@ -1615,28 +1615,6 @@
1615
1615
  justify-content: flex-end;
1616
1616
  }
1617
1617
 
1618
- .tabless {
1619
- width: 100%;
1620
- flex: 1;
1621
- display: flex;
1622
- flex-direction: column;
1623
- }
1624
- .tabless-main {
1625
- display: flex;
1626
- flex-direction: column;
1627
- flex: 1;
1628
- width: 100%;
1629
- }
1630
- .tabless-main.is-radio .el-table__header .el-table-column--selection .el-checkbox {
1631
- display: none;
1632
- }
1633
- .tabless-paginat {
1634
- overflow: hidden;
1635
- }
1636
- .tabless-paginat .el-pagination {
1637
- justify-content: flex-end;
1638
- }
1639
-
1640
1618
  .tablesv {
1641
1619
  width: 100%;
1642
1620
  min-height: 100px;
@@ -1718,4 +1696,26 @@
1718
1696
  left: 0;
1719
1697
  z-index: 1;
1720
1698
  opacity: 0;
1699
+ }
1700
+
1701
+ .tablesvp {
1702
+ width: 100%;
1703
+ height: var(--tablesvp-height);
1704
+ display: flex;
1705
+ flex-direction: column;
1706
+ }
1707
+ .tablesvp-main {
1708
+ display: flex;
1709
+ flex-direction: column;
1710
+ flex: 1;
1711
+ width: 100%;
1712
+ }
1713
+ .tablesvp-main.is-radio .el-table__header .el-table-column--selection .el-checkbox {
1714
+ display: none;
1715
+ }
1716
+ .tablesvp-paginat {
1717
+ overflow: hidden;
1718
+ }
1719
+ .tablesvp-paginat .el-pagination {
1720
+ justify-content: flex-end;
1721
1721
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/fang-ui",
3
3
  "private": false,
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "type": "module",
6
6
  "description ": "fang-ui",
7
7
  "keywords": [
@@ -50,13 +50,13 @@
50
50
  "vuedraggable": "4.1.0",
51
51
  "vxe-table": "4.17.10",
52
52
  "@fang-ui/components": "0.0.1-0",
53
- "@fang-ui/hooks": "0.0.1-0",
54
53
  "@fang-ui/directives": "0.0.1-0",
54
+ "@fang-ui/hooks": "0.0.1-0",
55
55
  "@fang-ui/icons": "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