@pisell/materials 1.0.607 → 1.0.609

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 (68) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +3 -3
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +24 -24
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +27 -27
  11. package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +6 -2
  12. package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +15 -1
  13. package/es/components/dataSourceComponents/fields/Select/index.js +2 -1
  14. package/es/components/image/avatar.png +0 -0
  15. package/es/components/image/image.png +0 -0
  16. package/es/components/image/product.png +0 -0
  17. package/es/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +1 -1
  18. package/es/components/pisellDraggable/components/TreeItem/TreeItem.js +1 -1
  19. package/es/components/pisellDraggable/index.d.ts +2 -1
  20. package/es/components/pisellDropSort/PisellDropSort.d.ts +5 -0
  21. package/es/components/pisellDropSort/PisellDropSort.js +102 -0
  22. package/es/components/pisellDropSort/PisellDropSort.less +92 -0
  23. package/es/components/pisellDropSort/components/SortableItem/index.d.ts +19 -0
  24. package/es/components/pisellDropSort/components/SortableItem/index.js +93 -0
  25. package/es/components/pisellDropSort/components/SortableItem/index.less +155 -0
  26. package/es/components/pisellDropSort/index.d.ts +3 -0
  27. package/es/components/pisellDropSort/index.js +2 -0
  28. package/es/components/pisellDropSort/types.d.ts +42 -0
  29. package/es/components/pisellDropSort/types.js +1 -0
  30. package/es/components/table/Table/utils.d.ts +1 -1
  31. package/es/index.d.ts +1 -0
  32. package/es/index.js +2 -1
  33. package/es/locales/en-US.d.ts +1 -0
  34. package/es/locales/en-US.js +1 -1
  35. package/es/locales/zh-CN.d.ts +1 -0
  36. package/es/locales/zh-CN.js +1 -1
  37. package/es/locales/zh-TW.d.ts +1 -0
  38. package/es/locales/zh-TW.js +1 -1
  39. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +6 -2
  40. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +16 -1
  41. package/lib/components/dataSourceComponents/fields/Select/index.js +2 -1
  42. package/lib/components/image/avatar.png +0 -0
  43. package/lib/components/image/image.png +0 -0
  44. package/lib/components/image/product.png +0 -0
  45. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +1 -1
  46. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.js +1 -1
  47. package/lib/components/pisellDraggable/index.d.ts +2 -1
  48. package/lib/components/pisellDropSort/PisellDropSort.d.ts +5 -0
  49. package/lib/components/pisellDropSort/PisellDropSort.js +147 -0
  50. package/lib/components/pisellDropSort/PisellDropSort.less +92 -0
  51. package/lib/components/pisellDropSort/components/SortableItem/index.d.ts +19 -0
  52. package/lib/components/pisellDropSort/components/SortableItem/index.js +164 -0
  53. package/lib/components/pisellDropSort/components/SortableItem/index.less +155 -0
  54. package/lib/components/pisellDropSort/index.d.ts +3 -0
  55. package/lib/components/pisellDropSort/index.js +36 -0
  56. package/lib/components/pisellDropSort/types.d.ts +42 -0
  57. package/lib/components/pisellDropSort/types.js +17 -0
  58. package/lib/components/table/Table/utils.d.ts +1 -1
  59. package/lib/index.d.ts +1 -0
  60. package/lib/index.js +3 -0
  61. package/lib/locales/en-US.d.ts +1 -0
  62. package/lib/locales/en-US.js +3 -1
  63. package/lib/locales/zh-CN.d.ts +1 -0
  64. package/lib/locales/zh-CN.js +3 -1
  65. package/lib/locales/zh-TW.d.ts +1 -0
  66. package/lib/locales/zh-TW.js +3 -1
  67. package/lowcode/pisell-drop-sort/meta.ts +344 -0
  68. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ .pisell-lowcode-drop-sort-item {
2
+ box-sizing: border-box;
3
+ padding-left: var(--spacing);
4
+
5
+ &.clone {
6
+ display: inline-block;
7
+ pointer-events: none;
8
+ padding: 0;
9
+ padding-left: 10px;
10
+ padding-top: 5px;
11
+
12
+ .pisell-lowcode-drop-sort-item-tree-item {
13
+ --vertical-padding: 5px;
14
+
15
+ padding-right: 24px;
16
+ box-shadow: 0px 15px 15px 0 rgba(34, 33, 81, 0.1);
17
+ }
18
+ }
19
+
20
+ &.ghost {
21
+ &.indicator {
22
+ opacity: 1;
23
+ position: relative;
24
+ z-index: 1;
25
+ margin-bottom: -1px;
26
+
27
+ .pisell-lowcode-drop-sort-item-tree-item {
28
+ position: relative;
29
+ padding: 0;
30
+ height: 8px;
31
+ border-color: #2389ff;
32
+ background-color: #56a1f8;
33
+
34
+ &:before {
35
+ position: absolute;
36
+ left: -8px;
37
+ top: -4px;
38
+ display: block;
39
+ content: '';
40
+ width: 12px;
41
+ height: 12px;
42
+ border-radius: 50%;
43
+ border: 1px solid #2389ff;
44
+ background-color: #ffffff;
45
+ }
46
+
47
+ > * {
48
+ /* Items are hidden using height and opacity to retain focus */
49
+ opacity: 0;
50
+ height: 0;
51
+ }
52
+ }
53
+ }
54
+
55
+ &:not(.indicator) {
56
+ opacity: 0.5;
57
+ }
58
+
59
+ .pisell-lowcode-drop-sort-item-tree-item > * {
60
+ box-shadow: none;
61
+ background-color: transparent;
62
+ }
63
+ }
64
+
65
+ }
66
+
67
+ .pisell-lowcode-drop-sort-item-tree-item {
68
+ position: relative;
69
+ display: flex;
70
+ padding: 12px;
71
+ align-items: center;
72
+ gap: 16px;
73
+ align-self: stretch;
74
+ border-radius: 12px;
75
+ background: var(--Base-White, #fff);
76
+
77
+ --vertical-padding: 10px;
78
+ box-sizing: border-box;
79
+ // transition: all 0.25s;
80
+
81
+ .pisell-lowcode-drop-sort-item-content {
82
+ flex: 1;
83
+ height: 48px;
84
+ }
85
+
86
+ .pisell-lowcode-drop-sort-item-button {
87
+ &:hover {
88
+ background: var(--Gray-100, #F2F4F7);
89
+ }
90
+ }
91
+
92
+ &:hover {
93
+ background: var(--Gray-25, #FCFCFD);
94
+ }
95
+
96
+ &.disabled {
97
+ border: 1px solid var(--Gray-200, #EAECF0);
98
+ background: var(--Gray-100, #F2F4F7);
99
+ cursor: not-allowed;
100
+ }
101
+ }
102
+
103
+ .pisell-lowcode-drop-sort-item-tree-item-border {
104
+ border: 1px solid var(--Gray-200, #eaecf0);
105
+ /* Shadow/xs */
106
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
107
+ }
108
+
109
+ .pisell-lowcode-drop-sort-item-icon {
110
+ font-size: 20px;
111
+ color: #101828;
112
+ }
113
+
114
+ .pisell-lowcode-drop-sort-item-drag-handle-icon {
115
+ font-size: 20px;
116
+ color: #98a2b3;
117
+ }
118
+
119
+ .pisell-lowcode-drop-sort-item-count {
120
+ position: absolute;
121
+ top: -10px;
122
+ right: -10px;
123
+ display: flex;
124
+ align-items: center;
125
+ justify-content: center;
126
+ width: 24px;
127
+ height: 24px;
128
+ border-radius: 50%;
129
+ background-color: #2389ff;
130
+ font-size: 0.8rem;
131
+ font-weight: 600;
132
+ color: #fff;
133
+ }
134
+
135
+ .disableInteraction {
136
+ pointer-events: none;
137
+ }
138
+
139
+ .disableSelection,
140
+ .clone {
141
+ .pisell-lowcode-drop-sort-item-count {
142
+ user-select: none;
143
+ -webkit-user-select: none;
144
+ }
145
+ }
146
+
147
+ .Collapse {
148
+ svg {
149
+ transition: transform 250ms ease;
150
+ }
151
+
152
+ &.collapsed svg {
153
+ transform: rotate(-90deg);
154
+ }
155
+ }
@@ -0,0 +1,3 @@
1
+ import PisellDropSort from './PisellDropSort';
2
+ export default PisellDropSort;
3
+ export type { PisellDropSortProps, DropSortItem } from './types';
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pisellDropSort/index.tsx
30
+ var pisellDropSort_exports = {};
31
+ __export(pisellDropSort_exports, {
32
+ default: () => pisellDropSort_default
33
+ });
34
+ module.exports = __toCommonJS(pisellDropSort_exports);
35
+ var import_PisellDropSort = __toESM(require("./PisellDropSort"));
36
+ var pisellDropSort_default = import_PisellDropSort.default;
@@ -0,0 +1,42 @@
1
+ import { CSSProperties } from 'react';
2
+ import type { Props as TreeItem } from '../pisellDraggable/components/TreeItem/TreeItem';
3
+ import type { TreeItem as TreeItemType } from '../pisellDraggable/types';
4
+ export interface DropSortItem extends TreeItemType {
5
+ [key: string]: any;
6
+ }
7
+ export interface PisellDropSortProps {
8
+ /** value */
9
+ value: DropSortItem[];
10
+ /** 允许拖拽 */
11
+ allowDrag?: boolean;
12
+ /** 允许删除 */
13
+ allowDelete?: boolean;
14
+ /** 允许添加子节点 */
15
+ allowAddChild?: boolean;
16
+ /** 允许添加根节点 */
17
+ allowAddRoot?: boolean;
18
+ /** 是否禁用 */
19
+ disabled?: boolean;
20
+ /** 节点间距 */
21
+ spacing?: number;
22
+ /** 最大层级数 */
23
+ maxLevel?: number;
24
+ /** 是否显示边框 */
25
+ showBorder?: boolean;
26
+ /** 样式 */
27
+ style?: CSSProperties;
28
+ /** 类名 */
29
+ className?: string;
30
+ /** 数据源变化回调 */
31
+ onChange?: (items: DropSortItem[]) => void;
32
+ /** 删除节点回调 */
33
+ onDelete?: (itemProps: TreeItem) => void;
34
+ /** 添加节点回调 */
35
+ onAdd?: (itemProps: TreeItem) => void;
36
+ /** 自定义渲染节点 */
37
+ renderItem?: (itemProps: TreeItem) => React.ReactNode;
38
+ /** 添加根节点回调 */
39
+ onAddRoot?: () => void;
40
+ /** 左侧自定义内容 */
41
+ leftContent?: React.ReactNode;
42
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/components/pisellDropSort/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
@@ -167,7 +167,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
167
167
  sort?: SortType | undefined;
168
168
  mode: "" | "localStorage" | "remote";
169
169
  currentViewMode: ModeType;
170
- }) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
170
+ }) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
171
171
  export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
172
172
  export declare const stringify: (obj: Record<string, any>) => string;
173
173
  export {};
package/lib/index.d.ts CHANGED
@@ -132,3 +132,4 @@ export { default as PisellPriceKeyboard } from './components/virtual-keyboard/Am
132
132
  export { default as PisellNumberKeyboard } from './components/virtual-keyboard/Number';
133
133
  export { default as VirtualKeyboardTime } from './components/virtual-keyboard/Time';
134
134
  export { default as WalletCard } from './components/walletCard';
135
+ export { default as PisellDropSort } from './components/pisellDropSort';
package/lib/index.js CHANGED
@@ -121,6 +121,7 @@ __export(src_exports, {
121
121
  PisellCustomCheckboxGroup: () => import_pisellCustomCheckboxGroup.default,
122
122
  PisellDatePicker: () => import_pisellDatePicker.default,
123
123
  PisellDraggable: () => import_pisellDraggable.default,
124
+ PisellDropSort: () => import_pisellDropSort.default,
124
125
  PisellDropdown: () => import_pisellDropdown.default,
125
126
  PisellEmpty: () => import_pisellEmpty.default,
126
127
  PisellFloatingPanel: () => import_pisellFloatingPanel.default,
@@ -333,6 +334,7 @@ var import_Amount = __toESM(require("./components/virtual-keyboard/Amount"));
333
334
  var import_Number = __toESM(require("./components/virtual-keyboard/Number"));
334
335
  var import_Time = __toESM(require("./components/virtual-keyboard/Time"));
335
336
  var import_walletCard = __toESM(require("./components/walletCard"));
337
+ var import_pisellDropSort = __toESM(require("./components/pisellDropSort"));
336
338
  // Annotate the CommonJS export names for ESM import in node:
337
339
  0 && (module.exports = {
338
340
  Affix,
@@ -427,6 +429,7 @@ var import_walletCard = __toESM(require("./components/walletCard"));
427
429
  PisellCustomCheckboxGroup,
428
430
  PisellDatePicker,
429
431
  PisellDraggable,
432
+ PisellDropSort,
430
433
  PisellDropdown,
431
434
  PisellEmpty,
432
435
  PisellFloatingPanel,
@@ -213,5 +213,6 @@ declare const _default: {
213
213
  'pisell-lowcode-app-version-control-promote-version-ok': string;
214
214
  'pisell-lowcode-app-version-control-promote-version-cancel': string;
215
215
  'pisell-lowcode-app-version-control-version-exists': string;
216
+ 'pisell-lowcode-drop-sort-add': string;
216
217
  };
217
218
  export default _default;
@@ -265,5 +265,7 @@ var en_US_default = {
265
265
  "pisell-lowcode-app-version-control-promote-version-describe": "Promoting this version will lock it further changes",
266
266
  "pisell-lowcode-app-version-control-promote-version-ok": "Promote",
267
267
  "pisell-lowcode-app-version-control-promote-version-cancel": "Cancel",
268
- "pisell-lowcode-app-version-control-version-exists": "Version already exists"
268
+ "pisell-lowcode-app-version-control-version-exists": "Version already exists",
269
+ // 拖拽排序组件
270
+ "pisell-lowcode-drop-sort-add": "Add"
269
271
  };
@@ -212,5 +212,6 @@ declare const _default: {
212
212
  'pisell-lowcode-app-version-control-promote-version-ok': string;
213
213
  'pisell-lowcode-app-version-control-promote-version-cancel': string;
214
214
  'pisell-lowcode-app-version-control-version-exists': string;
215
+ 'pisell-lowcode-drop-sort-add': string;
215
216
  };
216
217
  export default _default;
@@ -261,5 +261,7 @@ var zh_CN_default = {
261
261
  "pisell-lowcode-app-version-control-promote-version-describe": "发布版本后,该版本将无法再进行修改",
262
262
  "pisell-lowcode-app-version-control-promote-version-ok": "发布",
263
263
  "pisell-lowcode-app-version-control-promote-version-cancel": "取消",
264
- "pisell-lowcode-app-version-control-version-exists": "版本已存在"
264
+ "pisell-lowcode-app-version-control-version-exists": "版本已存在",
265
+ // 拖拽排序组件
266
+ "pisell-lowcode-drop-sort-add": "添加"
265
267
  };
@@ -212,5 +212,6 @@ declare const _default: {
212
212
  'pisell-lowcode-app-version-control-promote-version-ok': string;
213
213
  'pisell-lowcode-app-version-control-promote-version-cancel': string;
214
214
  'pisell-lowcode-app-version-control-version-exists': string;
215
+ 'pisell-lowcode-drop-sort-add': string;
215
216
  };
216
217
  export default _default;
@@ -263,5 +263,7 @@ var zh_TW_default = {
263
263
  "pisell-lowcode-app-version-control-promote-version-describe": "發布版本後,該版本將無法再進行修改",
264
264
  "pisell-lowcode-app-version-control-promote-version-ok": "發布",
265
265
  "pisell-lowcode-app-version-control-promote-version-cancel": "取消",
266
- "pisell-lowcode-app-version-control-version-exists": "版本已存在"
266
+ "pisell-lowcode-app-version-control-version-exists": "版本已存在",
267
+ // 拖拽排序组件
268
+ "pisell-lowcode-drop-sort-add": "添加"
267
269
  };
@@ -0,0 +1,344 @@
1
+ import {
2
+ IPublicTypeComponentMetadata,
3
+ IPublicTypeSnippet,
4
+ } from '@alilc/lowcode-types';
5
+
6
+ const PisellDropSortMeta: IPublicTypeComponentMetadata = {
7
+ componentName: 'PisellDropSort',
8
+ title: '拖拽排序',
9
+ docUrl: '',
10
+ screenshot: '',
11
+ devMode: 'proCode',
12
+ npm: {
13
+ package: '@pisell/materials',
14
+ version: '1.0.3',
15
+ exportName: 'PisellDropSort',
16
+ main: 'src/index.tsx',
17
+ destructuring: true,
18
+ subName: '',
19
+ },
20
+ props: [
21
+ {
22
+ name: 'value',
23
+ propType: 'object',
24
+ },
25
+ {
26
+ name: 'allowDrag',
27
+ propType: 'bool',
28
+ description: '允许拖拽',
29
+ defaultValue: true,
30
+ },
31
+ {
32
+ name: 'allowDelete',
33
+ propType: 'bool',
34
+ description: '允许删除',
35
+ defaultValue: true,
36
+ },
37
+ {
38
+ name: 'allowAddChild',
39
+ propType: 'bool',
40
+ description: '允许添加子节点',
41
+ defaultValue: true,
42
+ },
43
+ {
44
+ name: 'allowAddRoot',
45
+ propType: 'bool',
46
+ description: '允许添加根节点',
47
+ defaultValue: true,
48
+ },
49
+ {
50
+ name: 'disabled',
51
+ propType: 'bool',
52
+ description: '是否禁用',
53
+ defaultValue: false,
54
+ },
55
+ {
56
+ name: 'spacing',
57
+ propType: 'number',
58
+ description: '间距',
59
+ defaultValue: 8,
60
+ },
61
+ {
62
+ name: 'maxLevel',
63
+ propType: 'number',
64
+ description: '最大层级数',
65
+ defaultValue: 3,
66
+ },
67
+ {
68
+ name: 'showBorder',
69
+ propType: 'bool',
70
+ description: '显示边框',
71
+ defaultValue: true,
72
+ },
73
+ {
74
+ name: 'className',
75
+ propType: 'string',
76
+ description: '类名',
77
+ },
78
+ {
79
+ name: 'style',
80
+ propType: 'object',
81
+ description: '样式',
82
+ },
83
+ {
84
+ name: 'onDragEnd',
85
+ propType: 'func',
86
+ description: '拖拽完成回调',
87
+ },
88
+ {
89
+ name: 'onDelete',
90
+ propType: 'func',
91
+ description: '删除节点回调',
92
+ },
93
+ {
94
+ name: 'onAdd',
95
+ propType: 'func',
96
+ description: '添加节点回调',
97
+ },
98
+ {
99
+ name: 'renderItem',
100
+ propType: {
101
+ type: 'func',
102
+ },
103
+ setter: [
104
+ {
105
+ componentName: 'SlotSetter',
106
+ title: '渲染函数插槽',
107
+ initialValue: {
108
+ type: 'JSSlot',
109
+ params: ['option'],
110
+ },
111
+ },
112
+ {
113
+ componentName: 'FunctionSetter',
114
+ props: {
115
+ template:
116
+ 'renderItem(item,${extParams}){\n// 自定义渲染\nreturn `item`;\n}',
117
+ },
118
+ },
119
+ 'VariableSetter',
120
+ ],
121
+ },
122
+ {
123
+ name: 'leftContent',
124
+ propType: {
125
+ type: 'func',
126
+ },
127
+ description: '左侧自定义内容',
128
+ },
129
+ ],
130
+ configure: {
131
+ props: [
132
+ {
133
+ name: 'value',
134
+ setter: 'JsonSetter',
135
+ title: {
136
+ label: {
137
+ type: 'i18n',
138
+ 'en-US': 'Data source',
139
+ 'zh-CN': '数据源',
140
+ },
141
+ },
142
+ },
143
+ {
144
+ name: 'allowDrag',
145
+ setter: 'BoolSetter',
146
+ defaultValue: true,
147
+ title: {
148
+ label: {
149
+ type: 'i18n',
150
+ 'en-US': 'Allow drag',
151
+ 'zh-CN': '允许拖拽',
152
+ },
153
+ },
154
+ },
155
+ {
156
+ name: 'allowDelete',
157
+ setter: 'BoolSetter',
158
+ defaultValue: true,
159
+ title: {
160
+ label: {
161
+ type: 'i18n',
162
+ 'en-US': 'Allow delete',
163
+ 'zh-CN': '允许删除',
164
+ },
165
+ },
166
+ },
167
+ {
168
+ name: 'allowAddChild',
169
+ setter: 'BoolSetter',
170
+ defaultValue: true,
171
+ title: {
172
+ label: {
173
+ type: 'i18n',
174
+ 'en-US': 'Allow add child',
175
+ 'zh-CN': '允许添加子节点',
176
+ },
177
+ },
178
+ },
179
+ {
180
+ name: 'allowAddRoot',
181
+ setter: 'BoolSetter',
182
+ defaultValue: true,
183
+ title: {
184
+ label: {
185
+ type: 'i18n',
186
+ 'en-US': 'Allow add root',
187
+ 'zh-CN': '允许添加根节点',
188
+ },
189
+ },
190
+ },
191
+ {
192
+ name: 'disabled',
193
+ setter: 'BoolSetter',
194
+ defaultValue: false,
195
+ title: {
196
+ label: {
197
+ type: 'i18n',
198
+ 'en-US': 'Disabled',
199
+ 'zh-CN': '是否禁用',
200
+ },
201
+ },
202
+ },
203
+ {
204
+ name: 'spacing',
205
+ setter: 'NumberSetter',
206
+ defaultValue: 8,
207
+ title: {
208
+ label: {
209
+ type: 'i18n',
210
+ 'en-US': 'Spacing',
211
+ 'zh-CN': '间距',
212
+ },
213
+ },
214
+ },
215
+ {
216
+ name: 'maxLevel',
217
+ setter: 'NumberSetter',
218
+ defaultValue: 3,
219
+ title: {
220
+ label: {
221
+ type: 'i18n',
222
+ 'en-US': 'Max level',
223
+ 'zh-CN': '最大层级数',
224
+ },
225
+ },
226
+ },
227
+ {
228
+ name: 'showBorder',
229
+ setter: 'BoolSetter',
230
+ defaultValue: true,
231
+ title: {
232
+ label: {
233
+ type: 'i18n',
234
+ 'en-US': 'Show border',
235
+ 'zh-CN': '显示边框',
236
+ },
237
+ },
238
+ },
239
+ {
240
+ name: 'renderItem',
241
+ title: { label: '自定义渲染', tip: '自定义渲染选项内容' },
242
+ setter: [
243
+ {
244
+ componentName: 'SlotSetter',
245
+ title: '渲染函数插槽',
246
+ initialValue: {
247
+ type: 'JSSlot',
248
+ params: ['item'],
249
+ },
250
+ },
251
+ {
252
+ componentName: 'FunctionSetter',
253
+ props: {
254
+ template:
255
+ 'renderItem(item,${extParams}){\n// 自定义渲染\nreturn `item`;\n}',
256
+ },
257
+ },
258
+ 'VariableSetter',
259
+ ],
260
+ },
261
+ {
262
+ name: 'leftContent',
263
+ title: { label: '左侧自定义内容', tip: '左侧自定义内容' },
264
+ setter: {
265
+ componentName: 'SlotSetter',
266
+ title: '左侧自定义内容',
267
+ initialValue: {
268
+ type: 'JSSlot',
269
+ },
270
+ },
271
+ },
272
+ ],
273
+ component: {
274
+ isContainer: true,
275
+ },
276
+ supports: {
277
+ style: true,
278
+ className: true,
279
+ events: [
280
+ {
281
+ name: 'onChange',
282
+ template: "onChange(item,${extParams}){\n// 节点变化回调\nconsole.log('onChange',item);}",
283
+ },
284
+ {
285
+ name: 'onDelete',
286
+ template: "onDelete(item,${extParams}){\n// 删除节点回调\nconsole.log('onDelete',item);}",
287
+ },
288
+ {
289
+ name: 'onAdd',
290
+ template: "onAdd(item,${extParams}){\n// 添加节点回调\nconsole.log('onAdd',item);}",
291
+ },
292
+ {
293
+ name: 'onDragEnd',
294
+ template: "onDragEnd(item,${extParams}){\n// 拖拽完成回调\nconsole.log('onDragEnd',item);}",
295
+ },
296
+ {
297
+ name: 'onAddRoot',
298
+ template: "onAddRoot(item,${extParams}){\n// 添加根节点回调\nconsole.log('onAddRoot',item);}",
299
+ }
300
+ ],
301
+ },
302
+ },
303
+ };
304
+
305
+ const snippets: IPublicTypeSnippet[] = [
306
+ {
307
+ title: '拖拽排序',
308
+ screenshot: '',
309
+ schema: {
310
+ title: "拖拽排序",
311
+ componentName: 'PisellDropSort',
312
+ props: {
313
+ renderItem: {
314
+ type: 'JSSlot',
315
+ params: ['item'],
316
+ },
317
+ leftContent: {
318
+ type: 'JSSlot',
319
+ },
320
+ value: [
321
+ {
322
+ id: '1',
323
+ title: '节点1',
324
+ children: [
325
+ {
326
+ id: '1-1',
327
+ title: '节点1-1',
328
+ },
329
+ ],
330
+ },
331
+ {
332
+ id: '2',
333
+ title: '节点2',
334
+ },
335
+ ],
336
+ },
337
+ },
338
+ },
339
+ ];
340
+
341
+ export default {
342
+ ...PisellDropSortMeta,
343
+ snippets,
344
+ };