@tmagic/table 1.5.0-beta.4 → 1.5.0-beta.5

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.
@@ -1,8 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, withCtx, createElementBlock, Fragment, renderList, withDirectives, createVNode, createElementVNode, vShow, createTextVNode, resolveDynamicComponent, mergeProps, toHandlers, createCommentVNode, normalizeProps, toDisplayString, resolveComponent, ref, computed, resolveDirective } from 'vue';
2
2
  import { cloneDeep } from 'lodash-es';
3
- import { TMagicTableColumn, TMagicTooltip, TMagicButton, tMagicMessage, TMagicPopover, TMagicForm, TMagicTag, getConfig, TMagicTable } from '@tmagic/design';
4
- import { MForm } from '@tmagic/form';
5
- import { datetimeFormatter } from '@tmagic/utils';
3
+ import { TMagicTableColumn, TMagicTooltip, TMagicButton, tMagicMessage, TMagicPopover, TMagicForm, TMagicTag, getDesignConfig, TMagicTable } from '@tmagic/design';
4
+ import { MForm, datetimeFormatter } from '@tmagic/form';
6
5
 
7
6
  const _hoisted_1$2 = ["innerHTML"];
8
7
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
@@ -194,7 +193,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
194
193
  return props.config.props || {};
195
194
  };
196
195
  return (_ctx, _cache) => {
197
- return openBlock(), createBlock(unref(TMagicTableColumn), { type: "expand" }, {
196
+ return openBlock(), createBlock(unref(TMagicTableColumn), {
197
+ type: "expand",
198
+ width: _ctx.config.width,
199
+ fixed: _ctx.config.fixed
200
+ }, {
198
201
  default: withCtx((scope) => [
199
202
  _ctx.config.table ? (openBlock(), createBlock(_sfc_main, {
200
203
  key: 0,
@@ -214,7 +217,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
214
217
  _ctx.config.component ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.component), normalizeProps(mergeProps({ key: 3 }, componentProps(scope.row))), null, 16)) : createCommentVNode("", true)
215
218
  ]),
216
219
  _: 1
217
- });
220
+ }, 8, ["width", "fixed"]);
218
221
  };
219
222
  }
220
223
  });
@@ -424,7 +427,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
424
427
  const emit = __emit;
425
428
  const tMagicTable = ref();
426
429
  const editState = ref([]);
427
- const tableColumnComponent = getConfig("components")?.tableColumn;
430
+ const tableColumnComponent = getDesignConfig("components")?.tableColumn;
428
431
  const selectionColumn = computed(() => {
429
432
  const column = props.columns.filter((item) => item.selection);
430
433
  return column.length ? column[0] : null;
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/form'), require('@tmagic/utils')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'lodash-es', '@tmagic/design', '@tmagic/form', '@tmagic/utils'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicTable = {}, global.Vue, global.lodashEs, global.design, global.form, global.utils));
5
- })(this, (function (exports, vue, lodashEs, design, form, utils) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/form')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'lodash-es', '@tmagic/design', '@tmagic/form'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicTable = {}, global.Vue, global.lodashEs, global.design, global.form));
5
+ })(this, (function (exports, vue, lodashEs, design, form) { 'use strict';
6
6
 
7
7
  const _hoisted_1$2 = ["innerHTML"];
8
8
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
@@ -194,7 +194,11 @@
194
194
  return props.config.props || {};
195
195
  };
196
196
  return (_ctx, _cache) => {
197
- return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), { type: "expand" }, {
197
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
198
+ type: "expand",
199
+ width: _ctx.config.width,
200
+ fixed: _ctx.config.fixed
201
+ }, {
198
202
  default: vue.withCtx((scope) => [
199
203
  _ctx.config.table ? (vue.openBlock(), vue.createBlock(_sfc_main, {
200
204
  key: 0,
@@ -214,7 +218,7 @@
214
218
  _ctx.config.component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.component), vue.normalizeProps(vue.mergeProps({ key: 3 }, componentProps(scope.row))), null, 16)) : vue.createCommentVNode("", true)
215
219
  ]),
216
220
  _: 1
217
- });
221
+ }, 8, ["width", "fixed"]);
218
222
  };
219
223
  }
220
224
  });
@@ -223,7 +227,7 @@
223
227
  if (!item.prop) return "";
224
228
  if (item.formatter) {
225
229
  if (item.formatter === "datetime") {
226
- item.formatter = (value) => utils.datetimeFormatter(value);
230
+ item.formatter = (value) => form.datetimeFormatter(value);
227
231
  }
228
232
  try {
229
233
  return item.formatter(row[item.prop], row);
@@ -424,7 +428,7 @@
424
428
  const emit = __emit;
425
429
  const tMagicTable = vue.ref();
426
430
  const editState = vue.ref([]);
427
- const tableColumnComponent = design.getConfig("components")?.tableColumn;
431
+ const tableColumnComponent = design.getDesignConfig("components")?.tableColumn;
428
432
  const selectionColumn = vue.computed(() => {
429
433
  const column = props.columns.filter((item) => item.selection);
430
434
  return column.length ? column[0] : null;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.0-beta.4",
2
+ "version": "1.5.0-beta.5",
3
3
  "name": "@tmagic/table",
4
4
  "type": "module",
5
5
  "main": "dist/tmagic-table.umd.cjs",
@@ -46,9 +46,8 @@
46
46
  "peerDependencies": {
47
47
  "vue": "^3.4.35",
48
48
  "typescript": "*",
49
- "@tmagic/design": "1.5.0-beta.4",
50
- "@tmagic/utils": "1.5.0-beta.4",
51
- "@tmagic/form": "1.5.0-beta.4"
49
+ "@tmagic/design": "1.5.0-beta.5",
50
+ "@tmagic/form": "1.5.0-beta.5"
52
51
  },
53
52
  "peerDependenciesMeta": {
54
53
  "typescript": {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <TMagicTableColumn type="expand">
2
+ <TMagicTableColumn type="expand" :width="config.width" :fixed="config.fixed">
3
3
  <template #default="scope">
4
4
  <MTable
5
5
  v-if="config.table"
package/src/Table.vue CHANGED
@@ -66,7 +66,7 @@
66
66
  import { computed, ref } from 'vue';
67
67
  import { cloneDeep } from 'lodash-es';
68
68
 
69
- import { getConfig, TMagicTable } from '@tmagic/design';
69
+ import { getDesignConfig, TMagicTable } from '@tmagic/design';
70
70
 
71
71
  import ActionsColumn from './ActionsColumn.vue';
72
72
  import ComponentColumn from './ComponentColumn.vue';
@@ -121,7 +121,7 @@ const tMagicTable = ref<InstanceType<typeof TMagicTable>>();
121
121
 
122
122
  const editState = ref([]);
123
123
 
124
- const tableColumnComponent = getConfig('components')?.tableColumn;
124
+ const tableColumnComponent = getDesignConfig('components')?.tableColumn;
125
125
  const selectionColumn = computed(() => {
126
126
  const column = props.columns.filter((item) => item.selection);
127
127
  return column.length ? column[0] : null;
@@ -198,21 +198,3 @@ defineExpose({
198
198
  clearSelection,
199
199
  });
200
200
  </script>
201
-
202
- <style lang="scss">
203
- .m-table {
204
- .el-button.action-btn + .el-button.action-btn {
205
- margin-left: 0;
206
- }
207
- .keep-all {
208
- word-break: keep-all;
209
- }
210
- .el-table .cell > div {
211
- display: inline-block;
212
- vertical-align: middle;
213
- }
214
- .el-table__row.el-table__row--level-1 {
215
- color: #999;
216
- }
217
- }
218
- </style>
package/src/index.ts CHANGED
@@ -20,6 +20,8 @@ import { App } from 'vue';
20
20
 
21
21
  import Table from './Table.vue';
22
22
 
23
+ import './theme/index.scss';
24
+
23
25
  export { default as MagicTable } from './Table.vue';
24
26
  export * from './schema';
25
27
  export * from './utils';
@@ -0,0 +1,15 @@
1
+ .m-table {
2
+ .el-button.action-btn + .el-button.action-btn {
3
+ margin-left: 0;
4
+ }
5
+ .keep-all {
6
+ word-break: keep-all;
7
+ }
8
+ .el-table .cell > div {
9
+ display: inline-block;
10
+ vertical-align: middle;
11
+ }
12
+ .el-table__row.el-table__row--level-1 {
13
+ color: #999;
14
+ }
15
+ }
package/src/utils.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { datetimeFormatter } from '@tmagic/utils';
19
+ import { datetimeFormatter } from '@tmagic/form';
20
20
 
21
21
  import { ColumnConfig } from './schema';
22
22