@zxncij2390/monorepo3 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +16 -0
- package/.eslintrc.cjs +150 -0
- package/.github/ISSUE_TEMPLATE/bug-report.yml +178 -0
- package/.github/ISSUE_TEMPLATE/enhancement.yml +99 -0
- package/.github/ISSUE_TEMPLATE/question.yml +72 -0
- package/.github/ISSUE_TEMPLATE.md +39 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
- package/.github/workflows/lock.yml +18 -0
- package/.github/workflows/publish-buildsystem.yml +34 -0
- package/.github/workflows/publish-docs.yml +21 -0
- package/.github/workflows/publish.yml +40 -0
- package/.github/workflows/pull_request.yaml +28 -0
- package/.github/workflows/push.yaml +32 -0
- package/.github/workflows/v3-nightly.yml +40 -0
- package/.mocharc.cjs +68 -0
- package/.vscode/launch.json +103 -0
- package/.vscode/settings.json +17 -0
- package/.vscode/tasks.json +124 -0
- package/AUTHORS +13 -0
- package/CHANGELOG.md +33 -0
- package/CODE_OF_CONDUCT.md +6 -0
- package/CONTRIBUTING.md +9 -0
- package/LICENSE +25 -0
- package/README.md +66 -0
- package/buildsystem-config.ts +146 -0
- package/debug/launch/graph.ts +20 -0
- package/debug/launch/main.ts +38 -0
- package/debug/launch/setup.ts +50 -0
- package/debug/launch/sp.ts +21 -0
- package/debug/launch/tsconfig.json +27 -0
- package/debug/serve/main.ts +47 -0
- package/debug/serve/plumbing/local-module-resolver-plugin.ts +68 -0
- package/debug/serve/plumbing/run.ts +24 -0
- package/debug/serve/plumbing/serve.ts +27 -0
- package/debug/serve/plumbing/webpack.config.ts +43 -0
- package/debug/serve/spa.html +12 -0
- package/debug/serve/tsconfig.json +15 -0
- package/debug/spfx/.eslintrc.js +352 -0
- package/debug/spfx/README.md +73 -0
- package/debug/spfx/package-lock.json +57299 -0
- package/debug/spfx/package.json +38 -0
- package/debug/spfx/pnpjs-local-debug-start.js +19 -0
- package/debug/spfx/teams/f4c0e5ff-c402-46b7-8073-8cc506808d06_color.png +0 -0
- package/debug/spfx/teams/f4c0e5ff-c402-46b7-8073-8cc506808d06_outline.png +0 -0
- package/docs/_theme/main.html +5 -0
- package/docs/azidjsclient/index.md +36 -0
- package/docs/concepts/adv-clientside-pages.md +169 -0
- package/docs/concepts/auth-browser.md +42 -0
- package/docs/concepts/auth-nodejs.md +101 -0
- package/docs/concepts/auth-spfx.md +76 -0
- package/docs/concepts/authentication.md +42 -0
- package/docs/concepts/batching-caching.md +77 -0
- package/docs/concepts/batching.md +257 -0
- package/docs/concepts/calling-other-endpoints.md +213 -0
- package/docs/concepts/custom-bundle.md +15 -0
- package/docs/concepts/error-handling.md +245 -0
- package/docs/concepts/invokable.md +7 -0
- package/docs/concepts/nightly-builds.md +19 -0
- package/docs/concepts/project-preset.md +123 -0
- package/docs/concepts/selective-imports.md +106 -0
- package/docs/concepts/typings.md +23 -0
- package/docs/contributing/debug-tests.md +76 -0
- package/docs/contributing/debugging.md +135 -0
- package/docs/contributing/documentation.md +34 -0
- package/docs/contributing/extending-the-library.md +223 -0
- package/docs/contributing/index.md +22 -0
- package/docs/contributing/local-debug-configuration.md +28 -0
- package/docs/contributing/npm-scripts.md +148 -0
- package/docs/contributing/pull-requests.md +27 -0
- package/docs/contributing/settings.md +98 -0
- package/docs/contributing/setup-dev-machine.md +36 -0
- package/docs/core/behavior-recipes.md +199 -0
- package/docs/core/behaviors.md +179 -0
- package/docs/core/moments.md +215 -0
- package/docs/core/observers.md +100 -0
- package/docs/core/storage.md +90 -0
- package/docs/core/timeline.md +190 -0
- package/docs/core/util.md +191 -0
- package/docs/css/extra.css +33 -0
- package/docs/getting-started.md +361 -0
- package/docs/graph/behaviors.md +267 -0
- package/docs/graph/bookings.md +180 -0
- package/docs/graph/calendars.md +270 -0
- package/docs/graph/cloud-communications.md +40 -0
- package/docs/graph/columns.md +125 -0
- package/docs/graph/contacts.md +298 -0
- package/docs/graph/content-types.md +193 -0
- package/docs/graph/directoryobjects.md +106 -0
- package/docs/graph/groups.md +164 -0
- package/docs/graph/insights.md +151 -0
- package/docs/graph/invitations.md +22 -0
- package/docs/graph/items.md +38 -0
- package/docs/graph/lists.md +87 -0
- package/docs/graph/messages.md +20 -0
- package/docs/graph/onedrive.md +614 -0
- package/docs/graph/outlook.md +82 -0
- package/docs/graph/photos.md +71 -0
- package/docs/graph/planner.md +249 -0
- package/docs/graph/search.md +25 -0
- package/docs/graph/shares.md +44 -0
- package/docs/graph/sites.md +47 -0
- package/docs/graph/subscriptions.md +79 -0
- package/docs/graph/teams.md +293 -0
- package/docs/graph/users.md +134 -0
- package/docs/img/ConsoleListenerColors.png +0 -0
- package/docs/img/Logo.png +0 -0
- package/docs/img/PnPJS_FluentAPI.gif +0 -0
- package/docs/img/SPFx-On-Premesis-2016-1.png +0 -0
- package/docs/img/TimelineArchitecture.jpg +0 -0
- package/docs/img/csp_copyccvalue.png +0 -0
- package/docs/img/csp_networktab.png +0 -0
- package/docs/img/office365-header-icon.png +0 -0
- package/docs/img/usage-2020-eoy.png +0 -0
- package/docs/img/usage-2021-eoy.png +0 -0
- package/docs/img/usage-2022-eoy.png +0 -0
- package/docs/index.md +56 -0
- package/docs/logging/index.md +262 -0
- package/docs/msaljsclient/index.md +33 -0
- package/docs/news/2020-year-in-review.md +162 -0
- package/docs/news/2021-year-in-review.md +148 -0
- package/docs/news/2022-year-in-review.md +122 -0
- package/docs/nodejs/behaviors.md +164 -0
- package/docs/nodejs/sp-extensions.md +99 -0
- package/docs/packages.md +53 -0
- package/docs/queryable/behaviors.md +496 -0
- package/docs/queryable/extensions.md +204 -0
- package/docs/queryable/queryable.md +385 -0
- package/docs/sp/alias-parameters.md +76 -0
- package/docs/sp/alm.md +139 -0
- package/docs/sp/attachments.md +157 -0
- package/docs/sp/behaviors.md +142 -0
- package/docs/sp/clientside-pages.md +1048 -0
- package/docs/sp/column-defaults.md +241 -0
- package/docs/sp/comments-likes.md +302 -0
- package/docs/sp/content-types.md +131 -0
- package/docs/sp/context-info.md +67 -0
- package/docs/sp/favorites.md +91 -0
- package/docs/sp/features.md +83 -0
- package/docs/sp/fields.md +668 -0
- package/docs/sp/files.md +559 -0
- package/docs/sp/folders.md +532 -0
- package/docs/sp/forms.md +22 -0
- package/docs/sp/groupSiteManager.md +40 -0
- package/docs/sp/hubsites.md +140 -0
- package/docs/sp/items.md +601 -0
- package/docs/sp/lists.md +572 -0
- package/docs/sp/navigation.md +171 -0
- package/docs/sp/permissions.md +82 -0
- package/docs/sp/profiles.md +407 -0
- package/docs/sp/publishing-sitepageservice.md +16 -0
- package/docs/sp/recycle-bin.md +72 -0
- package/docs/sp/regional-settings.md +108 -0
- package/docs/sp/related-items.md +136 -0
- package/docs/sp/search.md +207 -0
- package/docs/sp/security.md +196 -0
- package/docs/sp/sharing.md +273 -0
- package/docs/sp/site-designs.md +117 -0
- package/docs/sp/site-groups.md +144 -0
- package/docs/sp/site-scripts.md +123 -0
- package/docs/sp/site-users.md +211 -0
- package/docs/sp/sites.md +269 -0
- package/docs/sp/social.md +182 -0
- package/docs/sp/sp-utilities-utility.md +159 -0
- package/docs/sp/subscriptions.md +79 -0
- package/docs/sp/taxonomy.md +470 -0
- package/docs/sp/tenant-properties.md +55 -0
- package/docs/sp/user-custom-actions.md +95 -0
- package/docs/sp/views.md +226 -0
- package/docs/sp/webs.md +947 -0
- package/docs/sp-admin/index.md +139 -0
- package/docs/transition-guide.md +87 -0
- package/docs/v1/404.html +1611 -0
- package/docs/v1/assets/fonts/font-awesome.css +4 -0
- package/docs/v1/assets/fonts/material-icons.css +13 -0
- package/docs/v1/assets/fonts/specimen/FontAwesome.ttf +0 -0
- package/docs/v1/assets/fonts/specimen/FontAwesome.woff +0 -0
- package/docs/v1/assets/fonts/specimen/FontAwesome.woff2 +0 -0
- package/docs/v1/assets/fonts/specimen/MaterialIcons-Regular.ttf +0 -0
- package/docs/v1/assets/fonts/specimen/MaterialIcons-Regular.woff +0 -0
- package/docs/v1/assets/fonts/specimen/MaterialIcons-Regular.woff2 +0 -0
- package/docs/v1/assets/images/favicon.png +0 -0
- package/docs/v1/assets/images/icons/bitbucket.1b09e088.svg +20 -0
- package/docs/v1/assets/images/icons/github.f0b8504a.svg +18 -0
- package/docs/v1/assets/images/icons/gitlab.6dd19c00.svg +38 -0
- package/docs/v1/assets/javascripts/application.583bbe55.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.da.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.de.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.du.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.es.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.fi.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.fr.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.hu.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.it.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.jp.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.multi.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.no.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.pt.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.ro.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.ru.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.stemmer.support.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.sv.js +1 -0
- package/docs/v1/assets/javascripts/lunr/lunr.tr.js +1 -0
- package/docs/v1/assets/javascripts/lunr/tinyseg.js +1 -0
- package/docs/v1/assets/javascripts/modernizr.1aa3b519.js +1 -0
- package/docs/v1/assets/stylesheets/application-palette.22915126.css +1176 -0
- package/docs/v1/assets/stylesheets/application.451f80e5.css +2552 -0
- package/docs/v1/common/docs/adalclient/index.html +1994 -0
- package/docs/v1/common/docs/collections/index.html +1786 -0
- package/docs/v1/common/docs/custom-httpclientimpl/index.html +1798 -0
- package/docs/v1/common/docs/index.html +1787 -0
- package/docs/v1/common/docs/libconfig/index.html +1930 -0
- package/docs/v1/common/docs/netutil/index.html +1860 -0
- package/docs/v1/common/docs/storage/index.html +1850 -0
- package/docs/v1/common/docs/util/index.html +2058 -0
- package/docs/v1/config-store/docs/configuration/index.html +1730 -0
- package/docs/v1/config-store/docs/index.html +1761 -0
- package/docs/v1/config-store/docs/providers/index.html +1782 -0
- package/docs/v1/documentation/SPFx-On-Premesis-2016/index.html +1720 -0
- package/docs/v1/documentation/beta-versions/index.html +1742 -0
- package/docs/v1/documentation/css/extra.css +33 -0
- package/docs/v1/documentation/debugging/index.html +2098 -0
- package/docs/v1/documentation/deployment/index.html +1972 -0
- package/docs/v1/documentation/documentation/index.html +1760 -0
- package/docs/v1/documentation/getting-started/index.html +2280 -0
- package/docs/v1/documentation/getting-started-dev/index.html +1799 -0
- package/docs/v1/documentation/gulp-commands/index.html +2100 -0
- package/docs/v1/documentation/img/Logo.png +0 -0
- package/docs/v1/documentation/img/PnPJS_FluentAPI.gif +0 -0
- package/docs/v1/documentation/img/SPFx-On-Premesis-2016-1.png +0 -0
- package/docs/v1/documentation/img/office365-header-icon.png +0 -0
- package/docs/v1/documentation/img/pnpjs-common-uml.svg +220 -0
- package/docs/v1/documentation/img/pnpjs-config-store-uml.svg +56 -0
- package/docs/v1/documentation/img/pnpjs-graph-uml.svg +602 -0
- package/docs/v1/documentation/img/pnpjs-logging-uml.svg +59 -0
- package/docs/v1/documentation/img/pnpjs-nodejs-uml.svg +85 -0
- package/docs/v1/documentation/img/pnpjs-odata-uml.svg +253 -0
- package/docs/v1/documentation/img/pnpjs-sp-addinhelpers-uml.svg +48 -0
- package/docs/v1/documentation/img/pnpjs-sp-clientsvc-uml.svg +167 -0
- package/docs/v1/documentation/img/pnpjs-sp-taxonomy-uml.svg +458 -0
- package/docs/v1/documentation/img/pnpjs-sp-uml.svg +2833 -0
- package/docs/v1/documentation/package-structure/index.html +1875 -0
- package/docs/v1/documentation/packages/index.html +1741 -0
- package/docs/v1/documentation/polyfill/index.html +1877 -0
- package/docs/v1/documentation/theme/main.html +5 -0
- package/docs/v1/documentation/transition-guide/index.html +1977 -0
- package/docs/v1/graph/docs/contacts/index.html +2080 -0
- package/docs/v1/graph/docs/directoryobjects/index.html +1865 -0
- package/docs/v1/graph/docs/index.html +1858 -0
- package/docs/v1/graph/docs/insights/index.html +1698 -0
- package/docs/v1/graph/docs/invitations/index.html +1742 -0
- package/docs/v1/graph/docs/onedrive/index.html +2086 -0
- package/docs/v1/graph/docs/people/index.html +1664 -0
- package/docs/v1/graph/docs/planner/index.html +2097 -0
- package/docs/v1/graph/docs/security/index.html +1692 -0
- package/docs/v1/graph/docs/sites/index.html +2043 -0
- package/docs/v1/graph/docs/subscriptions/index.html +1835 -0
- package/docs/v1/graph/docs/teams/index.html +2097 -0
- package/docs/v1/index.html +1889 -0
- package/docs/v1/logging/docs/index.html +2045 -0
- package/docs/v1/nodejs/docs/adal-certificate-fetch-client/index.html +1676 -0
- package/docs/v1/nodejs/docs/adal-fetch-client/index.html +1713 -0
- package/docs/v1/nodejs/docs/bearer-token-fetch-client/index.html +1712 -0
- package/docs/v1/nodejs/docs/index.html +1764 -0
- package/docs/v1/nodejs/docs/provider-hosted-app/index.html +1725 -0
- package/docs/v1/nodejs/docs/proxy/index.html +1699 -0
- package/docs/v1/nodejs/docs/sp-fetch-client/index.html +1895 -0
- package/docs/v1/odata/docs/caching/index.html +1988 -0
- package/docs/v1/odata/docs/core/index.html +1829 -0
- package/docs/v1/odata/docs/index.html +1781 -0
- package/docs/v1/odata/docs/odata-batch/index.html +1755 -0
- package/docs/v1/odata/docs/parsers/index.html +1862 -0
- package/docs/v1/odata/docs/pipeline/index.html +1811 -0
- package/docs/v1/odata/docs/queryable/index.html +1967 -0
- package/docs/v1/pnpjs/docs/index.html +1814 -0
- package/docs/v1/search/search_index.json +1 -0
- package/docs/v1/sitemap.xml +428 -0
- package/docs/v1/sitemap.xml.gz +0 -0
- package/docs/v1/sp/docs/alias-parameters/index.html +1830 -0
- package/docs/v1/sp/docs/alm/index.html +1920 -0
- package/docs/v1/sp/docs/attachments/index.html +1998 -0
- package/docs/v1/sp/docs/client-side-pages/index.html +2031 -0
- package/docs/v1/sp/docs/comments-likes/index.html +1958 -0
- package/docs/v1/sp/docs/content-types/index.html +1758 -0
- package/docs/v1/sp/docs/entity-merging/index.html +1838 -0
- package/docs/v1/sp/docs/features/index.html +1824 -0
- package/docs/v1/sp/docs/fields/index.html +2031 -0
- package/docs/v1/sp/docs/files/index.html +2178 -0
- package/docs/v1/sp/docs/index.html +1894 -0
- package/docs/v1/sp/docs/items/index.html +2362 -0
- package/docs/v1/sp/docs/navigation-service/index.html +1791 -0
- package/docs/v1/sp/docs/permissions/index.html +1860 -0
- package/docs/v1/sp/docs/profiles/index.html +1794 -0
- package/docs/v1/sp/docs/related-items/index.html +1886 -0
- package/docs/v1/sp/docs/search/index.html +1830 -0
- package/docs/v1/sp/docs/sharing/index.html +2058 -0
- package/docs/v1/sp/docs/sitedesigns/index.html +1851 -0
- package/docs/v1/sp/docs/sites/index.html +2186 -0
- package/docs/v1/sp/docs/social/index.html +2011 -0
- package/docs/v1/sp/docs/sp-utilities-utility/index.html +2061 -0
- package/docs/v1/sp/docs/tenant-properties/index.html +1795 -0
- package/docs/v1/sp/docs/views/index.html +1869 -0
- package/docs/v1/sp/docs/webs/index.html +1972 -0
- package/docs/v1/sp-addinhelpers/docs/index.html +1771 -0
- package/docs/v1/sp-addinhelpers/docs/sp-request-executor-client/index.html +1760 -0
- package/docs/v1/sp-addinhelpers/docs/sp-rest-addin/index.html +1711 -0
- package/docs/v1/sp-clientsvc/docs/index.html +1736 -0
- package/docs/v1/sp-taxonomy/docs/index.html +1887 -0
- package/docs/v1/sp-taxonomy/docs/labels/index.html +1827 -0
- package/docs/v1/sp-taxonomy/docs/term-groups/index.html +1875 -0
- package/docs/v1/sp-taxonomy/docs/term-sets/index.html +1946 -0
- package/docs/v1/sp-taxonomy/docs/term-stores/index.html +2111 -0
- package/docs/v1/sp-taxonomy/docs/terms/index.html +2036 -0
- package/docs/v1/sp-taxonomy/docs/utilities/index.html +1783 -0
- package/docs/v2/404.html +2108 -0
- package/docs/v2/SPFx-on-premises/index.html +2278 -0
- package/docs/v2/_theme/main.html +5 -0
- package/docs/v2/adaljsclient/adalclient/index.html +15 -0
- package/docs/v2/adaljsclient/index.html +15 -0
- package/docs/v2/assets/images/favicon.png +0 -0
- package/docs/v2/assets/javascripts/bundle.9554a270.min.js +2 -0
- package/docs/v2/assets/javascripts/bundle.9554a270.min.js.map +1 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.ar.min.js +1 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.da.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.de.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.du.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.es.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.fi.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.fr.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.hu.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.it.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.ja.min.js +1 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.jp.min.js +1 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.multi.min.js +1 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.nl.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.no.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.pt.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.ro.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.ru.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +1 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.sv.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.tr.min.js +18 -0
- package/docs/v2/assets/javascripts/lunr/min/lunr.vi.min.js +1 -0
- package/docs/v2/assets/javascripts/lunr/tinyseg.min.js +1 -0
- package/docs/v2/assets/javascripts/vendor.77e55a48.min.js +30 -0
- package/docs/v2/assets/javascripts/vendor.77e55a48.min.js.map +1 -0
- package/docs/v2/assets/javascripts/worker/search.4ac00218.min.js +59 -0
- package/docs/v2/assets/javascripts/worker/search.4ac00218.min.js.map +1 -0
- package/docs/v2/assets/stylesheets/main.38780c08.min.css +3 -0
- package/docs/v2/assets/stylesheets/main.38780c08.min.css.map +1 -0
- package/docs/v2/assets/stylesheets/palette.3f72e892.min.css +3 -0
- package/docs/v2/assets/stylesheets/palette.3f72e892.min.css.map +1 -0
- package/docs/v2/authentication/adaljsclient/index.html +2510 -0
- package/docs/v2/authentication/bearertokenclient/index.html +2251 -0
- package/docs/v2/authentication/client-spa/index.html +2206 -0
- package/docs/v2/authentication/client-spfx/index.html +2397 -0
- package/docs/v2/authentication/index.html +2307 -0
- package/docs/v2/authentication/lambdaclient/index.html +2304 -0
- package/docs/v2/authentication/msaljsclient/index.html +2413 -0
- package/docs/v2/authentication/server-nodejs/index.html +2404 -0
- package/docs/v2/authentication/sp-app-registration/index.html +2273 -0
- package/docs/v2/common/collections/index.html +2277 -0
- package/docs/v2/common/custom-httpclientimpl/index.html +2300 -0
- package/docs/v2/common/index.html +2262 -0
- package/docs/v2/common/libconfig/index.html +2413 -0
- package/docs/v2/common/netutil/index.html +2350 -0
- package/docs/v2/common/storage/index.html +2339 -0
- package/docs/v2/common/util/index.html +2638 -0
- package/docs/v2/concepts/configuration/index.html +2685 -0
- package/docs/v2/concepts/custom-bundle/index.html +2279 -0
- package/docs/v2/concepts/error-handling/index.html +2539 -0
- package/docs/v2/concepts/ie11-mode/index.html +2278 -0
- package/docs/v2/concepts/invokable/index.html +2254 -0
- package/docs/v2/concepts/polyfill/index.html +2401 -0
- package/docs/v2/concepts/selective-imports/index.html +2360 -0
- package/docs/v2/concepts/settings/index.html +2551 -0
- package/docs/v2/config-store/configuration/index.html +2226 -0
- package/docs/v2/config-store/index.html +2239 -0
- package/docs/v2/config-store/providers/index.html +2275 -0
- package/docs/v2/contributing/debug-tests/index.html +2323 -0
- package/docs/v2/contributing/debugging/index.html +2514 -0
- package/docs/v2/contributing/documentation/index.html +2291 -0
- package/docs/v2/contributing/extending-the-library/index.html +2521 -0
- package/docs/v2/contributing/index.html +2270 -0
- package/docs/v2/contributing/local-debug-configuration/index.html +2284 -0
- package/docs/v2/contributing/pull-requests/index.html +2261 -0
- package/docs/v2/contributing/setup-dev-machine/index.html +2284 -0
- package/docs/v2/css/extra.css +33 -0
- package/docs/v2/debug-tests/index.html +15 -0
- package/docs/v2/debugging/index.html +15 -0
- package/docs/v2/documentation/index.html +15 -0
- package/docs/v2/getting-started/index.html +2789 -0
- package/docs/v2/getting-started-dev/index.html +15 -0
- package/docs/v2/graph/calendars/index.html +2569 -0
- package/docs/v2/graph/contacts/index.html +2673 -0
- package/docs/v2/graph/directoryobjects/index.html +2402 -0
- package/docs/v2/graph/groups/index.html +2488 -0
- package/docs/v2/graph/index.html +2333 -0
- package/docs/v2/graph/insights/index.html +2478 -0
- package/docs/v2/graph/invitations/index.html +2273 -0
- package/docs/v2/graph/onedrive/index.html +2617 -0
- package/docs/v2/graph/outlook/index.html +2363 -0
- package/docs/v2/graph/photos/index.html +2351 -0
- package/docs/v2/graph/planner/index.html +2628 -0
- package/docs/v2/graph/search/index.html +2264 -0
- package/docs/v2/graph/subscriptions/index.html +2333 -0
- package/docs/v2/graph/teams/index.html +2619 -0
- package/docs/v2/graph/users/index.html +2461 -0
- package/docs/v2/img/ConsoleListenerColors.png +0 -0
- package/docs/v2/img/Logo.png +0 -0
- package/docs/v2/img/PnPJS_FluentAPI.gif +0 -0
- package/docs/v2/img/SPFx-On-Premesis-2016-1.png +0 -0
- package/docs/v2/img/office365-header-icon.png +0 -0
- package/docs/v2/img/usage-2020-eoy.png +0 -0
- package/docs/v2/index.html +2410 -0
- package/docs/v2/logging/index.html +2622 -0
- package/docs/v2/news/2020-year-in-review/index.html +2525 -0
- package/docs/v2/nodejs/adal-fetch-client/index.html +2204 -0
- package/docs/v2/nodejs/bearer-token-fetch-client/index.html +2203 -0
- package/docs/v2/nodejs/index.html +2261 -0
- package/docs/v2/nodejs/provider-hosted-app/index.html +2220 -0
- package/docs/v2/nodejs/proxy/index.html +2238 -0
- package/docs/v2/nodejs/sp-extensions/index.html +2362 -0
- package/docs/v2/nodejs/sp-fetch-client/index.html +2294 -0
- package/docs/v2/nodejs-support/index.html +2398 -0
- package/docs/v2/npm-scripts/index.html +2521 -0
- package/docs/v2/odata/caching/index.html +2465 -0
- package/docs/v2/odata/core/index.html +2322 -0
- package/docs/v2/odata/debug/index.html +2358 -0
- package/docs/v2/odata/extensions/index.html +2581 -0
- package/docs/v2/odata/index.html +2259 -0
- package/docs/v2/odata/odata-batch/index.html +2250 -0
- package/docs/v2/odata/parsers/index.html +2355 -0
- package/docs/v2/odata/pipeline/index.html +2297 -0
- package/docs/v2/odata/queryable/index.html +2455 -0
- package/docs/v2/packages/index.html +2251 -0
- package/docs/v2/pnpjs/index.html +2281 -0
- package/docs/v2/search/search_index.json +1 -0
- package/docs/v2/sitemap.xml +483 -0
- package/docs/v2/sitemap.xml.gz +0 -0
- package/docs/v2/sp/alias-parameters/index.html +2330 -0
- package/docs/v2/sp/alm/index.html +2433 -0
- package/docs/v2/sp/attachments/index.html +2504 -0
- package/docs/v2/sp/clientside-pages/index.html +3477 -0
- package/docs/v2/sp/column-defaults/index.html +2540 -0
- package/docs/v2/sp/comments-likes/index.html +2646 -0
- package/docs/v2/sp/content-types/index.html +2462 -0
- package/docs/v2/sp/custom-irequestclient/index.html +2339 -0
- package/docs/v2/sp/entity-merging/index.html +2325 -0
- package/docs/v2/sp/features/index.html +2440 -0
- package/docs/v2/sp/fields/index.html +3103 -0
- package/docs/v2/sp/files/index.html +2949 -0
- package/docs/v2/sp/folders/index.html +2968 -0
- package/docs/v2/sp/forms/index.html +2289 -0
- package/docs/v2/sp/hubsites/index.html +2485 -0
- package/docs/v2/sp/index.html +2328 -0
- package/docs/v2/sp/items/index.html +2974 -0
- package/docs/v2/sp/lists/index.html +3387 -0
- package/docs/v2/sp/navigation/index.html +2535 -0
- package/docs/v2/sp/permissions/index.html +2338 -0
- package/docs/v2/sp/profiles/index.html +2806 -0
- package/docs/v2/sp/regional-settings/index.html +2394 -0
- package/docs/v2/sp/related-items/index.html +2417 -0
- package/docs/v2/sp/search/index.html +2474 -0
- package/docs/v2/sp/security/index.html +2432 -0
- package/docs/v2/sp/sharing/index.html +2589 -0
- package/docs/v2/sp/site-designs/index.html +2414 -0
- package/docs/v2/sp/site-groups/index.html +2504 -0
- package/docs/v2/sp/site-scripts/index.html +2433 -0
- package/docs/v2/sp/site-users/index.html +2641 -0
- package/docs/v2/sp/sites/index.html +2727 -0
- package/docs/v2/sp/social/index.html +2517 -0
- package/docs/v2/sp/sp-utilities-utility/index.html +2460 -0
- package/docs/v2/sp/subscriptions/index.html +2395 -0
- package/docs/v2/sp/taxonomy/index.html +2565 -0
- package/docs/v2/sp/tenant-properties/index.html +2286 -0
- package/docs/v2/sp/user-custom-actions/index.html +2424 -0
- package/docs/v2/sp/views/index.html +2652 -0
- package/docs/v2/sp/webs/index.html +4190 -0
- package/docs/v2/sp-addinhelpers/index.html +2274 -0
- package/docs/v2/sp-addinhelpers/sp-request-executor-client/index.html +2253 -0
- package/docs/v2/sp-addinhelpers/sp-rest-addin/index.html +2206 -0
- package/docs/v2/transition-guide/index.html +2435 -0
- package/mkdocs-requirements.txt +2 -0
- package/mkdocs.yml +188 -0
- package/package.json +96 -0
- package/packages/azidjsclient/index.ts +68 -0
- package/packages/azidjsclient/package.json +13 -0
- package/packages/azidjsclient/tsconfig.json +12 -0
- package/packages/core/behaviors/assign-from.ts +17 -0
- package/packages/core/behaviors/copy-from.ts +58 -0
- package/packages/core/extendable.ts +193 -0
- package/packages/core/index.ts +11 -0
- package/packages/core/moments.ts +117 -0
- package/packages/core/package.json +10 -0
- package/packages/core/storage.ts +274 -0
- package/packages/core/timeline.ts +387 -0
- package/packages/core/tsconfig.json +10 -0
- package/packages/core/util.ts +169 -0
- package/packages/graph/attachments/conversations.ts +14 -0
- package/packages/graph/attachments/index.ts +8 -0
- package/packages/graph/attachments/types.ts +37 -0
- package/packages/graph/batching.ts +408 -0
- package/packages/graph/behaviors/consistency-level.ts +17 -0
- package/packages/graph/behaviors/defaults.ts +41 -0
- package/packages/graph/behaviors/endpoint.ts +22 -0
- package/packages/graph/behaviors/graphbrowser.ts +38 -0
- package/packages/graph/behaviors/paged.ts +109 -0
- package/packages/graph/behaviors/spfx.ts +46 -0
- package/packages/graph/behaviors/telemetry.ts +19 -0
- package/packages/graph/bookings/funcs.ts +18 -0
- package/packages/graph/bookings/index.ts +62 -0
- package/packages/graph/bookings/types.ts +352 -0
- package/packages/graph/calendars/funcs.ts +58 -0
- package/packages/graph/calendars/groups.ts +19 -0
- package/packages/graph/calendars/index.ts +18 -0
- package/packages/graph/calendars/types.ts +73 -0
- package/packages/graph/calendars/users.ts +28 -0
- package/packages/graph/cloud-communications/index.ts +24 -0
- package/packages/graph/cloud-communications/types.ts +32 -0
- package/packages/graph/cloud-communications/users.ts +15 -0
- package/packages/graph/columns/addColumns.ts +28 -0
- package/packages/graph/columns/content-types.ts +44 -0
- package/packages/graph/columns/index.ts +14 -0
- package/packages/graph/columns/lists.ts +33 -0
- package/packages/graph/columns/sites.ts +32 -0
- package/packages/graph/columns/types.ts +24 -0
- package/packages/graph/contacts/index.ts +14 -0
- package/packages/graph/contacts/types.ts +126 -0
- package/packages/graph/contacts/users.ts +17 -0
- package/packages/graph/content-types/index.ts +11 -0
- package/packages/graph/content-types/lists.ts +44 -0
- package/packages/graph/content-types/sites.ts +70 -0
- package/packages/graph/content-types/types.ts +112 -0
- package/packages/graph/conversations/groups.ts +20 -0
- package/packages/graph/conversations/index.ts +19 -0
- package/packages/graph/conversations/types.ts +147 -0
- package/packages/graph/decorators.ts +164 -0
- package/packages/graph/directory-objects/index.ts +24 -0
- package/packages/graph/directory-objects/types.ts +94 -0
- package/packages/graph/fi.ts +46 -0
- package/packages/graph/graphqueryable.ts +193 -0
- package/packages/graph/groups/index.ts +25 -0
- package/packages/graph/groups/types.ts +130 -0
- package/packages/graph/index.ts +21 -0
- package/packages/graph/insights/index.ts +20 -0
- package/packages/graph/insights/types.ts +105 -0
- package/packages/graph/insights/users.ts +14 -0
- package/packages/graph/invitations/index.ts +22 -0
- package/packages/graph/invitations/types.ts +41 -0
- package/packages/graph/lists/drive.ts +21 -0
- package/packages/graph/lists/index.ts +10 -0
- package/packages/graph/lists/sites.ts +16 -0
- package/packages/graph/lists/types.ts +47 -0
- package/packages/graph/members/groups.ts +17 -0
- package/packages/graph/members/index.ts +8 -0
- package/packages/graph/members/types.ts +40 -0
- package/packages/graph/messages/index.ts +14 -0
- package/packages/graph/messages/types.ts +46 -0
- package/packages/graph/messages/users.ts +27 -0
- package/packages/graph/onedrive/funcs.ts +40 -0
- package/packages/graph/onedrive/groups.ts +33 -0
- package/packages/graph/onedrive/index.ts +48 -0
- package/packages/graph/onedrive/sites.ts +35 -0
- package/packages/graph/onedrive/types.ts +482 -0
- package/packages/graph/onedrive/users.ts +56 -0
- package/packages/graph/onenote/index.ts +16 -0
- package/packages/graph/onenote/types.ts +119 -0
- package/packages/graph/onenote/users.ts +14 -0
- package/packages/graph/operations.ts +22 -0
- package/packages/graph/outlook/index.ts +11 -0
- package/packages/graph/outlook/types.ts +58 -0
- package/packages/graph/outlook/users.ts +14 -0
- package/packages/graph/package.json +16 -0
- package/packages/graph/photos/groups.ts +14 -0
- package/packages/graph/photos/index.ts +7 -0
- package/packages/graph/photos/types.ts +33 -0
- package/packages/graph/photos/users.ts +14 -0
- package/packages/graph/planner/groups.ts +14 -0
- package/packages/graph/planner/index.ts +42 -0
- package/packages/graph/planner/types.ts +213 -0
- package/packages/graph/planner/users.ts +14 -0
- package/packages/graph/post-install.cjs +20 -0
- package/packages/graph/presets/all.ts +42 -0
- package/packages/graph/search/index.ts +18 -0
- package/packages/graph/search/types.ts +20 -0
- package/packages/graph/shares/index.ts +23 -0
- package/packages/graph/shares/types.ts +47 -0
- package/packages/graph/sites/group.ts +14 -0
- package/packages/graph/sites/index.ts +25 -0
- package/packages/graph/sites/types.ts +45 -0
- package/packages/graph/subscriptions/index.ts +24 -0
- package/packages/graph/subscriptions/types.ts +59 -0
- package/packages/graph/teams/index.ts +68 -0
- package/packages/graph/teams/types.ts +333 -0
- package/packages/graph/teams/users.ts +14 -0
- package/packages/graph/tsconfig.json +16 -0
- package/packages/graph/users/index.ts +34 -0
- package/packages/graph/users/types.ts +56 -0
- package/packages/graph/utils/type.ts +3 -0
- package/packages/logging/index.ts +145 -0
- package/packages/logging/listeners.ts +134 -0
- package/packages/logging/package.json +10 -0
- package/packages/logging/tsconfig.json +7 -0
- package/packages/msaljsclient/index.ts +40 -0
- package/packages/msaljsclient/package.json +12 -0
- package/packages/msaljsclient/tsconfig.json +12 -0
- package/packages/nodejs/behaviors/fetch.ts +130 -0
- package/packages/nodejs/behaviors/graphdefault.ts +50 -0
- package/packages/nodejs/behaviors/msal.ts +24 -0
- package/packages/nodejs/behaviors/spdefault.ts +45 -0
- package/packages/nodejs/behaviors/stream-parse.ts +7 -0
- package/packages/nodejs/index.ts +33 -0
- package/packages/nodejs/package.json +17 -0
- package/packages/nodejs/sp-extensions/stream.ts +136 -0
- package/packages/nodejs/tsconfig.json +28 -0
- package/packages/queryable/add-prop.ts +18 -0
- package/packages/queryable/behaviors/bearer-token.ts +15 -0
- package/packages/queryable/behaviors/browser-fetch.ts +131 -0
- package/packages/queryable/behaviors/caching-pessimistic.ts +67 -0
- package/packages/queryable/behaviors/caching.ts +149 -0
- package/packages/queryable/behaviors/cancelable.ts +264 -0
- package/packages/queryable/behaviors/inject-headers.ts +23 -0
- package/packages/queryable/behaviors/parsers.ts +134 -0
- package/packages/queryable/behaviors/resolvers.ts +28 -0
- package/packages/queryable/behaviors/timeout.ts +24 -0
- package/packages/queryable/index.ts +19 -0
- package/packages/queryable/invokable.ts +42 -0
- package/packages/queryable/operations.ts +32 -0
- package/packages/queryable/package.json +11 -0
- package/packages/queryable/queryable-factory.ts +19 -0
- package/packages/queryable/queryable.ts +239 -0
- package/packages/queryable/request-builders.ts +20 -0
- package/packages/queryable/tsconfig.json +11 -0
- package/packages/readme.md +21 -0
- package/packages/sp/appcatalog/index.ts +35 -0
- package/packages/sp/appcatalog/types.ts +176 -0
- package/packages/sp/appcatalog/web.ts +19 -0
- package/packages/sp/attachments/index.ts +11 -0
- package/packages/sp/attachments/item.ts +17 -0
- package/packages/sp/attachments/types.ts +95 -0
- package/packages/sp/batching.ts +483 -0
- package/packages/sp/behaviors/defaults.ts +38 -0
- package/packages/sp/behaviors/request-digest.ts +78 -0
- package/packages/sp/behaviors/spbrowser.ts +40 -0
- package/packages/sp/behaviors/spfx.ts +83 -0
- package/packages/sp/behaviors/telemetry.ts +35 -0
- package/packages/sp/clientside-pages/funcs.ts +27 -0
- package/packages/sp/clientside-pages/index.ts +27 -0
- package/packages/sp/clientside-pages/types.ts +1661 -0
- package/packages/sp/clientside-pages/web.ts +93 -0
- package/packages/sp/column-defaults/folder.ts +89 -0
- package/packages/sp/column-defaults/index.ts +8 -0
- package/packages/sp/column-defaults/list.ts +219 -0
- package/packages/sp/column-defaults/types.ts +19 -0
- package/packages/sp/comments/clientside-page.ts +120 -0
- package/packages/sp/comments/index.ts +14 -0
- package/packages/sp/comments/item.ts +77 -0
- package/packages/sp/comments/types.ts +160 -0
- package/packages/sp/content-types/index.ts +17 -0
- package/packages/sp/content-types/item.ts +17 -0
- package/packages/sp/content-types/list.ts +17 -0
- package/packages/sp/content-types/types.ts +181 -0
- package/packages/sp/content-types/web.ts +17 -0
- package/packages/sp/context-info/index.ts +40 -0
- package/packages/sp/decorators.ts +18 -0
- package/packages/sp/favorites/index.ts +32 -0
- package/packages/sp/favorites/types.ts +187 -0
- package/packages/sp/features/index.ts +11 -0
- package/packages/sp/features/site.ts +17 -0
- package/packages/sp/features/types.ts +73 -0
- package/packages/sp/features/web.ts +17 -0
- package/packages/sp/fi.ts +46 -0
- package/packages/sp/fields/index.ts +22 -0
- package/packages/sp/fields/list.ts +17 -0
- package/packages/sp/fields/types.ts +648 -0
- package/packages/sp/fields/web.ts +23 -0
- package/packages/sp/files/folder.ts +17 -0
- package/packages/sp/files/index.ts +25 -0
- package/packages/sp/files/item.ts +17 -0
- package/packages/sp/files/readable-file.ts +40 -0
- package/packages/sp/files/types.ts +771 -0
- package/packages/sp/files/web.ts +46 -0
- package/packages/sp/folders/index.ts +19 -0
- package/packages/sp/folders/item.ts +16 -0
- package/packages/sp/folders/list.ts +17 -0
- package/packages/sp/folders/types.ts +439 -0
- package/packages/sp/folders/web.ts +50 -0
- package/packages/sp/forms/index.ts +9 -0
- package/packages/sp/forms/list.ts +14 -0
- package/packages/sp/forms/types.ts +41 -0
- package/packages/sp/groupsitemanager/index.ts +18 -0
- package/packages/sp/groupsitemanager/types.ts +433 -0
- package/packages/sp/hubsites/index.ts +31 -0
- package/packages/sp/hubsites/site.ts +43 -0
- package/packages/sp/hubsites/types.ts +71 -0
- package/packages/sp/hubsites/web.ts +38 -0
- package/packages/sp/index.ts +24 -0
- package/packages/sp/items/get-all.ts +52 -0
- package/packages/sp/items/index.ts +18 -0
- package/packages/sp/items/list.ts +14 -0
- package/packages/sp/items/types.ts +405 -0
- package/packages/sp/lists/index.ts +23 -0
- package/packages/sp/lists/types.ts +851 -0
- package/packages/sp/lists/web.ts +68 -0
- package/packages/sp/navigation/index.ts +35 -0
- package/packages/sp/navigation/types.ts +243 -0
- package/packages/sp/navigation/web.ts +19 -0
- package/packages/sp/operations.ts +33 -0
- package/packages/sp/package.json +15 -0
- package/packages/sp/post-install.cjs +20 -0
- package/packages/sp/presets/all.ts +75 -0
- package/packages/sp/profiles/index.ts +30 -0
- package/packages/sp/profiles/types.ts +595 -0
- package/packages/sp/publishing-sitepageservice/index.ts +22 -0
- package/packages/sp/publishing-sitepageservice/types.ts +18 -0
- package/packages/sp/recycle-bin/index.ts +36 -0
- package/packages/sp/recycle-bin/types.ts +113 -0
- package/packages/sp/regional-settings/content-type.ts +11 -0
- package/packages/sp/regional-settings/field.ts +11 -0
- package/packages/sp/regional-settings/funcs.ts +10 -0
- package/packages/sp/regional-settings/index.ts +18 -0
- package/packages/sp/regional-settings/list.ts +11 -0
- package/packages/sp/regional-settings/types.ts +159 -0
- package/packages/sp/regional-settings/user-custom-actions.ts +11 -0
- package/packages/sp/regional-settings/web.ts +21 -0
- package/packages/sp/related-items/index.ts +7 -0
- package/packages/sp/related-items/types.ts +194 -0
- package/packages/sp/related-items/web.ts +22 -0
- package/packages/sp/search/index.ts +48 -0
- package/packages/sp/search/query.ts +254 -0
- package/packages/sp/search/suggest.ts +130 -0
- package/packages/sp/search/types.ts +480 -0
- package/packages/sp/security/funcs.ts +94 -0
- package/packages/sp/security/index.ts +21 -0
- package/packages/sp/security/item.ts +29 -0
- package/packages/sp/security/list.ts +29 -0
- package/packages/sp/security/types.ts +440 -0
- package/packages/sp/security/web.ts +34 -0
- package/packages/sp/sharing/file.ts +75 -0
- package/packages/sp/sharing/folder.ts +69 -0
- package/packages/sp/sharing/funcs.ts +258 -0
- package/packages/sp/sharing/index.ts +27 -0
- package/packages/sp/sharing/item.ts +53 -0
- package/packages/sp/sharing/types.ts +626 -0
- package/packages/sp/sharing/web.ts +109 -0
- package/packages/sp/site-designs/index.ts +29 -0
- package/packages/sp/site-designs/types.ts +456 -0
- package/packages/sp/site-designs/web.ts +41 -0
- package/packages/sp/site-groups/index.ts +11 -0
- package/packages/sp/site-groups/types.ts +133 -0
- package/packages/sp/site-groups/web.ts +73 -0
- package/packages/sp/site-scripts/index.ts +27 -0
- package/packages/sp/site-scripts/list.ts +27 -0
- package/packages/sp/site-scripts/types.ts +243 -0
- package/packages/sp/site-scripts/web.ts +24 -0
- package/packages/sp/site-users/index.ts +12 -0
- package/packages/sp/site-users/types.ts +195 -0
- package/packages/sp/site-users/web.ts +56 -0
- package/packages/sp/sites/index.ts +26 -0
- package/packages/sp/sites/types.ts +422 -0
- package/packages/sp/social/index.ts +33 -0
- package/packages/sp/social/types.ts +381 -0
- package/packages/sp/spqueryable.ts +244 -0
- package/packages/sp/sputilities/index.ts +23 -0
- package/packages/sp/sputilities/types.ts +197 -0
- package/packages/sp/subscriptions/index.ts +10 -0
- package/packages/sp/subscriptions/list.ts +18 -0
- package/packages/sp/subscriptions/types.ts +107 -0
- package/packages/sp/taxonomy/index.ts +50 -0
- package/packages/sp/taxonomy/types.ts +508 -0
- package/packages/sp/tsconfig.json +16 -0
- package/packages/sp/types.ts +283 -0
- package/packages/sp/user-custom-actions/index.ts +15 -0
- package/packages/sp/user-custom-actions/list.ts +18 -0
- package/packages/sp/user-custom-actions/site.ts +18 -0
- package/packages/sp/user-custom-actions/types.ts +133 -0
- package/packages/sp/user-custom-actions/web.ts +21 -0
- package/packages/sp/utils/encode-path-str.ts +29 -0
- package/packages/sp/utils/extract-web-url.ts +21 -0
- package/packages/sp/utils/file-names.ts +35 -0
- package/packages/sp/utils/metadata.ts +5 -0
- package/packages/sp/utils/odata-url-from.ts +42 -0
- package/packages/sp/utils/to-resource-path.ts +9 -0
- package/packages/sp/views/index.ts +14 -0
- package/packages/sp/views/list.ts +33 -0
- package/packages/sp/views/types.ts +210 -0
- package/packages/sp/webparts/file.ts +21 -0
- package/packages/sp/webparts/index.ts +11 -0
- package/packages/sp/webparts/types.ts +141 -0
- package/packages/sp/webs/index.ts +32 -0
- package/packages/sp/webs/types.ts +350 -0
- package/packages/sp-admin/index.ts +46 -0
- package/packages/sp-admin/office-tenant.ts +567 -0
- package/packages/sp-admin/package.json +13 -0
- package/packages/sp-admin/site-properties.ts +45 -0
- package/packages/sp-admin/tenant.ts +595 -0
- package/packages/sp-admin/tsconfig.json +20 -0
- package/packages/sp-admin/types.ts +1679 -0
- package/packages/tsconfig-watch.json +9 -0
- package/packages/tsconfig.json +37 -0
- package/pre-install.cjs +1 -0
- package/samples/custom-bundle-webpack/index.ts +33 -0
- package/samples/custom-bundle-webpack/package-lock.json +4601 -0
- package/samples/custom-bundle-webpack/package.json +18 -0
- package/samples/custom-bundle-webpack/readme.md +102 -0
- package/samples/custom-bundle-webpack/tsconfig.json +12 -0
- package/samples/custom-bundle-webpack/webpack.config.js +27 -0
- package/samples/nodejs-app/.vscode/launch.json +27 -0
- package/samples/nodejs-app/.vscode/settings.json +10 -0
- package/samples/nodejs-app/.vscode/tasks.json +22 -0
- package/samples/nodejs-app/index.ts +63 -0
- package/samples/nodejs-app/package-lock.json +259 -0
- package/samples/nodejs-app/package.json +21 -0
- package/samples/nodejs-app/readme.md +140 -0
- package/samples/nodejs-app/tsconfig.json +14 -0
- package/samples/nodejs-commonjs/package-lock.json +702 -0
- package/samples/nodejs-commonjs/package.json +21 -0
- package/samples/nodejs-commonjs/readme.md +58 -0
- package/samples/nodejs-commonjs/src/index.ts +23 -0
- package/samples/nodejs-commonjs/src/settings.ts +35 -0
- package/samples/nodejs-commonjs/tsconfig.json +35 -0
- package/samples/project-preset/README.md +73 -0
- package/samples/project-preset/package-lock.json +21097 -0
- package/samples/project-preset/package.json +29 -0
- package/samples/project-preset/teams/4530a515-8ba7-45bb-9a27-be06b33c59d4_color.png +0 -0
- package/samples/project-preset/teams/4530a515-8ba7-45bb-9a27-be06b33c59d4_outline.png +0 -0
- package/samples/readme.md +16 -0
- package/settings.example.js +57 -0
- package/test/args.ts +107 -0
- package/test/clean-subsite.ts +36 -0
- package/test/core/assumptions.ts +99 -0
- package/test/core/storage.ts +60 -0
- package/test/core/timeline.ts +205 -0
- package/test/core/util.ts +205 -0
- package/test/graph/assets/testconvert.docx +0 -0
- package/test/graph/batch.ts +125 -0
- package/test/graph/calendars.ts +234 -0
- package/test/graph/columns.ts +247 -0
- package/test/graph/contacts.ts +254 -0
- package/test/graph/content-types.ts +206 -0
- package/test/graph/directoryobjects.ts +115 -0
- package/test/graph/groups.ts +130 -0
- package/test/graph/lists.ts +72 -0
- package/test/graph/onedrive.ts +365 -0
- package/test/graph/outlook.ts +95 -0
- package/test/graph/paging.ts +91 -0
- package/test/graph/planner.ts +160 -0
- package/test/graph/querable.ts +97 -0
- package/test/graph/search.ts +4 -0
- package/test/graph/shares.ts +26 -0
- package/test/graph/sites.ts +40 -0
- package/test/graph/teams.ts +76 -0
- package/test/graph/utilities/getTestingGraphSPSite.ts +27 -0
- package/test/graph/utilities/getValidUser.ts +37 -0
- package/test/load-settings.ts +103 -0
- package/test/logging/logging.ts +86 -0
- package/test/mocha-root-hooks.ts +227 -0
- package/test/nodejs/sp-extensions.ts +86 -0
- package/test/pnp-test.ts +60 -0
- package/test/queryable/add-prop.ts +24 -0
- package/test/queryable/behaviors.ts +188 -0
- package/test/queryable/invokable.ts +35 -0
- package/test/queryable/queryable.ts +118 -0
- package/test/sp/alias.ts +46 -0
- package/test/sp/appcatalog.ts +142 -0
- package/test/sp/assets/helloworld.sppkg +0 -0
- package/test/sp/assets/sample_file.jpg +0 -0
- package/test/sp/attachments.ts +134 -0
- package/test/sp/batch.ts +362 -0
- package/test/sp/clientside-pages.ts +426 -0
- package/test/sp/column-defaults.ts +225 -0
- package/test/sp/comments.ts +202 -0
- package/test/sp/content-types.ts +68 -0
- package/test/sp/favorites.ts +2 -0
- package/test/sp/features.ts +201 -0
- package/test/sp/fields.ts +396 -0
- package/test/sp/files.ts +338 -0
- package/test/sp/folders.ts +242 -0
- package/test/sp/forms.ts +22 -0
- package/test/sp/groupsitemanager.ts +88 -0
- package/test/sp/hubsites.ts +41 -0
- package/test/sp/items.ts +179 -0
- package/test/sp/lists.ts +319 -0
- package/test/sp/navigation.ts +167 -0
- package/test/sp/profiles.ts +2 -0
- package/test/sp/query-escaping.ts +94 -0
- package/test/sp/recycle-bin.ts +1 -0
- package/test/sp/regional-settings.ts +58 -0
- package/test/sp/related-items.ts +94 -0
- package/test/sp/search.ts +39 -0
- package/test/sp/security.ts +90 -0
- package/test/sp/sharing.ts +313 -0
- package/test/sp/site-designs.ts +224 -0
- package/test/sp/site-groups.ts +98 -0
- package/test/sp/site-scripts.ts +162 -0
- package/test/sp/site-users.ts +93 -0
- package/test/sp/sites.ts +156 -0
- package/test/sp/social.ts +2 -0
- package/test/sp/spfx.ts +52 -0
- package/test/sp/sputilities.ts +78 -0
- package/test/sp/subscriptions.ts +64 -0
- package/test/sp/taxonomy.ts +178 -0
- package/test/sp/user-custom-actions.ts +31 -0
- package/test/sp/views.ts +117 -0
- package/test/sp/webparts.ts +38 -0
- package/test/sp/webs.ts +249 -0
- package/test/test-invokable-props.ts +35 -0
- package/test/test-props.ts +90 -0
- package/test/test-recording.ts +171 -0
- package/test/tsconfig.json +18 -0
- package/tools/buildsystem/package-lock.json +4404 -0
- package/tools/buildsystem/package.json +56 -0
- package/tools/buildsystem/readme.md +23 -0
- package/tools/config.js +34 -0
- package/tools/local-module-resolver/cjs.ts +33 -0
- package/tools/local-module-resolver/esm-debug.ts +2 -0
- package/tools/local-module-resolver/esm-test.ts +2 -0
- package/tools/local-module-resolver/esm.ts +112 -0
- package/tools/local-module-resolver/readme.md +8 -0
- package/tsconfig.buildsystem.json +17 -0
- package/tsconfig.json +42 -0
@@ -0,0 +1,1661 @@
|
|
1
|
+
import { body, headers } from "@pnp/queryable";
|
2
|
+
import { getGUID, hOP, stringIsNullOrEmpty, objectDefinedNotNull, combine, isUrlAbsolute, isArray } from "@pnp/core";
|
3
|
+
import { IFile, IFileInfo } from "../files/types.js";
|
4
|
+
import { Item, IItem } from "../items/types.js";
|
5
|
+
import { _SPQueryable, SPQueryable, SPCollection, SPInit } from "../spqueryable.js";
|
6
|
+
import { List } from "../lists/types.js";
|
7
|
+
import { odataUrlFrom } from "../utils/odata-url-from.js";
|
8
|
+
import { Web, IWeb } from "../webs/types.js";
|
9
|
+
import { extractWebUrl } from "../utils/extract-web-url.js";
|
10
|
+
import { Site } from "../sites/types.js";
|
11
|
+
import { spPost } from "../operations.js";
|
12
|
+
import { getNextOrder, reindex } from "./funcs.js";
|
13
|
+
import "../files/web.js";
|
14
|
+
import "../comments/item.js";
|
15
|
+
import { createBatch } from "../batching.js";
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Page promotion state
|
19
|
+
*/
|
20
|
+
export const enum PromotedState {
|
21
|
+
/**
|
22
|
+
* Regular client side page
|
23
|
+
*/
|
24
|
+
NotPromoted = 0,
|
25
|
+
/**
|
26
|
+
* Page that will be promoted as news article after publishing
|
27
|
+
*/
|
28
|
+
PromoteOnPublish = 1,
|
29
|
+
/**
|
30
|
+
* Page that is promoted as news article
|
31
|
+
*/
|
32
|
+
Promoted = 2,
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Type describing the available page layout types for client side "modern" pages
|
37
|
+
*/
|
38
|
+
export type ClientsidePageLayoutType = "Article" | "Home" | "SingleWebPartAppPage" | "RepostPage";
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Column size factor. Max value is 12 (= one column), other options are 8,6,4 or 0
|
42
|
+
*/
|
43
|
+
export type CanvasColumnFactor = 0 | 2 | 4 | 6 | 8 | 12;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Represents the data and methods associated with client side "modern" pages
|
47
|
+
*/
|
48
|
+
export class _ClientsidePage extends _SPQueryable {
|
49
|
+
|
50
|
+
private _pageSettings: IClientsidePageSettingsSlice;
|
51
|
+
private _layoutPart: ILayoutPartsContent;
|
52
|
+
private _bannerImageDirty: boolean;
|
53
|
+
private _bannerImageThumbnailUrlDirty: boolean;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* PLEASE DON'T USE THIS CONSTRUCTOR DIRECTLY, thank you 🐇
|
57
|
+
*/
|
58
|
+
constructor(
|
59
|
+
base: SPInit,
|
60
|
+
path?: string,
|
61
|
+
protected json?: Partial<IPageData>,
|
62
|
+
noInit = false,
|
63
|
+
public sections: CanvasSection[] = [],
|
64
|
+
public commentsDisabled = false) {
|
65
|
+
|
66
|
+
super(base, path);
|
67
|
+
|
68
|
+
this._bannerImageDirty = false;
|
69
|
+
this._bannerImageThumbnailUrlDirty = false;
|
70
|
+
this.parentUrl = "";
|
71
|
+
|
72
|
+
// we need to rebase the url to always be the web url plus the path
|
73
|
+
// Queryable handles the correct parsing of the SPInit, and we pull
|
74
|
+
// the weburl and combine with the supplied path, which is unique
|
75
|
+
// to how ClientsitePages works. This class is a special case.
|
76
|
+
this._url = combine(extractWebUrl(this._url), path);
|
77
|
+
|
78
|
+
// set a default page settings slice
|
79
|
+
this._pageSettings = { controlType: 0, pageSettingsSlice: { isDefaultDescription: true, isDefaultThumbnail: true } };
|
80
|
+
|
81
|
+
// set a default layout part
|
82
|
+
this._layoutPart = _ClientsidePage.getDefaultLayoutPart();
|
83
|
+
|
84
|
+
if (typeof json !== "undefined" && !noInit) {
|
85
|
+
this.fromJSON(json);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
private static getDefaultLayoutPart(): ILayoutPartsContent {
|
90
|
+
return {
|
91
|
+
dataVersion: "1.4",
|
92
|
+
description: "Title Region Description",
|
93
|
+
id: "cbe7b0a9-3504-44dd-a3a3-0e5cacd07788",
|
94
|
+
instanceId: "cbe7b0a9-3504-44dd-a3a3-0e5cacd07788",
|
95
|
+
properties: {
|
96
|
+
authorByline: [],
|
97
|
+
authors: [],
|
98
|
+
layoutType: "FullWidthImage",
|
99
|
+
showPublishDate: false,
|
100
|
+
showTopicHeader: false,
|
101
|
+
textAlignment: "Left",
|
102
|
+
title: "",
|
103
|
+
topicHeader: "",
|
104
|
+
enableGradientEffect: true,
|
105
|
+
},
|
106
|
+
reservedHeight: 280,
|
107
|
+
serverProcessedContent: { htmlStrings: {}, searchablePlainTexts: {}, imageSources: {}, links: {} },
|
108
|
+
title: "Title area",
|
109
|
+
};
|
110
|
+
}
|
111
|
+
|
112
|
+
public get pageLayout(): ClientsidePageLayoutType {
|
113
|
+
return this.json.PageLayoutType;
|
114
|
+
}
|
115
|
+
|
116
|
+
public set pageLayout(value: ClientsidePageLayoutType) {
|
117
|
+
this.json.PageLayoutType = value;
|
118
|
+
}
|
119
|
+
|
120
|
+
public get bannerImageUrl(): string {
|
121
|
+
return this.json.BannerImageUrl;
|
122
|
+
}
|
123
|
+
|
124
|
+
public set bannerImageUrl(value: string) {
|
125
|
+
this.setBannerImage(value);
|
126
|
+
}
|
127
|
+
|
128
|
+
public get thumbnailUrl(): string {
|
129
|
+
return this._pageSettings.pageSettingsSlice.isDefaultThumbnail ? this.json.BannerImageUrl : this.json.BannerThumbnailUrl;
|
130
|
+
}
|
131
|
+
|
132
|
+
public set thumbnailUrl(value: string) {
|
133
|
+
this.json.BannerThumbnailUrl = value;
|
134
|
+
this._bannerImageThumbnailUrlDirty = true;
|
135
|
+
this._pageSettings.pageSettingsSlice.isDefaultThumbnail = false;
|
136
|
+
}
|
137
|
+
|
138
|
+
public get topicHeader(): string {
|
139
|
+
return objectDefinedNotNull(this.json.TopicHeader) ? this.json.TopicHeader : "";
|
140
|
+
}
|
141
|
+
|
142
|
+
public set topicHeader(value: string) {
|
143
|
+
this.json.TopicHeader = value;
|
144
|
+
this._layoutPart.properties.topicHeader = value;
|
145
|
+
if (stringIsNullOrEmpty(value)) {
|
146
|
+
this.showTopicHeader = false;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
public get title(): string {
|
151
|
+
return this.json.Title;
|
152
|
+
}
|
153
|
+
|
154
|
+
public set title(value: string) {
|
155
|
+
this.json.Title = value;
|
156
|
+
this._layoutPart.properties.title = value;
|
157
|
+
}
|
158
|
+
|
159
|
+
public get reservedHeight(): number {
|
160
|
+
return this._layoutPart.reservedHeight;
|
161
|
+
}
|
162
|
+
|
163
|
+
public set reservedHeight(value: number) {
|
164
|
+
this._layoutPart.reservedHeight = value;
|
165
|
+
}
|
166
|
+
|
167
|
+
public get description(): string {
|
168
|
+
return this.json.Description;
|
169
|
+
}
|
170
|
+
|
171
|
+
public set description(value: string) {
|
172
|
+
|
173
|
+
if (!stringIsNullOrEmpty(value) && value.length > 255) {
|
174
|
+
throw Error("Modern Page description is limited to 255 chars.");
|
175
|
+
}
|
176
|
+
|
177
|
+
this.json.Description = value;
|
178
|
+
if (!hOP(this._pageSettings, "htmlAttributes")) {
|
179
|
+
this._pageSettings.htmlAttributes = [];
|
180
|
+
}
|
181
|
+
if (this._pageSettings.htmlAttributes.indexOf("modifiedDescription") < 0) {
|
182
|
+
this._pageSettings.htmlAttributes.push("modifiedDescription");
|
183
|
+
}
|
184
|
+
this._pageSettings.pageSettingsSlice.isDefaultDescription = false;
|
185
|
+
}
|
186
|
+
|
187
|
+
public get layoutType(): LayoutType {
|
188
|
+
return this._layoutPart.properties.layoutType;
|
189
|
+
}
|
190
|
+
|
191
|
+
public set layoutType(value: LayoutType) {
|
192
|
+
this._layoutPart.properties.layoutType = value;
|
193
|
+
}
|
194
|
+
|
195
|
+
public get headerTextAlignment(): TextAlignment {
|
196
|
+
return this._layoutPart.properties.textAlignment;
|
197
|
+
}
|
198
|
+
|
199
|
+
public set headerTextAlignment(value: TextAlignment) {
|
200
|
+
this._layoutPart.properties.textAlignment = value;
|
201
|
+
}
|
202
|
+
|
203
|
+
public get showTopicHeader(): boolean {
|
204
|
+
return this._layoutPart.properties.showTopicHeader;
|
205
|
+
}
|
206
|
+
|
207
|
+
public set showTopicHeader(value: boolean) {
|
208
|
+
this._layoutPart.properties.showTopicHeader = value;
|
209
|
+
}
|
210
|
+
|
211
|
+
public get showPublishDate(): boolean {
|
212
|
+
return this._layoutPart.properties.showPublishDate;
|
213
|
+
}
|
214
|
+
|
215
|
+
public set showPublishDate(value: boolean) {
|
216
|
+
this._layoutPart.properties.showPublishDate = value;
|
217
|
+
}
|
218
|
+
|
219
|
+
public get hasVerticalSection(): boolean {
|
220
|
+
return this.sections.findIndex(s => s.layoutIndex === 2) > -1;
|
221
|
+
}
|
222
|
+
|
223
|
+
public get authorByLine(): string | null {
|
224
|
+
if (isArray(this._layoutPart.properties.authorByline) && this._layoutPart.properties.authorByline.length > 0) {
|
225
|
+
return this._layoutPart.properties.authorByline[0];
|
226
|
+
}
|
227
|
+
|
228
|
+
return null;
|
229
|
+
}
|
230
|
+
|
231
|
+
public get verticalSection(): CanvasSection | null {
|
232
|
+
if (this.hasVerticalSection) {
|
233
|
+
return this.addVerticalSection();
|
234
|
+
}
|
235
|
+
return null;
|
236
|
+
}
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Add a section to this page
|
240
|
+
*/
|
241
|
+
public addSection(): CanvasSection {
|
242
|
+
const section = new CanvasSection(this, getNextOrder(this.sections), 1);
|
243
|
+
this.sections.push(section);
|
244
|
+
return section;
|
245
|
+
}
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Add a section to this page
|
249
|
+
*/
|
250
|
+
public addVerticalSection(): CanvasSection {
|
251
|
+
|
252
|
+
// we can only have one vertical section so we find it if it exists
|
253
|
+
const sectionIndex = this.sections.findIndex(s => s.layoutIndex === 2);
|
254
|
+
if (sectionIndex > -1) {
|
255
|
+
return this.sections[sectionIndex];
|
256
|
+
}
|
257
|
+
|
258
|
+
const section = new CanvasSection(this, getNextOrder(this.sections), 2);
|
259
|
+
this.sections.push(section);
|
260
|
+
return section;
|
261
|
+
}
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Loads this instance from the appropriate JSON data
|
265
|
+
*
|
266
|
+
* @param pageData JSON data to load (replaces any existing data)
|
267
|
+
*/
|
268
|
+
public fromJSON(pageData: Partial<IPageData>): this {
|
269
|
+
|
270
|
+
this.json = pageData;
|
271
|
+
|
272
|
+
const canvasControls: IClientsideControlBaseData[] = JSON.parse(pageData.CanvasContent1);
|
273
|
+
|
274
|
+
const layouts = <ILayoutPartsContent[]>JSON.parse(pageData.LayoutWebpartsContent);
|
275
|
+
if (layouts && layouts.length > 0) {
|
276
|
+
this._layoutPart = layouts[0];
|
277
|
+
}
|
278
|
+
|
279
|
+
this.setControls(canvasControls);
|
280
|
+
|
281
|
+
return this;
|
282
|
+
}
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Loads this page's content from the server
|
286
|
+
*/
|
287
|
+
public async load(): Promise<IClientsidePage> {
|
288
|
+
|
289
|
+
const item = await this.getItem<{ Id: number; CommentsDisabled: boolean }>("Id", "CommentsDisabled");
|
290
|
+
const pageData = await SPQueryable(this, `_api/sitepages/pages(${item.Id})`)<IPageData>();
|
291
|
+
this.commentsDisabled = item.CommentsDisabled;
|
292
|
+
return this.fromJSON(pageData);
|
293
|
+
}
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Persists the content changes (sections, columns, and controls) [does not work with batching]
|
297
|
+
*
|
298
|
+
* @param publish If true the page is published, if false the changes are persisted to SharePoint but not published [Default: true]
|
299
|
+
*/
|
300
|
+
public async save(publish = true): Promise<boolean> {
|
301
|
+
|
302
|
+
if (this.json.Id === null) {
|
303
|
+
throw Error("The id for this page is null. If you want to create a new page, please use ClientSidePage.Create");
|
304
|
+
}
|
305
|
+
|
306
|
+
const previewPartialUrl = "_layouts/15/getpreview.ashx";
|
307
|
+
|
308
|
+
// If new banner image, and banner image url is not in getpreview.ashx format
|
309
|
+
if (this._bannerImageDirty && !this.bannerImageUrl.includes(previewPartialUrl)) {
|
310
|
+
|
311
|
+
const serverRelativePath = this.bannerImageUrl;
|
312
|
+
|
313
|
+
let imgInfo: Pick<IFileInfo, "ListId" | "WebId" | "UniqueId" | "Name" | "SiteId">;
|
314
|
+
let webUrl: string;
|
315
|
+
|
316
|
+
const web = Web(this);
|
317
|
+
|
318
|
+
const [batch, execute] = createBatch(web);
|
319
|
+
web.using(batch);
|
320
|
+
|
321
|
+
web.getFileByServerRelativePath(serverRelativePath.replace(/%20/ig, " "))
|
322
|
+
.select("ListId", "WebId", "UniqueId", "Name", "SiteId")().then(r1 => imgInfo = r1);
|
323
|
+
web.select("Url")().then(r2 => webUrl = r2.Url);
|
324
|
+
|
325
|
+
// we know the .then calls above will run before execute resolves, ensuring the vars are set
|
326
|
+
await execute();
|
327
|
+
|
328
|
+
const f = SPQueryable(webUrl, previewPartialUrl);
|
329
|
+
f.query.set("guidSite", `${imgInfo.SiteId}`);
|
330
|
+
f.query.set("guidWeb", `${imgInfo.WebId}`);
|
331
|
+
f.query.set("guidFile", `${imgInfo.UniqueId}`);
|
332
|
+
this.bannerImageUrl = f.toRequestUrl();
|
333
|
+
|
334
|
+
if (!objectDefinedNotNull(this._layoutPart.serverProcessedContent)) {
|
335
|
+
this._layoutPart.serverProcessedContent = <any>{};
|
336
|
+
}
|
337
|
+
|
338
|
+
this._layoutPart.serverProcessedContent.imageSources = { imageSource: serverRelativePath };
|
339
|
+
|
340
|
+
if (!objectDefinedNotNull(this._layoutPart.serverProcessedContent.customMetadata)) {
|
341
|
+
this._layoutPart.serverProcessedContent.customMetadata = <any>{};
|
342
|
+
}
|
343
|
+
|
344
|
+
this._layoutPart.serverProcessedContent.customMetadata.imageSource = {
|
345
|
+
listId: imgInfo.ListId,
|
346
|
+
siteId: imgInfo.SiteId,
|
347
|
+
uniqueId: imgInfo.UniqueId,
|
348
|
+
webId: imgInfo.WebId,
|
349
|
+
};
|
350
|
+
this._layoutPart.properties.webId = imgInfo.WebId;
|
351
|
+
this._layoutPart.properties.siteId = imgInfo.SiteId;
|
352
|
+
this._layoutPart.properties.listId = imgInfo.ListId;
|
353
|
+
this._layoutPart.properties.uniqueId = imgInfo.UniqueId;
|
354
|
+
}
|
355
|
+
|
356
|
+
// we try and check out the page for the user
|
357
|
+
if (!this.json.IsPageCheckedOutToCurrentUser) {
|
358
|
+
await spPost(ClientsidePage(this, `_api/sitepages/pages(${this.json.Id})/checkoutpage`));
|
359
|
+
}
|
360
|
+
|
361
|
+
// create the body for the save request
|
362
|
+
let saveBody = {
|
363
|
+
AuthorByline: this.json.AuthorByline || [],
|
364
|
+
CanvasContent1: this.getCanvasContent1(),
|
365
|
+
Description: this.description,
|
366
|
+
LayoutWebpartsContent: this.getLayoutWebpartsContent(),
|
367
|
+
Title: this.title,
|
368
|
+
TopicHeader: this.topicHeader,
|
369
|
+
BannerImageUrl: this.bannerImageUrl,
|
370
|
+
};
|
371
|
+
|
372
|
+
if (this._bannerImageDirty || this._bannerImageThumbnailUrlDirty) {
|
373
|
+
|
374
|
+
const bannerImageUrlValue = this._bannerImageThumbnailUrlDirty ? this.thumbnailUrl : this.bannerImageUrl;
|
375
|
+
|
376
|
+
saveBody = <any>{
|
377
|
+
BannerImageUrl: bannerImageUrlValue,
|
378
|
+
...saveBody,
|
379
|
+
};
|
380
|
+
}
|
381
|
+
|
382
|
+
const updater = ClientsidePage(this, `_api/sitepages/pages(${this.json.Id})/savepage`);
|
383
|
+
await spPost<boolean>(updater, headers({ "if-match": "*" }, body(saveBody)));
|
384
|
+
|
385
|
+
let r = true;
|
386
|
+
|
387
|
+
if (publish) {
|
388
|
+
r = await spPost(ClientsidePage(this, `_api/sitepages/pages(${this.json.Id})/publish`));
|
389
|
+
if (r) {
|
390
|
+
this.json.IsPageCheckedOutToCurrentUser = false;
|
391
|
+
}
|
392
|
+
}
|
393
|
+
|
394
|
+
this._bannerImageDirty = false;
|
395
|
+
this._bannerImageThumbnailUrlDirty = false;
|
396
|
+
|
397
|
+
// we need to ensure we reload from the latest data to ensure all urls are updated and current in the object (expecially for new pages)
|
398
|
+
await this.load();
|
399
|
+
|
400
|
+
return r;
|
401
|
+
}
|
402
|
+
|
403
|
+
/**
|
404
|
+
* Discards the checkout of this page
|
405
|
+
*/
|
406
|
+
public async discardPageCheckout(): Promise<void> {
|
407
|
+
|
408
|
+
if (this.json.Id === null) {
|
409
|
+
throw Error("The id for this page is null. If you want to create a new page, please use ClientSidePage.Create");
|
410
|
+
}
|
411
|
+
|
412
|
+
const d = await spPost(ClientsidePage(this, `_api/sitepages/pages(${this.json.Id})/discardPage`));
|
413
|
+
|
414
|
+
this.fromJSON(d);
|
415
|
+
}
|
416
|
+
|
417
|
+
/**
|
418
|
+
* Promotes this page as a news item
|
419
|
+
*/
|
420
|
+
public async promoteToNews(): Promise<boolean> {
|
421
|
+
return this.promoteNewsImpl("promoteToNews");
|
422
|
+
}
|
423
|
+
|
424
|
+
// API is currently broken on server side
|
425
|
+
// public async demoteFromNews(): Promise<boolean> {
|
426
|
+
// return this.promoteNewsImpl("demoteFromNews");
|
427
|
+
// }
|
428
|
+
|
429
|
+
/**
|
430
|
+
* Finds a control by the specified instance id
|
431
|
+
*
|
432
|
+
* @param id Instance id of the control to find
|
433
|
+
*/
|
434
|
+
public findControlById<T extends ColumnControl<any> = ColumnControl<any>>(id: string): T {
|
435
|
+
return this.findControl((c) => c.id === id);
|
436
|
+
}
|
437
|
+
|
438
|
+
/**
|
439
|
+
* Finds a control within this page's control tree using the supplied predicate
|
440
|
+
*
|
441
|
+
* @param predicate Takes a control and returns true or false, if true that control is returned by findControl
|
442
|
+
*/
|
443
|
+
public findControl<T extends ColumnControl<any> = ColumnControl<any>>(predicate: (c: ColumnControl<any>) => boolean): T {
|
444
|
+
// check all sections
|
445
|
+
for (let i = 0; i < this.sections.length; i++) {
|
446
|
+
// check all columns
|
447
|
+
for (let j = 0; j < this.sections[i].columns.length; j++) {
|
448
|
+
// check all controls
|
449
|
+
for (let k = 0; k < this.sections[i].columns[j].controls.length; k++) {
|
450
|
+
// check to see if the predicate likes this control
|
451
|
+
if (predicate(this.sections[i].columns[j].controls[k])) {
|
452
|
+
return <T>this.sections[i].columns[j].controls[k];
|
453
|
+
}
|
454
|
+
}
|
455
|
+
}
|
456
|
+
}
|
457
|
+
|
458
|
+
// we found nothing so give nothing back
|
459
|
+
return null;
|
460
|
+
}
|
461
|
+
|
462
|
+
/**
|
463
|
+
* Creates a new page with all of the content copied from this page
|
464
|
+
*
|
465
|
+
* @param web The web where we will create the copy
|
466
|
+
* @param pageName The file name of the new page
|
467
|
+
* @param title The title of the new page
|
468
|
+
* @param publish If true the page will be published (Default: true)
|
469
|
+
*/
|
470
|
+
public async copy(web: IWeb, pageName: string, title: string, publish = true, promotedState?: PromotedState): Promise<IClientsidePage> {
|
471
|
+
|
472
|
+
const page = await CreateClientsidePage(web, pageName, title, this.pageLayout, promotedState);
|
473
|
+
return this.copyTo(page, publish);
|
474
|
+
}
|
475
|
+
|
476
|
+
/**
|
477
|
+
* Copies the content from this page to the supplied page instance NOTE: fully overwriting any previous content!!
|
478
|
+
*
|
479
|
+
* @param page Page whose content we replace with this page's content
|
480
|
+
* @param publish If true the page will be published after the copy, if false it will be saved but left unpublished (Default: true)
|
481
|
+
*/
|
482
|
+
public async copyTo(page: IClientsidePage, publish = true): Promise<IClientsidePage> {
|
483
|
+
|
484
|
+
// we know the method is on the class - but it is protected so not part of the interface
|
485
|
+
(<any>page).setControls(this.getControls());
|
486
|
+
|
487
|
+
// copy page properties
|
488
|
+
if (this._layoutPart.properties) {
|
489
|
+
|
490
|
+
if (hOP(this._layoutPart.properties, "topicHeader")) {
|
491
|
+
page.topicHeader = this._layoutPart.properties.topicHeader;
|
492
|
+
}
|
493
|
+
|
494
|
+
if (hOP(this._layoutPart.properties, "imageSourceType")) {
|
495
|
+
page._layoutPart.properties.imageSourceType = this._layoutPart.properties.imageSourceType;
|
496
|
+
}
|
497
|
+
|
498
|
+
if (hOP(this._layoutPart.properties, "layoutType")) {
|
499
|
+
page._layoutPart.properties.layoutType = this._layoutPart.properties.layoutType;
|
500
|
+
}
|
501
|
+
|
502
|
+
if (hOP(this._layoutPart.properties, "textAlignment")) {
|
503
|
+
page._layoutPart.properties.textAlignment = this._layoutPart.properties.textAlignment;
|
504
|
+
}
|
505
|
+
|
506
|
+
if (hOP(this._layoutPart.properties, "showTopicHeader")) {
|
507
|
+
page._layoutPart.properties.showTopicHeader = this._layoutPart.properties.showTopicHeader;
|
508
|
+
}
|
509
|
+
|
510
|
+
if (hOP(this._layoutPart.properties, "showPublishDate")) {
|
511
|
+
page._layoutPart.properties.showPublishDate = this._layoutPart.properties.showPublishDate;
|
512
|
+
}
|
513
|
+
|
514
|
+
if (hOP(this._layoutPart.properties, "enableGradientEffect")) {
|
515
|
+
page._layoutPart.properties.enableGradientEffect = this._layoutPart.properties.enableGradientEffect;
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
// we need to do some work to set the banner image url in the copied page
|
520
|
+
if (!stringIsNullOrEmpty(this.json.BannerImageUrl)) {
|
521
|
+
|
522
|
+
// use a URL to parse things for us
|
523
|
+
const url = new URL(this.json.BannerImageUrl);
|
524
|
+
|
525
|
+
// helper function to translate the guid strings into properly formatted guids with dashes
|
526
|
+
const makeGuid = (s: string) => s.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/g, "$1-$2-$3-$4-$5");
|
527
|
+
|
528
|
+
// protect against errors because the serverside impl has changed, we'll just skip
|
529
|
+
if (url.searchParams.has("guidSite") && url.searchParams.has("guidWeb") && url.searchParams.has("guidFile")) {
|
530
|
+
|
531
|
+
const guidSite = makeGuid(url.searchParams.get("guidSite"));
|
532
|
+
const guidWeb = makeGuid(url.searchParams.get("guidWeb"));
|
533
|
+
const guidFile = makeGuid(url.searchParams.get("guidFile"));
|
534
|
+
|
535
|
+
const site = Site(this);
|
536
|
+
const id = await site.select("Id")<{ Id: string }>();
|
537
|
+
// the site guid must match the current site's guid or we are unable to set the image
|
538
|
+
if (id.Id === guidSite) {
|
539
|
+
|
540
|
+
const openWeb = await site.openWebById(guidWeb);
|
541
|
+
const file = await openWeb.web.getFileById(guidFile).select("ServerRelativeUrl")();
|
542
|
+
|
543
|
+
const props: any = {};
|
544
|
+
if (this._layoutPart.properties) {
|
545
|
+
|
546
|
+
if (hOP(this._layoutPart.properties, "translateX")) {
|
547
|
+
props.translateX = this._layoutPart.properties.translateX;
|
548
|
+
}
|
549
|
+
|
550
|
+
|
551
|
+
if (hOP(this._layoutPart.properties, "translateY")) {
|
552
|
+
props.translateY = this._layoutPart.properties.translateY;
|
553
|
+
}
|
554
|
+
|
555
|
+
|
556
|
+
if (hOP(this._layoutPart.properties, "imageSourceType")) {
|
557
|
+
props.imageSourceType = this._layoutPart.properties.imageSourceType;
|
558
|
+
}
|
559
|
+
|
560
|
+
|
561
|
+
if (hOP(this._layoutPart.properties, "altText")) {
|
562
|
+
props.altText = this._layoutPart.properties.altText;
|
563
|
+
}
|
564
|
+
}
|
565
|
+
|
566
|
+
page.setBannerImage(file.ServerRelativeUrl, props);
|
567
|
+
}
|
568
|
+
}
|
569
|
+
}
|
570
|
+
|
571
|
+
await page.save(publish);
|
572
|
+
|
573
|
+
return page;
|
574
|
+
}
|
575
|
+
|
576
|
+
/**
|
577
|
+
* Sets the modern page banner image
|
578
|
+
*
|
579
|
+
* @param url Url of the image to display
|
580
|
+
* @param altText Alt text to describe the image
|
581
|
+
* @param bannerProps Additional properties to control display of the banner
|
582
|
+
*/
|
583
|
+
public setBannerImage(url: string, props?: IBannerImageProps): void {
|
584
|
+
|
585
|
+
if (isUrlAbsolute(url)) {
|
586
|
+
// do our best to make this a server relative url by removing the x.sharepoint.com part
|
587
|
+
url = url.replace(/^https?:\/\/[a-z0-9.]*?\.[a-z]{2,3}\//i, "/");
|
588
|
+
}
|
589
|
+
|
590
|
+
this.json.BannerImageUrl = url;
|
591
|
+
// update serverProcessedContent (page behavior change 2021-Oct-13)
|
592
|
+
this._layoutPart.serverProcessedContent = { imageSources: { imageSource: url } };
|
593
|
+
this._bannerImageDirty = true;
|
594
|
+
/*
|
595
|
+
setting the banner image resets the thumbnail image (matching UI functionality)
|
596
|
+
but if the thumbnail is dirty they are likely trying to set them both to
|
597
|
+
different values, so we allow that here.
|
598
|
+
Also allows the banner image to be updated safely with the calculated one in save()
|
599
|
+
*/
|
600
|
+
if (!this._bannerImageThumbnailUrlDirty) {
|
601
|
+
this.thumbnailUrl = url;
|
602
|
+
this._pageSettings.pageSettingsSlice.isDefaultThumbnail = true;
|
603
|
+
}
|
604
|
+
|
605
|
+
// this seems to always be true, so default
|
606
|
+
this._layoutPart.properties.imageSourceType = 2;
|
607
|
+
|
608
|
+
if (objectDefinedNotNull(props)) {
|
609
|
+
if (hOP(props, "translateX")) {
|
610
|
+
this._layoutPart.properties.translateX = props.translateX;
|
611
|
+
}
|
612
|
+
if (hOP(props, "translateY")) {
|
613
|
+
this._layoutPart.properties.translateY = props.translateY;
|
614
|
+
}
|
615
|
+
if (hOP(props, "imageSourceType")) {
|
616
|
+
this._layoutPart.properties.imageSourceType = props.imageSourceType;
|
617
|
+
}
|
618
|
+
if (hOP(props, "altText")) {
|
619
|
+
this._layoutPart.properties.altText = props.altText;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
}
|
623
|
+
|
624
|
+
/**
|
625
|
+
* Sets the banner image url from an external source. You must call save to persist the changes
|
626
|
+
*
|
627
|
+
* @param url absolute url of the external file
|
628
|
+
* @param props optional set of properties to control display of the banner image
|
629
|
+
*/
|
630
|
+
public async setBannerImageFromExternalUrl(url: string, props?: IBannerImageProps): Promise<void> {
|
631
|
+
|
632
|
+
// validate and parse our input url
|
633
|
+
const fileUrl = new URL(url);
|
634
|
+
|
635
|
+
// get our page name without extension, used as a folder name when creating the file
|
636
|
+
const pageName = this.json.FileName.replace(/\.[^/.]+$/, "");
|
637
|
+
|
638
|
+
// get the filename we will use
|
639
|
+
const filename = fileUrl.pathname.split(/[\\/]/i).pop();
|
640
|
+
|
641
|
+
const request = ClientsidePage(this, "_api/sitepages/AddImageFromExternalUrl");
|
642
|
+
request.query.set("imageFileName", `'${filename}'`);
|
643
|
+
request.query.set("pageName", `'${pageName}'`);
|
644
|
+
request.query.set("externalUrl", `'${url}'`);
|
645
|
+
request.select("ServerRelativeUrl");
|
646
|
+
|
647
|
+
const result = await spPost<Pick<IFileInfo, "ServerRelativeUrl">>(request);
|
648
|
+
// set with the newly created relative url
|
649
|
+
this.setBannerImage(result.ServerRelativeUrl, props);
|
650
|
+
}
|
651
|
+
|
652
|
+
/**
|
653
|
+
* Sets the authors for this page from the supplied list of user integer ids
|
654
|
+
*
|
655
|
+
* @param authorId The integer id of the user to set as the author
|
656
|
+
*/
|
657
|
+
public async setAuthorById(authorId: number): Promise<void> {
|
658
|
+
|
659
|
+
const userLoginData = await SPCollection([this, extractWebUrl(this.toUrl())], "/_api/web/siteusers")
|
660
|
+
.filter(`Id eq ${authorId}`)
|
661
|
+
.select("LoginName")<{ LoginName: string }[]>();
|
662
|
+
|
663
|
+
if (userLoginData.length < 1) {
|
664
|
+
throw Error(`Could not find user with id ${authorId}.`);
|
665
|
+
}
|
666
|
+
|
667
|
+
return this.setAuthorByLoginName(userLoginData[0].LoginName);
|
668
|
+
}
|
669
|
+
|
670
|
+
/**
|
671
|
+
* Sets the authors for this page from the supplied list of user integer ids
|
672
|
+
*
|
673
|
+
* @param authorLoginName The login name of the user (ex: i:0#.f|membership|name@tenant.com)
|
674
|
+
*/
|
675
|
+
public async setAuthorByLoginName(authorLoginName: string): Promise<void> {
|
676
|
+
|
677
|
+
const userLoginData = await SPCollection([this, extractWebUrl(this.toUrl())], "/_api/web/siteusers")
|
678
|
+
.filter(`LoginName eq '${authorLoginName}'`)
|
679
|
+
.select("UserPrincipalName", "Title")<{ UserPrincipalName: string; Title: string }[]>();
|
680
|
+
|
681
|
+
if (userLoginData.length < 1) {
|
682
|
+
throw Error(`Could not find user with login name '${authorLoginName}'.`);
|
683
|
+
}
|
684
|
+
|
685
|
+
this.json.AuthorByline = [userLoginData[0].UserPrincipalName];
|
686
|
+
this._layoutPart.properties.authorByline = [userLoginData[0].UserPrincipalName];
|
687
|
+
this._layoutPart.properties.authors = [{
|
688
|
+
id: authorLoginName,
|
689
|
+
name: userLoginData[0].Title,
|
690
|
+
role: "",
|
691
|
+
upn: userLoginData[0].UserPrincipalName,
|
692
|
+
}];
|
693
|
+
}
|
694
|
+
|
695
|
+
/**
|
696
|
+
* Gets the list item associated with this clientside page
|
697
|
+
*
|
698
|
+
* @param selects Specific set of fields to include when getting the item
|
699
|
+
*/
|
700
|
+
public async getItem<T>(...selects: string[]): Promise<IItem & T> {
|
701
|
+
const initer = ClientsidePage(this, "/_api/lists/EnsureClientRenderedSitePagesLibrary").select("EnableModeration", "EnableMinorVersions", "Id");
|
702
|
+
const listData = await spPost<{ Id: string; "odata.id": string }>(initer);
|
703
|
+
const item = List([this, listData["odata.id"]]).items.getById(this.json.Id);
|
704
|
+
const itemData: T = await item.select(...selects)();
|
705
|
+
return Object.assign(Item([this, odataUrlFrom(itemData)]), itemData);
|
706
|
+
}
|
707
|
+
|
708
|
+
/**
|
709
|
+
* Recycle this page
|
710
|
+
*/
|
711
|
+
public async recycle(): Promise<void> {
|
712
|
+
const item = await this.getItem();
|
713
|
+
await item.recycle();
|
714
|
+
}
|
715
|
+
|
716
|
+
/**
|
717
|
+
* Delete this page
|
718
|
+
*/
|
719
|
+
public async delete(): Promise<void> {
|
720
|
+
const item = await this.getItem();
|
721
|
+
await item.delete();
|
722
|
+
}
|
723
|
+
|
724
|
+
/**
|
725
|
+
* Schedules a page for publishing
|
726
|
+
*
|
727
|
+
* @param publishDate Date to publish the item
|
728
|
+
* @returns Version which was scheduled to be published
|
729
|
+
*/
|
730
|
+
public async schedulePublish(publishDate: Date): Promise<string> {
|
731
|
+
return spPost(ClientsidePage(this, `_api/sitepages/pages(${this.json.Id})/SchedulePublish`), body({
|
732
|
+
sitePage: { PublishStartDate: publishDate },
|
733
|
+
}));
|
734
|
+
}
|
735
|
+
|
736
|
+
/**
|
737
|
+
* Saves a copy of this page as a template in this library's Templates folder
|
738
|
+
*
|
739
|
+
* @param publish If true the template is published, false the template is not published (default: true)
|
740
|
+
* @returns IClientsidePage instance representing the new template page
|
741
|
+
*/
|
742
|
+
public async saveAsTemplate(publish = true): Promise<IClientsidePage> {
|
743
|
+
const data = await spPost(ClientsidePage(this, `_api/sitepages/pages(${this.json.Id})/SavePageAsTemplate`));
|
744
|
+
const page = ClientsidePage(this, null, data);
|
745
|
+
page.title = this.title;
|
746
|
+
await page.save(publish);
|
747
|
+
return page;
|
748
|
+
}
|
749
|
+
|
750
|
+
/**
|
751
|
+
* Share this Page's Preview content by Email
|
752
|
+
*
|
753
|
+
* @param emails Set of emails to which the preview is shared
|
754
|
+
* @param message The message to include
|
755
|
+
* @returns void
|
756
|
+
*/
|
757
|
+
public share(emails: string[], message: string): Promise<void> {
|
758
|
+
return spPost(ClientsidePage(this, "_api/SP.Publishing.RichSharing/SharePageByEmail"), body({
|
759
|
+
recipientEmails: emails,
|
760
|
+
message,
|
761
|
+
url: this.json.AbsoluteUrl,
|
762
|
+
}));
|
763
|
+
}
|
764
|
+
|
765
|
+
protected getCanvasContent1(): string {
|
766
|
+
return JSON.stringify(this.getControls());
|
767
|
+
}
|
768
|
+
|
769
|
+
protected getLayoutWebpartsContent(): string {
|
770
|
+
if (this._layoutPart) {
|
771
|
+
return JSON.stringify([this._layoutPart]);
|
772
|
+
} else {
|
773
|
+
return JSON.stringify(null);
|
774
|
+
}
|
775
|
+
}
|
776
|
+
|
777
|
+
protected setControls(controls: IClientsideControlBaseData[]): void {
|
778
|
+
|
779
|
+
// reset the sections
|
780
|
+
this.sections = [];
|
781
|
+
|
782
|
+
if (controls && controls.length) {
|
783
|
+
|
784
|
+
for (let i = 0; i < controls.length; i++) {
|
785
|
+
|
786
|
+
// if no control type is present this is a column which we give type 0 to let us process it
|
787
|
+
const controlType = hOP(controls[i], "controlType") ? controls[i].controlType : 0;
|
788
|
+
|
789
|
+
switch (controlType) {
|
790
|
+
|
791
|
+
case 0:
|
792
|
+
// empty canvas column or page settings
|
793
|
+
if (hOP(controls[i], "pageSettingsSlice")) {
|
794
|
+
this._pageSettings = <IClientsidePageSettingsSlice>controls[i];
|
795
|
+
} else {
|
796
|
+
// we have an empty column
|
797
|
+
this.mergeColumnToTree(new CanvasColumn(<IClientsidePageColumnData>controls[i]));
|
798
|
+
}
|
799
|
+
break;
|
800
|
+
case 3: {
|
801
|
+
const part = new ClientsideWebpart(<IClientsideWebPartData>controls[i]);
|
802
|
+
this.mergePartToTree(part, part.data.position);
|
803
|
+
break;
|
804
|
+
}
|
805
|
+
case 4: {
|
806
|
+
const textData = <IClientsideTextData>controls[i];
|
807
|
+
const text = new ClientsideText(textData.innerHTML, textData);
|
808
|
+
this.mergePartToTree(text, text.data.position);
|
809
|
+
break;
|
810
|
+
}
|
811
|
+
}
|
812
|
+
}
|
813
|
+
|
814
|
+
reindex(this.sections);
|
815
|
+
}
|
816
|
+
}
|
817
|
+
|
818
|
+
protected getControls(): IClientsideControlBaseData[] {
|
819
|
+
|
820
|
+
// reindex things
|
821
|
+
reindex(this.sections);
|
822
|
+
|
823
|
+
// rollup the control changes
|
824
|
+
const canvasData: any[] = [];
|
825
|
+
|
826
|
+
this.sections.forEach(section => {
|
827
|
+
section.columns.forEach(column => {
|
828
|
+
if (column.controls.length < 1) {
|
829
|
+
// empty column
|
830
|
+
canvasData.push({
|
831
|
+
displayMode: column.data.displayMode,
|
832
|
+
emphasis: this.getEmphasisObj(section.emphasis),
|
833
|
+
position: column.data.position,
|
834
|
+
});
|
835
|
+
} else {
|
836
|
+
column.controls.forEach(control => {
|
837
|
+
control.data.emphasis = this.getEmphasisObj(section.emphasis);
|
838
|
+
canvasData.push(this.specialSaveHandling(control).data);
|
839
|
+
});
|
840
|
+
}
|
841
|
+
});
|
842
|
+
});
|
843
|
+
|
844
|
+
canvasData.push(this._pageSettings);
|
845
|
+
|
846
|
+
return canvasData;
|
847
|
+
}
|
848
|
+
|
849
|
+
private getEmphasisObj(value: 0 | 1 | 2 | 3): IClientControlEmphasis {
|
850
|
+
if (value < 1 || value > 3) {
|
851
|
+
return {};
|
852
|
+
}
|
853
|
+
|
854
|
+
return { zoneEmphasis: value };
|
855
|
+
}
|
856
|
+
|
857
|
+
private async promoteNewsImpl(method: string): Promise<boolean> {
|
858
|
+
|
859
|
+
if (this.json.Id === null) {
|
860
|
+
throw Error("The id for this page is null.");
|
861
|
+
}
|
862
|
+
|
863
|
+
// per bug #858 if we promote before we have ever published the last published date will
|
864
|
+
// forever not be updated correctly in the modern news web part. Because this will affect very
|
865
|
+
// few folks we just go ahead and publish for them here as that is likely what they intended.
|
866
|
+
if (stringIsNullOrEmpty(this.json.VersionInfo.LastVersionCreatedBy)) {
|
867
|
+
const lastPubData = new Date(this.json.VersionInfo.LastVersionCreated);
|
868
|
+
// no modern page should reasonable be published before the year 2000 :)
|
869
|
+
if (lastPubData.getFullYear() < 2000) {
|
870
|
+
await this.save(true);
|
871
|
+
}
|
872
|
+
}
|
873
|
+
|
874
|
+
return spPost(ClientsidePage(this, `_api/sitepages/pages(${this.json.Id})/${method}`));
|
875
|
+
}
|
876
|
+
|
877
|
+
/**
|
878
|
+
* Merges the control into the tree of sections and columns for this page
|
879
|
+
*
|
880
|
+
* @param control The control to merge
|
881
|
+
*/
|
882
|
+
private mergePartToTree(control: any, positionData: IPosition): void {
|
883
|
+
|
884
|
+
let column: CanvasColumn = null;
|
885
|
+
let sectionFactor: CanvasColumnFactor = 12;
|
886
|
+
let sectionIndex = 0;
|
887
|
+
let zoneIndex = 0;
|
888
|
+
let layoutIndex = 1;
|
889
|
+
|
890
|
+
// handle case where we don't have position data (shouldn't happen?)
|
891
|
+
if (positionData) {
|
892
|
+
if (hOP(positionData, "zoneIndex")) {
|
893
|
+
zoneIndex = positionData.zoneIndex;
|
894
|
+
}
|
895
|
+
if (hOP(positionData, "sectionIndex")) {
|
896
|
+
sectionIndex = positionData.sectionIndex;
|
897
|
+
}
|
898
|
+
if (hOP(positionData, "sectionFactor")) {
|
899
|
+
sectionFactor = positionData.sectionFactor;
|
900
|
+
}
|
901
|
+
if (hOP(positionData, "layoutIndex")) {
|
902
|
+
layoutIndex = positionData.layoutIndex;
|
903
|
+
}
|
904
|
+
}
|
905
|
+
|
906
|
+
const zoneEmphasis = control.data?.emphasis?.zoneEmphasis ?? 0;
|
907
|
+
const section = this.getOrCreateSection(zoneIndex, layoutIndex, zoneEmphasis);
|
908
|
+
|
909
|
+
const columns = section.columns.filter(c => c.order === sectionIndex);
|
910
|
+
if (columns.length < 1) {
|
911
|
+
column = section.addColumn(sectionFactor, layoutIndex);
|
912
|
+
} else {
|
913
|
+
column = columns[0];
|
914
|
+
}
|
915
|
+
|
916
|
+
control.column = column;
|
917
|
+
column.addControl(control);
|
918
|
+
}
|
919
|
+
|
920
|
+
/**
|
921
|
+
* Merges the supplied column into the tree
|
922
|
+
*
|
923
|
+
* @param column Column to merge
|
924
|
+
* @param position The position data for the column
|
925
|
+
*/
|
926
|
+
private mergeColumnToTree(column: CanvasColumn): void {
|
927
|
+
|
928
|
+
const order = hOP(column.data, "position") && hOP(column.data.position, "zoneIndex") ? column.data.position.zoneIndex : 0;
|
929
|
+
const layoutIndex = hOP(column.data, "position") && hOP(column.data.position, "layoutIndex") ? column.data.position.layoutIndex : 1;
|
930
|
+
const section = this.getOrCreateSection(order, layoutIndex, column.data?.emphasis?.zoneEmphasis || 0);
|
931
|
+
column.section = section;
|
932
|
+
section.columns.push(column);
|
933
|
+
}
|
934
|
+
|
935
|
+
/**
|
936
|
+
* Handle the logic to get or create a section based on the supplied order and layoutIndex
|
937
|
+
*
|
938
|
+
* @param order Section order
|
939
|
+
* @param layoutIndex Layout Index (1 === normal, 2 === vertical section)
|
940
|
+
* @param emphasis The section emphasis
|
941
|
+
*/
|
942
|
+
private getOrCreateSection(order: number, layoutIndex: number, emphasis: 0 | 1 | 2 | 3): CanvasSection {
|
943
|
+
|
944
|
+
let section: CanvasSection = null;
|
945
|
+
const sections = this.sections.filter(s => s.order === order && s.layoutIndex === layoutIndex);
|
946
|
+
|
947
|
+
if (sections.length < 1) {
|
948
|
+
section = layoutIndex === 2 ? this.addVerticalSection() : this.addSection();
|
949
|
+
section.order = order;
|
950
|
+
section.emphasis = emphasis;
|
951
|
+
} else {
|
952
|
+
section = sections[0];
|
953
|
+
}
|
954
|
+
|
955
|
+
return section;
|
956
|
+
}
|
957
|
+
|
958
|
+
/**
|
959
|
+
* Based on issue #1690 we need to take special case actions to ensure some things
|
960
|
+
* can be saved properly without breaking existing pages.
|
961
|
+
*
|
962
|
+
* @param control The control we are ensuring is "ready" to be saved
|
963
|
+
*/
|
964
|
+
private specialSaveHandling(control: ColumnControl<any>): ColumnControl<any> {
|
965
|
+
|
966
|
+
// this is to handle the special case in issue #1690
|
967
|
+
// must ensure that searchablePlainTexts values have < replaced with < in links web part
|
968
|
+
// For #2561 need to process for code snippet webpart and any control && (<any>control).data.webPartId === "c70391ea-0b10-4ee9-b2b4-006d3fcad0cd"
|
969
|
+
if ((<any>control).data.controlType === 3) {
|
970
|
+
const texts = (<any>control).data?.webPartData?.serverProcessedContent?.searchablePlainTexts || null;
|
971
|
+
if (objectDefinedNotNull(texts)) {
|
972
|
+
const keys = Object.getOwnPropertyNames(texts);
|
973
|
+
for (let i = 0; i < keys.length; i++) {
|
974
|
+
texts[keys[i]] = texts[keys[i]].replace(/</ig, "<");
|
975
|
+
(<any>control).data.webPartData.serverProcessedContent.searchablePlainTexts = texts;
|
976
|
+
}
|
977
|
+
}
|
978
|
+
}
|
979
|
+
|
980
|
+
return control;
|
981
|
+
}
|
982
|
+
}
|
983
|
+
export interface IClientsidePage extends _ClientsidePage { }
|
984
|
+
|
985
|
+
/**
|
986
|
+
* Invokable factory for IClientSidePage instances
|
987
|
+
*/
|
988
|
+
const ClientsidePage = (
|
989
|
+
base: SPInit,
|
990
|
+
path?: string,
|
991
|
+
json?: Partial<IPageData>,
|
992
|
+
noInit = false,
|
993
|
+
sections: CanvasSection[] = [],
|
994
|
+
commentsDisabled = false): IClientsidePage => {
|
995
|
+
|
996
|
+
return new _ClientsidePage(base, path, json, noInit, sections, commentsDisabled);
|
997
|
+
};
|
998
|
+
|
999
|
+
/**
|
1000
|
+
* Loads a client side page from the supplied IFile instance
|
1001
|
+
*
|
1002
|
+
* @param file Source IFile instance
|
1003
|
+
*/
|
1004
|
+
export const ClientsidePageFromFile = async (file: IFile): Promise<IClientsidePage> => {
|
1005
|
+
|
1006
|
+
const item = await file.getItem<{ Id: number }>();
|
1007
|
+
const page = ClientsidePage([file, extractWebUrl(file.toUrl())], "", { Id: item.Id }, true);
|
1008
|
+
return page.load();
|
1009
|
+
};
|
1010
|
+
|
1011
|
+
/**
|
1012
|
+
* Creates a new client side page
|
1013
|
+
*
|
1014
|
+
* @param web The web or list
|
1015
|
+
* @param pageName The name of the page (filename)
|
1016
|
+
* @param title The page's title
|
1017
|
+
* @param PageLayoutType Layout to use when creating the page
|
1018
|
+
*/
|
1019
|
+
export const CreateClientsidePage =
|
1020
|
+
async (web: IWeb, pageName: string, title: string, PageLayoutType: ClientsidePageLayoutType = "Article", promotedState: PromotedState = 0): Promise<IClientsidePage> => {
|
1021
|
+
|
1022
|
+
// patched because previously we used the full page name with the .aspx at the end
|
1023
|
+
// this allows folk's existing code to work after the re-write to the new API
|
1024
|
+
pageName = pageName.replace(/\.aspx$/i, "");
|
1025
|
+
|
1026
|
+
// initialize the page, at this point a checked-out page with a junk filename will be created.
|
1027
|
+
const pageInitData: IPageData = await spPost(ClientsidePage(web, "_api/sitepages/pages"), body({
|
1028
|
+
PageLayoutType,
|
1029
|
+
PromotedState: promotedState,
|
1030
|
+
}));
|
1031
|
+
|
1032
|
+
// now we can init our page with the save data
|
1033
|
+
const newPage = ClientsidePage(web, "", pageInitData);
|
1034
|
+
newPage.title = pageName;
|
1035
|
+
await newPage.save(false);
|
1036
|
+
newPage.title = title;
|
1037
|
+
return newPage;
|
1038
|
+
};
|
1039
|
+
|
1040
|
+
export class CanvasSection {
|
1041
|
+
|
1042
|
+
/**
|
1043
|
+
* Used to track this object inside the collection at runtime
|
1044
|
+
*/
|
1045
|
+
private _memId: string;
|
1046
|
+
|
1047
|
+
private _order: number;
|
1048
|
+
private _layoutIndex: number;
|
1049
|
+
|
1050
|
+
constructor(protected page: IClientsidePage, order: number, layoutIndex: number, public columns: CanvasColumn[] = [], private _emphasis: 0 | 1 | 2 | 3 = 0) {
|
1051
|
+
this._memId = getGUID();
|
1052
|
+
this._order = order;
|
1053
|
+
this._layoutIndex = layoutIndex;
|
1054
|
+
}
|
1055
|
+
|
1056
|
+
public get order(): number {
|
1057
|
+
return this._order;
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
public set order(value: number) {
|
1061
|
+
this._order = value;
|
1062
|
+
for (let i = 0; i < this.columns.length; i++) {
|
1063
|
+
this.columns[i].data.position.zoneIndex = value;
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
public get layoutIndex(): number {
|
1068
|
+
return this._layoutIndex;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
public set layoutIndex(value: number) {
|
1072
|
+
this._layoutIndex = value;
|
1073
|
+
for (let i = 0; i < this.columns.length; i++) {
|
1074
|
+
this.columns[i].data.position.layoutIndex = value;
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
/**
|
1079
|
+
* Default column (this.columns[0]) for this section
|
1080
|
+
*/
|
1081
|
+
public get defaultColumn(): CanvasColumn {
|
1082
|
+
|
1083
|
+
if (this.columns.length < 1) {
|
1084
|
+
this.addColumn(12);
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
return this.columns[0];
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
/**
|
1091
|
+
* Adds a new column to this section
|
1092
|
+
*/
|
1093
|
+
public addColumn(factor: CanvasColumnFactor, layoutIndex = this.layoutIndex): CanvasColumn {
|
1094
|
+
const column = new CanvasColumn();
|
1095
|
+
column.section = this;
|
1096
|
+
column.data.position.zoneIndex = this.order;
|
1097
|
+
column.data.position.layoutIndex = layoutIndex;
|
1098
|
+
column.data.position.sectionFactor = factor;
|
1099
|
+
column.order = getNextOrder(this.columns);
|
1100
|
+
this.columns.push(column);
|
1101
|
+
return column;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
/**
|
1105
|
+
* Adds a control to the default column for this section
|
1106
|
+
*
|
1107
|
+
* @param control Control to add to the default column
|
1108
|
+
*/
|
1109
|
+
public addControl(control: ColumnControl<any>): this {
|
1110
|
+
this.defaultColumn.addControl(control);
|
1111
|
+
return this;
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
public get emphasis(): 0 | 1 | 2 | 3 {
|
1115
|
+
return this._emphasis;
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
public set emphasis(value: 0 | 1 | 2 | 3) {
|
1119
|
+
this._emphasis = value;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
/**
|
1123
|
+
* Removes this section and all contained columns and controls from the collection
|
1124
|
+
*/
|
1125
|
+
public remove(): void {
|
1126
|
+
this.page.sections = this.page.sections.filter(section => section._memId !== this._memId);
|
1127
|
+
reindex(this.page.sections);
|
1128
|
+
}
|
1129
|
+
}
|
1130
|
+
|
1131
|
+
export class CanvasColumn {
|
1132
|
+
|
1133
|
+
public static Default: IClientsidePageColumnData = {
|
1134
|
+
controlType: 0,
|
1135
|
+
displayMode: 2,
|
1136
|
+
emphasis: {},
|
1137
|
+
position: {
|
1138
|
+
layoutIndex: 1,
|
1139
|
+
sectionFactor: 12,
|
1140
|
+
sectionIndex: 1,
|
1141
|
+
zoneIndex: 1,
|
1142
|
+
},
|
1143
|
+
};
|
1144
|
+
|
1145
|
+
private _section: CanvasSection | null;
|
1146
|
+
private _memId: string;
|
1147
|
+
|
1148
|
+
constructor(protected json: IClientsidePageColumnData = JSON.parse(JSON.stringify(CanvasColumn.Default)), public controls: ColumnControl<any>[] = []) {
|
1149
|
+
this._section = null;
|
1150
|
+
this._memId = getGUID();
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
public get data(): IClientsidePageColumnData {
|
1154
|
+
return this.json;
|
1155
|
+
}
|
1156
|
+
|
1157
|
+
public get section(): CanvasSection {
|
1158
|
+
return this._section;
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
public set section(section: CanvasSection) {
|
1162
|
+
this._section = section;
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
public get order(): number {
|
1166
|
+
return this.data.position.sectionIndex;
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
public set order(value: number) {
|
1170
|
+
this.data.position.sectionIndex = value;
|
1171
|
+
for (let i = 0; i < this.controls.length; i++) {
|
1172
|
+
this.controls[i].data.position.zoneIndex = this.data.position.zoneIndex;
|
1173
|
+
this.controls[i].data.position.layoutIndex = this.data.position.layoutIndex;
|
1174
|
+
this.controls[i].data.position.sectionIndex = value;
|
1175
|
+
}
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
public get factor(): CanvasColumnFactor {
|
1179
|
+
return this.data.position.sectionFactor;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
public set factor(value: CanvasColumnFactor) {
|
1183
|
+
this.data.position.sectionFactor = value;
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
public addControl(control: ColumnControl<any>): this {
|
1187
|
+
control.column = this;
|
1188
|
+
this.controls.push(control);
|
1189
|
+
return this;
|
1190
|
+
}
|
1191
|
+
|
1192
|
+
public getControl<T extends ColumnControl<any>>(index: number): T {
|
1193
|
+
return <T>this.controls[index];
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
public remove(): void {
|
1197
|
+
this.section.columns = this.section.columns.filter(column => column._memId !== this._memId);
|
1198
|
+
reindex(this.section.columns);
|
1199
|
+
}
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
export abstract class ColumnControl<T extends ICanvasControlBaseData> {
|
1203
|
+
|
1204
|
+
private _column: CanvasColumn | null;
|
1205
|
+
|
1206
|
+
constructor(protected json: T) { }
|
1207
|
+
|
1208
|
+
public abstract get order(): number;
|
1209
|
+
public abstract set order(value: number);
|
1210
|
+
|
1211
|
+
public get id(): string {
|
1212
|
+
return this.json.id;
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
public get data(): T {
|
1216
|
+
return this.json;
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
public get column(): CanvasColumn | null {
|
1220
|
+
return this._column;
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
public set column(value: CanvasColumn) {
|
1224
|
+
this._column = value;
|
1225
|
+
this.onColumnChange(this._column);
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
public remove(): void {
|
1229
|
+
this.column.controls = this.column.controls.filter(control => control.id !== this.id);
|
1230
|
+
reindex(this.column.controls);
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
protected setData(data: T) {
|
1234
|
+
this.json = data;
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
protected abstract onColumnChange(col: CanvasColumn): void;
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
export class ClientsideText extends ColumnControl<IClientsideTextData> {
|
1241
|
+
|
1242
|
+
public static Default: IClientsideTextData = {
|
1243
|
+
addedFromPersistedData: false,
|
1244
|
+
anchorComponentId: "",
|
1245
|
+
controlType: 4,
|
1246
|
+
displayMode: 2,
|
1247
|
+
editorType: "CKEditor",
|
1248
|
+
emphasis: {},
|
1249
|
+
id: "",
|
1250
|
+
innerHTML: "",
|
1251
|
+
position: {
|
1252
|
+
controlIndex: 1,
|
1253
|
+
layoutIndex: 1,
|
1254
|
+
sectionFactor: 12,
|
1255
|
+
sectionIndex: 1,
|
1256
|
+
zoneIndex: 1,
|
1257
|
+
},
|
1258
|
+
};
|
1259
|
+
|
1260
|
+
constructor(text: string, json: IClientsideTextData = JSON.parse(JSON.stringify(ClientsideText.Default))) {
|
1261
|
+
if (stringIsNullOrEmpty(json.id)) {
|
1262
|
+
json.id = getGUID();
|
1263
|
+
json.anchorComponentId = json.id;
|
1264
|
+
}
|
1265
|
+
super(json);
|
1266
|
+
|
1267
|
+
this.text = text;
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
public get text(): string {
|
1271
|
+
return this.data.innerHTML;
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
public set text(value: string) {
|
1275
|
+
this.data.innerHTML = value;
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
public get order(): number {
|
1279
|
+
return this.data.position.controlIndex;
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
public set order(value: number) {
|
1283
|
+
this.data.position.controlIndex = value;
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
protected onColumnChange(col: CanvasColumn): void {
|
1287
|
+
this.data.position.sectionFactor = col.factor;
|
1288
|
+
this.data.position.controlIndex = getNextOrder(col.controls);
|
1289
|
+
this.data.position.zoneIndex = col.data.position.zoneIndex;
|
1290
|
+
this.data.position.sectionIndex = col.order;
|
1291
|
+
this.data.position.layoutIndex = col.data.position.layoutIndex;
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
export class ClientsideWebpart extends ColumnControl<IClientsideWebPartData> {
|
1296
|
+
|
1297
|
+
public static Default: IClientsideWebPartData = {
|
1298
|
+
addedFromPersistedData: false,
|
1299
|
+
controlType: 3,
|
1300
|
+
displayMode: 2,
|
1301
|
+
emphasis: {},
|
1302
|
+
id: null,
|
1303
|
+
position: {
|
1304
|
+
controlIndex: 1,
|
1305
|
+
layoutIndex: 1,
|
1306
|
+
sectionFactor: 12,
|
1307
|
+
sectionIndex: 1,
|
1308
|
+
zoneIndex: 1,
|
1309
|
+
},
|
1310
|
+
reservedHeight: 500,
|
1311
|
+
reservedWidth: 500,
|
1312
|
+
webPartData: null,
|
1313
|
+
webPartId: null,
|
1314
|
+
};
|
1315
|
+
|
1316
|
+
constructor(json: IClientsideWebPartData = JSON.parse(JSON.stringify(ClientsideWebpart.Default))) {
|
1317
|
+
super(json);
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
public static fromComponentDef(definition: IClientsidePageComponent): ClientsideWebpart {
|
1321
|
+
const part = new ClientsideWebpart();
|
1322
|
+
part.import(definition);
|
1323
|
+
return part;
|
1324
|
+
}
|
1325
|
+
|
1326
|
+
public get title(): string {
|
1327
|
+
return this.data.webPartData.title;
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
public set title(value: string) {
|
1331
|
+
this.data.webPartData.title = value;
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
public get description(): string {
|
1335
|
+
return this.data.webPartData.description;
|
1336
|
+
}
|
1337
|
+
|
1338
|
+
public set description(value: string) {
|
1339
|
+
this.data.webPartData.description = value;
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
public get order(): number {
|
1343
|
+
return this.data.position.controlIndex;
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
public set order(value: number) {
|
1347
|
+
this.data.position.controlIndex = value;
|
1348
|
+
}
|
1349
|
+
|
1350
|
+
public get height(): number {
|
1351
|
+
return this.data.reservedHeight;
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
public set height(value: number) {
|
1355
|
+
this.data.reservedHeight = value;
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
public get width(): number {
|
1359
|
+
return this.data.reservedWidth;
|
1360
|
+
}
|
1361
|
+
|
1362
|
+
public set width(value: number) {
|
1363
|
+
this.data.reservedWidth = value;
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
public get dataVersion(): string {
|
1367
|
+
return this.data.webPartData.dataVersion;
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
public set dataVersion(value: string) {
|
1371
|
+
this.data.webPartData.dataVersion = value;
|
1372
|
+
}
|
1373
|
+
|
1374
|
+
public setProperties<T = any>(properties: T): this {
|
1375
|
+
this.data.webPartData.properties = {
|
1376
|
+
...this.data.webPartData.properties,
|
1377
|
+
...properties,
|
1378
|
+
};
|
1379
|
+
return this;
|
1380
|
+
}
|
1381
|
+
|
1382
|
+
public getProperties<T = any>(): T {
|
1383
|
+
return <T>this.data.webPartData.properties;
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
public setServerProcessedContent<T = any>(properties: T): this {
|
1387
|
+
this.data.webPartData.serverProcessedContent = {
|
1388
|
+
...this.data.webPartData.serverProcessedContent,
|
1389
|
+
...properties,
|
1390
|
+
};
|
1391
|
+
return this;
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
public getServerProcessedContent<T = any>(): T {
|
1395
|
+
return <T>this.data.webPartData.serverProcessedContent;
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
protected onColumnChange(col: CanvasColumn): void {
|
1399
|
+
this.data.position.sectionFactor = col.factor;
|
1400
|
+
this.data.position.controlIndex = getNextOrder(col.controls);
|
1401
|
+
this.data.position.zoneIndex = col.data.position.zoneIndex;
|
1402
|
+
this.data.position.sectionIndex = col.data.position.sectionIndex;
|
1403
|
+
this.data.position.layoutIndex = col.data.position.layoutIndex;
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
protected import(component: IClientsidePageComponent): void {
|
1407
|
+
|
1408
|
+
const id = getGUID();
|
1409
|
+
const componendId = component.Id.replace(/^\{|\}$/g, "").toLowerCase();
|
1410
|
+
const manifest: IClientSidePageComponentManifest = JSON.parse(component.Manifest);
|
1411
|
+
const preconfiguredEntries = manifest.preconfiguredEntries[0];
|
1412
|
+
|
1413
|
+
this.setData(Object.assign({}, this.data, <IClientsideWebPartData>{
|
1414
|
+
id,
|
1415
|
+
webPartData: {
|
1416
|
+
dataVersion: "1.0",
|
1417
|
+
description: preconfiguredEntries.description.default,
|
1418
|
+
id: componendId,
|
1419
|
+
instanceId: id,
|
1420
|
+
properties: preconfiguredEntries.properties,
|
1421
|
+
title: preconfiguredEntries.title.default,
|
1422
|
+
},
|
1423
|
+
webPartId: componendId,
|
1424
|
+
}));
|
1425
|
+
}
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
export interface IPageData {
|
1429
|
+
readonly "odata.metadata": string;
|
1430
|
+
readonly "odata.type": "SP.Publishing.SitePage";
|
1431
|
+
readonly "odata.id": string;
|
1432
|
+
readonly "odata.editLink": string;
|
1433
|
+
AbsoluteUrl: string;
|
1434
|
+
AuthorByline: string[] | null;
|
1435
|
+
BannerImageUrl: string;
|
1436
|
+
BannerThumbnailUrl: string;
|
1437
|
+
ContentTypeId: null | string;
|
1438
|
+
Description: string;
|
1439
|
+
DoesUserHaveEditPermission: boolean;
|
1440
|
+
FileName: string;
|
1441
|
+
readonly FirstPublished: string;
|
1442
|
+
readonly Id: number;
|
1443
|
+
IsPageCheckedOutToCurrentUser: boolean;
|
1444
|
+
IsWebWelcomePage: boolean;
|
1445
|
+
readonly Modified: string;
|
1446
|
+
PageLayoutType: ClientsidePageLayoutType;
|
1447
|
+
Path: {
|
1448
|
+
DecodedUrl: string;
|
1449
|
+
};
|
1450
|
+
PromotedState: number;
|
1451
|
+
Title: string;
|
1452
|
+
TopicHeader: null | string;
|
1453
|
+
readonly UniqueId: string;
|
1454
|
+
Url: string;
|
1455
|
+
readonly Version: string;
|
1456
|
+
readonly VersionInfo: {
|
1457
|
+
readonly LastVersionCreated: string;
|
1458
|
+
readonly LastVersionCreatedBy: string;
|
1459
|
+
};
|
1460
|
+
AlternativeUrlMap: string;
|
1461
|
+
CanvasContent1: string;
|
1462
|
+
LayoutWebpartsContent: string;
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
/**
|
1466
|
+
* Client side webpart object (retrieved via the _api/web/GetClientSideWebParts REST call)
|
1467
|
+
*/
|
1468
|
+
export interface IClientsidePageComponent {
|
1469
|
+
/**
|
1470
|
+
* Component type for client side webpart object
|
1471
|
+
*/
|
1472
|
+
ComponentType: number;
|
1473
|
+
/**
|
1474
|
+
* Id for client side webpart object
|
1475
|
+
*/
|
1476
|
+
Id: string;
|
1477
|
+
/**
|
1478
|
+
* Manifest for client side webpart object
|
1479
|
+
*/
|
1480
|
+
Manifest: string;
|
1481
|
+
/**
|
1482
|
+
* Manifest type for client side webpart object
|
1483
|
+
*/
|
1484
|
+
ManifestType: number;
|
1485
|
+
/**
|
1486
|
+
* Name for client side webpart object
|
1487
|
+
*/
|
1488
|
+
Name: string;
|
1489
|
+
/**
|
1490
|
+
* Status for client side webpart object
|
1491
|
+
*/
|
1492
|
+
Status: number;
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
interface IClientSidePageComponentManifest {
|
1496
|
+
alias: string;
|
1497
|
+
componentType: "WebPart" | "" | null;
|
1498
|
+
disabledOnClassicSharepoint: boolean;
|
1499
|
+
hiddenFromToolbox: boolean;
|
1500
|
+
id: string;
|
1501
|
+
imageLinkPropertyNames: any;
|
1502
|
+
isInternal: boolean;
|
1503
|
+
linkPropertyNames: boolean;
|
1504
|
+
loaderConfig: any;
|
1505
|
+
manifestVersion: number;
|
1506
|
+
preconfiguredEntries: {
|
1507
|
+
description: { default: string };
|
1508
|
+
group: { default: string };
|
1509
|
+
groupId: string;
|
1510
|
+
iconImageUrl: string;
|
1511
|
+
officeFabricIconFontName: string;
|
1512
|
+
properties: Record<string, any>;
|
1513
|
+
title: { default: string };
|
1514
|
+
|
1515
|
+
}[];
|
1516
|
+
preloadComponents: any | null;
|
1517
|
+
requiredCapabilities: any | null;
|
1518
|
+
searchablePropertyNames: any | null;
|
1519
|
+
supportsFullBleed: boolean;
|
1520
|
+
version: string;
|
1521
|
+
}
|
1522
|
+
|
1523
|
+
export interface IClientsideControlBaseData {
|
1524
|
+
controlType: number;
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
export interface ICanvasControlBaseData extends IClientsideControlBaseData {
|
1528
|
+
id: string;
|
1529
|
+
emphasis: IClientControlEmphasis;
|
1530
|
+
displayMode: number;
|
1531
|
+
}
|
1532
|
+
|
1533
|
+
export interface IClientsidePageSettingsSlice extends IClientsideControlBaseData {
|
1534
|
+
htmlAttributes?: string[];
|
1535
|
+
pageSettingsSlice: {
|
1536
|
+
"isDefaultDescription": boolean;
|
1537
|
+
"isDefaultThumbnail": boolean;
|
1538
|
+
};
|
1539
|
+
}
|
1540
|
+
|
1541
|
+
export interface IClientsidePageColumnData extends IClientsideControlBaseData {
|
1542
|
+
controlType: 0;
|
1543
|
+
displayMode: number;
|
1544
|
+
emphasis: IClientControlEmphasis;
|
1545
|
+
position: IPosition;
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
interface IPosition {
|
1549
|
+
zoneIndex: number;
|
1550
|
+
sectionIndex: number;
|
1551
|
+
controlIndex?: number;
|
1552
|
+
sectionFactor?: CanvasColumnFactor;
|
1553
|
+
layoutIndex: number;
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
export interface IClientsideTextData extends ICanvasControlBaseData {
|
1557
|
+
controlType: 4;
|
1558
|
+
position: IPosition;
|
1559
|
+
anchorComponentId: string;
|
1560
|
+
editorType: "CKEditor";
|
1561
|
+
addedFromPersistedData: boolean;
|
1562
|
+
innerHTML: string;
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
export interface IClientsideWebPartData<PropertiesType = any> extends ICanvasControlBaseData {
|
1566
|
+
controlType: 3;
|
1567
|
+
position: IPosition;
|
1568
|
+
webPartId: string;
|
1569
|
+
reservedHeight: number;
|
1570
|
+
reservedWidth: number;
|
1571
|
+
addedFromPersistedData: boolean;
|
1572
|
+
webPartData: {
|
1573
|
+
id: string;
|
1574
|
+
instanceId: string;
|
1575
|
+
title: string;
|
1576
|
+
description: string;
|
1577
|
+
serverProcessedContent?: {
|
1578
|
+
htmlStrings?: Record<string, string>;
|
1579
|
+
searchablePlainTexts?: Record<string, string>;
|
1580
|
+
imageSources?: Record<string, string>;
|
1581
|
+
links?: Record<string, string>;
|
1582
|
+
};
|
1583
|
+
dataVersion: string;
|
1584
|
+
properties: PropertiesType;
|
1585
|
+
};
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
export interface IClientControlEmphasis {
|
1589
|
+
zoneEmphasis?: 0 | 1 | 2 | 3;
|
1590
|
+
}
|
1591
|
+
|
1592
|
+
export type LayoutType = "FullWidthImage" | "NoImage" | "ColorBlock" | "CutInShape";
|
1593
|
+
export type TextAlignment = "Left" | "Center";
|
1594
|
+
|
1595
|
+
interface ILayoutPartsContent {
|
1596
|
+
id: string;
|
1597
|
+
instanceId: string;
|
1598
|
+
title: string;
|
1599
|
+
description: string;
|
1600
|
+
serverProcessedContent: {
|
1601
|
+
htmlStrings?: Record<string, string>;
|
1602
|
+
searchablePlainTexts?: Record<string, string>;
|
1603
|
+
imageSources?: Record<string, string>;
|
1604
|
+
links?: Record<string, string>;
|
1605
|
+
customMetadata?: {
|
1606
|
+
imageSource?: {
|
1607
|
+
siteId: string;
|
1608
|
+
webId: string;
|
1609
|
+
listId: string;
|
1610
|
+
uniqueId: string;
|
1611
|
+
};
|
1612
|
+
};
|
1613
|
+
};
|
1614
|
+
dataVersion: string;
|
1615
|
+
properties: {
|
1616
|
+
title: string;
|
1617
|
+
imageSourceType?: number;
|
1618
|
+
layoutType: LayoutType;
|
1619
|
+
textAlignment: TextAlignment;
|
1620
|
+
showTopicHeader: boolean;
|
1621
|
+
showPublishDate: boolean;
|
1622
|
+
topicHeader: string;
|
1623
|
+
enableGradientEffect: boolean;
|
1624
|
+
authorByline: string[];
|
1625
|
+
authors: {
|
1626
|
+
id: string;
|
1627
|
+
upn: string;
|
1628
|
+
name: string;
|
1629
|
+
role: string;
|
1630
|
+
}[];
|
1631
|
+
webId?: string;
|
1632
|
+
siteId?: string;
|
1633
|
+
listId?: string;
|
1634
|
+
uniqueId?: string;
|
1635
|
+
translateX?: number;
|
1636
|
+
translateY?: number;
|
1637
|
+
altText?: string;
|
1638
|
+
hasTitleBeenCommitted?: boolean;
|
1639
|
+
};
|
1640
|
+
reservedHeight: number;
|
1641
|
+
}
|
1642
|
+
|
1643
|
+
export interface IBannerImageProps {
|
1644
|
+
altText?: string;
|
1645
|
+
imageSourceType?: number;
|
1646
|
+
translateX?: number;
|
1647
|
+
translateY?: number;
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
export interface IRepostPage {
|
1651
|
+
Description?: string;
|
1652
|
+
IsBannerImageUrlExternal?: boolean;
|
1653
|
+
OriginalSourceListId?: string;
|
1654
|
+
ShouldSaveAsDraft?: boolean;
|
1655
|
+
OriginalSourceSiteId?: string;
|
1656
|
+
BannerImageUrl?: string;
|
1657
|
+
Title?: string;
|
1658
|
+
OriginalSourceItemId?: string;
|
1659
|
+
OriginalSourceUrl?: string;
|
1660
|
+
OriginalSourceWebId?: string;
|
1661
|
+
}
|