@microsoft/sp-listview-extensibility 1.22.0-beta.2 → 1.22.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/lib/commandSet/BaseListViewCommandSet.d.ts +82 -0
  2. package/lib/commandSet/BaseListViewCommandSet.d.ts.map +1 -0
  3. package/lib/commandSet/BaseListViewCommandSet.js +68 -0
  4. package/lib/commandSet/Command.d.ts +51 -0
  5. package/lib/commandSet/Command.d.ts.map +1 -0
  6. package/lib/commandSet/Command.js +18 -0
  7. package/lib/commandSet/ListViewCommandSetContext.d.ts +43 -0
  8. package/lib/commandSet/ListViewCommandSetContext.d.ts.map +1 -0
  9. package/lib/commandSet/ListViewCommandSetContext.js +84 -0
  10. package/lib/common/IListItem.d.ts +9 -0
  11. package/lib/common/IListItem.d.ts.map +1 -0
  12. package/lib/common/IListItem.js +2 -0
  13. package/lib/common/ListItemAccessor.d.ts +42 -0
  14. package/lib/common/ListItemAccessor.d.ts.map +1 -0
  15. package/lib/common/ListItemAccessor.js +25 -0
  16. package/lib/common/ListViewAccessor.d.ts +168 -0
  17. package/lib/common/ListViewAccessor.d.ts.map +1 -0
  18. package/lib/common/ListViewAccessor.js +146 -0
  19. package/lib/common/ListViewAccessorState.d.ts +207 -0
  20. package/lib/common/ListViewAccessorState.d.ts.map +1 -0
  21. package/lib/common/ListViewAccessorState.js +18 -0
  22. package/lib/fieldCustomizer/BaseFieldCustomizer.d.ts +51 -0
  23. package/lib/fieldCustomizer/BaseFieldCustomizer.d.ts.map +1 -0
  24. package/lib/fieldCustomizer/BaseFieldCustomizer.js +33 -0
  25. package/lib/fieldCustomizer/FieldCustomizerContext.d.ts +41 -0
  26. package/lib/fieldCustomizer/FieldCustomizerContext.d.ts.map +1 -0
  27. package/lib/fieldCustomizer/FieldCustomizerContext.js +45 -0
  28. package/lib/formCustomizer/BaseFormCustomizer.d.ts +102 -0
  29. package/lib/formCustomizer/BaseFormCustomizer.d.ts.map +1 -0
  30. package/lib/formCustomizer/BaseFormCustomizer.js +134 -0
  31. package/lib/formCustomizer/FormActionEventArgs.d.ts +23 -0
  32. package/lib/formCustomizer/FormActionEventArgs.d.ts.map +1 -0
  33. package/lib/formCustomizer/FormActionEventArgs.js +28 -0
  34. package/lib/formCustomizer/FormCustomizerContext.d.ts +95 -0
  35. package/lib/formCustomizer/FormCustomizerContext.d.ts.map +1 -0
  36. package/lib/formCustomizer/FormCustomizerContext.js +96 -0
  37. package/lib/formCustomizer/FormCustomizerHost.d.ts +42 -0
  38. package/lib/formCustomizer/FormCustomizerHost.d.ts.map +1 -0
  39. package/lib/formCustomizer/FormCustomizerHost.js +49 -0
  40. package/lib/index.d.ts +19 -0
  41. package/lib/index.d.ts.map +1 -0
  42. package/lib/index.js +18 -0
  43. package/lib/sp-listview-extensibility.manifest.json +9 -0
  44. package/package.json +6 -6
@@ -0,0 +1,82 @@
1
+ import { BaseExtension } from '@microsoft/sp-extension-base';
2
+ import type ListViewCommandSetContext from './ListViewCommandSetContext';
3
+ import type Command from './Command';
4
+ import type { RowAccessor } from '../common/ListViewAccessor';
5
+ /**
6
+ * Parameters for {@link BaseListViewCommandSet.onListViewUpdated}
7
+ *
8
+ * @public
9
+ */
10
+ export interface IListViewCommandSetListViewUpdatedParameters {
11
+ /**
12
+ * The currently selected ListView rows, at the time when the event occurred.
13
+ */
14
+ readonly selectedRows: ReadonlyArray<RowAccessor>;
15
+ }
16
+ /**
17
+ * Parameters for {@link BaseListViewCommandSet.onExecute}
18
+ *
19
+ * @public
20
+ */
21
+ export interface IListViewCommandSetExecuteEventParameters {
22
+ /**
23
+ * The unique identifier for the command. This is specified as ICommandDefinition.commandId
24
+ * in the component manifest.
25
+ */
26
+ readonly itemId: string;
27
+ /**
28
+ * The currently selected ListView rows, at the time when the event occurred.
29
+ */
30
+ readonly selectedRows: ReadonlyArray<RowAccessor>;
31
+ }
32
+ /**
33
+ * This is the base class that third parties should extend when implementing
34
+ * a client-side extension that provides a command set for a SharePoint list view.
35
+ *
36
+ * @remarks
37
+ * In the component manifest, the "extensionType" should be set to "ListViewCommandSet".
38
+ *
39
+ * @privateRemarks
40
+ *
41
+ * Eventually other command set classes will be introduced, and then we will introduce a base class
42
+ * so the hierarchy goes `BaseListViewCommandSet <- BaseCommandSet <- BaseExtension <- BaseComponent`.
43
+ *
44
+ * @public
45
+ */
46
+ declare abstract class BaseListViewCommandSet<TProperties> extends BaseExtension<TProperties> {
47
+ /**
48
+ * {@inheritDoc @microsoft/sp-extension-base#BaseExtension.context}
49
+ */
50
+ readonly context: ListViewCommandSetContext;
51
+ /**
52
+ * @internal
53
+ */
54
+ _raiseOnChange?: () => void;
55
+ /**
56
+ * Returns the command with the given id.
57
+ * Returns undefined if there is not command with the given id.
58
+ * @param id - Id of the command
59
+ */
60
+ tryGetCommand(id: string): Command;
61
+ /**
62
+ * This event occurs whenever the ListView state changes.
63
+ * virtual
64
+ * @remarks
65
+ * This event allows the implementor to tailor the visibility of the command.
66
+ *
67
+ * @deprecated Use context.listView.listViewStateChangedEvent instead.
68
+ */
69
+ onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void;
70
+ /**
71
+ * This event occurs when the command is invoked, e.g. because the user
72
+ * clicked on the toolbar button or menu item.
73
+ * virtual
74
+ */
75
+ onExecute(event: IListViewCommandSetExecuteEventParameters): void;
76
+ /**
77
+ * Use this method to fire OnChange event and initialize a reflow of the ListView.
78
+ */
79
+ raiseOnChange(): void;
80
+ }
81
+ export default BaseListViewCommandSet;
82
+ //# sourceMappingURL=BaseListViewCommandSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseListViewCommandSet.d.ts","sourceRoot":"","sources":["../../src/commandSet/BaseListViewCommandSet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,yBAAyB,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,4CAA4C;IAC3D;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,yCAAyC;IACxD;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;GAaG;AACH,uBAAe,sBAAsB,CAAC,WAAW,CAAE,SAAQ,aAAa,CAAC,WAAW,CAAC;IACnF;;OAEG;IAEH,SAAgB,OAAO,EAAG,yBAAyB,CAAC;IAEpD;;OAEG;IACI,cAAc,CAAC,EAAE,MAAM,IAAI,CAAa;IAE/C;;;;OAIG;IACI,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAMzC;;;;;;;OAOG;IACI,iBAAiB,CAAC,KAAK,EAAE,4CAA4C,GAAG,IAAI;IAInF;;;;OAIG;IACI,SAAS,CAAC,KAAK,EAAE,yCAAyC,GAAG,IAAI;IAIxE;;OAEG;IACI,aAAa,IAAI,IAAI;CAK7B;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { __extends } from "tslib";
2
+ import { Validate } from '@microsoft/sp-core-library';
3
+ import { BaseExtension } from '@microsoft/sp-extension-base';
4
+ /**
5
+ * This is the base class that third parties should extend when implementing
6
+ * a client-side extension that provides a command set for a SharePoint list view.
7
+ *
8
+ * @remarks
9
+ * In the component manifest, the "extensionType" should be set to "ListViewCommandSet".
10
+ *
11
+ * @privateRemarks
12
+ *
13
+ * Eventually other command set classes will be introduced, and then we will introduce a base class
14
+ * so the hierarchy goes `BaseListViewCommandSet <- BaseCommandSet <- BaseExtension <- BaseComponent`.
15
+ *
16
+ * @public
17
+ */
18
+ var BaseListViewCommandSet = /** @class */ (function (_super) {
19
+ __extends(BaseListViewCommandSet, _super);
20
+ function BaseListViewCommandSet() {
21
+ var _this = _super !== null && _super.apply(this, arguments) || this;
22
+ /**
23
+ * @internal
24
+ */
25
+ _this._raiseOnChange = undefined; // provided by Command set adapter
26
+ return _this;
27
+ }
28
+ /**
29
+ * Returns the command with the given id.
30
+ * Returns undefined if there is not command with the given id.
31
+ * @param id - Id of the command
32
+ */
33
+ BaseListViewCommandSet.prototype.tryGetCommand = function (id) {
34
+ Validate.isNonemptyString(id, 'id');
35
+ var commands = this.context._commands.filter(function (command) { return command.id === id; });
36
+ return commands[0];
37
+ };
38
+ /**
39
+ * This event occurs whenever the ListView state changes.
40
+ * virtual
41
+ * @remarks
42
+ * This event allows the implementor to tailor the visibility of the command.
43
+ *
44
+ * @deprecated Use context.listView.listViewStateChangedEvent instead.
45
+ */
46
+ BaseListViewCommandSet.prototype.onListViewUpdated = function (event) {
47
+ // (implemented by child class)
48
+ };
49
+ /**
50
+ * This event occurs when the command is invoked, e.g. because the user
51
+ * clicked on the toolbar button or menu item.
52
+ * virtual
53
+ */
54
+ BaseListViewCommandSet.prototype.onExecute = function (event) {
55
+ // (implemented by child class)
56
+ };
57
+ /**
58
+ * Use this method to fire OnChange event and initialize a reflow of the ListView.
59
+ */
60
+ BaseListViewCommandSet.prototype.raiseOnChange = function () {
61
+ if (this._raiseOnChange) {
62
+ this._raiseOnChange();
63
+ }
64
+ };
65
+ return BaseListViewCommandSet;
66
+ }(BaseExtension));
67
+ export default BaseListViewCommandSet;
68
+ //# sourceMappingURL=BaseListViewCommandSet.js.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Represents a command belonging to a command set.
3
+ *
4
+ * @remarks
5
+ * The BaseListViewCommandSet extension type exposes generalized commands that may be displayed as tool bar buttons,
6
+ * context menu items, etc. These commands are initially defined in the extension's manifest file. At runtime, the
7
+ * corresponding Command object can be obtained by calling {@link BaseListViewCommandSet.tryGetCommand}.
8
+ * The command's appearance can be customized by assigning its properties, for example to hide a command that is not
9
+ * contextually relevant, or to pluralize the title based on the number of selected items.
10
+ * @public
11
+ */
12
+ export default class Command {
13
+ /**
14
+ * Id of the command.
15
+ */
16
+ id: string;
17
+ /**
18
+ * A short label to be displayed by the associated button, menu item, etc.
19
+ * @remarks
20
+ * Example: "Show information"
21
+ *
22
+ * Altering the title property is intended to allow minor changes to the title, e.g. “Submit these 3 items” or
23
+ * toggling between “Schedule” and “Unschedule”. Developers are discouraged from assigning a title that radically
24
+ * alters the meaning of the command, because administrators should be able to examine the extension manifest to
25
+ * understand which commands are being implemented by a given extension.
26
+ */
27
+ title: string;
28
+ /**
29
+ * An optional URL for an image to be displayed next to the command. The requirements for this image
30
+ * are defined by the type of extension; some extension types may not display the image at all.
31
+ *
32
+ * @remarks
33
+ * This must be a absolute URL.
34
+ */
35
+ iconImageUrl: string | undefined;
36
+ /**
37
+ * Custom accessibility text for the browser's "aria-label" attribute. If omitted, the title property
38
+ * will be used by default.
39
+ * Example: "Show information. Press ENTER to select."
40
+ */
41
+ ariaLabel: string | undefined;
42
+ /**
43
+ * True if the command is visible.
44
+ */
45
+ visible: boolean;
46
+ /**
47
+ * Whether the command is currently disabled.
48
+ */
49
+ disabled: boolean | undefined;
50
+ }
51
+ //# sourceMappingURL=Command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/commandSet/Command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B;;OAEG;IACI,EAAE,EAAG,MAAM,CAAC;IAEnB;;;;;;;;;OASG;IACI,KAAK,EAAG,MAAM,CAAC;IAEtB;;;;;;OAMG;IACI,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC;;;;OAIG;IACI,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;OAEG;IACI,OAAO,EAAG,OAAO,CAAC;IAEzB;;OAEG;IACI,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Represents a command belonging to a command set.
3
+ *
4
+ * @remarks
5
+ * The BaseListViewCommandSet extension type exposes generalized commands that may be displayed as tool bar buttons,
6
+ * context menu items, etc. These commands are initially defined in the extension's manifest file. At runtime, the
7
+ * corresponding Command object can be obtained by calling {@link BaseListViewCommandSet.tryGetCommand}.
8
+ * The command's appearance can be customized by assigning its properties, for example to hide a command that is not
9
+ * contextually relevant, or to pluralize the title based on the number of selected items.
10
+ * @public
11
+ */
12
+ var Command = /** @class */ (function () {
13
+ function Command() {
14
+ }
15
+ return Command;
16
+ }());
17
+ export default Command;
18
+ //# sourceMappingURL=Command.js.map
@@ -0,0 +1,43 @@
1
+ import { ExtensionContext, type _IExtensionContextParameters } from '@microsoft/sp-extension-base';
2
+ import type { ICommandSetExtensionManifest } from '@microsoft/sp-module-interfaces';
3
+ import type ListViewAccessor from '../common/ListViewAccessor';
4
+ import type Command from './Command';
5
+ /**
6
+ * Constructor parameters for `ListViewCommandSetContext`.
7
+ *
8
+ * @internal
9
+ */
10
+ export interface IListViewCommandSetContextParameters {
11
+ readonly listView: ListViewAccessor;
12
+ }
13
+ /**
14
+ * This object provides contextual information for BaseListViewCommandSet.
15
+ * @public
16
+ */
17
+ export default class ListViewCommandSetContext extends ExtensionContext {
18
+ /**
19
+ * {@inheritDoc @microsoft/sp-component-base#BaseComponentContext.manifest}
20
+ */
21
+ readonly manifest: ICommandSetExtensionManifest;
22
+ private _listView;
23
+ private _commandArray;
24
+ /**
25
+ * @internal
26
+ */
27
+ constructor(extensionContextParameters: _IExtensionContextParameters, listViewCommandSetContextParameters: IListViewCommandSetContextParameters);
28
+ /**
29
+ * Provides access to the ListView control that the customizer will operate on.
30
+ */
31
+ get listView(): ListViewAccessor;
32
+ /**
33
+ * Returns an array with all commands.
34
+ *
35
+ * @privateRemarks
36
+ * In the future commands won't be a flat list. This allows us to get all commands together, so we can
37
+ * provide a straight-forward API tryGetCommand in the BaseListViewCommandSet itself.
38
+ *
39
+ * @internal
40
+ */
41
+ get _commands(): ReadonlyArray<Command>;
42
+ }
43
+ //# sourceMappingURL=ListViewCommandSetContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListViewCommandSetContext.d.ts","sourceRoot":"","sources":["../../src/commandSet/ListViewCommandSetContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,EACV,4BAA4B,EAG7B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,gBAAgB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAGrC;;;;GAIG;AACH,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,gBAAgB;IACrE;;OAEG;IACH,SAAgB,QAAQ,EAAG,4BAA4B,CAAC;IACxD,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,aAAa,CAAY;IAEjC;;OAEG;gBAED,0BAA0B,EAAE,4BAA4B,EACxD,mCAAmC,EAAE,oCAAoC;IAiD3E;;OAEG;IACH,IAAW,QAAQ,IAAI,gBAAgB,CAEtC;IAED;;;;;;;;OAQG;IACH,IAAW,SAAS,IAAI,aAAa,CAAC,OAAO,CAAC,CAE7C;CACF"}
@@ -0,0 +1,84 @@
1
+ import { __extends } from "tslib";
2
+ import { ExtensionContext } from '@microsoft/sp-extension-base';
3
+ import { Text, UrlUtilities } from '@microsoft/sp-core-library';
4
+ import { PageContext } from '@microsoft/sp-page-context';
5
+ /**
6
+ * This object provides contextual information for BaseListViewCommandSet.
7
+ * @public
8
+ */
9
+ var ListViewCommandSetContext = /** @class */ (function (_super) {
10
+ __extends(ListViewCommandSetContext, _super);
11
+ /**
12
+ * @internal
13
+ */
14
+ function ListViewCommandSetContext(extensionContextParameters, listViewCommandSetContextParameters) {
15
+ var _this = _super.call(this, extensionContextParameters) || this;
16
+ _this._listView = listViewCommandSetContextParameters.listView;
17
+ _this._commandArray = [];
18
+ var itemsMap = _this.manifest.items;
19
+ for (var _i = 0, _a = Object.keys(itemsMap); _i < _a.length; _i++) {
20
+ var itemId = _a[_i];
21
+ // Future proof for grouping
22
+ if (itemsMap[itemId].type === 'command') {
23
+ var iconUrl = itemsMap[itemId].iconImageUrl;
24
+ if (iconUrl && !UrlUtilities.isDataUrl(iconUrl)) {
25
+ iconUrl = UrlUtilities.resolve(iconUrl, _this.manifest.loaderConfig.internalModuleBaseUrls[0]);
26
+ }
27
+ _this._commandArray.push({
28
+ id: itemId,
29
+ title: itemsMap[itemId].title.default || '',
30
+ ariaLabel: itemsMap[itemId].ariaLabel
31
+ ? itemsMap[itemId].ariaLabel.default
32
+ : undefined,
33
+ iconImageUrl: iconUrl,
34
+ visible: true,
35
+ disabled: undefined
36
+ });
37
+ }
38
+ }
39
+ // updating title and ariaLabel based on UI culture
40
+ if (_this._commandArray.length) {
41
+ _this.serviceScope.whenFinished(function () {
42
+ var pageContext = _this.serviceScope.consume(PageContext.serviceKey);
43
+ var currentUICulture = pageContext.cultureInfo.currentUICultureName;
44
+ _this._commandArray.forEach(function (command) {
45
+ var item = itemsMap[command.id];
46
+ command.title = Text._getLocalizedString(item.title, currentUICulture) || '';
47
+ if (item.ariaLabel) {
48
+ command.ariaLabel = Text._getLocalizedString(item.ariaLabel, currentUICulture);
49
+ }
50
+ });
51
+ });
52
+ }
53
+ return _this;
54
+ }
55
+ Object.defineProperty(ListViewCommandSetContext.prototype, "listView", {
56
+ /**
57
+ * Provides access to the ListView control that the customizer will operate on.
58
+ */
59
+ get: function () {
60
+ return this._listView;
61
+ },
62
+ enumerable: false,
63
+ configurable: true
64
+ });
65
+ Object.defineProperty(ListViewCommandSetContext.prototype, "_commands", {
66
+ /**
67
+ * Returns an array with all commands.
68
+ *
69
+ * @privateRemarks
70
+ * In the future commands won't be a flat list. This allows us to get all commands together, so we can
71
+ * provide a straight-forward API tryGetCommand in the BaseListViewCommandSet itself.
72
+ *
73
+ * @internal
74
+ */
75
+ get: function () {
76
+ return this._commandArray;
77
+ },
78
+ enumerable: false,
79
+ configurable: true
80
+ });
81
+ return ListViewCommandSetContext;
82
+ }(ExtensionContext));
83
+ export default ListViewCommandSetContext;
84
+ //# sourceMappingURL=ListViewCommandSetContext.js.map
@@ -0,0 +1,9 @@
1
+ import type { IODataListItem } from '@microsoft/sp-odata-types';
2
+ /**
3
+ * @public
4
+ *
5
+ * Represents an SP.ListItem data (OData).
6
+ */
7
+ export interface IListItem extends IODataListItem {
8
+ }
9
+ //# sourceMappingURL=IListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IListItem.d.ts","sourceRoot":"","sources":["../../src/common/IListItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc;CAAG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IListItem.js.map
@@ -0,0 +1,42 @@
1
+ import type { SPField } from '@microsoft/sp-page-context';
2
+ /**
3
+ * When a field customizer extension is rendering a field, the ListItemAccessor provides
4
+ * access to the associated SharePoint list item.
5
+ *
6
+ * @remarks
7
+ *
8
+ * ListItemAccessor allows a field customizer extension to determine which fields are available
9
+ * in the editor and retrieve the current values for those fields. In the future, it may
10
+ * also support validation and editing operations.
11
+ *
12
+ * When the editor is the SharePoint list view, the ListViewAccessor uses the RowAccessor
13
+ * subclass instead of the ListItemAccessor base class. This allows additional functionality
14
+ * to be exposed, for example determining whether the associated table row is selected or not.
15
+ *
16
+ * @public
17
+ */
18
+ export default abstract class ListItemAccessor {
19
+ /** @internal */
20
+ constructor();
21
+ /**
22
+ * The SharePoint fields that are currently available in the editor for this list item.
23
+ *
24
+ * @remarks
25
+ * The set of available fields depends on the editing context. For example, if a list view
26
+ * column is hidden, the corresponding field definition may not be loaded. Field customizers
27
+ * should not assume that a given field will be available, even if it is defined in the
28
+ * content type.
29
+ */
30
+ abstract get fields(): ReadonlyArray<SPField>;
31
+ /**
32
+ * Retrieves the current data value for the field with the specified internal name.
33
+ * The value will be a primitive JavaScript object such as a string, number, etc.
34
+ */
35
+ abstract getValueByName(internalName: string): any;
36
+ /**
37
+ * Retrieves the current data value for the specified field.
38
+ * The value will be a primitive JavaScript object such as a string, number, etc.
39
+ */
40
+ abstract getValue(field: SPField): any;
41
+ }
42
+ //# sourceMappingURL=ListItemAccessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemAccessor.d.ts","sourceRoot":"","sources":["../../src/common/ListItemAccessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAgB;IAC5C,gBAAgB;;IAKhB;;;;;;;;OAQG;IACH,aAAoB,MAAM,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IAErD;;;OAGG;aAEa,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,GAAG;IAEzD;;;OAGG;aAEa,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG;CAC9C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * When a field customizer extension is rendering a field, the ListItemAccessor provides
3
+ * access to the associated SharePoint list item.
4
+ *
5
+ * @remarks
6
+ *
7
+ * ListItemAccessor allows a field customizer extension to determine which fields are available
8
+ * in the editor and retrieve the current values for those fields. In the future, it may
9
+ * also support validation and editing operations.
10
+ *
11
+ * When the editor is the SharePoint list view, the ListViewAccessor uses the RowAccessor
12
+ * subclass instead of the ListItemAccessor base class. This allows additional functionality
13
+ * to be exposed, for example determining whether the associated table row is selected or not.
14
+ *
15
+ * @public
16
+ */
17
+ var ListItemAccessor = /** @class */ (function () {
18
+ /** @internal */
19
+ function ListItemAccessor() {
20
+ // (mark constructor as internal)
21
+ }
22
+ return ListItemAccessor;
23
+ }());
24
+ export default ListItemAccessor;
25
+ //# sourceMappingURL=ListItemAccessor.js.map
@@ -0,0 +1,168 @@
1
+ import type { SPField } from '@microsoft/sp-page-context';
2
+ import { type IDisposable, SPEvent, SPEventArgs } from '@microsoft/sp-core-library';
3
+ import ListItemAccessor from './ListItemAccessor';
4
+ import type { IFilter, IFolderInfo, IList, IListViewAccessorState, IView, ListViewAccessorStateChanges } from './ListViewAccessorState';
5
+ /**
6
+ * Provides access to a ListView column, which is the visual presentation
7
+ * of a field.
8
+ *
9
+ * @remarks
10
+ *
11
+ * A SharePoint "field" (SPField) defines the data storage for a property of a list item.
12
+ * (If the list item represents a document, then the field is sometimes called a "property".)
13
+ *
14
+ * A "column" is the visual presentation of a field, when displayed by the ListView.
15
+ *
16
+ * @public
17
+ */
18
+ export declare abstract class ColumnAccessor {
19
+ /** @internal */
20
+ constructor();
21
+ /**
22
+ * The server-side definition of the field.
23
+ * This property is read-only.
24
+ */
25
+ abstract get field(): SPField;
26
+ /**
27
+ * Whether to show this column in the list view.
28
+ * This property is read-only.
29
+ */
30
+ abstract get visible(): boolean;
31
+ }
32
+ /**
33
+ * Provides access to a ListView row, which is the visual presentation
34
+ * of a SharePoint list item.
35
+ *
36
+ * @remarks
37
+ *
38
+ * A SharePoint "list item" (SPListItem) is a data storage record in the content
39
+ * management system; it stores an array of values for the associated fields.
40
+ *
41
+ * A "row" is the visual presentation of a list item, when displayed by the ListView;
42
+ * it stores an array of cell values for the associated columns.
43
+ *
44
+ * @public
45
+ */
46
+ export declare abstract class RowAccessor extends ListItemAccessor {
47
+ /**
48
+ * @internal
49
+ */
50
+ constructor();
51
+ }
52
+ /**
53
+ * Arguments for the selected rows changed event.
54
+ *
55
+ * @public
56
+ */
57
+ export declare class SelectedRowsChangedEventArgs extends SPEventArgs {
58
+ /**
59
+ * The list of rows that were selected in the list view at the time when the event was fired.
60
+ */
61
+ selectedRows: ReadonlyArray<RowAccessor>;
62
+ }
63
+ /**
64
+ * Arguments for the list view state changed event.
65
+ *
66
+ * @public
67
+ */
68
+ export declare class ListViewStateChangedEventArgs extends SPEventArgs {
69
+ /**
70
+ * Previous state of the ListView.
71
+ */
72
+ prevState: Readonly<IListViewAccessorState>;
73
+ /**
74
+ * Changes that were made to the ListView state.
75
+ */
76
+ stateChanges: ListViewAccessorStateChanges;
77
+ }
78
+ /**
79
+ * Provides access to a SharePoint ListView control.
80
+ *
81
+ * @public
82
+ */
83
+ declare abstract class ListViewAccessor implements IDisposable {
84
+ /**
85
+ * SPEvent name when the selected rows in a list have changed.
86
+ *
87
+ * @internal
88
+ */
89
+ static _selectedRowsChangedEventName: string;
90
+ /**
91
+ * SPEvent name when the list view state has changed.
92
+ *
93
+ * @internal
94
+ */
95
+ static _listViewStateChangedEventName: string;
96
+ private _selectedRowsChangedEvent;
97
+ private _listViewStateChangedEvent;
98
+ private readonly _listViewStateChangedEventName;
99
+ private _isDisposed;
100
+ /**
101
+ * @internal
102
+ */
103
+ constructor(eventPrefix?: string);
104
+ /**
105
+ * The columns in associated with this view, including hidden columns.
106
+ */
107
+ abstract get columns(): ReadonlyArray<ColumnAccessor>;
108
+ /**
109
+ * Currently rendered rows in the list view.
110
+ */
111
+ abstract get rows(): ReadonlyArray<RowAccessor>;
112
+ /**
113
+ * Selected rows in the list view.
114
+ */
115
+ abstract get selectedRows(): ReadonlyArray<RowAccessor> | undefined;
116
+ /**
117
+ * Basic information about the list rendered by the list view.
118
+ */
119
+ abstract get list(): IList | undefined;
120
+ /**
121
+ * Basic information about the view rendered by the list view.
122
+ */
123
+ abstract get view(): IView | undefined;
124
+ /**
125
+ * Folder information for the list view.
126
+ */
127
+ abstract get folderInfo(): IFolderInfo | undefined;
128
+ /**
129
+ * Filters applied to the list view.
130
+ */
131
+ abstract get appliedFilters(): {
132
+ [fieldName: string]: IFilter;
133
+ } | undefined;
134
+ /**
135
+ * Sort field name
136
+ */
137
+ abstract get sortField(): string | undefined;
138
+ /**
139
+ * Specifies whether the list view is sorted ascending or descending.
140
+ */
141
+ abstract get sortAscending(): boolean | undefined;
142
+ /**
143
+ * Returns the list view column corresponding to the field with the specified internal name,
144
+ * or undefined if none is found.
145
+ */
146
+ abstract tryGetColumnByName(internalName: string): ColumnAccessor | undefined;
147
+ /**
148
+ * Event that gets raised every time the selected items in the list view change.
149
+ * @eventproperty
150
+ */
151
+ get selectedRowsChangedEvent(): SPEvent<SelectedRowsChangedEventArgs>;
152
+ /**
153
+ * Event that gets raised every time the list view state changes.
154
+ *
155
+ * @eventproperty
156
+ */
157
+ get listViewStateChangedEvent(): SPEvent<ListViewStateChangedEventArgs>;
158
+ /**
159
+ * @internal
160
+ */
161
+ dispose(): void;
162
+ /**
163
+ * @internal
164
+ */
165
+ get isDisposed(): boolean;
166
+ }
167
+ export default ListViewAccessor;
168
+ //# sourceMappingURL=ListViewAccessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListViewAccessor.d.ts","sourceRoot":"","sources":["../../src/common/ListViewAccessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,KAAK,WAAW,EAAE,OAAO,EAAE,WAAW,EAAmB,MAAM,4BAA4B,CAAC;AACrG,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,KAAK,EACL,sBAAsB,EACtB,KAAK,EACL,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,8BAAsB,cAAc;IAClC,gBAAgB;;IAKhB;;;OAGG;IACH,aAAoB,KAAK,IAAI,OAAO,CAAC;IAErC;;;OAGG;IACH,aAAoB,OAAO,IAAI,OAAO,CAAC;CACxC;AAED;;;;;;;;;;;;;GAaG;AACH,8BAAsB,WAAY,SAAQ,gBAAgB;IACxD;;OAEG;;CAIJ;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,WAAW;IAC3D;;OAEG;IACI,YAAY,EAAG,aAAa,CAAC,WAAW,CAAC,CAAC;CAClD;AAED;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,WAAW;IAC5D;;OAEG;IACI,SAAS,EAAG,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IACpD;;OAEG;IACI,YAAY,EAAG,4BAA4B,CAAC;CACpD;AAED;;;;GAIG;AACH,uBAAe,gBAAiB,YAAW,WAAW;IACpD;;;;OAIG;IACH,OAAc,6BAA6B,EAAE,MAAM,CAAkC;IAErF;;;;OAIG;IACH,OAAc,8BAA8B,EAAE,MAAM,CAA2B;IAE/E,OAAO,CAAC,yBAAyB,CAAwC;IACzE,OAAO,CAAC,0BAA0B,CAAyC;IAC3E,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAS;IAExD,OAAO,CAAC,WAAW,CAAkB;IAErC;;OAEG;gBACgB,WAAW,CAAC,EAAE,MAAM;IAcvC;;OAEG;IACH,aAAoB,OAAO,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;IAE7D;;OAEG;IACH,aAAoB,IAAI,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;IAEvD;;OAEG;IACH,aAAoB,YAAY,IAAI,aAAa,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IAE3E;;OAEG;IACH,aAAoB,IAAI,IAAI,KAAK,GAAG,SAAS,CAAC;IAE9C;;OAEG;IACH,aAAoB,IAAI,IAAI,KAAK,GAAG,SAAS,CAAC;IAE9C;;OAEG;IACH,aAAoB,UAAU,IAAI,WAAW,GAAG,SAAS,CAAC;IAE1D;;OAEG;IACH,aAAoB,cAAc,IAAI;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;IAEnF;;OAEG;IACH,aAAoB,SAAS,IAAI,MAAM,GAAG,SAAS,CAAC;IAEpD;;OAEG;IACH,aAAoB,aAAa,IAAI,OAAO,GAAG,SAAS,CAAC;IAEzD;;;OAGG;aACa,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAEpF;;;OAGG;IACH,IAAW,wBAAwB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAE3E;IAED;;;;OAIG;IACH,IAAW,yBAAyB,IAAI,OAAO,CAAC,6BAA6B,CAAC,CAE7E;IAED;;OAEG;IACI,OAAO,IAAI,IAAI;IAKtB;;OAEG;IACH,IAAW,UAAU,IAAI,OAAO,CAE/B;CACF;AAED,eAAe,gBAAgB,CAAC"}