@tailor-cms/ce-table-manifest 0.0.3 → 0.1.0
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/dist/index.cjs +6 -16
- package/dist/index.d.cts +6 -46
- package/dist/index.d.ts +6 -46
- package/dist/index.js +2 -2
- package/package.json +14 -10
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name2 in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
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
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/index.ts
|
|
@@ -38,7 +28,7 @@ __export(index_exports, {
|
|
|
38
28
|
version: () => version
|
|
39
29
|
});
|
|
40
30
|
module.exports = __toCommonJS(index_exports);
|
|
41
|
-
var
|
|
31
|
+
var import_lodash_es2 = require("lodash-es");
|
|
42
32
|
var import_uuid = require("uuid");
|
|
43
33
|
|
|
44
34
|
// src/utils.ts
|
|
@@ -49,14 +39,14 @@ __export(utils_exports, {
|
|
|
49
39
|
removeCell: () => removeCell,
|
|
50
40
|
removeEmbed: () => removeEmbed
|
|
51
41
|
});
|
|
52
|
-
var
|
|
42
|
+
var import_lodash_es = require("lodash-es");
|
|
53
43
|
function addCell(row, cell) {
|
|
54
44
|
if (!row.cells) row.cells = {};
|
|
55
45
|
row.cells[cell.id] = cell;
|
|
56
46
|
return cell;
|
|
57
47
|
}
|
|
58
48
|
function removeCell(row, predicate = {}) {
|
|
59
|
-
const cell = (0,
|
|
49
|
+
const cell = (0, import_lodash_es.find)(row.cells, predicate);
|
|
60
50
|
if (!cell) return;
|
|
61
51
|
delete row.cells[cell.id];
|
|
62
52
|
return cell;
|
|
@@ -72,7 +62,7 @@ function addEmbed(embeds, cellId, tableId) {
|
|
|
72
62
|
return embed;
|
|
73
63
|
}
|
|
74
64
|
function removeEmbed(embeds, predicate = {}) {
|
|
75
|
-
const embed = (0,
|
|
65
|
+
const embed = (0, import_lodash_es.find)(embeds, predicate);
|
|
76
66
|
if (!embed) return;
|
|
77
67
|
delete embeds[embed.id];
|
|
78
68
|
return embed;
|
|
@@ -92,11 +82,11 @@ var initState = () => {
|
|
|
92
82
|
const tableId = (0, import_uuid.v4)();
|
|
93
83
|
const embeds = {};
|
|
94
84
|
const rows = {};
|
|
95
|
-
(0,
|
|
85
|
+
(0, import_lodash_es2.times)(2, (position) => {
|
|
96
86
|
const rowId = (0, import_uuid.v4)();
|
|
97
87
|
const row = { id: rowId, position, cells: {} };
|
|
98
88
|
rows[rowId] = row;
|
|
99
|
-
(0,
|
|
89
|
+
(0, import_lodash_es2.times)(3, (position2) => {
|
|
100
90
|
const cellId = (0, import_uuid.v4)();
|
|
101
91
|
addCell(row, { id: cellId, position: position2, data: {} });
|
|
102
92
|
addEmbed(embeds, cellId, tableId);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as common from '@tailor-cms/cek-common';
|
|
2
|
+
|
|
1
3
|
declare enum Direction {
|
|
2
4
|
Before = -1,
|
|
3
5
|
After = 1
|
|
@@ -16,56 +18,14 @@ interface Row {
|
|
|
16
18
|
cells: Cells;
|
|
17
19
|
}
|
|
18
20
|
type Rows = Record<string, Row>;
|
|
19
|
-
interface ElementData {
|
|
21
|
+
interface ElementData extends common.ElementConfig {
|
|
20
22
|
tableId: string;
|
|
21
23
|
embeds: Embeds;
|
|
22
24
|
rows: Rows;
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
activityId: number;
|
|
28
|
-
repositoryId: number;
|
|
29
|
-
contentId: string;
|
|
30
|
-
contentSignature: string;
|
|
31
|
-
type: string;
|
|
32
|
-
position: number;
|
|
33
|
-
data: ElementData;
|
|
34
|
-
meta: {
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
};
|
|
37
|
-
refs: {
|
|
38
|
-
[key: string]: unknown;
|
|
39
|
-
};
|
|
40
|
-
linked: boolean;
|
|
41
|
-
detached: boolean;
|
|
42
|
-
createdAt: string;
|
|
43
|
-
updatedAt: string;
|
|
44
|
-
deletedAt: string | null;
|
|
45
|
-
}
|
|
46
|
-
type DataInitializer = () => ElementData;
|
|
47
|
-
interface ElementManifest {
|
|
48
|
-
type: string;
|
|
49
|
-
version: string;
|
|
50
|
-
name: string;
|
|
51
|
-
ssr: boolean;
|
|
52
|
-
isComposite?: boolean;
|
|
53
|
-
initState: DataInitializer;
|
|
54
|
-
Edit?: object;
|
|
55
|
-
TopToolbar?: object;
|
|
56
|
-
SideToolbar?: object;
|
|
57
|
-
Display?: object;
|
|
58
|
-
ui: {
|
|
59
|
-
icon: string;
|
|
60
|
-
forceFullWidth: boolean;
|
|
61
|
-
};
|
|
62
|
-
mocks?: {
|
|
63
|
-
displayContexts: Array<{
|
|
64
|
-
name: string;
|
|
65
|
-
data: any;
|
|
66
|
-
}>;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
26
|
+
type DataInitializer = common.DataInitializer<ElementData>;
|
|
27
|
+
type Element = common.Element<ElementData>;
|
|
28
|
+
type ElementManifest = common.ElementManifest<ElementData>;
|
|
69
29
|
|
|
70
30
|
declare function addCell(row: Row, cell: Cell): Cell;
|
|
71
31
|
declare function removeCell(row: Row, predicate?: {}): Cell;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as common from '@tailor-cms/cek-common';
|
|
2
|
+
|
|
1
3
|
declare enum Direction {
|
|
2
4
|
Before = -1,
|
|
3
5
|
After = 1
|
|
@@ -16,56 +18,14 @@ interface Row {
|
|
|
16
18
|
cells: Cells;
|
|
17
19
|
}
|
|
18
20
|
type Rows = Record<string, Row>;
|
|
19
|
-
interface ElementData {
|
|
21
|
+
interface ElementData extends common.ElementConfig {
|
|
20
22
|
tableId: string;
|
|
21
23
|
embeds: Embeds;
|
|
22
24
|
rows: Rows;
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
activityId: number;
|
|
28
|
-
repositoryId: number;
|
|
29
|
-
contentId: string;
|
|
30
|
-
contentSignature: string;
|
|
31
|
-
type: string;
|
|
32
|
-
position: number;
|
|
33
|
-
data: ElementData;
|
|
34
|
-
meta: {
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
};
|
|
37
|
-
refs: {
|
|
38
|
-
[key: string]: unknown;
|
|
39
|
-
};
|
|
40
|
-
linked: boolean;
|
|
41
|
-
detached: boolean;
|
|
42
|
-
createdAt: string;
|
|
43
|
-
updatedAt: string;
|
|
44
|
-
deletedAt: string | null;
|
|
45
|
-
}
|
|
46
|
-
type DataInitializer = () => ElementData;
|
|
47
|
-
interface ElementManifest {
|
|
48
|
-
type: string;
|
|
49
|
-
version: string;
|
|
50
|
-
name: string;
|
|
51
|
-
ssr: boolean;
|
|
52
|
-
isComposite?: boolean;
|
|
53
|
-
initState: DataInitializer;
|
|
54
|
-
Edit?: object;
|
|
55
|
-
TopToolbar?: object;
|
|
56
|
-
SideToolbar?: object;
|
|
57
|
-
Display?: object;
|
|
58
|
-
ui: {
|
|
59
|
-
icon: string;
|
|
60
|
-
forceFullWidth: boolean;
|
|
61
|
-
};
|
|
62
|
-
mocks?: {
|
|
63
|
-
displayContexts: Array<{
|
|
64
|
-
name: string;
|
|
65
|
-
data: any;
|
|
66
|
-
}>;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
26
|
+
type DataInitializer = common.DataInitializer<ElementData>;
|
|
27
|
+
type Element = common.Element<ElementData>;
|
|
28
|
+
type ElementManifest = common.ElementManifest<ElementData>;
|
|
69
29
|
|
|
70
30
|
declare function addCell(row: Row, cell: Cell): Cell;
|
|
71
31
|
declare function removeCell(row: Row, predicate?: {}): Cell;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
|
-
import times from "lodash
|
|
8
|
+
import { times } from "lodash-es";
|
|
9
9
|
import { v4 as uuid } from "uuid";
|
|
10
10
|
|
|
11
11
|
// src/utils.ts
|
|
@@ -16,7 +16,7 @@ __export(utils_exports, {
|
|
|
16
16
|
removeCell: () => removeCell,
|
|
17
17
|
removeEmbed: () => removeEmbed
|
|
18
18
|
});
|
|
19
|
-
import find from "lodash
|
|
19
|
+
import { find } from "lodash-es";
|
|
20
20
|
function addCell(row, cell) {
|
|
21
21
|
if (!row.cells) row.cells = {};
|
|
22
22
|
row.cells[cell.id] = cell;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Tailor CMS table manifest",
|
|
4
4
|
"author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.0
|
|
6
|
+
"version": "0.1.0",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/index.js",
|
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tailor-cms/
|
|
20
|
-
"@
|
|
21
|
-
"
|
|
22
|
-
"
|
|
19
|
+
"@tailor-cms/cek-common": "^1.3.2",
|
|
20
|
+
"@tailor-cms/eslint-config": "1.1.2",
|
|
21
|
+
"@types/lodash-es": "^4.17.12",
|
|
22
|
+
"tsup": "^8.5.0",
|
|
23
|
+
"typescript": "^5.8.3"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"lodash": "^4.17.21",
|
|
26
|
-
"uuid": "^11.0
|
|
26
|
+
"lodash-es": "^4.17.21",
|
|
27
|
+
"uuid": "^11.1.0"
|
|
27
28
|
},
|
|
28
29
|
"tsup": {
|
|
29
30
|
"entry": [
|
|
@@ -47,8 +48,11 @@
|
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"dev": "tsup --watch",
|
|
50
|
-
"build": "tsup",
|
|
51
|
-
"lint": "eslint
|
|
52
|
-
"lint:fix": "pnpm lint --fix"
|
|
51
|
+
"build": "pnpm nuke:dist && tsup",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:fix": "pnpm lint --fix",
|
|
54
|
+
"nuke": "pnpm dlx del-cli dist node_modules",
|
|
55
|
+
"nuke:dist": "pnpm dlx del-cli dist",
|
|
56
|
+
"prepublish": "pnpm build"
|
|
53
57
|
}
|
|
54
58
|
}
|