@ctzy-web-client/plugin-component-vue 1.0.62 → 1.0.63

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.
@@ -33,6 +33,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
33
33
  type: [String, Number],
34
34
  default: "auto"
35
35
  },
36
+ autoHeight: {
37
+ type: Boolean,
38
+ default: true
39
+ },
36
40
  fixedSelection: { type: [Boolean, String], default: false },
37
41
  showIndex: {
38
42
  type: Boolean,
@@ -83,6 +87,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
83
87
  dataTable._userService = (_a = userService.value) == null ? void 0 : _a.getUserList;
84
88
  const dataTableEl = ref(null);
85
89
  const realHeight = computed(() => props.height);
90
+ const cssAuto = computed(() => {
91
+ if (!props.autoHeight)
92
+ return false;
93
+ const h = props.height;
94
+ return h === "auto" || h === "" || h === null || h === void 0 || !Number.isFinite(Number(h));
95
+ });
86
96
  const displayColumns = computed(
87
97
  () => unref(dataTable).getDisplayColumns() || []
88
98
  );
@@ -308,18 +318,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
308
318
  });
309
319
  return (_ctx, _cache) => {
310
320
  return openBlock(), createElementBlock("div", {
311
- class: normalizeClass(unref(ns).b()),
321
+ class: normalizeClass([unref(ns).b(), cssAuto.value ? unref(ns).m("auto") : null, cssAuto.value && __props.showPagination ? "is-paged" : null]),
312
322
  ref_key: "dataTableEl",
313
323
  ref: dataTableEl,
314
324
  style: normalizeStyle({
315
- display: realHeight.value === "auto" ? "flex" : "block",
316
- flexDirection: realHeight.value === "auto" ? "column" : "unset"
325
+ display: cssAuto.value ? "flex" : "block",
326
+ flexDirection: cssAuto.value ? "column" : "unset"
317
327
  })
318
328
  }, [
319
329
  renderSlot(_ctx.$slots, "default", { dataTable: unref(dataTable) }, () => [
320
330
  createVNode(unref(ElTable), mergeProps({
321
331
  class: "content",
322
- height: realHeight.value,
332
+ height: cssAuto.value ? void 0 : realHeight.value,
333
+ "max-height": cssAuto.value ? "100%" : void 0,
323
334
  ref_key: "elTable",
324
335
  ref: elTable,
325
336
  data: data.value,
@@ -410,7 +421,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
410
421
  renderSlot(_ctx.$slots, "column-append")
411
422
  ]),
412
423
  _: 3
413
- }, 16, ["height", "data", "row-key", "onSelectionChange", "border"])
424
+ }, 16, ["height", "max-height", "data", "row-key", "onSelectionChange", "border"])
414
425
  ]),
415
426
  __props.showPagination ? (openBlock(), createElementBlock("div", {
416
427
  key: 0,
@@ -37,6 +37,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
37
37
  type: [String, Number],
38
38
  default: "auto"
39
39
  },
40
+ autoHeight: {
41
+ type: Boolean,
42
+ default: true
43
+ },
40
44
  fixedSelection: { type: [Boolean, String], default: false },
41
45
  showIndex: {
42
46
  type: Boolean,
@@ -87,6 +91,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
87
91
  dataTable._userService = (_a = userService.value) == null ? void 0 : _a.getUserList;
88
92
  const dataTableEl = vue.ref(null);
89
93
  const realHeight = vue.computed(() => props.height);
94
+ const cssAuto = vue.computed(() => {
95
+ if (!props.autoHeight)
96
+ return false;
97
+ const h = props.height;
98
+ return h === "auto" || h === "" || h === null || h === void 0 || !Number.isFinite(Number(h));
99
+ });
90
100
  const displayColumns = vue.computed(
91
101
  () => vue.unref(dataTable).getDisplayColumns() || []
92
102
  );
@@ -312,18 +322,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
312
322
  });
313
323
  return (_ctx, _cache) => {
314
324
  return vue.openBlock(), vue.createElementBlock("div", {
315
- class: vue.normalizeClass(vue.unref(ns).b()),
325
+ class: vue.normalizeClass([vue.unref(ns).b(), cssAuto.value ? vue.unref(ns).m("auto") : null, cssAuto.value && __props.showPagination ? "is-paged" : null]),
316
326
  ref_key: "dataTableEl",
317
327
  ref: dataTableEl,
318
328
  style: vue.normalizeStyle({
319
- display: realHeight.value === "auto" ? "flex" : "block",
320
- flexDirection: realHeight.value === "auto" ? "column" : "unset"
329
+ display: cssAuto.value ? "flex" : "block",
330
+ flexDirection: cssAuto.value ? "column" : "unset"
321
331
  })
322
332
  }, [
323
333
  vue.renderSlot(_ctx.$slots, "default", { dataTable: vue.unref(dataTable) }, () => [
324
334
  vue.createVNode(vue.unref(ElementPlus.ElTable), vue.mergeProps({
325
335
  class: "content",
326
- height: realHeight.value,
336
+ height: cssAuto.value ? void 0 : realHeight.value,
337
+ "max-height": cssAuto.value ? "100%" : void 0,
327
338
  ref_key: "elTable",
328
339
  ref: elTable,
329
340
  data: data.value,
@@ -414,7 +425,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
414
425
  vue.renderSlot(_ctx.$slots, "column-append")
415
426
  ]),
416
427
  _: 3
417
- }, 16, ["height", "data", "row-key", "onSelectionChange", "border"])
428
+ }, 16, ["height", "max-height", "data", "row-key", "onSelectionChange", "border"])
418
429
  ]),
419
430
  __props.showPagination ? (vue.openBlock(), vue.createElementBlock("div", {
420
431
  key: 0,
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
- {
2
- "name": "@ctzy-web-client/plugin-component-vue",
3
- "version": "1.0.62",
4
- "main": "lib/index.js",
5
- "module": "es/index.mjs",
6
- "exports": {
7
- ".": {
8
- "require": "./lib/index.js",
9
- "import": "./es/index.mjs"
10
- },
11
- "./src": "./src/index.js",
12
- "./src/*": "./src/*",
13
- "./es": "./es/index.mjs",
14
- "./lib": "./lib/index.js",
15
- "./es/*": "./es/*",
16
- "./lib/*": "./lib/*",
17
- "./style": "./style/index.css",
18
- "./style/*": "./style/*",
19
- "./style/src": "./style/src/index.scss",
20
- "./style/src/*": "./style/src/*"
21
- },
22
- "style": "./style/index.css",
23
- "author": "tommy",
24
- "license": "MIT",
25
- "description": "web client 通用ui库",
26
- "dependencies": {
27
- "@element-plus/icons": "^0.0.11",
28
- "@tinymce/tinymce-vue": "^5",
29
- "dayjs": "^1.11.6",
30
- "dexie": "^3.2.3",
31
- "element-plus": "^2.10.2",
32
- "lodash": "^4.17.21",
33
- "quill": "^1.3.7",
34
- "rxjs": "^7.6.0",
35
- "tinymce": "^6.4.2",
36
- "pinyin-pro": "^3.28.0",
37
- "@ctzy-web-client/web-base-client-vue": "^1.0.0"
38
- },
39
- "devDependencies": {
40
- "@vueuse/core": "^9.6.0",
41
- "vue": "^3.2.41",
42
- "vue-router": "^4.1.6"
43
- }
44
- }
1
+ {
2
+ "name": "@ctzy-web-client/plugin-component-vue",
3
+ "version": "1.0.63",
4
+ "main": "lib/index.js",
5
+ "module": "es/index.mjs",
6
+ "exports": {
7
+ ".": {
8
+ "require": "./lib/index.js",
9
+ "import": "./es/index.mjs"
10
+ },
11
+ "./src": "./src/index.js",
12
+ "./src/*": "./src/*",
13
+ "./es": "./es/index.mjs",
14
+ "./lib": "./lib/index.js",
15
+ "./es/*": "./es/*",
16
+ "./lib/*": "./lib/*",
17
+ "./style": "./style/index.css",
18
+ "./style/*": "./style/*",
19
+ "./style/src": "./style/src/index.scss",
20
+ "./style/src/*": "./style/src/*"
21
+ },
22
+ "style": "./style/index.css",
23
+ "author": "tommy",
24
+ "license": "MIT",
25
+ "description": "web client 通用ui库",
26
+ "dependencies": {
27
+ "@element-plus/icons": "^0.0.11",
28
+ "@tinymce/tinymce-vue": "^5",
29
+ "dayjs": "^1.11.6",
30
+ "dexie": "^3.2.3",
31
+ "element-plus": "^2.10.2",
32
+ "lodash": "^4.17.21",
33
+ "quill": "^1.3.7",
34
+ "rxjs": "^7.6.0",
35
+ "tinymce": "^6.4.2",
36
+ "pinyin-pro": "^3.28.0",
37
+ "@ctzy-web-client/web-base-client-vue": "^1.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "@vueuse/core": "^9.6.0",
41
+ "vue": "^3.2.41",
42
+ "vue-router": "^4.1.6"
43
+ }
44
+ }
@@ -1,10 +1,12 @@
1
1
  <template>
2
- <div :class="ns.b()" ref="dataTableEl" :style="{display: realHeight === 'auto' ? 'flex' : 'block',
3
- flexDirection: realHeight === 'auto' ? 'column' : 'unset'}">
2
+ <div :class="[ns.b(), cssAuto ? ns.m('auto') : null, cssAuto && showPagination ? 'is-paged' : null]"
3
+ ref="dataTableEl" :style="{display: cssAuto ? 'flex' : 'block',
4
+ flexDirection: cssAuto ? 'column' : 'unset'}">
4
5
  <slot :dataTable="dataTable">
5
6
  <ElTable
6
7
  class="content"
7
- :height="realHeight"
8
+ :height="cssAuto ? undefined : realHeight"
9
+ :max-height="cssAuto ? '100%' : undefined"
8
10
  ref="elTable"
9
11
  :data="data"
10
12
  :row-key="dataTable.primaryKey"
@@ -155,6 +157,14 @@ const props = defineProps({
155
157
  height: {
156
158
  type: [String, Number],
157
159
  default: "auto",
160
+ },
161
+ // CSS 自适应高度总开关,默认开启。
162
+ // 是否自适应由 height 决定:传数值(含数字字符串)时 height 生效、走原有固定高度;
163
+ // 不传 / 'auto' / 空值时走 CSS 自适应(ElTable 只给 max-height,由 flex 高度链决定上限)。
164
+ // 个别父级高度链不通的场景可显式传 :auto-height="false" 关掉。
165
+ autoHeight: {
166
+ type: Boolean,
167
+ default: true,
158
168
  },
159
169
  fixedSelection: { type: [Boolean, String], default: false },
160
170
  showIndex: {
@@ -207,6 +217,12 @@ dataTable._userService = userService.value?.getUserList
207
217
  const dataTableEl = ref(null);
208
218
  // const realHeight = computed(() => props.height)
209
219
  const realHeight = computed(() => props.height)
220
+ // height 传数值则固定高度(height 生效);不传 / 'auto' / 空值 / 非数值字符串则交给 CSS 自适应
221
+ const cssAuto = computed(() => {
222
+ if (!props.autoHeight) return false
223
+ const h = props.height
224
+ return h === 'auto' || h === '' || h === null || h === undefined || !Number.isFinite(Number(h))
225
+ })
210
226
 
211
227
 
212
228
  const displayColumns = computed(
@@ -1 +1 @@
1
- .bwa-datatable{--bwa-datatable-pagination-padding-top:20px;--bwa-datatable-pagination-line-height:36px;--bwa-datatable-pagination-info-margin-right:16px;--bwa-datatable-pagination-info-font-size:12px;--bwa-datatable-pagination-info-text-color:#547781;height:100%;width:100%}.bwa-datatable__pagination{display:flex;line-height:var(--bwa-datatable-pagination-line-height)}.bwa-datatable__pagination::before{content:"";position:relative;flex:1}.bwa-datatable__pagination{padding-top:var(--bwa-datatable-pagination-padding-top)}.bwa-datatable__pagination-info{margin-right:var(--bwa-datatable-pagination-info-margin-right);font-size:var(--bwa-datatable-pagination-info-font-size);color:var(--bwa-datatable-pagination-info-text-color);white-space:nowrap}.bwa-datatable>.el-table{flex:1;height:0}.bwa-datatable__drag{text-align:center;cursor:grab}.bwa-datatable__dragbar{position:fixed;background-color:var(--bwa-color-primary);z-index:99}.bwa-column-view{text-overflow:ellipsis;overflow:hidden}
1
+ .bwa-datatable{--bwa-datatable-pagination-padding-top:20px;--bwa-datatable-pagination-line-height:36px;--bwa-datatable-pagination-info-margin-right:16px;--bwa-datatable-pagination-info-font-size:12px;--bwa-datatable-pagination-info-text-color:#547781;height:100%;width:100%}.bwa-datatable__pagination{display:flex;line-height:var(--bwa-datatable-pagination-line-height)}.bwa-datatable__pagination::before{content:"";position:relative;flex:1}.bwa-datatable__pagination{padding-top:var(--bwa-datatable-pagination-padding-top)}.bwa-datatable__pagination-info{margin-right:var(--bwa-datatable-pagination-info-margin-right);font-size:var(--bwa-datatable-pagination-info-font-size);color:var(--bwa-datatable-pagination-info-text-color);white-space:nowrap}.bwa-datatable>.el-table{flex:1;height:0}.bwa-datatable--auto{--bwa-datatable-pager-h:56px;display:flex;flex-direction:column;min-height:0;overflow:hidden}.bwa-datatable--auto>.el-table{flex:0 1 auto;height:auto;max-height:100%!important}.bwa-datatable--auto.is-paged>.el-table{max-height:calc(100% - var(--bwa-datatable-pager-h))!important}.bwa-datatable--auto .el-table__body-wrapper .el-scrollbar__wrap{max-height:100%!important}.bwa-datatable--auto .bwa-datatable__pagination{flex:0 0 auto;height:var(--bwa-datatable-pager-h);box-sizing:border-box;align-items:center;padding-top:0}.bwa-datatable__drag{text-align:center;cursor:grab}.bwa-datatable__dragbar{position:fixed;background-color:var(--bwa-color-primary);z-index:99}.bwa-column-view{text-overflow:ellipsis;overflow:hidden}