feat: Update dynamic poll web part to version 1.3.0 with enhanced field mapping and configurable title

- Bump version in package.json to 1.3.0
- Add new properties for field mapping in DynamicPollWebPart.manifest.json
- Enhance DynamicPollWebPart.ts to support dynamic field mapping for polls and answers
- Implement field loading and default application logic in PollDataService.ts
- Update PollTypes.ts to include new interfaces for field mapping
- Modify DynamicPollCollection.tsx to display configurable web part title
- Update styles in DynamicPoll.module.scss for improved UI
- Add localization strings for new properties in en-us.js and de-de.js
- Update tests to reflect changes in data structure and functionality
- Validate project structure and ensure all new features are accounted for
This commit is contained in:
Torsten Brendgen
2026-08-27 00:13:58 +02:00
parent f87c49a91a
commit 6bcf7c5020
15 changed files with 423 additions and 99 deletions
+4 -4
View File
@@ -34,10 +34,10 @@ assert('all active polls are returned in activation order',
activePolls.length === 2 && activePolls[0].id === 2 && activePolls[1].id === 4);
const answers: IPollAnswer[] = [
{ id: 1, userKey: 'one@contoso.local', answer: 'A' },
{ id: 2, userKey: 'two@contoso.local', answer: 'B' },
{ id: 3, userKey: 'three@contoso.local', answer: 'A' },
{ id: 4, userKey: 'legacy@contoso.local', answer: 'Removed option' }
{ id: 1, pollKey: 'poll-1', userKey: 'one@contoso.local', answer: 'A' },
{ id: 2, pollKey: 'poll-1', userKey: 'two@contoso.local', answer: 'B' },
{ id: 3, pollKey: 'poll-1', userKey: 'three@contoso.local', answer: 'A' },
{ id: 4, pollKey: 'poll-1', userKey: 'legacy@contoso.local', answer: 'Removed option' }
];
const results = calculatePollResults(['A', 'B'], answers);
assert('votes are counted per configured option', results[0].votes === 2 && results[1].votes === 1);
+14 -3
View File
@@ -13,9 +13,10 @@ var manifest = json('src/webparts/dynamicPoll/DynamicPollWebPart.manifest.json')
var webPart = read('src/webparts/dynamicPoll/DynamicPollWebPart.ts');
var service = read('src/webparts/dynamicPoll/PollDataService.ts');
var component = read('src/webparts/dynamicPoll/components/DynamicPoll.tsx');
var collection = read('src/webparts/dynamicPoll/components/DynamicPollCollection.tsx');
var styles = read('src/webparts/dynamicPoll/components/DynamicPoll.module.scss');
assert(packageJson.version === '1.1.0' && solution.version === '1.1.0.0', 'Version mismatch.');
assert(packageJson.version === '1.3.0' && solution.version === '1.3.0.0', 'Version mismatch.');
assert(solution.includeClientSideAssets === true && solution.skipFeatureDeployment === true, 'Central deployment missing.');
assert(packageJson.name === 'dynamic-poll-web-part' && solution.name === 'dynamic-poll-web-part' &&
solution.title === 'dynamic-poll-web-part', 'Dynamic Poll package naming is inconsistent.');
@@ -24,17 +25,27 @@ assert(json('config/package-solution.json').paths.zippedPackage === 'solution/dy
assert(manifest.componentType === 'WebPart', 'Component is not a web part.');
assert(webPart.indexOf("PropertyPaneDropdown('pollListId'") >= 0 && webPart.indexOf("PropertyPaneDropdown('answerListId'") >= 0,
'List selection is missing.');
assert(webPart.indexOf("PropertyPaneDropdown('pollKeyField'") >= 0 &&
webPart.indexOf("PropertyPaneDropdown('answerPollKeyField'") >= 0 &&
webPart.indexOf("PropertyPaneDropdown('answerValueField'") >= 0, 'Column mapping is missing.');
assert(webPart.indexOf("PropertyPaneTextField('title'") >= 0 &&
collection.indexOf('styles.webPartHeading') >= 0,
'Configurable web part title is missing.');
assert(webPart.indexOf("PropertyPaneDropdown('displayMode'") >= 0 &&
webPart.indexOf('DynamicPollCollection') >= 0, 'Multiple-poll display mode is missing.');
assert(service.indexOf('getSnapshots') >= 0 && service.indexOf('getActivePolls') >= 0,
'All active polls must be loaded and remain voteable.');
assert(service.indexOf("'PollId': pollId") >= 0 && service.indexOf("'Answer': answer") >= 0, 'Vote persistence is missing.');
assert(service.indexOf("body[mapping.answerPollKeyField]") >= 0 &&
service.indexOf("body[mapping.answerValueField]") >= 0, 'Mapped vote persistence is missing.');
assert(service.indexOf("new Error('ALREADY_VOTED')") >= 0, 'Duplicate vote protection is missing.');
assert(service.indexOf("new Error('POLL_NOT_ACTIVE')") >= 0, 'Active poll and answer validation is missing.');
assert(service.indexOf("'OptionsText'") >= 0 && service.indexOf('parsePollOptionLines') >= 0,
assert(service.indexOf('mapping.pollOptionsField') >= 0 && service.indexOf('parsePollOptionLines') >= 0,
'Multiline poll options are missing.');
assert(read('deployment/Initialize-DynamicPollLists.ps1').indexOf('Type="Note" DisplayName="Options"') >= 0,
'Multiline options field provisioning is missing.');
assert(read('deployment/Initialize-DynamicPollLists.ps1').indexOf("InternalName 'PollKey'") >= 0 &&
read('deployment/Initialize-DynamicPollLists.ps1').indexOf('Type="Lookup" DisplayName="Poll"') < 0,
'Content Type Hub compatible text key provisioning is missing.');
assert(component.indexOf("type='radio'") >= 0 && component.indexOf("role='progressbar'") >= 0,
'Accessible voting or results UI is missing.');
assert(fs.existsSync(path.join(root, 'deployment/Initialize-DynamicPollLists.ps1')), 'Provisioning script is missing.');