@tmagic/tdesign-vue-next-adapter 1.4.16 → 1.5.0-beta.1

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,7 +1,7 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, createElementBlock, renderSlot, createSlots, withCtx, createElementVNode, ref, h } from 'vue';
2
- import { DateRangePicker, DatePicker, Textarea, Input, Popup, Tree, MessagePlugin, DialogPlugin, Badge, Button, Card, Cascader, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, Dialog, Divider, Drawer, Dropdown, DropdownItem, Form, FormItem, InputNumber, Option, OptionGroup, Pagination, Radio, RadioButton, RadioGroup, Row, Select, StepItem, Steps, Switch, Table, TabPanel, Tabs, Tag, TimePicker, Tooltip, Upload } from 'tdesign-vue-next';
1
+ import { defineComponent, computed, openBlock, createBlock, unref, createElementBlock, renderSlot, createSlots, withCtx, createElementVNode, h } from 'vue';
2
+ import { DateRangePicker, DatePicker, Textarea, Input, MessagePlugin, DialogPlugin, Badge, Button, Card, Cascader, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, Dialog, Divider, Drawer, Dropdown, DropdownItem, Form, FormItem, InputNumber, Option, OptionGroup, Pagination, Radio, RadioButton, RadioGroup, Row, Select, StepItem, Steps, Switch, Table, TabPanel, Tabs, Tag, TimePicker, Tooltip, Upload } from 'tdesign-vue-next';
3
3
 
4
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
5
5
  __name: "DatePicker",
6
6
  props: {
7
7
  type: { default: "date" },
@@ -74,16 +74,16 @@ const _export_sfc = (sfc, props) => {
74
74
  return target;
75
75
  };
76
76
 
77
- const _sfc_main$5 = {};
77
+ const _sfc_main$3 = {};
78
78
 
79
79
  function _sfc_render$2(_ctx, _cache) {
80
80
  return (openBlock(), createElementBlock("i", null, [
81
81
  renderSlot(_ctx.$slots, "default")
82
82
  ]))
83
83
  }
84
- const Icon = /*#__PURE__*/_export_sfc(_sfc_main$5, [['render',_sfc_render$2]]);
84
+ const Icon = /*#__PURE__*/_export_sfc(_sfc_main$3, [['render',_sfc_render$2]]);
85
85
 
86
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
86
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
87
87
  __name: "Input",
88
88
  props: {
89
89
  modelValue: {},
@@ -145,44 +145,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
145
145
  }
146
146
  });
147
147
 
148
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
149
- __name: "Popover",
150
- props: {
151
- placement: {},
152
- width: {},
153
- title: {},
154
- trigger: {},
155
- effect: {},
156
- content: {},
157
- disabled: { type: Boolean },
158
- popperClass: {},
159
- visible: { type: [Boolean, null] }
160
- },
161
- setup(__props) {
162
- const props = __props;
163
- const placement = computed(() => props.placement);
164
- const trigger = computed(() => props.trigger);
165
- return (_ctx, _cache) => {
166
- return openBlock(), createBlock(unref(Popup), {
167
- placement: placement.value,
168
- trigger: trigger.value,
169
- disabled: _ctx.disabled,
170
- visible: _ctx.visible,
171
- overlayClassName: _ctx.popperClass
172
- }, {
173
- content: withCtx(() => [
174
- renderSlot(_ctx.$slots, "default")
175
- ]),
176
- default: withCtx(() => [
177
- renderSlot(_ctx.$slots, "reference")
178
- ]),
179
- _: 3
180
- }, 8, ["placement", "trigger", "disabled", "visible", "overlayClassName"]);
181
- };
182
- }
183
- });
184
-
185
- const _sfc_main$2 = {};
148
+ const _sfc_main$1 = {};
186
149
 
187
150
  const _hoisted_1 = {
188
151
  class: "tdesign-scrollbar",
@@ -203,124 +166,14 @@ function _sfc_render$1(_ctx, _cache) {
203
166
  ])
204
167
  ]))
205
168
  }
206
- const Scrollbar = /*#__PURE__*/_export_sfc(_sfc_main$2, [['render',_sfc_render$1]]);
169
+ const Scrollbar = /*#__PURE__*/_export_sfc(_sfc_main$1, [['render',_sfc_render$1]]);
207
170
 
208
- const _sfc_main$1 = {};
171
+ const _sfc_main = {};
209
172
 
210
173
  function _sfc_render(_ctx, _cache) {
211
174
  return (openBlock(), createElementBlock("div"))
212
175
  }
213
- const TableColumn = /*#__PURE__*/_export_sfc(_sfc_main$1, [['render',_sfc_render]]);
214
-
215
- const _sfc_main = /* @__PURE__ */ defineComponent({
216
- __name: "Tree",
217
- props: {
218
- data: {},
219
- emptyText: {},
220
- nodeKey: {},
221
- props: {},
222
- renderAfterExpand: { type: Boolean },
223
- load: {},
224
- renderContent: {},
225
- highlightCurrent: { type: Boolean },
226
- defaultExpandAll: { type: Boolean },
227
- checkOnClickNode: { type: Boolean },
228
- autoExpandParent: { type: Boolean },
229
- defaultExpandedKeys: {},
230
- showCheckbox: { type: Boolean },
231
- checkStrictly: { type: Boolean },
232
- defaultCheckedKeys: {},
233
- currentNodeKey: {},
234
- filterNodeMethod: { type: Function },
235
- accordion: { type: Boolean },
236
- indent: {},
237
- icon: {},
238
- lazy: { type: Boolean },
239
- draggable: { type: Boolean },
240
- allowDrag: { type: Function },
241
- allowDrop: {}
242
- },
243
- emits: [
244
- "node-click",
245
- "node-contextmenu",
246
- "node-drag-end",
247
- "node-collapse",
248
- "node-expand",
249
- "check",
250
- "mousedown",
251
- "mouseup"
252
- ],
253
- setup(__props, { expose: __expose, emit: __emit }) {
254
- const props = __props;
255
- const nodeKeys = computed(() => ({
256
- value: props.props?.value || "value",
257
- label: props.props?.label || "label",
258
- children: props.props?.children || "children"
259
- }));
260
- const loadChildren = (node) => props.load ? new Promise((resolve) => {
261
- props.load(node, resolve);
262
- }) : void 0;
263
- let filterValue;
264
- const filterNode = (node) => props.filterNodeMethod?.(filterValue, node.data, node);
265
- const iconRender = () => props.icon && h(props.icon);
266
- const emit = __emit;
267
- const nodeClickHandler = (context) => {
268
- emit("node-click", context.node.data, context.node, context, context.e);
269
- };
270
- const contextmenu = (...args) => {
271
- emit("node-contextmenu", ...args);
272
- };
273
- const handleExpand = (value, context) => {
274
- emit("node-expand", context.node.data, context.node);
275
- };
276
- const tree = ref();
277
- __expose({
278
- getData() {
279
- return tree.value?.data;
280
- },
281
- getStore() {
282
- return tree.value?.store;
283
- },
284
- filter(value) {
285
- filterValue = value;
286
- },
287
- getNode(...args) {
288
- return tree.value?.getNode(...args);
289
- },
290
- setCheckedKeys(...args) {
291
- console.log(args);
292
- },
293
- setCurrentKey(...args) {
294
- console.log(args);
295
- }
296
- });
297
- return (_ctx, _cache) => {
298
- return openBlock(), createBlock(unref(Tree), {
299
- ref_key: "tree",
300
- ref: tree,
301
- data: _ctx.data,
302
- empty: _ctx.emptyText,
303
- keys: nodeKeys.value,
304
- load: loadChildren,
305
- activable: _ctx.highlightCurrent,
306
- expandAll: _ctx.defaultExpandAll,
307
- expandParent: _ctx.autoExpandParent,
308
- defaultExpanded: _ctx.defaultExpandedKeys,
309
- actived: _ctx.currentNodeKey,
310
- filter: filterNode,
311
- expandMutex: _ctx.accordion,
312
- draggable: _ctx.draggable,
313
- icon: iconRender,
314
- lazy: _ctx.lazy,
315
- allowDrag: _ctx.allowDrag,
316
- allowDrop: _ctx.allowDrop,
317
- onClick: nodeClickHandler,
318
- onExpand: handleExpand,
319
- onContextmenu: contextmenu
320
- }, null, 8, ["data", "empty", "keys", "activable", "expandAll", "expandParent", "defaultExpanded", "actived", "expandMutex", "draggable", "lazy", "allowDrag", "allowDrop"]);
321
- };
322
- }
323
- });
176
+ const TableColumn = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render]]);
324
177
 
325
178
  const adapter = {
326
179
  message: MessagePlugin,
@@ -432,7 +285,7 @@ const adapter = {
432
285
  })
433
286
  },
434
287
  datePicker: {
435
- component: _sfc_main$6,
288
+ component: _sfc_main$4,
436
289
  props: (props) => props
437
290
  },
438
291
  dialog: {
@@ -519,7 +372,7 @@ const adapter = {
519
372
  props: (props) => props
520
373
  },
521
374
  input: {
522
- component: _sfc_main$4,
375
+ component: _sfc_main$2,
523
376
  props: (props) => props
524
377
  },
525
378
  inputNumber: {
@@ -556,10 +409,6 @@ const adapter = {
556
409
  total: props.total
557
410
  })
558
411
  },
559
- popover: {
560
- component: _sfc_main$3,
561
- props: (props) => props
562
- },
563
412
  radio: {
564
413
  component: Radio,
565
414
  props: (props) => ({
@@ -675,31 +524,6 @@ const adapter = {
675
524
  content: props.content
676
525
  })
677
526
  },
678
- tree: {
679
- component: _sfc_main,
680
- props: (props) => ({
681
- ...props,
682
- data: props.data,
683
- draggable: props.draggable,
684
- activable: props.highlightCurrent,
685
- activeMultiple: props.highlightCurrent,
686
- defaultActived: props.defaultCheckedKeys,
687
- checkable: props.showCheckbox,
688
- empty: props.emptyText,
689
- expandAll: props.defaultExpandAll,
690
- checkStrictly: props.checkStrictly,
691
- load: props.load,
692
- keys: props.props
693
- }),
694
- listeners: {
695
- click(context) {
696
- return {
697
- node: context.node,
698
- data: context.node.data
699
- };
700
- }
701
- }
702
- },
703
527
  upload: {
704
528
  component: Upload,
705
529
  props: (props) => ({
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.TMagicTdesignVueNextAdapter = factory(global.vue, global.tdesignVueNext));
5
5
  })(this, (function (vue, tdesignVueNext) { 'use strict';
6
6
 
7
- const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
7
+ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
8
8
  __name: "DatePicker",
9
9
  props: {
10
10
  type: { default: "date" },
@@ -77,16 +77,16 @@
77
77
  return target;
78
78
  };
79
79
 
80
- const _sfc_main$5 = {};
80
+ const _sfc_main$3 = {};
81
81
 
82
82
  function _sfc_render$2(_ctx, _cache) {
83
83
  return (vue.openBlock(), vue.createElementBlock("i", null, [
84
84
  vue.renderSlot(_ctx.$slots, "default")
85
85
  ]))
86
86
  }
87
- const Icon = /*#__PURE__*/_export_sfc(_sfc_main$5, [['render',_sfc_render$2]]);
87
+ const Icon = /*#__PURE__*/_export_sfc(_sfc_main$3, [['render',_sfc_render$2]]);
88
88
 
89
- const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
89
+ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
90
90
  __name: "Input",
91
91
  props: {
92
92
  modelValue: {},
@@ -148,44 +148,7 @@
148
148
  }
149
149
  });
150
150
 
151
- const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
152
- __name: "Popover",
153
- props: {
154
- placement: {},
155
- width: {},
156
- title: {},
157
- trigger: {},
158
- effect: {},
159
- content: {},
160
- disabled: { type: Boolean },
161
- popperClass: {},
162
- visible: { type: [Boolean, null] }
163
- },
164
- setup(__props) {
165
- const props = __props;
166
- const placement = vue.computed(() => props.placement);
167
- const trigger = vue.computed(() => props.trigger);
168
- return (_ctx, _cache) => {
169
- return vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Popup), {
170
- placement: placement.value,
171
- trigger: trigger.value,
172
- disabled: _ctx.disabled,
173
- visible: _ctx.visible,
174
- overlayClassName: _ctx.popperClass
175
- }, {
176
- content: vue.withCtx(() => [
177
- vue.renderSlot(_ctx.$slots, "default")
178
- ]),
179
- default: vue.withCtx(() => [
180
- vue.renderSlot(_ctx.$slots, "reference")
181
- ]),
182
- _: 3
183
- }, 8, ["placement", "trigger", "disabled", "visible", "overlayClassName"]);
184
- };
185
- }
186
- });
187
-
188
- const _sfc_main$2 = {};
151
+ const _sfc_main$1 = {};
189
152
 
190
153
  const _hoisted_1 = {
191
154
  class: "tdesign-scrollbar",
@@ -206,124 +169,14 @@
206
169
  ])
207
170
  ]))
208
171
  }
209
- const Scrollbar = /*#__PURE__*/_export_sfc(_sfc_main$2, [['render',_sfc_render$1]]);
172
+ const Scrollbar = /*#__PURE__*/_export_sfc(_sfc_main$1, [['render',_sfc_render$1]]);
210
173
 
211
- const _sfc_main$1 = {};
174
+ const _sfc_main = {};
212
175
 
213
176
  function _sfc_render(_ctx, _cache) {
214
177
  return (vue.openBlock(), vue.createElementBlock("div"))
215
178
  }
216
- const TableColumn = /*#__PURE__*/_export_sfc(_sfc_main$1, [['render',_sfc_render]]);
217
-
218
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
219
- __name: "Tree",
220
- props: {
221
- data: {},
222
- emptyText: {},
223
- nodeKey: {},
224
- props: {},
225
- renderAfterExpand: { type: Boolean },
226
- load: {},
227
- renderContent: {},
228
- highlightCurrent: { type: Boolean },
229
- defaultExpandAll: { type: Boolean },
230
- checkOnClickNode: { type: Boolean },
231
- autoExpandParent: { type: Boolean },
232
- defaultExpandedKeys: {},
233
- showCheckbox: { type: Boolean },
234
- checkStrictly: { type: Boolean },
235
- defaultCheckedKeys: {},
236
- currentNodeKey: {},
237
- filterNodeMethod: { type: Function },
238
- accordion: { type: Boolean },
239
- indent: {},
240
- icon: {},
241
- lazy: { type: Boolean },
242
- draggable: { type: Boolean },
243
- allowDrag: { type: Function },
244
- allowDrop: {}
245
- },
246
- emits: [
247
- "node-click",
248
- "node-contextmenu",
249
- "node-drag-end",
250
- "node-collapse",
251
- "node-expand",
252
- "check",
253
- "mousedown",
254
- "mouseup"
255
- ],
256
- setup(__props, { expose: __expose, emit: __emit }) {
257
- const props = __props;
258
- const nodeKeys = vue.computed(() => ({
259
- value: props.props?.value || "value",
260
- label: props.props?.label || "label",
261
- children: props.props?.children || "children"
262
- }));
263
- const loadChildren = (node) => props.load ? new Promise((resolve) => {
264
- props.load(node, resolve);
265
- }) : void 0;
266
- let filterValue;
267
- const filterNode = (node) => props.filterNodeMethod?.(filterValue, node.data, node);
268
- const iconRender = () => props.icon && vue.h(props.icon);
269
- const emit = __emit;
270
- const nodeClickHandler = (context) => {
271
- emit("node-click", context.node.data, context.node, context, context.e);
272
- };
273
- const contextmenu = (...args) => {
274
- emit("node-contextmenu", ...args);
275
- };
276
- const handleExpand = (value, context) => {
277
- emit("node-expand", context.node.data, context.node);
278
- };
279
- const tree = vue.ref();
280
- __expose({
281
- getData() {
282
- return tree.value?.data;
283
- },
284
- getStore() {
285
- return tree.value?.store;
286
- },
287
- filter(value) {
288
- filterValue = value;
289
- },
290
- getNode(...args) {
291
- return tree.value?.getNode(...args);
292
- },
293
- setCheckedKeys(...args) {
294
- console.log(args);
295
- },
296
- setCurrentKey(...args) {
297
- console.log(args);
298
- }
299
- });
300
- return (_ctx, _cache) => {
301
- return vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Tree), {
302
- ref_key: "tree",
303
- ref: tree,
304
- data: _ctx.data,
305
- empty: _ctx.emptyText,
306
- keys: nodeKeys.value,
307
- load: loadChildren,
308
- activable: _ctx.highlightCurrent,
309
- expandAll: _ctx.defaultExpandAll,
310
- expandParent: _ctx.autoExpandParent,
311
- defaultExpanded: _ctx.defaultExpandedKeys,
312
- actived: _ctx.currentNodeKey,
313
- filter: filterNode,
314
- expandMutex: _ctx.accordion,
315
- draggable: _ctx.draggable,
316
- icon: iconRender,
317
- lazy: _ctx.lazy,
318
- allowDrag: _ctx.allowDrag,
319
- allowDrop: _ctx.allowDrop,
320
- onClick: nodeClickHandler,
321
- onExpand: handleExpand,
322
- onContextmenu: contextmenu
323
- }, null, 8, ["data", "empty", "keys", "activable", "expandAll", "expandParent", "defaultExpanded", "actived", "expandMutex", "draggable", "lazy", "allowDrag", "allowDrop"]);
324
- };
325
- }
326
- });
179
+ const TableColumn = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render]]);
327
180
 
328
181
  const adapter = {
329
182
  message: tdesignVueNext.MessagePlugin,
@@ -435,7 +288,7 @@
435
288
  })
436
289
  },
437
290
  datePicker: {
438
- component: _sfc_main$6,
291
+ component: _sfc_main$4,
439
292
  props: (props) => props
440
293
  },
441
294
  dialog: {
@@ -522,7 +375,7 @@
522
375
  props: (props) => props
523
376
  },
524
377
  input: {
525
- component: _sfc_main$4,
378
+ component: _sfc_main$2,
526
379
  props: (props) => props
527
380
  },
528
381
  inputNumber: {
@@ -559,10 +412,6 @@
559
412
  total: props.total
560
413
  })
561
414
  },
562
- popover: {
563
- component: _sfc_main$3,
564
- props: (props) => props
565
- },
566
415
  radio: {
567
416
  component: tdesignVueNext.Radio,
568
417
  props: (props) => ({
@@ -678,31 +527,6 @@
678
527
  content: props.content
679
528
  })
680
529
  },
681
- tree: {
682
- component: _sfc_main,
683
- props: (props) => ({
684
- ...props,
685
- data: props.data,
686
- draggable: props.draggable,
687
- activable: props.highlightCurrent,
688
- activeMultiple: props.highlightCurrent,
689
- defaultActived: props.defaultCheckedKeys,
690
- checkable: props.showCheckbox,
691
- empty: props.emptyText,
692
- expandAll: props.defaultExpandAll,
693
- checkStrictly: props.checkStrictly,
694
- load: props.load,
695
- keys: props.props
696
- }),
697
- listeners: {
698
- click(context) {
699
- return {
700
- node: context.node,
701
- data: context.node.data
702
- };
703
- }
704
- }
705
- },
706
530
  upload: {
707
531
  component: tdesignVueNext.Upload,
708
532
  props: (props) => ({
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.16",
2
+ "version": "1.5.0-beta.1",
3
3
  "name": "@tmagic/tdesign-vue-next-adapter",
4
4
  "type": "module",
5
5
  "main": "dist/tmagic-tdesign-vue-next-adapter.umd.cjs",
@@ -38,14 +38,13 @@
38
38
  "@vue/compiler-sfc": "^3.4.27",
39
39
  "@types/node": "^18.19.0",
40
40
  "rimraf": "^3.0.2",
41
- "vite": "^5.3.5",
42
- "vue-tsc": "^2.0.19"
41
+ "vite": "^5.3.5"
43
42
  },
44
43
  "peerDependencies": {
45
- "tdesign-vue-next": "^1.8.1",
44
+ "tdesign-vue-next": "^1.9.8",
46
45
  "vue": "^3.4.35",
47
46
  "typescript": "*",
48
- "@tmagic/design": "1.4.16"
47
+ "@tmagic/design": "1.5.0-beta.1"
49
48
  },
50
49
  "peerDependenciesMeta": {
51
50
  "typescript": {
@@ -53,9 +52,6 @@
53
52
  }
54
53
  },
55
54
  "scripts": {
56
- "build": "npm run build:type && vite build",
57
- "build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
58
- "clear:type": "rimraf ./types",
59
- "check:type": "tsc --noEmit --project tsconfig.build.json"
55
+ "build": "vite build"
60
56
  }
61
57
  }
package/src/index.ts CHANGED
@@ -37,7 +37,6 @@ import {
37
37
  Tag as TTag,
38
38
  TimePicker as TTimePicker,
39
39
  Tooltip as TTooltip,
40
- TreeNodeModel,
41
40
  Upload as TUpload,
42
41
  } from 'tdesign-vue-next';
43
42
 
@@ -65,7 +64,6 @@ import type {
65
64
  OptionGroupProps,
66
65
  OptionProps,
67
66
  PaginationProps,
68
- PopoverProps,
69
67
  RadioButtonProps,
70
68
  RadioGroupProps,
71
69
  RadioProps,
@@ -80,17 +78,14 @@ import type {
80
78
  TagProps,
81
79
  TimePickerProps,
82
80
  TooltipProps,
83
- TreeProps,
84
81
  UploadProps,
85
82
  } from '@tmagic/design';
86
83
 
87
84
  import DatePicker from './DatePicker.vue';
88
85
  import Icon from './Icon.vue';
89
86
  import Input from './Input.vue';
90
- import Popover from './Popover.vue';
91
87
  import Scrollbar from './Scrollbar.vue';
92
88
  import TableColumn from './TableColumn.vue';
93
- import Tree from './Tree.vue';
94
89
 
95
90
  const adapter: any = {
96
91
  message: MessagePlugin,
@@ -351,11 +346,6 @@ const adapter: any = {
351
346
  }),
352
347
  },
353
348
 
354
- popover: {
355
- component: Popover,
356
- props: (props: PopoverProps) => props,
357
- },
358
-
359
349
  radio: {
360
350
  component: TRadio,
361
351
  props: (props: RadioProps) => ({
@@ -487,32 +477,6 @@ const adapter: any = {
487
477
  }),
488
478
  },
489
479
 
490
- tree: {
491
- component: Tree,
492
- props: (props: TreeProps) => ({
493
- ...props,
494
- data: props.data,
495
- draggable: props.draggable,
496
- activable: props.highlightCurrent,
497
- activeMultiple: props.highlightCurrent,
498
- defaultActived: props.defaultCheckedKeys,
499
- checkable: props.showCheckbox,
500
- empty: props.emptyText,
501
- expandAll: props.defaultExpandAll,
502
- checkStrictly: props.checkStrictly,
503
- load: props.load,
504
- keys: props.props,
505
- }),
506
- listeners: {
507
- click(context: { node: TreeNodeModel<any>; e: MouseEvent }) {
508
- return {
509
- node: context.node,
510
- data: context.node.data,
511
- };
512
- },
513
- },
514
- },
515
-
516
480
  upload: {
517
481
  component: TUpload,
518
482
  props: (props: UploadProps) => ({
package/types/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  declare const adapter: any;
2
- export default adapter;
2
+
3
+ export { adapter as default };
package/src/Popover.vue DELETED
@@ -1,27 +0,0 @@
1
- <template>
2
- <TPopup
3
- :placement="placement"
4
- :trigger="trigger"
5
- :disabled="disabled"
6
- :visible="visible"
7
- :overlayClassName="popperClass"
8
- >
9
- <slot name="reference"></slot>
10
-
11
- <template #content>
12
- <slot></slot>
13
- </template>
14
- </TPopup>
15
- </template>
16
-
17
- <script setup lang="ts">
18
- import { computed } from 'vue';
19
- import { Popup as TPopup, type PopupPlacement } from 'tdesign-vue-next';
20
-
21
- import type { PopoverProps } from '@tmagic/design';
22
-
23
- const props = defineProps<PopoverProps>();
24
-
25
- const placement = computed(() => props.placement as PopupPlacement);
26
- const trigger = computed(() => props.trigger as 'click' | 'focus' | 'mousedown' | 'context-menu' | 'hover');
27
- </script>
package/src/Tree.vue DELETED
@@ -1,103 +0,0 @@
1
- <template>
2
- <TTree
3
- ref="tree"
4
- :data="data"
5
- :empty="emptyText"
6
- :keys="nodeKeys"
7
- :load="loadChildren"
8
- :activable="highlightCurrent"
9
- :expandAll="defaultExpandAll"
10
- :expandParent="autoExpandParent"
11
- :defaultExpanded="defaultExpandedKeys"
12
- :actived="currentNodeKey"
13
- :filter="filterNode"
14
- :expandMutex="accordion"
15
- :draggable="draggable"
16
- :icon="iconRender"
17
- :lazy="lazy"
18
- :allowDrag="allowDrag"
19
- :allowDrop="allowDrop"
20
- :onClick="nodeClickHandler"
21
- :onExpand="handleExpand"
22
- @contextmenu="contextmenu"
23
- ></TTree>
24
- </template>
25
-
26
- <script lang="ts" setup>
27
- import { computed, h, ref } from 'vue';
28
- import { Tree as TTree, TreeNodeModel, TreeNodeValue } from 'tdesign-vue-next';
29
-
30
- import type { TreeProps } from '@tmagic/design';
31
-
32
- const props = defineProps<TreeProps>();
33
-
34
- const nodeKeys = computed(() => ({
35
- value: props.props?.value || 'value',
36
- label: props.props?.label || 'label',
37
- children: props.props?.children || 'children',
38
- }));
39
-
40
- const loadChildren = (node: TreeNodeModel<any>) =>
41
- props.load
42
- ? new Promise((resolve) => {
43
- props.load(node, resolve);
44
- })
45
- : undefined;
46
-
47
- let filterValue: any;
48
-
49
- const filterNode = (node: TreeNodeModel<any>) => props.filterNodeMethod?.(filterValue, node.data, node);
50
-
51
- const iconRender = () => props.icon && h(props.icon);
52
-
53
- const emit = defineEmits([
54
- 'node-click',
55
- 'node-contextmenu',
56
- 'node-drag-end',
57
- 'node-collapse',
58
- 'node-expand',
59
- 'check',
60
- 'mousedown',
61
- 'mouseup',
62
- ]);
63
-
64
- const nodeClickHandler = (context: { node: TreeNodeModel<any>; e: MouseEvent }) => {
65
- emit('node-click', context.node.data, context.node, context, context.e);
66
- };
67
-
68
- const contextmenu = (...args: any[]) => {
69
- emit('node-contextmenu', ...args);
70
- };
71
-
72
- const handleExpand = (value: Array<TreeNodeValue>, context: { node: TreeNodeModel<any>; e: MouseEvent }) => {
73
- emit('node-expand', context.node.data, context.node);
74
- };
75
-
76
- const tree = ref<InstanceType<typeof TTree>>();
77
-
78
- defineExpose({
79
- getData() {
80
- return tree.value?.data;
81
- },
82
-
83
- getStore() {
84
- return tree.value?.store;
85
- },
86
-
87
- filter(value: any) {
88
- filterValue = value;
89
- },
90
-
91
- getNode(...args: any[]) {
92
- return tree.value?.getNode(...args);
93
- },
94
-
95
- setCheckedKeys(...args: any[]) {
96
- console.log(args);
97
- },
98
-
99
- setCurrentKey(...args: any[]) {
100
- console.log(args);
101
- },
102
- });
103
- </script>