ngx-axis-appforge 0.0.29 → 0.0.31
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/axis-components/design/index.d.ts +4 -3
- package/axis-components/tree-selector/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-design.mjs +47 -40
- package/fesm2022/ngx-axis-appforge-axis-components-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs +2 -2
- package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs +2 -2
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs +2 -2
- package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs +3 -2
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs +2 -2
- package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs +31 -14
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components.mjs +148 -148
- package/fesm2022/ngx-axis-appforge-axis-components.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-core.mjs +14 -9
- package/fesm2022/ngx-axis-appforge-core.mjs.map +1 -1
- package/package.json +119 -119
|
@@ -142,8 +142,6 @@ declare class ShortcutKey {
|
|
|
142
142
|
cut(): void;
|
|
143
143
|
paste(): Promise<void>;
|
|
144
144
|
private isComponentObj;
|
|
145
|
-
private parseToExample;
|
|
146
|
-
private recursionParse;
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
declare class DesignOptions extends ValueAccessOptions {
|
|
@@ -238,7 +236,10 @@ declare class Design extends ValueAccess<DesignOptions> implements OnDestroy {
|
|
|
238
236
|
private genNewComponentId;
|
|
239
237
|
onCmplibDragStart(example: Example, element: HTMLElement): void;
|
|
240
238
|
onCmplibDragEnd(): Promise<void>;
|
|
241
|
-
|
|
239
|
+
onPaste(objs: any[]): void;
|
|
240
|
+
replaceExampleId(example: any): any;
|
|
241
|
+
private buildIdMap;
|
|
242
|
+
private isComponentObj;
|
|
242
243
|
onNodesMove(nodeIds: string[]): void;
|
|
243
244
|
onEditorChange(optionsStr: string): void;
|
|
244
245
|
syncToSetting(): void;
|
|
@@ -59,7 +59,7 @@ declare class TreeSelector extends ValueAccess<TreeSelectorOptions> {
|
|
|
59
59
|
readonly changeOn: (option: NzCascaderOption, level: number) => boolean;
|
|
60
60
|
writeValue(value: any): void;
|
|
61
61
|
private buildTreeData;
|
|
62
|
-
private
|
|
62
|
+
private valueToComponentValue;
|
|
63
63
|
nodeClick(e: NzFormatEmitEvent): void;
|
|
64
64
|
private treeNodeToValue;
|
|
65
65
|
private fullArrayToValue;
|
package/core/index.d.ts
CHANGED
|
@@ -1053,7 +1053,7 @@ class Cmplib {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
preloadDragElement(example, desc) {
|
|
1055
1055
|
if (this.selectMode() == "drag") {
|
|
1056
|
-
this.dragOptions.set(example.
|
|
1056
|
+
this.dragOptions.set(example.options);
|
|
1057
1057
|
this.dragExample = example;
|
|
1058
1058
|
if (desc) {
|
|
1059
1059
|
example.name ??= desc.component;
|
|
@@ -1206,8 +1206,7 @@ class ShortcutKey {
|
|
|
1206
1206
|
this.cutNodeIds = undefined;
|
|
1207
1207
|
}
|
|
1208
1208
|
else {
|
|
1209
|
-
|
|
1210
|
-
this.design.onExamplePaste(examples);
|
|
1209
|
+
this.design.onPaste(objs);
|
|
1211
1210
|
}
|
|
1212
1211
|
}
|
|
1213
1212
|
}
|
|
@@ -1219,36 +1218,6 @@ class ShortcutKey {
|
|
|
1219
1218
|
isComponentObj(obj) {
|
|
1220
1219
|
return obj && obj.hasOwnProperty("id") && obj.hasOwnProperty("component");
|
|
1221
1220
|
}
|
|
1222
|
-
parseToExample(obj) {
|
|
1223
|
-
return {
|
|
1224
|
-
builder: componentIdBuilder => {
|
|
1225
|
-
if (componentIdBuilder) {
|
|
1226
|
-
return this.recursionParse(obj, componentIdBuilder);
|
|
1227
|
-
}
|
|
1228
|
-
return obj;
|
|
1229
|
-
}
|
|
1230
|
-
};
|
|
1231
|
-
}
|
|
1232
|
-
recursionParse(obj, idBuilder, components = new Map()) {
|
|
1233
|
-
if (this.isComponentObj(obj)) {
|
|
1234
|
-
const offset = (components.get(obj.component) ?? 0) + 1;
|
|
1235
|
-
components.set(obj.component, offset);
|
|
1236
|
-
obj.id = idBuilder(obj.component, offset);
|
|
1237
|
-
}
|
|
1238
|
-
if (obj) {
|
|
1239
|
-
if (Array.isArray(obj)) {
|
|
1240
|
-
for (let i = 0; i < obj.length; i++) {
|
|
1241
|
-
obj[i] = this.recursionParse(obj[i], idBuilder, components);
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
else if (typeof obj == "object") {
|
|
1245
|
-
for (const en of Object.entries(obj)) {
|
|
1246
|
-
obj[en[0]] = this.recursionParse(en[1], idBuilder, components);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
return obj;
|
|
1251
|
-
}
|
|
1252
1221
|
}
|
|
1253
1222
|
|
|
1254
1223
|
class DesignOptions extends ValueAccessOptions {
|
|
@@ -1645,7 +1614,7 @@ class Design extends ValueAccess {
|
|
|
1645
1614
|
this.chooseComponentTags.set(tags);
|
|
1646
1615
|
this.chooseComponentVisible.set(true);
|
|
1647
1616
|
return this.chooseComponentSubject.asObservable()
|
|
1648
|
-
.pipe(take(1), map((example) => example
|
|
1617
|
+
.pipe(take(1), map((example) => example ? this.replaceExampleId(example.options) : null), switchMap(options => options ? from(this.loader.loadComponent(`${options.component}/design`)).pipe(map(config => ({ options, config }))) : of({})));
|
|
1649
1618
|
}
|
|
1650
1619
|
genNewComponentId(component, offset = 1, existsIds) {
|
|
1651
1620
|
let id;
|
|
@@ -1658,11 +1627,10 @@ class Design extends ValueAccess {
|
|
|
1658
1627
|
if (existsIds?.has(id) || this.optionsNodes.has(id)) {
|
|
1659
1628
|
return this.genNewComponentId(component, offset + 1, existsIds);
|
|
1660
1629
|
}
|
|
1661
|
-
|
|
1662
|
-
return id;
|
|
1630
|
+
return { id, offset };
|
|
1663
1631
|
}
|
|
1664
1632
|
onCmplibDragStart(example, element) {
|
|
1665
|
-
const options =
|
|
1633
|
+
const options = this.replaceExampleId(example.options);
|
|
1666
1634
|
const optionsNode = new OptionsNode({
|
|
1667
1635
|
canDrag: true,
|
|
1668
1636
|
dragType: "component",
|
|
@@ -1681,10 +1649,10 @@ class Design extends ValueAccess {
|
|
|
1681
1649
|
this.loadSetting(nodeId);
|
|
1682
1650
|
}
|
|
1683
1651
|
}
|
|
1684
|
-
|
|
1652
|
+
onPaste(objs) {
|
|
1685
1653
|
const nodes = [];
|
|
1686
|
-
for (const
|
|
1687
|
-
const options =
|
|
1654
|
+
for (const obj of objs) {
|
|
1655
|
+
const options = this.replaceExampleId(obj);
|
|
1688
1656
|
const optionsNode = new OptionsNode({
|
|
1689
1657
|
canDrag: true,
|
|
1690
1658
|
dragType: "component",
|
|
@@ -1695,6 +1663,45 @@ class Design extends ValueAccess {
|
|
|
1695
1663
|
}
|
|
1696
1664
|
this.tree.addNodeForSelected(nodes, undefined, `粘贴${nodes.length}个组件`);
|
|
1697
1665
|
}
|
|
1666
|
+
replaceExampleId(example) {
|
|
1667
|
+
const idMap = new Map();
|
|
1668
|
+
this.buildIdMap(example, idMap);
|
|
1669
|
+
let exampleStr = JSON.stringify(example);
|
|
1670
|
+
while (idMap.size > 0) {
|
|
1671
|
+
idMap.forEach((newId, oldId) => {
|
|
1672
|
+
if (!idMap.has(newId)) {
|
|
1673
|
+
exampleStr = exampleStr.replaceAll(oldId, newId);
|
|
1674
|
+
idMap.delete(oldId);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
return JSON.parse(exampleStr);
|
|
1679
|
+
}
|
|
1680
|
+
buildIdMap(obj, idMap, offsetMap = new Map()) {
|
|
1681
|
+
if (this.isComponentObj(obj)) {
|
|
1682
|
+
const offset = (offsetMap.get(obj.component) ?? 0) + 1;
|
|
1683
|
+
const res = this.genNewComponentId(obj.component, offset, new Set(idMap.values()));
|
|
1684
|
+
offsetMap.set(obj.component, res.offset);
|
|
1685
|
+
if (obj.id != res.id) {
|
|
1686
|
+
idMap.set(obj.id, res.id);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
if (obj) {
|
|
1690
|
+
if (Array.isArray(obj)) {
|
|
1691
|
+
for (let i = 0; i < obj.length; i++) {
|
|
1692
|
+
this.buildIdMap(obj[i], idMap, offsetMap);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
else if (typeof obj == "object") {
|
|
1696
|
+
for (const en of Object.entries(obj)) {
|
|
1697
|
+
this.buildIdMap(en[1], idMap, offsetMap);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
isComponentObj(obj) {
|
|
1703
|
+
return obj && obj.hasOwnProperty("id") && obj.hasOwnProperty("component");
|
|
1704
|
+
}
|
|
1698
1705
|
onNodesMove(nodeIds) {
|
|
1699
1706
|
if (this.tree.selectListSelection.selected.length == 1) {
|
|
1700
1707
|
this.tree.addNodeForSelected(nodeIds.map(id => this.optionsNodes.get(id)), true, `粘贴${nodeIds.length}个组件`);
|