|
@@ -34,69 +34,24 @@ export const duplicateCol = (options: {
|
|
newColData.id = Lute.NewNodeID();
|
|
newColData.id = Lute.NewNodeID();
|
|
const newUpdated = dayjs().format("YYYYMMDDHHmmss");
|
|
const newUpdated = dayjs().format("YYYYMMDDHHmmss");
|
|
const blockId = options.blockElement.getAttribute("data-node-id");
|
|
const blockId = options.blockElement.getAttribute("data-node-id");
|
|
- if (["select", "mSelect", "rollup"].includes(newColData.type)) {
|
|
|
|
- fetchPost("/api/av/renderAttributeView", {
|
|
|
|
- id: options.data.id,
|
|
|
|
- viewID: options.viewID
|
|
|
|
- }, (response) => {
|
|
|
|
- const data = response.data as IAV;
|
|
|
|
- let colOptions;
|
|
|
|
- data.view.columns.find((item) => {
|
|
|
|
- if (item.id === options.colId) {
|
|
|
|
- colOptions = item.options;
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- transaction(options.protyle, [{
|
|
|
|
- action: "addAttrViewCol",
|
|
|
|
- name: newColData.name,
|
|
|
|
- avID: options.data.id,
|
|
|
|
- type: newColData.type,
|
|
|
|
- data: newColData.icon,
|
|
|
|
- previousID: options.colId,
|
|
|
|
- id: newColData.id
|
|
|
|
- }, {
|
|
|
|
- action: "updateAttrViewColOptions",
|
|
|
|
- id: newColData.id,
|
|
|
|
- avID: options.data.id,
|
|
|
|
- data: colOptions
|
|
|
|
- }, {
|
|
|
|
- action: "doUpdateUpdated",
|
|
|
|
- id: blockId,
|
|
|
|
- data: newUpdated,
|
|
|
|
- }], [{
|
|
|
|
- action: "removeAttrViewCol",
|
|
|
|
- id: newColData.id,
|
|
|
|
- avID: options.data.id,
|
|
|
|
- }, {
|
|
|
|
- action: "doUpdateUpdated",
|
|
|
|
- id: blockId,
|
|
|
|
- data: options.blockElement.getAttribute("updated")
|
|
|
|
- }]);
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- transaction(options.protyle, [{
|
|
|
|
- action: "addAttrViewCol",
|
|
|
|
- name: newColData.name,
|
|
|
|
- avID: options.data.id,
|
|
|
|
- type: newColData.type,
|
|
|
|
- data: newColData.icon,
|
|
|
|
- id: newColData.id,
|
|
|
|
- previousID: options.colId,
|
|
|
|
- }, {
|
|
|
|
- action: "doUpdateUpdated",
|
|
|
|
- id: blockId,
|
|
|
|
- data: newUpdated,
|
|
|
|
- }], [{
|
|
|
|
- action: "removeAttrViewCol",
|
|
|
|
- id: newColData.id,
|
|
|
|
- avID: options.data.id,
|
|
|
|
- }, {
|
|
|
|
- action: "doUpdateUpdated",
|
|
|
|
- id: blockId,
|
|
|
|
- data: options.blockElement.getAttribute("updated")
|
|
|
|
- }]);
|
|
|
|
- }
|
|
|
|
|
|
+ transaction(options.protyle, [{
|
|
|
|
+ action: "duplicateAttrViewKey",
|
|
|
|
+ keyID:newColData.id,
|
|
|
|
+ nextID:options.colId,
|
|
|
|
+ avID: options.data.id,
|
|
|
|
+ }, {
|
|
|
|
+ action: "doUpdateUpdated",
|
|
|
|
+ id: blockId,
|
|
|
|
+ data: newUpdated,
|
|
|
|
+ }], [{
|
|
|
|
+ action: "removeAttrViewCol",
|
|
|
|
+ id: newColData.id,
|
|
|
|
+ avID: options.data.id,
|
|
|
|
+ }, {
|
|
|
|
+ action: "doUpdateUpdated",
|
|
|
|
+ id: blockId,
|
|
|
|
+ data: options.blockElement.getAttribute("updated")
|
|
|
|
+ }]);
|
|
addAttrViewColAnimation({
|
|
addAttrViewColAnimation({
|
|
blockElement: options.blockElement,
|
|
blockElement: options.blockElement,
|
|
protyle: options.protyle,
|
|
protyle: options.protyle,
|