1 | import { __decorate } from "tslib";
|
2 | import { body } from "@pnp/queryable";
|
3 | import { _SPCollection, spInvokableFactory, _SPInstance, deleteable, } from "../spqueryable.js";
|
4 | import { defaultPath } from "../decorators.js";
|
5 | import { spPost, spPostMerge } from "../operations.js";
|
6 | let _Views = class _Views extends _SPCollection {
|
7 | |
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | async add(Title, PersonalView = false, additionalSettings = {}) {
|
15 | const data = await spPost(this, body({
|
16 | PersonalView,
|
17 | Title,
|
18 | ...additionalSettings,
|
19 | }));
|
20 | return {
|
21 | data,
|
22 | view: this.getById(data.Id),
|
23 | };
|
24 | }
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 | getById(id) {
|
31 | return View(this).concat(`('${id}')`);
|
32 | }
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 | getByTitle(title) {
|
39 | return View(this, `getByTitle('${title}')`);
|
40 | }
|
41 | };
|
42 | _Views = __decorate([
|
43 | defaultPath("views")
|
44 | ], _Views);
|
45 | export { _Views };
|
46 | export const Views = spInvokableFactory(_Views);
|
47 | export class _View extends _SPInstance {
|
48 | constructor() {
|
49 | super(...arguments);
|
50 | this.delete = deleteable();
|
51 | }
|
52 | get fields() {
|
53 | return ViewFields(this);
|
54 | }
|
55 | |
56 |
|
57 |
|
58 |
|
59 |
|
60 | async update(props) {
|
61 | const data = await spPostMerge(this, body(props));
|
62 | return {
|
63 | data,
|
64 | view: this,
|
65 | };
|
66 | }
|
67 |
|
68 | |
69 |
|
70 |
|
71 |
|
72 | renderAsHtml() {
|
73 | return View(this, "renderashtml")();
|
74 | }
|
75 | |
76 |
|
77 |
|
78 |
|
79 |
|
80 | setViewXml(viewXml) {
|
81 | return spPost(View(this, "SetViewXml"), body({ viewXml }));
|
82 | }
|
83 | }
|
84 | export const View = spInvokableFactory(_View);
|
85 | let _ViewFields = class _ViewFields extends _SPCollection {
|
86 | |
87 |
|
88 |
|
89 | getSchemaXml() {
|
90 | return ViewFields(this, "schemaxml")();
|
91 | }
|
92 | |
93 |
|
94 |
|
95 |
|
96 |
|
97 | add(fieldTitleOrInternalName) {
|
98 | return spPost(ViewFields(this, `addviewfield('${fieldTitleOrInternalName}')`));
|
99 | }
|
100 | |
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 | move(field, index) {
|
107 | return spPost(ViewFields(this, "moveviewfieldto"), body({ field, index }));
|
108 | }
|
109 | |
110 |
|
111 |
|
112 | removeAll() {
|
113 | return spPost(ViewFields(this, "removeallviewfields"));
|
114 | }
|
115 | |
116 |
|
117 |
|
118 |
|
119 |
|
120 | remove(fieldInternalName) {
|
121 | return spPost(ViewFields(this, `removeviewfield('${fieldInternalName}')`));
|
122 | }
|
123 | };
|
124 | _ViewFields = __decorate([
|
125 | defaultPath("viewfields")
|
126 | ], _ViewFields);
|
127 | export { _ViewFields };
|
128 | export const ViewFields = spInvokableFactory(_ViewFields);
|
129 | export var ViewScope;
|
130 | (function (ViewScope) {
|
131 | ViewScope[ViewScope["DefaultValue"] = 0] = "DefaultValue";
|
132 | ViewScope[ViewScope["Recursive"] = 1] = "Recursive";
|
133 | ViewScope[ViewScope["RecursiveAll"] = 2] = "RecursiveAll";
|
134 | ViewScope[ViewScope["FilesOnly"] = 3] = "FilesOnly";
|
135 | })(ViewScope || (ViewScope = {}));
|
136 |
|
\ | No newline at end of file |