@dckj-npm/dc-material 0.1.279 → 0.1.281
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.
- package/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/meta.design.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/lowcode/drawer/meta.ts +162 -1
- package/lowcode_es/drawer/meta.js +137 -2
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/drawer/meta.js +137 -2
- package/lowcode_lib/meta.js +1 -1
- package/package.json +2 -2
package/lowcode/drawer/meta.ts
CHANGED
|
@@ -53,6 +53,7 @@ const CustomDrawerMeta: IPublicTypeComponentMetadata = {
|
|
|
53
53
|
{ label: '下', value: 'bottom' },
|
|
54
54
|
],
|
|
55
55
|
},
|
|
56
|
+
initialValue: 'left',
|
|
56
57
|
},
|
|
57
58
|
},
|
|
58
59
|
{
|
|
@@ -126,12 +127,164 @@ const CustomDrawerMeta: IPublicTypeComponentMetadata = {
|
|
|
126
127
|
isContainer: true,
|
|
127
128
|
isModal: true,
|
|
128
129
|
disableBehaviors: ['copy'],
|
|
130
|
+
rootSelector: '.drawer',
|
|
129
131
|
nestingRule: {
|
|
130
132
|
parentWhitelist: (testNode, currentNode) => {
|
|
131
133
|
return testNode.componentName === 'Page'
|
|
132
134
|
},
|
|
133
135
|
},
|
|
134
136
|
},
|
|
137
|
+
advanced: {
|
|
138
|
+
callbacks: {
|
|
139
|
+
// 与 next-page 的 onNodeAdd 一模一样
|
|
140
|
+
onNodeAdd: (dragment, currentNode) => {
|
|
141
|
+
// 拖入的组件为 P、Block、Slot(把NextPage拖入到面板里时,NextPage的Slot也会触发onNodeAdd事件) 时,不进行包裹
|
|
142
|
+
// 拖入的组件 isModal为true时(例如drawer dialog 这类有单独组件树结构的),不进行包裹
|
|
143
|
+
if (
|
|
144
|
+
!dragment ||
|
|
145
|
+
['NextP', 'NextBlock', 'Slot'].includes(dragment.componentName) ||
|
|
146
|
+
(dragment.componentMeta.isModal && dragment.componentMeta.isModal())
|
|
147
|
+
) {
|
|
148
|
+
console.log(
|
|
149
|
+
`[${dragment.componentName}] doesn\'n need to wrap with NextBlock > NextBlockCell`,
|
|
150
|
+
)
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const NextPProps = {
|
|
155
|
+
wrap: false,
|
|
156
|
+
type: 'body2',
|
|
157
|
+
verAlign: 'middle',
|
|
158
|
+
textSpacing: true,
|
|
159
|
+
align: 'left',
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (
|
|
163
|
+
[
|
|
164
|
+
'Form',
|
|
165
|
+
'ResponsiveGrid',
|
|
166
|
+
'Box',
|
|
167
|
+
'Card',
|
|
168
|
+
'List',
|
|
169
|
+
'Message',
|
|
170
|
+
'Slider',
|
|
171
|
+
'NextTable',
|
|
172
|
+
].includes(dragment.componentName) ||
|
|
173
|
+
dragment.getPropValue('isFillContainer')
|
|
174
|
+
) {
|
|
175
|
+
NextPProps.full = true
|
|
176
|
+
}
|
|
177
|
+
const layoutPSchema = {
|
|
178
|
+
componentName: 'NextP',
|
|
179
|
+
title: '段落',
|
|
180
|
+
props: NextPProps,
|
|
181
|
+
children: [dragment.exportSchema()],
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 为目标元素包裹一层 Block
|
|
185
|
+
const layoutBlockNode = (len) =>
|
|
186
|
+
currentNode.document.createNode({
|
|
187
|
+
componentName: 'NextBlock',
|
|
188
|
+
title: '区块',
|
|
189
|
+
props: {
|
|
190
|
+
childTotalColumns: len || 12,
|
|
191
|
+
},
|
|
192
|
+
children: [
|
|
193
|
+
{
|
|
194
|
+
componentName: 'NextBlockCell',
|
|
195
|
+
title: '子区块',
|
|
196
|
+
props: {
|
|
197
|
+
isAutoContainer: true,
|
|
198
|
+
colSpan: 12,
|
|
199
|
+
rowSpan: 1,
|
|
200
|
+
},
|
|
201
|
+
children: [layoutPSchema],
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
const dropLocation = dragment.document.canvas.dropLocation
|
|
207
|
+
|
|
208
|
+
if (!dropLocation) {
|
|
209
|
+
// 没有 dropLocation 一般是 slot, slot 元素不用特殊处理 不做任何包裹
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
const dropTarget = dropLocation.target
|
|
213
|
+
const dropTargetName = dropLocation.target.componentName || ''
|
|
214
|
+
|
|
215
|
+
// 找到要拖入进去的节点 ID
|
|
216
|
+
const targetId = (dropLocation && dropLocation.target.id) || ''
|
|
217
|
+
// 找到要拖入进去的节点
|
|
218
|
+
let slotTarget =
|
|
219
|
+
currentNode.slots.length > 0 && currentNode.slots.find((item) => item.id === targetId)
|
|
220
|
+
|
|
221
|
+
const layoutPNode = currentNode.document.createNode(layoutPSchema)
|
|
222
|
+
|
|
223
|
+
// 是否为 aside slot
|
|
224
|
+
const isAsideSlot = slotTarget && ['aside'].indexOf(slotTarget._slotFor.key) > -1
|
|
225
|
+
// 是否为需要被 P 包裹的 Slot
|
|
226
|
+
const isNeedPSlot =
|
|
227
|
+
slotTarget && ['header', 'footer', 'nav'].indexOf(slotTarget._slotFor.key) > -1
|
|
228
|
+
|
|
229
|
+
const wrapWithBlock = (dragment, node, dropTargetName, blockLen) => {
|
|
230
|
+
setTimeout(() => {
|
|
231
|
+
console.log(
|
|
232
|
+
`[${dragment.componentName}] to [${dropTargetName}] need to wrap with NextBlock > NextBlockCell > NextP [from NextPage2]`,
|
|
233
|
+
)
|
|
234
|
+
const newNode = node.document.createNode(layoutBlockNode(blockLen).exportSchema())
|
|
235
|
+
node.insertBefore(newNode, dragment, false)
|
|
236
|
+
dragment.remove(false)
|
|
237
|
+
newNode.children.get(0).children.get(0).children.get(0).select()
|
|
238
|
+
}, 1)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const wrapWithP = (dragment, node, dropTargetName) => {
|
|
242
|
+
setTimeout(() => {
|
|
243
|
+
// const dragmentTarget = dropTarget;
|
|
244
|
+
// 要拖入的地方如果是 NextP 那就 不再自动包裹 P了
|
|
245
|
+
if (dropTargetName === 'NextP') {
|
|
246
|
+
console.log(
|
|
247
|
+
`[${dragment.componentName}] to [${dropTargetName}] does't need to wrap with NextP. [from NextPage3]`,
|
|
248
|
+
)
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
console.log(
|
|
253
|
+
`[${dragment.componentName}] to [${dropTargetName}] need to wrap with NextP [from NextPage3]`,
|
|
254
|
+
)
|
|
255
|
+
const newNode = node.document.createNode(Object.assign(layoutPNode.exportSchema()))
|
|
256
|
+
node.insertBefore(newNode, dragment, false)
|
|
257
|
+
dragment.remove(false)
|
|
258
|
+
newNode.children.get(0).select()
|
|
259
|
+
}, 1)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// 需要包裹 Block BlockCell P 的情况:
|
|
263
|
+
// 1. 组件拖入到 NextPage,的直接子元素下(不包括slot), 此时Block宽度为12
|
|
264
|
+
if (['NextPage'].includes(dropTargetName) && currentNode.children.has(dragment)) {
|
|
265
|
+
wrapWithBlock(dragment, currentNode, dropTargetName, 12)
|
|
266
|
+
|
|
267
|
+
// 需要包裹 Block BlockCell P 的情况:
|
|
268
|
+
// 2. 组件拖入到 NextPage 的 aside slot, 的直接子元素下 (不包括slot下的进一步内容),此时Block宽度为1
|
|
269
|
+
} else if (isAsideSlot && slotTarget && slotTarget.children.has(dragment)) {
|
|
270
|
+
wrapWithBlock(dragment, slotTarget, dropTargetName, 1)
|
|
271
|
+
|
|
272
|
+
// 需要包裹 P 的情况:
|
|
273
|
+
// 1. 如果是处于,开启了自然布局模式的容器组件中 (或者Tab里)
|
|
274
|
+
// 这里的Tab主要是给纪元epoch使用的,因为他们用到了 @ali/vc-deep 的TabLayout组件,没办法在这个组件上再增加属性 isAutoContainer
|
|
275
|
+
} else if (dropTarget.getPropValue('isAutoContainer') || dropTargetName === 'Tab.Item') {
|
|
276
|
+
wrapWithP(dragment, dropTarget, dropTargetName)
|
|
277
|
+
|
|
278
|
+
// 需要包裹 P 的情况:
|
|
279
|
+
// 2. 如果是处于,Page 的 nav header footer 中
|
|
280
|
+
} else if (isNeedPSlot && slotTarget) {
|
|
281
|
+
wrapWithP(dragment, slotTarget, dropTargetName)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// 其他维持原状,不进行其他设置
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
135
288
|
},
|
|
136
289
|
}
|
|
137
290
|
|
|
@@ -141,7 +294,15 @@ const snippets: IPublicTypeSnippet[] = [
|
|
|
141
294
|
screenshot: '',
|
|
142
295
|
schema: {
|
|
143
296
|
componentName: 'CustomDrawer',
|
|
144
|
-
props: {
|
|
297
|
+
props: {
|
|
298
|
+
title: '抽屉',
|
|
299
|
+
placement: 'left',
|
|
300
|
+
isAutoContainer: true,
|
|
301
|
+
actions: [
|
|
302
|
+
{ text: '确定', action: 'submit', style: 'primary', type: 'submit' },
|
|
303
|
+
{ text: '取消', action: 'submit', style: 'normal', type: 'cancel' },
|
|
304
|
+
],
|
|
305
|
+
},
|
|
145
306
|
},
|
|
146
307
|
},
|
|
147
308
|
]
|
|
@@ -62,7 +62,8 @@ var CustomDrawerMeta = {
|
|
|
62
62
|
label: '下',
|
|
63
63
|
value: 'bottom'
|
|
64
64
|
}]
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
initialValue: 'left'
|
|
66
67
|
}
|
|
67
68
|
}, {
|
|
68
69
|
title: '操作项',
|
|
@@ -146,11 +147,130 @@ var CustomDrawerMeta = {
|
|
|
146
147
|
isContainer: true,
|
|
147
148
|
isModal: true,
|
|
148
149
|
disableBehaviors: ['copy'],
|
|
150
|
+
rootSelector: '.drawer',
|
|
149
151
|
nestingRule: {
|
|
150
152
|
parentWhitelist: function parentWhitelist(testNode, currentNode) {
|
|
151
153
|
return testNode.componentName === 'Page';
|
|
152
154
|
}
|
|
153
155
|
}
|
|
156
|
+
},
|
|
157
|
+
advanced: {
|
|
158
|
+
callbacks: {
|
|
159
|
+
// 与 next-page 的 onNodeAdd 一模一样
|
|
160
|
+
onNodeAdd: function onNodeAdd(dragment, currentNode) {
|
|
161
|
+
// 拖入的组件为 P、Block、Slot(把NextPage拖入到面板里时,NextPage的Slot也会触发onNodeAdd事件) 时,不进行包裹
|
|
162
|
+
// 拖入的组件 isModal为true时(例如drawer dialog 这类有单独组件树结构的),不进行包裹
|
|
163
|
+
if (!dragment || ['NextP', 'NextBlock', 'Slot'].includes(dragment.componentName) || dragment.componentMeta.isModal && dragment.componentMeta.isModal()) {
|
|
164
|
+
console.log("[" + dragment.componentName + "] doesn'n need to wrap with NextBlock > NextBlockCell");
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
var NextPProps = {
|
|
168
|
+
wrap: false,
|
|
169
|
+
type: 'body2',
|
|
170
|
+
verAlign: 'middle',
|
|
171
|
+
textSpacing: true,
|
|
172
|
+
align: 'left'
|
|
173
|
+
};
|
|
174
|
+
if (['Form', 'ResponsiveGrid', 'Box', 'Card', 'List', 'Message', 'Slider', 'NextTable'].includes(dragment.componentName) || dragment.getPropValue('isFillContainer')) {
|
|
175
|
+
NextPProps.full = true;
|
|
176
|
+
}
|
|
177
|
+
var layoutPSchema = {
|
|
178
|
+
componentName: 'NextP',
|
|
179
|
+
title: '段落',
|
|
180
|
+
props: NextPProps,
|
|
181
|
+
children: [dragment.exportSchema()]
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// 为目标元素包裹一层 Block
|
|
185
|
+
var layoutBlockNode = function layoutBlockNode(len) {
|
|
186
|
+
return currentNode.document.createNode({
|
|
187
|
+
componentName: 'NextBlock',
|
|
188
|
+
title: '区块',
|
|
189
|
+
props: {
|
|
190
|
+
childTotalColumns: len || 12
|
|
191
|
+
},
|
|
192
|
+
children: [{
|
|
193
|
+
componentName: 'NextBlockCell',
|
|
194
|
+
title: '子区块',
|
|
195
|
+
props: {
|
|
196
|
+
isAutoContainer: true,
|
|
197
|
+
colSpan: 12,
|
|
198
|
+
rowSpan: 1
|
|
199
|
+
},
|
|
200
|
+
children: [layoutPSchema]
|
|
201
|
+
}]
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
var dropLocation = dragment.document.canvas.dropLocation;
|
|
205
|
+
if (!dropLocation) {
|
|
206
|
+
// 没有 dropLocation 一般是 slot, slot 元素不用特殊处理 不做任何包裹
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
var dropTarget = dropLocation.target;
|
|
210
|
+
var dropTargetName = dropLocation.target.componentName || '';
|
|
211
|
+
|
|
212
|
+
// 找到要拖入进去的节点 ID
|
|
213
|
+
var targetId = dropLocation && dropLocation.target.id || '';
|
|
214
|
+
// 找到要拖入进去的节点
|
|
215
|
+
var slotTarget = currentNode.slots.length > 0 && currentNode.slots.find(function (item) {
|
|
216
|
+
return item.id === targetId;
|
|
217
|
+
});
|
|
218
|
+
var layoutPNode = currentNode.document.createNode(layoutPSchema);
|
|
219
|
+
|
|
220
|
+
// 是否为 aside slot
|
|
221
|
+
var isAsideSlot = slotTarget && ['aside'].indexOf(slotTarget._slotFor.key) > -1;
|
|
222
|
+
// 是否为需要被 P 包裹的 Slot
|
|
223
|
+
var isNeedPSlot = slotTarget && ['header', 'footer', 'nav'].indexOf(slotTarget._slotFor.key) > -1;
|
|
224
|
+
var wrapWithBlock = function wrapWithBlock(dragment, node, dropTargetName, blockLen) {
|
|
225
|
+
setTimeout(function () {
|
|
226
|
+
console.log("[" + dragment.componentName + "] to [" + dropTargetName + "] need to wrap with NextBlock > NextBlockCell > NextP [from NextPage2]");
|
|
227
|
+
var newNode = node.document.createNode(layoutBlockNode(blockLen).exportSchema());
|
|
228
|
+
node.insertBefore(newNode, dragment, false);
|
|
229
|
+
dragment.remove(false);
|
|
230
|
+
newNode.children.get(0).children.get(0).children.get(0).select();
|
|
231
|
+
}, 1);
|
|
232
|
+
};
|
|
233
|
+
var wrapWithP = function wrapWithP(dragment, node, dropTargetName) {
|
|
234
|
+
setTimeout(function () {
|
|
235
|
+
// const dragmentTarget = dropTarget;
|
|
236
|
+
// 要拖入的地方如果是 NextP 那就 不再自动包裹 P了
|
|
237
|
+
if (dropTargetName === 'NextP') {
|
|
238
|
+
console.log("[" + dragment.componentName + "] to [" + dropTargetName + "] does't need to wrap with NextP. [from NextPage3]");
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
console.log("[" + dragment.componentName + "] to [" + dropTargetName + "] need to wrap with NextP [from NextPage3]");
|
|
242
|
+
var newNode = node.document.createNode(Object.assign(layoutPNode.exportSchema()));
|
|
243
|
+
node.insertBefore(newNode, dragment, false);
|
|
244
|
+
dragment.remove(false);
|
|
245
|
+
newNode.children.get(0).select();
|
|
246
|
+
}, 1);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// 需要包裹 Block BlockCell P 的情况:
|
|
250
|
+
// 1. 组件拖入到 NextPage,的直接子元素下(不包括slot), 此时Block宽度为12
|
|
251
|
+
if (['NextPage'].includes(dropTargetName) && currentNode.children.has(dragment)) {
|
|
252
|
+
wrapWithBlock(dragment, currentNode, dropTargetName, 12);
|
|
253
|
+
|
|
254
|
+
// 需要包裹 Block BlockCell P 的情况:
|
|
255
|
+
// 2. 组件拖入到 NextPage 的 aside slot, 的直接子元素下 (不包括slot下的进一步内容),此时Block宽度为1
|
|
256
|
+
} else if (isAsideSlot && slotTarget && slotTarget.children.has(dragment)) {
|
|
257
|
+
wrapWithBlock(dragment, slotTarget, dropTargetName, 1);
|
|
258
|
+
|
|
259
|
+
// 需要包裹 P 的情况:
|
|
260
|
+
// 1. 如果是处于,开启了自然布局模式的容器组件中 (或者Tab里)
|
|
261
|
+
// 这里的Tab主要是给纪元epoch使用的,因为他们用到了 @ali/vc-deep 的TabLayout组件,没办法在这个组件上再增加属性 isAutoContainer
|
|
262
|
+
} else if (dropTarget.getPropValue('isAutoContainer') || dropTargetName === 'Tab.Item') {
|
|
263
|
+
wrapWithP(dragment, dropTarget, dropTargetName);
|
|
264
|
+
|
|
265
|
+
// 需要包裹 P 的情况:
|
|
266
|
+
// 2. 如果是处于,Page 的 nav header footer 中
|
|
267
|
+
} else if (isNeedPSlot && slotTarget) {
|
|
268
|
+
wrapWithP(dragment, slotTarget, dropTargetName);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// 其他维持原状,不进行其他设置
|
|
272
|
+
}
|
|
273
|
+
}
|
|
154
274
|
}
|
|
155
275
|
}
|
|
156
276
|
};
|
|
@@ -159,7 +279,22 @@ var snippets = [{
|
|
|
159
279
|
screenshot: '',
|
|
160
280
|
schema: {
|
|
161
281
|
componentName: 'CustomDrawer',
|
|
162
|
-
props: {
|
|
282
|
+
props: {
|
|
283
|
+
title: '抽屉',
|
|
284
|
+
placement: 'left',
|
|
285
|
+
isAutoContainer: true,
|
|
286
|
+
actions: [{
|
|
287
|
+
text: '确定',
|
|
288
|
+
action: 'submit',
|
|
289
|
+
style: 'primary',
|
|
290
|
+
type: 'submit'
|
|
291
|
+
}, {
|
|
292
|
+
text: '取消',
|
|
293
|
+
action: 'submit',
|
|
294
|
+
style: 'normal',
|
|
295
|
+
type: 'cancel'
|
|
296
|
+
}]
|
|
297
|
+
}
|
|
163
298
|
}
|
|
164
299
|
}];
|
|
165
300
|
export default _extends({}, CustomDrawerMeta, {
|
package/lowcode_es/meta.js
CHANGED
|
@@ -105,7 +105,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
105
105
|
packageName = '@dckj-npm/dc-material';
|
|
106
106
|
}
|
|
107
107
|
if (version === void 0) {
|
|
108
|
-
version = '0.1.
|
|
108
|
+
version = '0.1.281';
|
|
109
109
|
}
|
|
110
110
|
if (basicLibraryVersion === void 0) {
|
|
111
111
|
basicLibraryVersion = {
|
|
@@ -67,7 +67,8 @@ var CustomDrawerMeta = {
|
|
|
67
67
|
label: '下',
|
|
68
68
|
value: 'bottom'
|
|
69
69
|
}]
|
|
70
|
-
}
|
|
70
|
+
},
|
|
71
|
+
initialValue: 'left'
|
|
71
72
|
}
|
|
72
73
|
}, {
|
|
73
74
|
title: '操作项',
|
|
@@ -151,11 +152,130 @@ var CustomDrawerMeta = {
|
|
|
151
152
|
isContainer: true,
|
|
152
153
|
isModal: true,
|
|
153
154
|
disableBehaviors: ['copy'],
|
|
155
|
+
rootSelector: '.drawer',
|
|
154
156
|
nestingRule: {
|
|
155
157
|
parentWhitelist: function parentWhitelist(testNode, currentNode) {
|
|
156
158
|
return testNode.componentName === 'Page';
|
|
157
159
|
}
|
|
158
160
|
}
|
|
161
|
+
},
|
|
162
|
+
advanced: {
|
|
163
|
+
callbacks: {
|
|
164
|
+
// 与 next-page 的 onNodeAdd 一模一样
|
|
165
|
+
onNodeAdd: function onNodeAdd(dragment, currentNode) {
|
|
166
|
+
// 拖入的组件为 P、Block、Slot(把NextPage拖入到面板里时,NextPage的Slot也会触发onNodeAdd事件) 时,不进行包裹
|
|
167
|
+
// 拖入的组件 isModal为true时(例如drawer dialog 这类有单独组件树结构的),不进行包裹
|
|
168
|
+
if (!dragment || ['NextP', 'NextBlock', 'Slot'].includes(dragment.componentName) || dragment.componentMeta.isModal && dragment.componentMeta.isModal()) {
|
|
169
|
+
console.log("[" + dragment.componentName + "] doesn'n need to wrap with NextBlock > NextBlockCell");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
var NextPProps = {
|
|
173
|
+
wrap: false,
|
|
174
|
+
type: 'body2',
|
|
175
|
+
verAlign: 'middle',
|
|
176
|
+
textSpacing: true,
|
|
177
|
+
align: 'left'
|
|
178
|
+
};
|
|
179
|
+
if (['Form', 'ResponsiveGrid', 'Box', 'Card', 'List', 'Message', 'Slider', 'NextTable'].includes(dragment.componentName) || dragment.getPropValue('isFillContainer')) {
|
|
180
|
+
NextPProps.full = true;
|
|
181
|
+
}
|
|
182
|
+
var layoutPSchema = {
|
|
183
|
+
componentName: 'NextP',
|
|
184
|
+
title: '段落',
|
|
185
|
+
props: NextPProps,
|
|
186
|
+
children: [dragment.exportSchema()]
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// 为目标元素包裹一层 Block
|
|
190
|
+
var layoutBlockNode = function layoutBlockNode(len) {
|
|
191
|
+
return currentNode.document.createNode({
|
|
192
|
+
componentName: 'NextBlock',
|
|
193
|
+
title: '区块',
|
|
194
|
+
props: {
|
|
195
|
+
childTotalColumns: len || 12
|
|
196
|
+
},
|
|
197
|
+
children: [{
|
|
198
|
+
componentName: 'NextBlockCell',
|
|
199
|
+
title: '子区块',
|
|
200
|
+
props: {
|
|
201
|
+
isAutoContainer: true,
|
|
202
|
+
colSpan: 12,
|
|
203
|
+
rowSpan: 1
|
|
204
|
+
},
|
|
205
|
+
children: [layoutPSchema]
|
|
206
|
+
}]
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
var dropLocation = dragment.document.canvas.dropLocation;
|
|
210
|
+
if (!dropLocation) {
|
|
211
|
+
// 没有 dropLocation 一般是 slot, slot 元素不用特殊处理 不做任何包裹
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
var dropTarget = dropLocation.target;
|
|
215
|
+
var dropTargetName = dropLocation.target.componentName || '';
|
|
216
|
+
|
|
217
|
+
// 找到要拖入进去的节点 ID
|
|
218
|
+
var targetId = dropLocation && dropLocation.target.id || '';
|
|
219
|
+
// 找到要拖入进去的节点
|
|
220
|
+
var slotTarget = currentNode.slots.length > 0 && currentNode.slots.find(function (item) {
|
|
221
|
+
return item.id === targetId;
|
|
222
|
+
});
|
|
223
|
+
var layoutPNode = currentNode.document.createNode(layoutPSchema);
|
|
224
|
+
|
|
225
|
+
// 是否为 aside slot
|
|
226
|
+
var isAsideSlot = slotTarget && ['aside'].indexOf(slotTarget._slotFor.key) > -1;
|
|
227
|
+
// 是否为需要被 P 包裹的 Slot
|
|
228
|
+
var isNeedPSlot = slotTarget && ['header', 'footer', 'nav'].indexOf(slotTarget._slotFor.key) > -1;
|
|
229
|
+
var wrapWithBlock = function wrapWithBlock(dragment, node, dropTargetName, blockLen) {
|
|
230
|
+
setTimeout(function () {
|
|
231
|
+
console.log("[" + dragment.componentName + "] to [" + dropTargetName + "] need to wrap with NextBlock > NextBlockCell > NextP [from NextPage2]");
|
|
232
|
+
var newNode = node.document.createNode(layoutBlockNode(blockLen).exportSchema());
|
|
233
|
+
node.insertBefore(newNode, dragment, false);
|
|
234
|
+
dragment.remove(false);
|
|
235
|
+
newNode.children.get(0).children.get(0).children.get(0).select();
|
|
236
|
+
}, 1);
|
|
237
|
+
};
|
|
238
|
+
var wrapWithP = function wrapWithP(dragment, node, dropTargetName) {
|
|
239
|
+
setTimeout(function () {
|
|
240
|
+
// const dragmentTarget = dropTarget;
|
|
241
|
+
// 要拖入的地方如果是 NextP 那就 不再自动包裹 P了
|
|
242
|
+
if (dropTargetName === 'NextP') {
|
|
243
|
+
console.log("[" + dragment.componentName + "] to [" + dropTargetName + "] does't need to wrap with NextP. [from NextPage3]");
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
console.log("[" + dragment.componentName + "] to [" + dropTargetName + "] need to wrap with NextP [from NextPage3]");
|
|
247
|
+
var newNode = node.document.createNode(Object.assign(layoutPNode.exportSchema()));
|
|
248
|
+
node.insertBefore(newNode, dragment, false);
|
|
249
|
+
dragment.remove(false);
|
|
250
|
+
newNode.children.get(0).select();
|
|
251
|
+
}, 1);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// 需要包裹 Block BlockCell P 的情况:
|
|
255
|
+
// 1. 组件拖入到 NextPage,的直接子元素下(不包括slot), 此时Block宽度为12
|
|
256
|
+
if (['NextPage'].includes(dropTargetName) && currentNode.children.has(dragment)) {
|
|
257
|
+
wrapWithBlock(dragment, currentNode, dropTargetName, 12);
|
|
258
|
+
|
|
259
|
+
// 需要包裹 Block BlockCell P 的情况:
|
|
260
|
+
// 2. 组件拖入到 NextPage 的 aside slot, 的直接子元素下 (不包括slot下的进一步内容),此时Block宽度为1
|
|
261
|
+
} else if (isAsideSlot && slotTarget && slotTarget.children.has(dragment)) {
|
|
262
|
+
wrapWithBlock(dragment, slotTarget, dropTargetName, 1);
|
|
263
|
+
|
|
264
|
+
// 需要包裹 P 的情况:
|
|
265
|
+
// 1. 如果是处于,开启了自然布局模式的容器组件中 (或者Tab里)
|
|
266
|
+
// 这里的Tab主要是给纪元epoch使用的,因为他们用到了 @ali/vc-deep 的TabLayout组件,没办法在这个组件上再增加属性 isAutoContainer
|
|
267
|
+
} else if (dropTarget.getPropValue('isAutoContainer') || dropTargetName === 'Tab.Item') {
|
|
268
|
+
wrapWithP(dragment, dropTarget, dropTargetName);
|
|
269
|
+
|
|
270
|
+
// 需要包裹 P 的情况:
|
|
271
|
+
// 2. 如果是处于,Page 的 nav header footer 中
|
|
272
|
+
} else if (isNeedPSlot && slotTarget) {
|
|
273
|
+
wrapWithP(dragment, slotTarget, dropTargetName);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// 其他维持原状,不进行其他设置
|
|
277
|
+
}
|
|
278
|
+
}
|
|
159
279
|
}
|
|
160
280
|
}
|
|
161
281
|
};
|
|
@@ -164,7 +284,22 @@ var snippets = [{
|
|
|
164
284
|
screenshot: '',
|
|
165
285
|
schema: {
|
|
166
286
|
componentName: 'CustomDrawer',
|
|
167
|
-
props: {
|
|
287
|
+
props: {
|
|
288
|
+
title: '抽屉',
|
|
289
|
+
placement: 'left',
|
|
290
|
+
isAutoContainer: true,
|
|
291
|
+
actions: [{
|
|
292
|
+
text: '确定',
|
|
293
|
+
action: 'submit',
|
|
294
|
+
style: 'primary',
|
|
295
|
+
type: 'submit'
|
|
296
|
+
}, {
|
|
297
|
+
text: '取消',
|
|
298
|
+
action: 'submit',
|
|
299
|
+
style: 'normal',
|
|
300
|
+
type: 'cancel'
|
|
301
|
+
}]
|
|
302
|
+
}
|
|
168
303
|
}
|
|
169
304
|
}];
|
|
170
305
|
var _default = exports["default"] = (0, _extends2["default"])({}, CustomDrawerMeta, {
|
package/lowcode_lib/meta.js
CHANGED
|
@@ -110,7 +110,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
110
110
|
packageName = '@dckj-npm/dc-material';
|
|
111
111
|
}
|
|
112
112
|
if (version === void 0) {
|
|
113
|
-
version = '0.1.
|
|
113
|
+
version = '0.1.281';
|
|
114
114
|
}
|
|
115
115
|
if (basicLibraryVersion === void 0) {
|
|
116
116
|
basicLibraryVersion = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dckj-npm/dc-material",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.281",
|
|
4
4
|
"description": "dc低代码物料",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
"componentConfig": {
|
|
108
108
|
"isComponentLibrary": true,
|
|
109
|
-
"materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.
|
|
109
|
+
"materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.281/build/lowcode/assets-prod.json"
|
|
110
110
|
},
|
|
111
111
|
"lcMeta": {
|
|
112
112
|
"type": "component"
|