@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
@@ -0,0 +1,337 @@
1
+ import { defineComponent, ref, computed, h, onMounted } from "vue";
2
+ import { setLabel, setSslot } from "./util.js";
3
+ import { setStyles } from "../../common/css.js";
4
+ import { uesObjComponSelected, useHide } from "../../common/use.js";
5
+ import { getCompons } from "../../common/compons.js";
6
+ import { useCssName } from "../../../hooks/cssname/index.js";
7
+ import { dataProps, dataExpose, dataEmits } from "./data.js";
8
+ import "../../tables/common/img.js";
9
+ import _sfc_main$1 from "../../tables/common/img2.js";
10
+ const Components = {
11
+ Img: _sfc_main$1
12
+ };
13
+ const _sfc_main = defineComponent({
14
+ emits: dataEmits,
15
+ components: Components,
16
+ expose: dataExpose,
17
+ props: dataProps,
18
+ setup(props, { emit, slots }) {
19
+ const compons = getCompons(props.compons);
20
+ const cs = useCssName("list");
21
+ const isfocus = ref(false);
22
+ const rowObj = ref();
23
+ const borderColor = computed(() => {
24
+ const d = "#ccc";
25
+ if (typeof props.border === "boolean") {
26
+ return d;
27
+ } else {
28
+ return props.border ?? d;
29
+ }
30
+ });
31
+ function isComponSelected(obj) {
32
+ if (uesObjComponSelected(obj, props)) {
33
+ if (rowObj.value == obj) {
34
+ if (isfocus.value) {
35
+ return true;
36
+ } else {
37
+ return false;
38
+ }
39
+ } else {
40
+ return false;
41
+ }
42
+ } else {
43
+ return true;
44
+ }
45
+ }
46
+ const getLists = (arrs, listobj) => {
47
+ let arr = [], trs = [], lin = 0;
48
+ arrs.forEach((obj, index) => {
49
+ if (listobj) {
50
+ obj.father = obj.father ?? listobj;
51
+ }
52
+ if (!useHide(obj, props.value)) {
53
+ let is = false;
54
+ if (obj.whole) {
55
+ lin = props.column;
56
+ is = true;
57
+ } else {
58
+ let k = (obj.column || 1) + lin;
59
+ if (k > props.column) {
60
+ lin = obj.column || 1;
61
+ is = true;
62
+ } else {
63
+ lin = k;
64
+ is = false;
65
+ }
66
+ }
67
+ if (is) {
68
+ arr.push(h("tr", {}, trs));
69
+ trs = [];
70
+ }
71
+ trs.push(...getTd(obj, index));
72
+ if (lin >= props.column) {
73
+ arr.push(h("tr", {}, trs));
74
+ trs = [];
75
+ lin = 0;
76
+ }
77
+ }
78
+ });
79
+ if (trs.length > 0) {
80
+ arr.push(h("tr", {}, trs));
81
+ }
82
+ return arr;
83
+ };
84
+ const getListTops = (arrs, listobj) => {
85
+ let arr = [], trvs = [], trls = [], lin = 0;
86
+ arrs.forEach((obj, index) => {
87
+ if (listobj) {
88
+ obj.father = obj.father ?? listobj;
89
+ }
90
+ if (!useHide(obj, props.value)) {
91
+ let is = false;
92
+ if (obj.whole) {
93
+ lin = props.column;
94
+ is = true;
95
+ } else {
96
+ let k = (obj.column || 1) + lin;
97
+ if (k > props.column) {
98
+ lin = obj.column || 1;
99
+ is = true;
100
+ } else {
101
+ lin = k;
102
+ is = false;
103
+ }
104
+ }
105
+ if (is) {
106
+ arr.push(h("tr", {}, trls));
107
+ trls = [];
108
+ arr.push(h("tr", {}, trvs));
109
+ trvs = [];
110
+ }
111
+ if (obj.isdiv) {
112
+ trls.push(getValue(obj, index, true));
113
+ } else {
114
+ trls.push(getlabel(obj, index));
115
+ trvs.push(getValue(obj, index));
116
+ }
117
+ if (lin >= props.column) {
118
+ arr.push(h("tr", {}, trls));
119
+ arr.push(h("tr", {}, trvs));
120
+ trls = [];
121
+ trvs = [];
122
+ lin = 0;
123
+ }
124
+ }
125
+ });
126
+ if (trls.length > 0) {
127
+ arr.push(h("tr", {}, trls));
128
+ arr.push(h("tr", {}, trvs));
129
+ }
130
+ return arr;
131
+ };
132
+ const getlabel = (obj, index) => {
133
+ return h(
134
+ "th",
135
+ {
136
+ style: {
137
+ width: obj.labelWidth ?? props.labelWidth
138
+ },
139
+ class: [
140
+ cs.z("table-th"),
141
+ cs.is("whole", obj.whole),
142
+ obj.class ?? ""
143
+ ].join(" "),
144
+ colspan: props.labelPosition == "top" ? setColspan(obj) : void 0,
145
+ onClick: (event) => {
146
+ isfocus.value = true;
147
+ rowObj.value = obj;
148
+ event.stopPropagation();
149
+ return false;
150
+ }
151
+ },
152
+ [
153
+ h(
154
+ "span",
155
+ {
156
+ class: cs.z("table-label")
157
+ },
158
+ [
159
+ setLabel(
160
+ obj,
161
+ props,
162
+ compons,
163
+ emit,
164
+ slots,
165
+ isComponSelected,
166
+ index
167
+ )
168
+ ]
169
+ )
170
+ ]
171
+ );
172
+ };
173
+ const getChildrenValue = (obj, index) => {
174
+ if (obj.children) {
175
+ return [
176
+ h(
177
+ "div",
178
+ {
179
+ class: cs.z("table-children")
180
+ },
181
+ [
182
+ props.labelPosition == "top" ? getListTops(obj.children, obj) : getLists(obj.children, obj)
183
+ ]
184
+ )
185
+ ];
186
+ } else {
187
+ return [
188
+ h(
189
+ "span",
190
+ {
191
+ class: cs.z("table-value")
192
+ },
193
+ [
194
+ setSslot(
195
+ obj,
196
+ props.value,
197
+ props,
198
+ compons,
199
+ emit,
200
+ slots,
201
+ isComponSelected,
202
+ index
203
+ )
204
+ ]
205
+ )
206
+ ];
207
+ }
208
+ };
209
+ const getValue = (obj, index, isRow) => {
210
+ return h(
211
+ "td",
212
+ {
213
+ style: setStyles(obj, props.value, props),
214
+ class: [
215
+ cs.z("table-td"),
216
+ cs.is("whole", obj.whole),
217
+ obj.class ?? ""
218
+ ].join(" "),
219
+ colspan: setColspan(obj),
220
+ rowspan: isRow ? 2 : void 0,
221
+ onClick: (event) => {
222
+ isfocus.value = true;
223
+ rowObj.value = obj;
224
+ event.stopPropagation();
225
+ return false;
226
+ }
227
+ },
228
+ [...getChildrenValue(obj, index)]
229
+ );
230
+ };
231
+ const getTd = (obj, index) => {
232
+ const arr = [getValue(obj, index)];
233
+ if (!obj.isdiv) {
234
+ arr.unshift(getlabel(obj, index));
235
+ }
236
+ if (props.labelPosition == "auto") {
237
+ return [
238
+ h(
239
+ "td",
240
+ {
241
+ colspan: setColspan(obj),
242
+ class: cs.is("whole", obj.whole)
243
+ },
244
+ [
245
+ h(
246
+ "div",
247
+ {
248
+ class: cs.z("table-auto")
249
+ },
250
+ arr
251
+ )
252
+ ]
253
+ )
254
+ ];
255
+ } else {
256
+ return arr;
257
+ }
258
+ };
259
+ const setColspan = (obj) => {
260
+ if (["auto", "top"].includes(props.labelPosition)) {
261
+ if (obj.whole) {
262
+ return props.column;
263
+ } else if (obj.column) {
264
+ return obj.column;
265
+ } else {
266
+ return "";
267
+ }
268
+ } else {
269
+ const j = !obj.isdiv ? 0 : 1;
270
+ if (obj.whole) {
271
+ return (props.column - 1) * 2 + 1 + j;
272
+ } else if (obj.column) {
273
+ return (obj.column - 1) * 2 + 1 + j;
274
+ } else {
275
+ return 1 + j;
276
+ }
277
+ }
278
+ };
279
+ const renderValue = () => {
280
+ if (props.list && props.list.length > 0) {
281
+ return h(
282
+ "div",
283
+ {
284
+ class: cs.z("div"),
285
+ style: cs.vdo({
286
+ borderColor: borderColor.value
287
+ })
288
+ // onClick(event: Event) {
289
+ // isfocus.value = true;
290
+ // event.stopPropagation();
291
+ // return false;
292
+ // },
293
+ },
294
+ [
295
+ h(
296
+ "table",
297
+ {
298
+ class: [
299
+ cs.z("table"),
300
+ props.labelPosition ?? "",
301
+ cs.is(
302
+ "border",
303
+ props.border ? true : false
304
+ ),
305
+ cs.is("aliquots", props.aliquots)
306
+ ].join(" "),
307
+ cellspacing: "0",
308
+ cellpadding: "0",
309
+ border: "0"
310
+ },
311
+ props.labelPosition == "top" ? getListTops(props.list) : getLists(props.list)
312
+ )
313
+ ]
314
+ );
315
+ } else {
316
+ return "";
317
+ }
318
+ };
319
+ onMounted(() => {
320
+ if (window) {
321
+ window.addEventListener("click", () => {
322
+ isfocus.value = false;
323
+ });
324
+ }
325
+ });
326
+ return {
327
+ renderValue,
328
+ borderColor
329
+ };
330
+ },
331
+ render(props) {
332
+ return props.renderValue();
333
+ }
334
+ });
335
+ export {
336
+ _sfc_main as default
337
+ };
@@ -3,7 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  ;/* empty css */
4
4
  const withInstall = require("../../utils/vues/withInstall.cjs");
5
5
  require("./src/index.cjs");
6
- const index_vue_vue_type_script_lang = require("./src/index2.cjs");
7
- const Lists = withInstall.withInstall(index_vue_vue_type_script_lang.default, "Lists");
6
+ const index_vue_vue_type_script_setup_true_lang = require("./src/index2.cjs");
7
+ const Lists = withInstall.withInstall(index_vue_vue_type_script_setup_true_lang.default, "Lists");
8
8
  exports.Lists = Lists;
9
9
  exports.default = Lists;
@@ -12,85 +12,40 @@
12
12
  --g-main-bg: var(--bg-color-page);
13
13
  }
14
14
 
15
- .lists-div .lists-table {
15
+ .lists {
16
16
  width: 100%;
17
- height: 100%;
18
- }
19
- .lists-div .lists-table td {
20
- text-align: left;
21
- }
22
- .lists-div .lists-table th {
23
- font-weight: initial;
24
- }
25
- .lists-div .lists-table .is-whole .lists-table-auto {
26
- width: 100%;
27
- }
28
- .lists-div .lists-table .is-whole .lists-table-value {
29
- width: 100%;
30
- display: block;
31
- }
32
- .lists-div .lists-table .lists-table-td,
33
- .lists-div .lists-table .lists-table-th {
34
- padding: 6px;
35
- }
36
- .lists-div .lists-table .lists-table-auto {
37
- display: inline-flex;
38
- align-items: center;
39
- }
40
- .lists-div .lists-table .lists-table-auto .lists-table-label {
41
- white-space: nowrap;
42
- }
43
- .lists-div .lists-table .lists-table-th {
44
- text-align: left;
45
- }
46
- .lists-div .lists-table.right .lists-table-th {
47
- text-align: right;
48
- }
49
- .lists-div .lists-table.center .lists-table-th {
50
- text-align: center;
51
- }
52
- .lists-div .lists-table.auto .lists-table-th {
53
- padding-right: 0;
54
- }
55
- .lists-div .lists-table.top .lists-table-th {
56
- padding-bottom: 0;
57
- }
58
- .lists-div .lists-table.is-aliquots {
59
- table-layout: fixed;
60
- }
61
- .lists-div .lists-table.is-border {
62
- border-right: 1px solid var(--lists-border-color);
63
- border-top: 1px solid var(--lists-border-color);
64
- border-bottom: 1px solid var(--lists-border-color);
65
- }
66
- .lists-div .lists-table.is-border > tr > td {
67
- border-bottom: 1px solid var(--lists-border-color);
68
- border-left: 1px solid var(--lists-border-color);
17
+ min-height: 100px;
18
+ position: relative;
19
+ flex: 1;
20
+ display: flex;
21
+ flex-direction: column;
22
+ background-color: #eee;
69
23
  }
70
- .lists-div .lists-table.is-border > tr > td:last-child {
71
- border-right: 1px solid var(--lists-border-color);
24
+ .lists-list {
25
+ padding: 0 var(--lists-interval);
72
26
  }
73
- .lists-div .lists-table.is-border > tr > th {
74
- border-left: 1px solid var(--lists-border-color);
75
- border-bottom: 1px solid var(--lists-border-color);
27
+ .lists-list.is-absolute {
28
+ position: absolute;
29
+ inset: 0;
30
+ overflow-y: auto;
76
31
  }
77
- .lists-div .lists-table.is-border > tr > th:last-child {
78
- border-right: 1px solid var(--lists-border-color);
32
+ .lists-list--column .lists-list-item {
33
+ display: inline-block;
79
34
  }
80
- .lists-div .lists-table.is-border > tr:last-child > td {
81
- border-bottom: 0;
35
+ .lists-list-item {
36
+ background-color: #fff;
37
+ margin: 0 var(--lists-interval);
38
+ margin-top: calc(var(--lists-interval) * 2);
82
39
  }
83
- .lists-div .lists-table.is-border > tr:last-child > th {
84
- border-bottom: 0;
40
+ .lists-list-item:last-child {
41
+ margin-bottom: calc(var(--lists-interval) * 2);
85
42
  }
86
- .lists-div .lists-table.is-border.top > tr > th {
87
- border-bottom: 0;
43
+ .lists-list-item.is-active {
44
+ background-color: rgb(250, 235, 215);
88
45
  }
89
- .lists-div .lists-table .lists-com {
90
- display: flex;
91
- align-items: center;
46
+ .lists-list-item.is-selected {
47
+ background-color: rgb(215, 250, 224);
92
48
  }
93
- .lists-div .lists-table .lists-com-img {
94
- width: 50px;
95
- height: 50px;
49
+ .lists-list-item .el-card {
50
+ background-color: transparent;
96
51
  }
@@ -2,96 +2,127 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const dataProps = {
4
4
  /**
5
- * @props { Object } options={}
6
- * 选择数据集合
5
+ * @props { Object } defaultSort 排序
7
6
  */
8
- options: {
7
+ defaultSort: {
9
8
  type: Object,
10
9
  default() {
11
10
  return {};
12
11
  }
13
12
  },
14
- /**
15
- * @props { Object } compons={}
16
- * 外部组件集合
17
- */
18
- compons: {
19
- type: Object,
13
+ height: {
14
+ type: [String, Number],
20
15
  default() {
21
- return {};
16
+ return "auto";
22
17
  }
23
18
  },
24
19
  /**
25
- * @props { Object } labelPosition='auto' ('left' | 'top' | 'right' | 'center' | 'auto')
26
- * 标签位置
20
+ * 加载中
27
21
  */
28
- labelPosition: {
29
- type: String,
30
- default: "auto"
22
+ loading: {
23
+ type: Boolean,
24
+ default: false
31
25
  },
26
+ // 高度自适应
27
+ adaptive: Boolean,
32
28
  /**
33
- * @props { Array<ListObj> } list=[]
34
- * 列数据
29
+ * @props { Array<Object> } list table展示的列
30
+ * @props { String } list.class table展示的列class
31
+ * @props { String } list.label table展示的列头名称
32
+ * @props { Array<Object> } list.children 用来展示多级头
33
+ * @props { boolean } list.hide=false 当前列是否隐藏
34
+ * @props { function } list.sethide 当前列是否隐藏方法模式
35
+ * @props { function } list.formatter (row, column, cellValue, index) 用来格式化内容
36
+ * @props { String } list.align=left (left , center , right) 对齐方式
37
+ * @props { string , number } list.width table展示的宽度
38
+ * @props { string , number } list.minWidth table展示的最小宽度
39
+ * @props { string , boolean } list.fixed (true , 'left' , 'right') 列是否固定在左侧或者右侧。 true 表示固定在左侧
40
+ * @props { String } list.compon (component, color, list, but) table的扩展组件配置
41
+ * @props { Object } list.config table的扩展组件的配置对象
35
42
  */
36
43
  list: {
37
44
  type: Array,
38
- default: () => {
45
+ default() {
39
46
  return [];
40
47
  }
41
48
  },
49
+ /**
50
+ * @props { Array } value table列表数据
51
+ */
42
52
  value: {
43
- type: Object,
44
- default: () => {
45
- return {};
53
+ type: Array,
54
+ default() {
55
+ return [];
46
56
  }
47
57
  },
48
58
  /**
49
- * @props { Number } column=2
50
- * 一行展示多少列
59
+ * 行高度
51
60
  */
52
- column: {
53
- type: Number,
61
+ lineHeight: {
62
+ type: [String, Number]
63
+ },
64
+ /**
65
+ * @props { Object } options 选择数据集合
66
+ */
67
+ options: {
68
+ type: Object,
54
69
  default() {
55
- return 2;
70
+ return {};
56
71
  }
57
72
  },
58
73
  /**
59
- * @props { Boolean, String } colon
60
- * 标签后面是否加内容 true 是 :
74
+ * @props { Object } compons 外部组件集合
61
75
  */
62
- colon: [Boolean, String],
76
+ compons: {
77
+ type: Object,
78
+ default() {
79
+ return {};
80
+ }
81
+ },
63
82
  /**
64
- * @props {Number, String } labelWidth=[]
65
- * 标签宽度
83
+ * @props { String } rowWidth
84
+ * 列的宽度
66
85
  */
67
- labelWidth: {
68
- type: [Number, String]
69
- // default: '60px',
86
+ rowWidth: {
87
+ type: String
70
88
  },
71
89
  /**
72
- * @props { Boolean, String } border=true ( )
73
- * 是否需要边框,边框颜色
90
+ * @props { String } rowMinWidth
91
+ * 列的最小宽度
74
92
  */
75
- border: {
76
- type: [Boolean, String]
77
- // default: true
93
+ rowMinWidth: {
94
+ type: String
78
95
  },
79
96
  /**
80
- * @props { Boolean } aliquots=true ( )
81
- * 是否等分
97
+ * @props { Number } rowColumn=1 一行几个
82
98
  */
83
- aliquots: {
84
- type: Boolean,
85
- default: true
99
+ rowColumn: {
100
+ type: Number,
101
+ default: 1
86
102
  },
87
103
  /**
88
- * @props { Boolean } componSelected
89
- * 是否在选中时显示 compon 组件
104
+ * @props { String } interval='6px'
105
+ * 查询模式的上下间距
90
106
  */
91
- componSelected: Boolean
107
+ interval: {
108
+ type: String,
109
+ default: "6px"
110
+ }
111
+ };
112
+ const dataEmits = [
113
+ "sort-change",
114
+ "scroll-bottom",
115
+ "scope-click",
116
+ "selection-list",
117
+ "list-events",
118
+ "row-click"
119
+ ];
120
+ const dataExpose = {};
121
+ const dataSlot = {
122
+ default: "default",
123
+ noData: "no-data"
92
124
  };
93
- const dataEmits = ["list-events"];
94
- const dataExpose = [];
95
125
  exports.dataEmits = dataEmits;
96
126
  exports.dataExpose = dataExpose;
97
127
  exports.dataProps = dataProps;
128
+ exports.dataSlot = dataSlot;