@fangzhongya/fang-ui 0.0.54 → 0.0.56

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.
Files changed (73) hide show
  1. package/dist/components/common/use.cjs +2 -0
  2. package/dist/components/common/use.js +2 -0
  3. package/dist/components/index.cjs +84 -80
  4. package/dist/components/index.d.ts +3 -1
  5. package/dist/components/index.js +5 -1
  6. package/dist/components/index.scss +2 -2
  7. package/dist/components/index2.scss +2 -2
  8. package/dist/components/list/index.cjs +9 -0
  9. package/dist/components/list/index.css +96 -0
  10. package/dist/components/list/index.d.ts +2 -0
  11. package/dist/components/list/index.js +9 -0
  12. package/dist/components/list/src/data.cjs +97 -0
  13. package/dist/components/list/src/data.d.ts +100 -0
  14. package/dist/components/list/src/data.js +97 -0
  15. package/dist/components/list/src/index.cjs +4 -0
  16. package/dist/components/list/src/index.js +4 -0
  17. package/dist/components/list/src/index2.cjs +337 -0
  18. package/dist/components/list/src/index2.js +337 -0
  19. package/dist/components/lists/index.cjs +2 -2
  20. package/dist/components/lists/index.css +27 -72
  21. package/dist/components/lists/src/data.cjs +80 -49
  22. package/dist/components/lists/src/data.d.ts +103 -48
  23. package/dist/components/lists/src/data.js +81 -50
  24. package/dist/components/lists/src/index.cjs +2 -2
  25. package/dist/components/lists/src/index2.cjs +237 -303
  26. package/dist/components/lists/src/index2.js +237 -303
  27. package/dist/components/listsp/index.cjs +9 -0
  28. package/dist/components/listsp/index.css +86 -0
  29. package/dist/components/listsp/index.d.ts +2 -0
  30. package/dist/components/listsp/index.js +9 -0
  31. package/dist/components/listsp/src/data.d.ts +14 -0
  32. package/dist/components/listsp/src/index.cjs +4 -0
  33. package/dist/components/listsp/src/index.js +4 -0
  34. package/dist/components/listsp/src/index2.cjs +98 -0
  35. package/dist/components/listsp/src/index2.js +98 -0
  36. package/dist/components/page/index.css +35 -38
  37. package/dist/components/page/index.scss +1 -1
  38. package/dist/components/page/src/index2.cjs +2 -2
  39. package/dist/components/page/src/index2.js +2 -2
  40. package/dist/components/page/style/index2.scss +1 -1
  41. package/dist/components/tables/common/pagin.cjs +33 -15
  42. package/dist/components/tables/common/pagin.d.ts +14 -3
  43. package/dist/components/tables/common/pagin.js +33 -15
  44. package/dist/components/tables/index.css +1 -4
  45. package/dist/components/tablesp/index.css +1 -4
  46. package/dist/css/index.css +122 -46
  47. package/dist/css/list.css +96 -0
  48. package/dist/css/lists.css +27 -72
  49. package/dist/css/listsp.css +86 -0
  50. package/dist/css/page.css +35 -38
  51. package/dist/css/tables.css +1 -4
  52. package/dist/css/tablesp.css +1 -4
  53. package/dist/directives/scroll/index.cjs +36 -11
  54. package/dist/directives/scroll/index.js +36 -11
  55. package/dist/icons/index.css +36 -36
  56. package/dist/icons/index.json +15 -15
  57. package/dist/index.cjs +102 -98
  58. package/dist/index.css +122 -46
  59. package/dist/index.js +5 -1
  60. package/dist/type.d.ts +11 -2
  61. package/package.json +5 -5
  62. /package/dist/components/{forms-item → forms-items}/index.css +0 -0
  63. /package/dist/components/{cascader-panel → keep-com}/index.css +0 -0
  64. /package/dist/components/{lists → list}/src/setup.d.ts +0 -0
  65. /package/dist/components/{lists → list}/src/util.cjs +0 -0
  66. /package/dist/components/{lists → list}/src/util.d.ts +0 -0
  67. /package/dist/components/{lists → list}/src/util.js +0 -0
  68. /package/dist/components/{lists → tables}/common/img.cjs +0 -0
  69. /package/dist/components/{lists → tables}/common/img.js +0 -0
  70. /package/dist/components/{lists → tables}/common/img2.cjs +0 -0
  71. /package/dist/components/{lists → tables}/common/img2.js +0 -0
  72. /package/dist/css/{forms-item.css → forms-items.css} +0 -0
  73. /package/dist/css/{cascader-panel.css → keep-com.css} +0 -0
@@ -1,337 +1,271 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const es = require("element-plus/es");
4
+ require("element-plus/es/components/base/style/css");
5
+ require("element-plus/es/components/loading/style/css");
3
6
  const vue = require("vue");
4
- const util = require("./util.cjs");
5
- const css = require("../../common/css.cjs");
6
- const use = require("../../common/use.cjs");
7
- const compons = require("../../common/compons.cjs");
8
- const index = require("../../../hooks/cssname/index.cjs");
9
7
  const data = require("./data.cjs");
10
- require("../common/img.cjs");
11
- const img_vue_vue_type_script_setup_true_lang = require("../common/img2.cjs");
12
- const Components = {
13
- Img: img_vue_vue_type_script_setup_true_lang.default
14
- };
15
- const _sfc_main = vue.defineComponent({
16
- emits: data.dataEmits,
17
- components: Components,
18
- expose: data.dataExpose,
8
+ const index$3 = require("element-plus/es/components/card/index");
9
+ const index$2 = require("../../../hooks/cssname/index.cjs");
10
+ const index$1 = require("../../../hooks/locale/index.cjs");
11
+ const index = require("../../../hooks/inherit/index.cjs");
12
+ const index$4 = require("../../list/index.cjs");
13
+ require("../../../utils/css.cjs");
14
+ const setObjStyle = require("@fangzhongya/utils/css/setObjStyle");
15
+ const _hoisted_1 = ["onClick"];
16
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
17
+ __name: "index",
19
18
  props: data.dataProps,
20
- setup(props, { emit, slots }) {
21
- const compons$1 = compons.getCompons(props.compons);
22
- const cs = index.useCssName("lists");
23
- const isfocus = vue.ref(false);
24
- const rowObj = vue.ref();
25
- const borderColor = vue.computed(() => {
26
- const d = "#ccc";
27
- if (typeof props.border === "boolean") {
28
- return d;
29
- } else {
30
- return props.border ?? d;
31
- }
32
- });
33
- function isComponSelected(obj) {
34
- if (use.uesObjComponSelected(obj, props)) {
35
- if (rowObj.value == obj) {
36
- if (isfocus.value) {
37
- return true;
19
+ emits: data.dataEmits,
20
+ setup(__props, { expose: __expose, emit: __emit }) {
21
+ const slots = vue.useSlots();
22
+ const attrs = index.useInherit(vue.useAttrs());
23
+ const { getLocale } = index$1.useLocale();
24
+ const cs = index$2.useCssName("lists");
25
+ const props = __props;
26
+ const emit = __emit;
27
+ const header = vue.ref([]);
28
+ const footer = vue.ref([]);
29
+ const dataList = vue.ref([]);
30
+ const setList = () => {
31
+ const list = props.list || [];
32
+ list.forEach((obj) => {
33
+ const fixed = obj.fixed;
34
+ if (fixed) {
35
+ if (typeof fixed === "boolean") {
36
+ header.value.push({ ...obj });
37
+ } else if (fixed == "right") {
38
+ footer.value.push({ ...obj });
38
39
  } else {
39
- return false;
40
+ header.value.push({ ...obj });
40
41
  }
41
42
  } else {
42
- return false;
43
- }
44
- } else {
45
- return true;
46
- }
47
- }
48
- const getLists = (arrs, listobj) => {
49
- let arr = [], trs = [], lin = 0;
50
- arrs.forEach((obj, index2) => {
51
- if (listobj) {
52
- obj.father = obj.father ?? listobj;
53
- }
54
- if (!use.useHide(obj, props.value)) {
55
- let is = false;
56
- if (obj.whole) {
57
- lin = props.column;
58
- is = true;
59
- } else {
60
- let k = (obj.column || 1) + lin;
61
- if (k > props.column) {
62
- lin = obj.column || 1;
63
- is = true;
64
- } else {
65
- lin = k;
66
- is = false;
67
- }
68
- }
69
- if (is) {
70
- arr.push(vue.h("tr", {}, trs));
71
- trs = [];
72
- }
73
- trs.push(...getTd(obj, index2));
74
- if (lin >= props.column) {
75
- arr.push(vue.h("tr", {}, trs));
76
- trs = [];
77
- lin = 0;
78
- }
43
+ dataList.value.push({ ...obj });
79
44
  }
80
45
  });
81
- if (trs.length > 0) {
82
- arr.push(vue.h("tr", {}, trs));
83
- }
84
- return arr;
85
46
  };
86
- const getListTops = (arrs, listobj) => {
87
- let arr = [], trvs = [], trls = [], lin = 0;
88
- arrs.forEach((obj, index2) => {
89
- if (listobj) {
90
- obj.father = obj.father ?? listobj;
91
- }
92
- if (!use.useHide(obj, props.value)) {
93
- let is = false;
94
- if (obj.whole) {
95
- lin = props.column;
96
- is = true;
47
+ vue.watch(
48
+ [() => props.list, () => {
49
+ var _a;
50
+ return (_a = props.list) == null ? void 0 : _a.length;
51
+ }],
52
+ () => {
53
+ setList();
54
+ },
55
+ {
56
+ immediate: true,
57
+ deep: true
58
+ }
59
+ );
60
+ const setListValue = (list, index2) => {
61
+ const arr = [];
62
+ for (let i = 0; i < list.length; i++) {
63
+ const obj = list[i];
64
+ if (obj.type == "index") {
65
+ let value = "";
66
+ const paginat = attrs.assem.paginat;
67
+ if (obj.index) {
68
+ value = obj.index(index2, paginat);
97
69
  } else {
98
- let k = (obj.column || 1) + lin;
99
- if (k > props.column) {
100
- lin = obj.column || 1;
101
- is = true;
70
+ if (paginat && paginat.current && paginat.pageSize) {
71
+ value = (paginat.current - 1) * paginat.pageSize + index2 + 1;
102
72
  } else {
103
- lin = k;
104
- is = false;
73
+ value = index2 + 1;
105
74
  }
106
75
  }
107
- if (is) {
108
- arr.push(vue.h("tr", {}, trls));
109
- trls = [];
110
- arr.push(vue.h("tr", {}, trvs));
111
- trvs = [];
112
- }
113
- if (obj.isdiv) {
114
- trls.push(getValue(obj, index2, true));
115
- } else {
116
- trls.push(getlabel(obj, index2));
117
- trvs.push(getValue(obj, index2));
118
- }
119
- if (lin >= props.column) {
120
- arr.push(vue.h("tr", {}, trls));
121
- arr.push(vue.h("tr", {}, trvs));
122
- trls = [];
123
- trvs = [];
124
- lin = 0;
125
- }
76
+ arr.push({ ...obj, value });
77
+ } else {
78
+ arr.push({ ...obj });
126
79
  }
127
- });
128
- if (trls.length > 0) {
129
- arr.push(vue.h("tr", {}, trls));
130
- arr.push(vue.h("tr", {}, trvs));
131
80
  }
132
81
  return arr;
133
82
  };
134
- const getlabel = (obj, index2) => {
135
- return vue.h(
136
- "th",
137
- {
138
- style: {
139
- width: obj.labelWidth ?? props.labelWidth
140
- },
141
- class: [
142
- cs.z("table-th"),
143
- cs.is("whole", obj.whole),
144
- obj.class ?? ""
145
- ].join(" "),
146
- colspan: props.labelPosition == "top" ? setColspan(obj) : void 0,
147
- onClick: (event) => {
148
- isfocus.value = true;
149
- rowObj.value = obj;
150
- event.stopPropagation();
151
- return false;
152
- }
153
- },
154
- [
155
- vue.h(
156
- "span",
157
- {
158
- class: cs.z("table-label")
159
- },
160
- [
161
- util.setLabel(
162
- obj,
163
- props,
164
- compons$1,
165
- emit,
166
- slots,
167
- isComponSelected,
168
- index2
169
- )
170
- ]
171
- )
172
- ]
173
- );
174
- };
175
- const getChildrenValue = (obj, index2) => {
176
- if (obj.children) {
177
- return [
178
- vue.h(
179
- "div",
180
- {
181
- class: cs.z("table-children")
182
- },
183
- [
184
- props.labelPosition == "top" ? getListTops(obj.children, obj) : getLists(obj.children, obj)
185
- ]
186
- )
187
- ];
83
+ const rows = vue.ref();
84
+ const onClick = (item, index2) => {
85
+ if (attrs.assem.ischecked) {
86
+ const i = selections.value.indexOf(item);
87
+ if (i != -1) {
88
+ selections.value.splice(i, 1);
89
+ } else {
90
+ selections.value.push(item);
91
+ }
92
+ emit("selection-change", selections.value);
188
93
  } else {
189
- return [
190
- vue.h(
191
- "span",
192
- {
193
- class: cs.z("table-value")
194
- },
195
- [
196
- util.setSslot(
197
- obj,
198
- props.value,
199
- props,
200
- compons$1,
201
- emit,
202
- slots,
203
- isComponSelected,
204
- index2
205
- )
206
- ]
207
- )
208
- ];
94
+ rows.value = item;
95
+ emit("row-click", item, index2);
209
96
  }
210
97
  };
211
- const getValue = (obj, index2, isRow) => {
212
- return vue.h(
213
- "td",
214
- {
215
- style: css.setStyles(obj, props.value, props),
216
- class: [
217
- cs.z("table-td"),
218
- cs.is("whole", obj.whole),
219
- obj.class ?? ""
220
- ].join(" "),
221
- colspan: setColspan(obj),
222
- rowspan: isRow ? 2 : void 0,
223
- onClick: (event) => {
224
- isfocus.value = true;
225
- rowObj.value = obj;
226
- event.stopPropagation();
227
- return false;
228
- }
229
- },
230
- [...getChildrenValue(obj, index2)]
231
- );
232
- };
233
- const getTd = (obj, index2) => {
234
- const arr = [getValue(obj, index2)];
235
- if (!obj.isdiv) {
236
- arr.unshift(getlabel(obj, index2));
237
- }
238
- if (props.labelPosition == "auto") {
239
- return [
240
- vue.h(
241
- "td",
242
- {
243
- colspan: setColspan(obj),
244
- class: cs.is("whole", obj.whole)
245
- },
246
- [
247
- vue.h(
248
- "div",
249
- {
250
- class: cs.z("table-auto")
251
- },
252
- arr
253
- )
254
- ]
255
- )
256
- ];
98
+ function setStyles(v) {
99
+ const style = v.style || {};
100
+ let vst;
101
+ if (typeof style === "function") {
102
+ vst = style(v, props) || {};
257
103
  } else {
258
- return arr;
104
+ vst = style;
259
105
  }
260
- };
261
- const setColspan = (obj) => {
262
- if (["auto", "top"].includes(props.labelPosition)) {
263
- if (obj.whole) {
264
- return props.column;
265
- } else if (obj.column) {
266
- return obj.column;
267
- } else {
268
- return "";
269
- }
106
+ const obj = {};
107
+ const minWidth = v.minWidth ?? props.rowMinWidth;
108
+ const width = v.width ?? props.rowWidth;
109
+ if (width) {
110
+ obj.width = width;
270
111
  } else {
271
- const j = !obj.isdiv ? 0 : 1;
272
- if (obj.whole) {
273
- return (props.column - 1) * 2 + 1 + j;
274
- } else if (obj.column) {
275
- return (obj.column - 1) * 2 + 1 + j;
276
- } else {
277
- return 1 + j;
112
+ if (props.rowColumn > 1) {
113
+ obj.width = "calc(" + Number((100 / props.rowColumn).toFixed(2)) + "% - " + props.interval + " * 2)";
278
114
  }
279
115
  }
280
- };
281
- const renderValue = () => {
282
- if (props.list && props.list.length > 0) {
283
- return vue.h(
284
- "div",
285
- {
286
- class: cs.z("div"),
287
- style: cs.vdo({
288
- borderColor: borderColor.value
289
- })
290
- // onClick(event: Event) {
291
- // isfocus.value = true;
292
- // event.stopPropagation();
293
- // return false;
294
- // },
295
- },
296
- [
297
- vue.h(
298
- "table",
299
- {
300
- class: [
301
- cs.z("table"),
302
- props.labelPosition ?? "",
303
- cs.is(
304
- "border",
305
- props.border ? true : false
306
- ),
307
- cs.is("aliquots", props.aliquots)
308
- ].join(" "),
309
- cellspacing: "0",
310
- cellpadding: "0",
311
- border: "0"
312
- },
313
- props.labelPosition == "top" ? getListTops(props.list) : getLists(props.list)
314
- )
315
- ]
316
- );
317
- } else {
318
- return "";
116
+ if (minWidth) {
117
+ obj.minWidth = minWidth;
319
118
  }
320
- };
321
- vue.onMounted(() => {
322
- if (window) {
323
- window.addEventListener("click", () => {
324
- isfocus.value = false;
325
- });
119
+ if (v.whole) {
120
+ obj.display = "block";
121
+ obj.width = "100%";
326
122
  }
123
+ return setObjStyle.setObjStyle(vst, obj);
124
+ }
125
+ const selections = vue.ref([]);
126
+ function toggleRowSelection(item, is) {
127
+ if (is) {
128
+ selections.value.push(item);
129
+ } else {
130
+ const i = selections.value.indexOf(item);
131
+ if (i != -1) {
132
+ selections.value.splice(i, 1);
133
+ }
134
+ }
135
+ }
136
+ function clearSelection() {
137
+ selections.value = [];
138
+ }
139
+ function getSelections() {
140
+ return selections.value;
141
+ }
142
+ __expose({
143
+ ...data.dataExpose,
144
+ clearSelection,
145
+ getSelections,
146
+ toggleRowSelection
327
147
  });
328
- return {
329
- renderValue,
330
- borderColor
148
+ return (_ctx, _cache) => {
149
+ const _directive_loading = es.ElLoadingDirective;
150
+ return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
151
+ class: vue.unref(cs).z(),
152
+ style: vue.unref(cs).vdo({
153
+ interval: props.interval
154
+ })
155
+ }, vue.unref(attrs).root), [
156
+ vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
157
+ class: vue.normalizeClass([
158
+ vue.unref(cs).z("list"),
159
+ vue.unref(cs).is("absolute", props.adaptive),
160
+ vue.unref(cs).zis("list", "column", props.rowColumn > 1)
161
+ ]),
162
+ style: vue.normalizeStyle({
163
+ height: props.height
164
+ })
165
+ }, [
166
+ props.value && props.value.length > 0 ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(props.value, (item, index2) => {
167
+ return vue.openBlock(), vue.createElementBlock("div", {
168
+ class: vue.normalizeClass([
169
+ vue.unref(cs).z("list-item"),
170
+ vue.unref(cs).is("active", rows.value === item),
171
+ vue.unref(cs).is("selected", selections.value.includes(item))
172
+ ]),
173
+ style: vue.normalizeStyle(setStyles(item)),
174
+ onClick: ($event) => onClick(item, index2)
175
+ }, [
176
+ vue.renderSlot(_ctx.$slots, vue.unref(data.dataSlot).default, {
177
+ config: vue.unref(attrs).assem,
178
+ value: item,
179
+ index: index2,
180
+ list: props.list,
181
+ active: rows.value === item,
182
+ selected: selections.value.includes(item),
183
+ options: props.options,
184
+ compons: props.compons
185
+ }, () => [
186
+ vue.createVNode(vue.unref(index$3.ElCard), null, vue.createSlots({
187
+ default: vue.withCtx(() => [
188
+ vue.createVNode(vue.unref(index$4.List), vue.mergeProps({ ref_for: true }, vue.unref(attrs).assem, {
189
+ value: item,
190
+ list: setListValue(dataList.value, index2),
191
+ options: props.options,
192
+ compons: props.compons
193
+ }), vue.createSlots({ _: 2 }, [
194
+ vue.renderList(Object.keys(vue.unref(slots)).filter(
195
+ (v) => !["no-data"].includes(v)
196
+ ), (k) => {
197
+ return {
198
+ name: k,
199
+ fn: vue.withCtx((scope) => [
200
+ vue.renderSlot(_ctx.$slots, k, vue.mergeProps({ ref_for: true }, scope))
201
+ ])
202
+ };
203
+ })
204
+ ]), 1040, ["value", "list", "options", "compons"])
205
+ ]),
206
+ _: 2
207
+ }, [
208
+ header.value.length > 0 ? {
209
+ name: "header",
210
+ fn: vue.withCtx(() => [
211
+ vue.createVNode(vue.unref(index$4.List), vue.mergeProps({ ref_for: true }, vue.unref(attrs).assem, {
212
+ value: item,
213
+ list: setListValue(header.value, index2),
214
+ options: props.options,
215
+ compons: props.compons
216
+ }), vue.createSlots({ _: 2 }, [
217
+ vue.renderList(Object.keys(vue.unref(slots)).filter(
218
+ (v) => !["no-data"].includes(v)
219
+ ), (k) => {
220
+ return {
221
+ name: k,
222
+ fn: vue.withCtx((scope) => [
223
+ vue.renderSlot(_ctx.$slots, k, vue.mergeProps({ ref_for: true }, scope))
224
+ ])
225
+ };
226
+ })
227
+ ]), 1040, ["value", "list", "options", "compons"])
228
+ ]),
229
+ key: "0"
230
+ } : void 0,
231
+ footer.value.length > 0 ? {
232
+ name: "footer",
233
+ fn: vue.withCtx(() => [
234
+ vue.createVNode(vue.unref(index$4.List), vue.mergeProps({ ref_for: true }, vue.unref(attrs).assem, {
235
+ value: item,
236
+ list: setListValue(footer.value, index2),
237
+ options: props.options,
238
+ compons: props.compons
239
+ }), vue.createSlots({ _: 2 }, [
240
+ vue.renderList(Object.keys(vue.unref(slots)).filter(
241
+ (v) => !["no-data"].includes(v)
242
+ ), (k) => {
243
+ return {
244
+ name: k,
245
+ fn: vue.withCtx((scope) => [
246
+ vue.renderSlot(_ctx.$slots, k, vue.mergeProps({ ref_for: true }, scope))
247
+ ])
248
+ };
249
+ })
250
+ ]), 1040, ["value", "list", "options", "compons"])
251
+ ]),
252
+ key: "1"
253
+ } : void 0
254
+ ]), 1024)
255
+ ])
256
+ ], 14, _hoisted_1);
257
+ }), 256)) : vue.renderSlot(_ctx.$slots, vue.unref(data.dataSlot).noData, { key: 1 }, () => [
258
+ vue.createElementVNode("div", {
259
+ class: vue.normalizeClass(vue.unref(cs).z("no-data"))
260
+ }, _cache[0] || (_cache[0] = [
261
+ vue.createElementVNode("span", null, "暂无数据", -1)
262
+ ]), 2)
263
+ ])
264
+ ], 6)), [
265
+ [_directive_loading, props.loading]
266
+ ])
267
+ ], 16);
331
268
  };
332
- },
333
- render(props) {
334
- return props.renderValue();
335
269
  }
336
270
  });
337
271
  exports.default = _sfc_main;