profile-pane 3.1.4 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/lib/04567ff683933c35c465.png +0 -0
- package/lib/10163fd9b5a0e00d63a0.png +0 -0
- package/lib/1234dcb2eec2e45f252b.png +0 -0
- package/lib/20899934157df4db56cb.png +0 -0
- package/lib/33760bf79f097f449da5.png +0 -0
- package/lib/578d2b6ed32e7624164e.png +0 -0
- package/lib/5f62a5b2b7e99b9640c7.png +0 -0
- package/lib/6525766ecd288ec60129.png +0 -0
- package/lib/7800be6f6c4b5b0f4f20.png +0 -0
- package/lib/976473cf5fe24d657d4b.png +0 -0
- package/lib/ChatWithMe.d.ts +2 -1
- package/lib/ChatWithMe.d.ts.map +1 -1
- package/lib/ChatWithMe.js +3 -3
- package/lib/ProfileView.d.ts +1 -1
- package/lib/ProfileView.d.ts.map +1 -1
- package/lib/ProfileView.js +71 -131
- package/lib/ProfileViewModelPresenter.d.ts +23 -0
- package/lib/ProfileViewModelPresenter.d.ts.map +1 -0
- package/lib/ProfileViewModelPresenter.js +37 -0
- package/lib/QRCodeCard.d.ts +3 -1
- package/lib/QRCodeCard.d.ts.map +1 -1
- package/lib/QRCodeCard.js +86 -66
- package/lib/addMeToYourFriends.d.ts +3 -3
- package/lib/addMeToYourFriends.d.ts.map +1 -1
- package/lib/addMeToYourFriends.js +14 -30
- package/lib/bda84f59e7216675a208.png +0 -0
- package/lib/buttonsHelper.js +1 -1
- package/lib/cd68e8f3990ba8b2139e.png +0 -0
- package/lib/e7074a7e2cb69e51cfd3.png +0 -0
- package/lib/editProfilePane/EditCVCard.d.ts +1 -0
- package/lib/editProfilePane/EditCVCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditCVCard.js +2 -1
- package/lib/editProfilePane/EditCommunitiesCard.d.ts +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.js +2 -1
- package/lib/editProfilePane/EditContactsCard.d.ts +1 -0
- package/lib/editProfilePane/EditContactsCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditContactsCard.js +2 -0
- package/lib/editProfilePane/EditFriendsCard.d.ts +1 -1
- package/lib/editProfilePane/EditFriendsCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditFriendsCard.js +2 -1
- package/lib/editProfilePane/EditOtherPreferences.d.ts +1 -0
- package/lib/editProfilePane/EditOtherPreferences.d.ts.map +1 -1
- package/lib/editProfilePane/EditOtherPreferences.js +1 -0
- package/lib/editProfilePane/EditProfileView.d.ts +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts.map +1 -1
- package/lib/editProfilePane/EditProfileView.js +1 -1
- package/lib/editProfilePane/EditSocialCard.d.ts +1 -0
- package/lib/editProfilePane/EditSocialCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditSocialCard.js +2 -1
- package/lib/editProfilePane/editProfilePresenter.d.ts +1 -0
- package/lib/editProfilePane/editProfilePresenter.d.ts.map +1 -1
- package/lib/editProfilePane/editProfilePresenter.js +2 -0
- package/lib/f3772696fb7ee53c23d8.png +0 -0
- package/lib/icons-svg/contactIcons.d.ts +3 -0
- package/lib/icons-svg/contactIcons.d.ts.map +1 -0
- package/lib/icons-svg/contactIcons.js +32 -0
- package/lib/icons-svg/profileIcons.d.ts +22 -0
- package/lib/icons-svg/profileIcons.d.ts.map +1 -0
- package/lib/icons-svg/profileIcons.js +309 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +42 -19
- package/lib/profile-pane.js +15629 -5666
- package/lib/profile-pane.js.map +1 -1
- package/lib/profile-pane.min.js +2171 -230
- package/lib/profile-pane.min.js.map +1 -1
- package/lib/rdfFormsHelper.d.ts +1 -0
- package/lib/rdfFormsHelper.d.ts.map +1 -1
- package/lib/rdfFormsHelper.js +2 -0
- package/lib/sections/bio/BioEditDialog.d.ts +6 -0
- package/lib/sections/bio/BioEditDialog.d.ts.map +1 -0
- package/lib/sections/bio/BioEditDialog.js +119 -0
- package/lib/sections/bio/BioSection.d.ts +7 -0
- package/lib/sections/bio/BioSection.d.ts.map +1 -0
- package/lib/sections/bio/BioSection.js +131 -0
- package/lib/sections/bio/mutations.d.ts +4 -0
- package/lib/sections/bio/mutations.d.ts.map +1 -0
- package/lib/sections/bio/mutations.js +43 -0
- package/lib/sections/bio/selectors.d.ts +4 -0
- package/lib/sections/bio/selectors.d.ts.map +1 -0
- package/lib/sections/bio/selectors.js +15 -0
- package/lib/sections/bio/types.d.ts +15 -0
- package/lib/sections/bio/types.d.ts.map +1 -0
- package/lib/sections/bio/types.js +5 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts +7 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts.map +1 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.js +658 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts +5 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts.map +1 -0
- package/lib/sections/contactInfo/ContactInfoSection.js +229 -0
- package/lib/sections/contactInfo/mutations.d.ts +4 -0
- package/lib/sections/contactInfo/mutations.d.ts.map +1 -0
- package/lib/sections/contactInfo/mutations.js +150 -0
- package/lib/sections/contactInfo/selectors.d.ts +4 -0
- package/lib/sections/contactInfo/selectors.d.ts.map +1 -0
- package/lib/sections/contactInfo/selectors.js +104 -0
- package/lib/sections/contactInfo/types.d.ts +44 -0
- package/lib/sections/contactInfo/types.d.ts.map +1 -0
- package/lib/sections/contactInfo/types.js +5 -0
- package/lib/sections/education/EducationEditDialog.d.ts +7 -0
- package/lib/sections/education/EducationEditDialog.d.ts.map +1 -0
- package/lib/sections/education/EducationEditDialog.js +459 -0
- package/lib/sections/education/EducationSection.d.ts +7 -0
- package/lib/sections/education/EducationSection.d.ts.map +1 -0
- package/lib/sections/education/EducationSection.js +126 -0
- package/lib/sections/education/mutations.d.ts +4 -0
- package/lib/sections/education/mutations.d.ts.map +1 -0
- package/lib/sections/education/mutations.js +60 -0
- package/lib/sections/education/selectors.d.ts +4 -0
- package/lib/sections/education/selectors.d.ts.map +1 -0
- package/lib/sections/education/selectors.js +64 -0
- package/lib/sections/education/types.d.ts +20 -0
- package/lib/sections/education/types.d.ts.map +1 -0
- package/lib/sections/education/types.js +5 -0
- package/lib/sections/heading/HeadingEditDialog.d.ts +6 -0
- package/lib/sections/heading/HeadingEditDialog.d.ts.map +1 -0
- package/lib/sections/heading/HeadingEditDialog.js +742 -0
- package/lib/sections/heading/HeadingSection.d.ts +9 -0
- package/lib/sections/heading/HeadingSection.d.ts.map +1 -0
- package/lib/sections/heading/HeadingSection.js +97 -0
- package/lib/sections/heading/camera.d.ts +19 -0
- package/lib/sections/heading/camera.d.ts.map +1 -0
- package/lib/sections/heading/camera.js +199 -0
- package/lib/sections/heading/dateHelpers.d.ts +4 -0
- package/lib/sections/heading/dateHelpers.d.ts.map +1 -0
- package/lib/sections/heading/dateHelpers.js +48 -0
- package/lib/sections/heading/imageHelpers.d.ts +4 -0
- package/lib/sections/heading/imageHelpers.d.ts.map +1 -0
- package/lib/sections/heading/imageHelpers.js +81 -0
- package/lib/sections/heading/mutations.d.ts +4 -0
- package/lib/sections/heading/mutations.d.ts.map +1 -0
- package/lib/sections/heading/mutations.js +190 -0
- package/lib/sections/heading/selectors.d.ts +5 -0
- package/lib/sections/heading/selectors.d.ts.map +1 -0
- package/lib/sections/heading/selectors.js +157 -0
- package/lib/sections/heading/types.d.ts +36 -0
- package/lib/sections/heading/types.d.ts.map +1 -0
- package/lib/sections/heading/types.js +5 -0
- package/lib/sections/languages/LanguageEditDialog.d.ts +7 -0
- package/lib/sections/languages/LanguageEditDialog.d.ts.map +1 -0
- package/lib/sections/languages/LanguageEditDialog.js +457 -0
- package/lib/sections/languages/LanguageSection.d.ts +5 -0
- package/lib/sections/languages/LanguageSection.d.ts.map +1 -0
- package/lib/sections/languages/LanguageSection.js +137 -0
- package/lib/sections/languages/mutations.d.ts +6 -0
- package/lib/sections/languages/mutations.d.ts.map +1 -0
- package/lib/sections/languages/mutations.js +296 -0
- package/lib/sections/languages/selectors.d.ts +5 -0
- package/lib/sections/languages/selectors.d.ts.map +1 -0
- package/lib/sections/languages/selectors.js +146 -0
- package/lib/sections/languages/types.d.ts +15 -0
- package/lib/sections/languages/types.d.ts.map +1 -0
- package/lib/sections/languages/types.js +5 -0
- package/lib/sections/projects/ProjectEditDialog.d.ts +7 -0
- package/lib/sections/projects/ProjectEditDialog.d.ts.map +1 -0
- package/lib/sections/projects/ProjectEditDialog.js +182 -0
- package/lib/sections/projects/ProjectSection.d.ts +6 -0
- package/lib/sections/projects/ProjectSection.d.ts.map +1 -0
- package/lib/sections/projects/ProjectSection.js +220 -0
- package/lib/sections/projects/mutations.d.ts +4 -0
- package/lib/sections/projects/mutations.d.ts.map +1 -0
- package/lib/sections/projects/mutations.js +188 -0
- package/lib/sections/projects/selectors.d.ts +5 -0
- package/lib/sections/projects/selectors.d.ts.map +1 -0
- package/lib/sections/projects/selectors.js +163 -0
- package/lib/sections/projects/types.d.ts +28 -0
- package/lib/sections/projects/types.d.ts.map +1 -0
- package/lib/sections/projects/types.js +8 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts +7 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts.map +1 -0
- package/lib/sections/resume/ResumeEditDialog.js +629 -0
- package/lib/sections/resume/ResumeSection.d.ts +7 -0
- package/lib/sections/resume/ResumeSection.d.ts.map +1 -0
- package/lib/sections/resume/ResumeSection.js +160 -0
- package/lib/sections/resume/mutations.d.ts +6 -0
- package/lib/sections/resume/mutations.d.ts.map +1 -0
- package/lib/sections/resume/mutations.js +172 -0
- package/lib/sections/resume/selectors.d.ts +4 -0
- package/lib/sections/resume/selectors.d.ts.map +1 -0
- package/lib/sections/resume/selectors.js +142 -0
- package/lib/sections/resume/types.d.ts +33 -0
- package/lib/sections/resume/types.d.ts.map +1 -0
- package/lib/sections/resume/types.js +8 -0
- package/lib/sections/shared/collapsibleSection.d.ts +2 -0
- package/lib/sections/shared/collapsibleSection.d.ts.map +1 -0
- package/lib/sections/shared/collapsibleSection.js +24 -0
- package/lib/sections/shared/contactTypeUtils.d.ts +7 -0
- package/lib/sections/shared/contactTypeUtils.d.ts.map +1 -0
- package/lib/sections/shared/contactTypeUtils.js +48 -0
- package/lib/sections/shared/idNodeFactory.d.ts +3 -0
- package/lib/sections/shared/idNodeFactory.d.ts.map +1 -0
- package/lib/sections/shared/idNodeFactory.js +14 -0
- package/lib/sections/shared/phoneCountries.d.ts +20 -0
- package/lib/sections/shared/phoneCountries.d.ts.map +1 -0
- package/lib/sections/shared/phoneCountries.js +1080 -0
- package/lib/sections/shared/rdfList.d.ts +3 -0
- package/lib/sections/shared/rdfList.d.ts.map +1 -0
- package/lib/sections/shared/rdfList.js +34 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts +12 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts.map +1 -0
- package/lib/sections/shared/rdfMutationHelpers.js +82 -0
- package/lib/sections/shared/rowState.d.ts +21 -0
- package/lib/sections/shared/rowState.d.ts.map +1 -0
- package/lib/sections/shared/rowState.js +52 -0
- package/lib/sections/shared/sanitizeUtils.d.ts +5 -0
- package/lib/sections/shared/sanitizeUtils.d.ts.map +1 -0
- package/lib/sections/shared/sanitizeUtils.js +22 -0
- package/lib/sections/shared/sectionCardHelpers.d.ts +11 -0
- package/lib/sections/shared/sectionCardHelpers.d.ts.map +1 -0
- package/lib/sections/shared/sectionCardHelpers.js +105 -0
- package/lib/sections/shared/types.d.ts +7 -0
- package/lib/sections/shared/types.d.ts.map +1 -0
- package/lib/sections/shared/types.js +5 -0
- package/lib/sections/skills/SkillsEditDialog.d.ts +7 -0
- package/lib/sections/skills/SkillsEditDialog.d.ts.map +1 -0
- package/lib/sections/skills/SkillsEditDialog.js +340 -0
- package/lib/sections/skills/SkillsSection.d.ts +5 -0
- package/lib/sections/skills/SkillsSection.d.ts.map +1 -0
- package/lib/sections/skills/SkillsSection.js +169 -0
- package/lib/sections/skills/mutations.d.ts +6 -0
- package/lib/sections/skills/mutations.d.ts.map +1 -0
- package/lib/sections/skills/mutations.js +110 -0
- package/lib/sections/skills/selectors.d.ts +6 -0
- package/lib/sections/skills/selectors.d.ts.map +1 -0
- package/lib/sections/skills/selectors.js +37 -0
- package/lib/sections/skills/types.d.ts +14 -0
- package/lib/sections/skills/types.d.ts.map +1 -0
- package/lib/sections/skills/types.js +5 -0
- package/lib/sections/social/SocialEditDialog.d.ts +7 -0
- package/lib/sections/social/SocialEditDialog.d.ts.map +1 -0
- package/lib/sections/social/SocialEditDialog.js +362 -0
- package/lib/sections/social/SocialSection.d.ts +8 -0
- package/lib/sections/social/SocialSection.d.ts.map +1 -0
- package/lib/sections/social/SocialSection.js +201 -0
- package/lib/sections/social/constants.d.ts +3 -0
- package/lib/sections/social/constants.d.ts.map +1 -0
- package/lib/sections/social/constants.js +16 -0
- package/lib/sections/social/helpers.d.ts +15 -0
- package/lib/sections/social/helpers.d.ts.map +1 -0
- package/lib/sections/social/helpers.js +316 -0
- package/lib/sections/social/mutations.d.ts +4 -0
- package/lib/sections/social/mutations.d.ts.map +1 -0
- package/lib/sections/social/mutations.js +298 -0
- package/lib/sections/social/selectors.d.ts +4 -0
- package/lib/sections/social/selectors.d.ts.map +1 -0
- package/lib/sections/social/selectors.js +43 -0
- package/lib/sections/social/types.d.ts +19 -0
- package/lib/sections/social/types.d.ts.map +1 -0
- package/lib/sections/social/types.js +5 -0
- package/lib/styles/BioSection.css +77 -0
- package/lib/styles/CVCard.css +107 -2
- package/lib/styles/ContactInfoEditDialog.css +153 -0
- package/lib/styles/EditDialogs.css +1028 -0
- package/lib/styles/EducationCard.css +103 -0
- package/lib/styles/HeadingSection.css +309 -0
- package/lib/styles/ProfileCard.css +10 -42
- package/lib/styles/ProfileView.css +53 -8
- package/lib/styles/ProjectsCard.css +206 -0
- package/lib/styles/QRCodeCard.css +29 -10
- package/lib/styles/SocialCard.css +41 -13
- package/lib/styles/dialog.css +209 -0
- package/lib/styles/utilities.css +638 -256
- package/lib/textUtils.d.ts +6 -0
- package/lib/textUtils.d.ts.map +1 -0
- package/lib/textUtils.js +44 -0
- package/lib/texts.d.ts +45 -4
- package/lib/texts.d.ts.map +1 -1
- package/lib/texts.js +46 -5
- package/lib/types.d.ts +2 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +5 -0
- package/lib/ui/dialog.d.ts +29 -0
- package/lib/ui/dialog.d.ts.map +1 -0
- package/lib/ui/dialog.js +269 -0
- package/lib/ui/errors.d.ts +2 -0
- package/lib/ui/errors.d.ts.map +1 -0
- package/lib/ui/errors.js +10 -0
- package/package.json +8 -6
- package/lib/CVCard.d.ts +0 -4
- package/lib/CVCard.d.ts.map +0 -1
- package/lib/CVCard.js +0 -114
- package/lib/CVPresenter.d.ts +0 -25
- package/lib/CVPresenter.d.ts.map +0 -1
- package/lib/CVPresenter.js +0 -119
- package/lib/FriendList.d.ts +0 -6
- package/lib/FriendList.d.ts.map +0 -1
- package/lib/FriendList.js +0 -27
- package/lib/ProfileCard.d.ts +0 -6
- package/lib/ProfileCard.d.ts.map +0 -1
- package/lib/ProfileCard.js +0 -62
- package/lib/SocialCard.d.ts +0 -5
- package/lib/SocialCard.d.ts.map +0 -1
- package/lib/SocialCard.js +0 -51
- package/lib/SocialPresenter.d.ts +0 -11
- package/lib/SocialPresenter.d.ts.map +0 -1
- package/lib/SocialPresenter.js +0 -117
- package/lib/StuffCard.d.ts +0 -10
- package/lib/StuffCard.d.ts.map +0 -1
- package/lib/StuffCard.js +0 -52
- package/lib/StuffPresenter.d.ts +0 -14
- package/lib/StuffPresenter.d.ts.map +0 -1
- package/lib/StuffPresenter.js +0 -53
- package/lib/presenter.d.ts +0 -14
- package/lib/presenter.d.ts.map +0 -1
- package/lib/presenter.js +0 -68
- package/lib/styles/FriendList.css +0 -12
- package/lib/styles/StuffCard.css +0 -23
- package/lib/styles/editProfile.css +0 -62
- package/lib/styles/profileRDFFormsEnforced.css +0 -427
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createEducationEditDialog = createEducationEditDialog;
|
|
7
|
+
var _dialog = require("../../ui/dialog");
|
|
8
|
+
var _litHtml = require("lit-html");
|
|
9
|
+
require("../../styles/EditDialogs.css");
|
|
10
|
+
require("../../styles/ContactInfoEditDialog.css");
|
|
11
|
+
var _mutations = require("./mutations");
|
|
12
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
13
|
+
var _rowState = require("../shared/rowState");
|
|
14
|
+
var _textUtils = require("../../textUtils");
|
|
15
|
+
var _texts = require("../../texts");
|
|
16
|
+
function sanitizeEducationFieldValue(value) {
|
|
17
|
+
return (0, _textUtils.sanitizeTextValue)(value);
|
|
18
|
+
}
|
|
19
|
+
function parseYearMonthFromDateText(dateText) {
|
|
20
|
+
const normalized = (dateText || '').trim();
|
|
21
|
+
if (!normalized) return {
|
|
22
|
+
year: '',
|
|
23
|
+
month: ''
|
|
24
|
+
};
|
|
25
|
+
const isoYearMonth = normalized.match(/^(\d{4})-(\d{2})/);
|
|
26
|
+
if (isoYearMonth) {
|
|
27
|
+
return {
|
|
28
|
+
year: isoYearMonth[1],
|
|
29
|
+
month: isoYearMonth[2]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const fallbackYear = normalized.match(/(\d{4})/);
|
|
33
|
+
return {
|
|
34
|
+
year: fallbackYear ? fallbackYear[1] : '',
|
|
35
|
+
month: ''
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function rowHasContent(row) {
|
|
39
|
+
return [row.school, (0, _textUtils.toText)(row.startDate), (0, _textUtils.toText)(row.endDate), row.degree, row.location, row.description].some(_textUtils.hasNonEmptyText);
|
|
40
|
+
}
|
|
41
|
+
function toFormState(educationData) {
|
|
42
|
+
const education = (educationData || []).map(educationEntry => ({
|
|
43
|
+
school: sanitizeEducationFieldValue((0, _textUtils.toText)(educationEntry.school)),
|
|
44
|
+
startDate: educationEntry.startDate,
|
|
45
|
+
endDate: educationEntry.endDate,
|
|
46
|
+
degree: sanitizeEducationFieldValue((0, _textUtils.toText)(educationEntry.degree)),
|
|
47
|
+
location: sanitizeEducationFieldValue((0, _textUtils.toText)(educationEntry.location)),
|
|
48
|
+
description: sanitizeEducationFieldValue((0, _textUtils.toText)(educationEntry.description)),
|
|
49
|
+
entryNode: (0, _textUtils.toText)(educationEntry.entryNode),
|
|
50
|
+
status: (0, _textUtils.toText)(educationEntry.entryNode) ? 'existing' : 'new'
|
|
51
|
+
})).filter(educationEntry => rowHasContent(educationEntry) || Boolean(educationEntry.entryNode));
|
|
52
|
+
return {
|
|
53
|
+
educationData: education.length ? education : [{
|
|
54
|
+
school: '',
|
|
55
|
+
startDate: undefined,
|
|
56
|
+
endDate: undefined,
|
|
57
|
+
degree: '',
|
|
58
|
+
location: '',
|
|
59
|
+
description: '',
|
|
60
|
+
entryNode: '',
|
|
61
|
+
status: 'new'
|
|
62
|
+
}]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function validateEducationBeforeSave(rows) {
|
|
66
|
+
for (let i = 0; i < rows.length; i++) {
|
|
67
|
+
const row = rows[i];
|
|
68
|
+
if (!row || row.status === 'deleted') continue;
|
|
69
|
+
if (!rowHasContent(row)) continue;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
ok: true
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function renderEducationInputRow({
|
|
76
|
+
educationData,
|
|
77
|
+
index,
|
|
78
|
+
displayIndex,
|
|
79
|
+
onDelete,
|
|
80
|
+
onChange
|
|
81
|
+
}) {
|
|
82
|
+
const educationRow = educationData[index];
|
|
83
|
+
const label = `Education ${displayIndex + 1}`;
|
|
84
|
+
const educationHeadingId = `education-heading-${index}`;
|
|
85
|
+
const schoolName = `education-school-${index}`;
|
|
86
|
+
const degreeName = `education-degree-${index}`;
|
|
87
|
+
const descriptionName = `education-description-${index}`;
|
|
88
|
+
const descriptionCounterId = `education-description-counter-${index}`;
|
|
89
|
+
const descriptionMaxLength = 2000;
|
|
90
|
+
const descriptionCount = (educationRow?.description || '').length;
|
|
91
|
+
const startMonthLabel = `Start Month ${displayIndex + 1}`;
|
|
92
|
+
const startMonthInputName = `education-start-month-${index}`;
|
|
93
|
+
const startMonthSelectId = `education-start-month-select-${index}`;
|
|
94
|
+
const startYearLabel = `Start Year ${displayIndex + 1}`;
|
|
95
|
+
const startYearInputName = `education-start-year-${index}`;
|
|
96
|
+
const startYearSelectId = `education-start-year-select-${index}`;
|
|
97
|
+
const startDateText = (0, _textUtils.toText)(educationRow?.startDate);
|
|
98
|
+
const startDateParts = parseYearMonthFromDateText(startDateText);
|
|
99
|
+
const startMonthValue = startDateParts.month;
|
|
100
|
+
const startYearText = startDateParts.year;
|
|
101
|
+
const endMonthLabel = `End Month ${displayIndex + 1}`;
|
|
102
|
+
const endMonthInputName = `education-end-month-${index}`;
|
|
103
|
+
const endMonthSelectId = `education-end-month-select-${index}`;
|
|
104
|
+
const endDateText = (0, _textUtils.toText)(educationRow?.endDate);
|
|
105
|
+
const endYearLabel = `End Year ${displayIndex + 1}`;
|
|
106
|
+
const endYearInputName = `education-end-year-${index}`;
|
|
107
|
+
const endYearSelectId = `education-end-year-select-${index}`;
|
|
108
|
+
const endDateParts = parseYearMonthFromDateText(endDateText);
|
|
109
|
+
const endMonthValue = endDateParts.month;
|
|
110
|
+
const endYearParsedText = endDateParts.year;
|
|
111
|
+
const currentYear = new Date().getFullYear();
|
|
112
|
+
const baseYearOptions = Array.from({
|
|
113
|
+
length: 120
|
|
114
|
+
}, (_, i) => String(currentYear - i));
|
|
115
|
+
const yearOptions = Array.from(new Set([...baseYearOptions, startYearText, endYearParsedText].filter(Boolean))).sort((a, b) => Number(b) - Number(a));
|
|
116
|
+
const monthOptions = [{
|
|
117
|
+
value: '01',
|
|
118
|
+
label: 'January'
|
|
119
|
+
}, {
|
|
120
|
+
value: '02',
|
|
121
|
+
label: 'February'
|
|
122
|
+
}, {
|
|
123
|
+
value: '03',
|
|
124
|
+
label: 'March'
|
|
125
|
+
}, {
|
|
126
|
+
value: '04',
|
|
127
|
+
label: 'April'
|
|
128
|
+
}, {
|
|
129
|
+
value: '05',
|
|
130
|
+
label: 'May'
|
|
131
|
+
}, {
|
|
132
|
+
value: '06',
|
|
133
|
+
label: 'June'
|
|
134
|
+
}, {
|
|
135
|
+
value: '07',
|
|
136
|
+
label: 'July'
|
|
137
|
+
}, {
|
|
138
|
+
value: '08',
|
|
139
|
+
label: 'August'
|
|
140
|
+
}, {
|
|
141
|
+
value: '09',
|
|
142
|
+
label: 'September'
|
|
143
|
+
}, {
|
|
144
|
+
value: '10',
|
|
145
|
+
label: 'October'
|
|
146
|
+
}, {
|
|
147
|
+
value: '11',
|
|
148
|
+
label: 'November'
|
|
149
|
+
}, {
|
|
150
|
+
value: '12',
|
|
151
|
+
label: 'December'
|
|
152
|
+
}];
|
|
153
|
+
const renderMonthOptions = selectedMonth => (0, _litHtml.html)`
|
|
154
|
+
<option value="" ?selected=${!selectedMonth}>Select month</option>
|
|
155
|
+
${monthOptions.map(month => (0, _litHtml.html)`
|
|
156
|
+
<option value=${month.value} ?selected=${month.value === selectedMonth}>${month.label}</option>
|
|
157
|
+
`)}
|
|
158
|
+
`;
|
|
159
|
+
const renderYearOptions = selectedYear => (0, _litHtml.html)`
|
|
160
|
+
<option value="" ?selected=${!selectedYear}>Select year</option>
|
|
161
|
+
${yearOptions.map(year => (0, _litHtml.html)`
|
|
162
|
+
<option value=${year} ?selected=${year === selectedYear}>${year}</option>
|
|
163
|
+
`)}
|
|
164
|
+
`;
|
|
165
|
+
const handleEducationInput = field => e => {
|
|
166
|
+
const target = e.target;
|
|
167
|
+
const nextValue = sanitizeEducationFieldValue(target.value);
|
|
168
|
+
if (educationData[index]) {
|
|
169
|
+
(0, _rowState.applyRowFieldChange)(educationData[index], field, nextValue, rowHasContent);
|
|
170
|
+
onChange();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const handleDelete = event => {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
onDelete();
|
|
176
|
+
};
|
|
177
|
+
const buildDateLiteral = (month, year) => {
|
|
178
|
+
if (!month || !year) return undefined;
|
|
179
|
+
return `${year}-${month}-01`;
|
|
180
|
+
};
|
|
181
|
+
const handleStartMonthChange = event => {
|
|
182
|
+
const target = event.target;
|
|
183
|
+
const month = target.value;
|
|
184
|
+
const year = parseYearMonthFromDateText((0, _textUtils.toText)(educationData[index]?.startDate)).year || String(currentYear);
|
|
185
|
+
const nextStartDate = buildDateLiteral(month, year);
|
|
186
|
+
if (educationData[index]) {
|
|
187
|
+
(0, _rowState.applyRowFieldChange)(educationData[index], 'startDate', nextStartDate, rowHasContent);
|
|
188
|
+
onChange();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const handleStartYearChange = event => {
|
|
192
|
+
const target = event.target;
|
|
193
|
+
const year = target.value;
|
|
194
|
+
const month = parseYearMonthFromDateText((0, _textUtils.toText)(educationData[index]?.startDate)).month || '01';
|
|
195
|
+
const nextStartDate = buildDateLiteral(month, year);
|
|
196
|
+
if (educationData[index]) {
|
|
197
|
+
(0, _rowState.applyRowFieldChange)(educationData[index], 'startDate', nextStartDate, rowHasContent);
|
|
198
|
+
onChange();
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
const handleEndMonthChange = event => {
|
|
202
|
+
const target = event.target;
|
|
203
|
+
const month = target.value;
|
|
204
|
+
const year = parseYearMonthFromDateText((0, _textUtils.toText)(educationData[index]?.endDate)).year || String(currentYear);
|
|
205
|
+
const nextEndDate = buildDateLiteral(month, year);
|
|
206
|
+
if (educationData[index]) {
|
|
207
|
+
(0, _rowState.applyRowFieldChange)(educationData[index], 'endDate', nextEndDate, rowHasContent);
|
|
208
|
+
onChange();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const handleEndYearChange = event => {
|
|
212
|
+
const target = event.target;
|
|
213
|
+
const year = target.value;
|
|
214
|
+
const month = parseYearMonthFromDateText((0, _textUtils.toText)(educationData[index]?.endDate)).month || '01';
|
|
215
|
+
const nextEndDate = buildDateLiteral(month, year);
|
|
216
|
+
if (educationData[index]) {
|
|
217
|
+
(0, _rowState.applyRowFieldChange)(educationData[index], 'endDate', nextEndDate, rowHasContent);
|
|
218
|
+
onChange();
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const handleDescriptionInput = event => {
|
|
222
|
+
const target = event.target;
|
|
223
|
+
const nextValue = sanitizeEducationFieldValue(target.value.slice(0, descriptionMaxLength));
|
|
224
|
+
if (educationData[index]) {
|
|
225
|
+
(0, _rowState.applyRowFieldChange)(educationData[index], 'description', nextValue, rowHasContent);
|
|
226
|
+
onChange();
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
return (0, _litHtml.html)`
|
|
230
|
+
<div class="profile-edit-dialog__row" role="group" aria-labelledby=${educationHeadingId}>
|
|
231
|
+
<h4 id=${educationHeadingId} class="profile-edit-dialog__entry-heading">${label}</h4>
|
|
232
|
+
<div class="profile-edit-dialog__actions profile-edit-dialog__actions--edge">
|
|
233
|
+
<button
|
|
234
|
+
type="button"
|
|
235
|
+
class="profile-edit-dialog__delete-button"
|
|
236
|
+
aria-label=${`Delete education ${displayIndex + 1}`}
|
|
237
|
+
title=${_texts.deleteEntryButtonTitleText}
|
|
238
|
+
@click=${handleDelete}
|
|
239
|
+
>
|
|
240
|
+
<span class="profile-edit-dialog__delete-icon" aria-hidden="true">${_profileIcons.trashIcon}</span>
|
|
241
|
+
</button>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
<label aria-label=${`${label} School/College`} class="label profile-edit-dialog__field">
|
|
245
|
+
School/College
|
|
246
|
+
<input
|
|
247
|
+
class="input"
|
|
248
|
+
type="text"
|
|
249
|
+
name=${schoolName}
|
|
250
|
+
.value=${educationData[index]?.school || ''}
|
|
251
|
+
data-contact-field="title"
|
|
252
|
+
data-entry-node=${educationData[index]?.entryNode || ''}
|
|
253
|
+
data-row-status=${educationData[index]?.status || 'n/a'}
|
|
254
|
+
placeholder="School/College"
|
|
255
|
+
autocomplete="organization"
|
|
256
|
+
inputmode="text"
|
|
257
|
+
@change=${handleEducationInput('school')}
|
|
258
|
+
/>
|
|
259
|
+
</label>
|
|
260
|
+
<div class="profile-edit-dialog__row">
|
|
261
|
+
<label aria-label=${`${label} Degree`} class="label profile-edit-dialog__field">
|
|
262
|
+
Degree
|
|
263
|
+
<input
|
|
264
|
+
class="input"
|
|
265
|
+
type="text"
|
|
266
|
+
name=${degreeName}
|
|
267
|
+
.value=${educationData[index]?.degree || ''}
|
|
268
|
+
required
|
|
269
|
+
data-contact-field="degree"
|
|
270
|
+
data-entry-node=${educationData[index]?.entryNode || ''}
|
|
271
|
+
data-row-status=${educationData[index]?.status || 'n/a'}
|
|
272
|
+
placeholder="Degree"
|
|
273
|
+
autocomplete="off"
|
|
274
|
+
inputmode="text"
|
|
275
|
+
@change=${handleEducationInput('degree')}
|
|
276
|
+
/>
|
|
277
|
+
</label>
|
|
278
|
+
</div>
|
|
279
|
+
<div class="profile-edit-dialog__row">
|
|
280
|
+
<label aria-label=${startMonthLabel} class="label profile-edit-dialog__field-type">
|
|
281
|
+
Start Month
|
|
282
|
+
<select name=${startMonthInputName} id=${startMonthSelectId} @change=${handleStartMonthChange}>
|
|
283
|
+
${renderMonthOptions(startMonthValue)}
|
|
284
|
+
</select>
|
|
285
|
+
</label>
|
|
286
|
+
<label aria-label=${startYearLabel} class="label profile-edit-dialog__field-type">
|
|
287
|
+
Start Year
|
|
288
|
+
<select name=${startYearInputName} id=${startYearSelectId} @change=${handleStartYearChange}>
|
|
289
|
+
${renderYearOptions(startYearText)}
|
|
290
|
+
</select>
|
|
291
|
+
</label>
|
|
292
|
+
<label aria-label=${endMonthLabel} class="label profile-edit-dialog__field-type">
|
|
293
|
+
End Month
|
|
294
|
+
<select name=${endMonthInputName} id=${endMonthSelectId} @change=${handleEndMonthChange}>
|
|
295
|
+
${renderMonthOptions(endMonthValue)}
|
|
296
|
+
</select>
|
|
297
|
+
</label>
|
|
298
|
+
<label aria-label=${endYearLabel} class="label profile-edit-dialog__field-type">
|
|
299
|
+
End Year
|
|
300
|
+
<select name=${endYearInputName} id=${endYearSelectId} @change=${handleEndYearChange}>
|
|
301
|
+
${renderYearOptions(endYearParsedText)}
|
|
302
|
+
</select>
|
|
303
|
+
</label>
|
|
304
|
+
</div>
|
|
305
|
+
<label aria-label=${`${label} Description`} class="label profile-edit-dialog__field profile-edit-dialog__field--full profile-edit-dialog__field--stack">
|
|
306
|
+
<span>Description</span>
|
|
307
|
+
<textarea
|
|
308
|
+
class="profile-edit-dialog__textarea"
|
|
309
|
+
name=${descriptionName}
|
|
310
|
+
rows="4"
|
|
311
|
+
.value=${educationData[index]?.description || ''}
|
|
312
|
+
maxlength=${descriptionMaxLength}
|
|
313
|
+
aria-describedby=${descriptionCounterId}
|
|
314
|
+
data-contact-field="description"
|
|
315
|
+
data-entry-node=${educationData[index]?.entryNode || ''}
|
|
316
|
+
data-row-status=${educationData[index]?.status || 'n/a'}
|
|
317
|
+
placeholder="Description"
|
|
318
|
+
autocomplete="off"
|
|
319
|
+
inputmode="text"
|
|
320
|
+
@input=${handleDescriptionInput}
|
|
321
|
+
></textarea>
|
|
322
|
+
<small id=${descriptionCounterId} aria-live="polite">${descriptionCount}/${descriptionMaxLength}</small>
|
|
323
|
+
</label>
|
|
324
|
+
`;
|
|
325
|
+
}
|
|
326
|
+
function renderEducationSection(educationData, onAddRow) {
|
|
327
|
+
const createNewRow = event => {
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
educationData.push({
|
|
330
|
+
school: '',
|
|
331
|
+
degree: '',
|
|
332
|
+
location: '',
|
|
333
|
+
startDate: undefined,
|
|
334
|
+
endDate: undefined,
|
|
335
|
+
description: '',
|
|
336
|
+
entryNode: '',
|
|
337
|
+
status: 'new'
|
|
338
|
+
});
|
|
339
|
+
onAddRow();
|
|
340
|
+
};
|
|
341
|
+
const visibleEducationRows = educationData.map((education, index) => ({
|
|
342
|
+
education,
|
|
343
|
+
index
|
|
344
|
+
})).filter(({
|
|
345
|
+
education
|
|
346
|
+
}) => education.status !== 'deleted');
|
|
347
|
+
return (0, _litHtml.html)`
|
|
348
|
+
<section
|
|
349
|
+
aria-labelledby="education-heading"
|
|
350
|
+
class="educationEditSection section-bg">
|
|
351
|
+
<header class="profile__section-header">
|
|
352
|
+
<h3 id="education-heading" class="profile-edit-dialog__section-heading">
|
|
353
|
+
<span class="sectionTitleIcon" aria-hidden="true">✉</span>
|
|
354
|
+
Education
|
|
355
|
+
</h3>
|
|
356
|
+
<button
|
|
357
|
+
type="button"
|
|
358
|
+
class="profile__action-button profile-action-text flex-center"
|
|
359
|
+
data-dialog-add-more="true"
|
|
360
|
+
aria-label="Add another education entry"
|
|
361
|
+
@click=${createNewRow}
|
|
362
|
+
>
|
|
363
|
+
<span class="profile__add-more-content inline-flex-row">
|
|
364
|
+
<span class="profile__add-more-icon inline-flex-row" aria-hidden="true">${_profileIcons.addIcon}</span>
|
|
365
|
+
Add More
|
|
366
|
+
</span>
|
|
367
|
+
</button>
|
|
368
|
+
</header>
|
|
369
|
+
<fieldset>
|
|
370
|
+
<legend class="sr-only">Education entries</legend>
|
|
371
|
+
${visibleEducationRows.map(({
|
|
372
|
+
index
|
|
373
|
+
}, displayIndex) => renderEducationInputRow({
|
|
374
|
+
educationData,
|
|
375
|
+
index,
|
|
376
|
+
displayIndex,
|
|
377
|
+
onDelete: () => {
|
|
378
|
+
(0, _rowState.deleteRow)(educationData, index);
|
|
379
|
+
onAddRow();
|
|
380
|
+
},
|
|
381
|
+
onChange: onAddRow
|
|
382
|
+
}))}
|
|
383
|
+
</fieldset>
|
|
384
|
+
</section>
|
|
385
|
+
`;
|
|
386
|
+
}
|
|
387
|
+
function renderEducationEditTemplate(form, formState, rerender, viewerMode) {
|
|
388
|
+
(0, _litHtml.render)((0, _litHtml.html)`
|
|
389
|
+
${renderEducationSection(formState.educationData, rerender)}
|
|
390
|
+
${viewerMode !== 'owner' ? (0, _litHtml.html)`<p class="profile-edit-dialog__login-message">${_texts.ownerLoginRequiredDialogMessageText}</p>` : null}
|
|
391
|
+
`, form);
|
|
392
|
+
}
|
|
393
|
+
function createEducationEditForm(educationData, viewerMode) {
|
|
394
|
+
const form = document.createElement('form');
|
|
395
|
+
form.classList.add('profile__edit-form');
|
|
396
|
+
const formState = toFormState(educationData);
|
|
397
|
+
const rerender = () => renderEducationEditTemplate(form, formState, rerender, viewerMode);
|
|
398
|
+
rerender();
|
|
399
|
+
return {
|
|
400
|
+
form,
|
|
401
|
+
formState,
|
|
402
|
+
rerender
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
async function createEducationEditDialog(event, store, subject, educationData, viewerMode, onSaved) {
|
|
406
|
+
const dom = event.currentTarget?.ownerDocument || document;
|
|
407
|
+
const {
|
|
408
|
+
form,
|
|
409
|
+
formState,
|
|
410
|
+
rerender
|
|
411
|
+
} = createEducationEditForm(educationData, viewerMode);
|
|
412
|
+
const triggerAddMore = () => {
|
|
413
|
+
const addMoreButton = form.querySelector('[data-dialog-add-more="true"]');
|
|
414
|
+
if (addMoreButton) addMoreButton.click();
|
|
415
|
+
};
|
|
416
|
+
const result = await (0, _dialog.openInputDialog)({
|
|
417
|
+
title: _texts.editEducationDialogTitleText,
|
|
418
|
+
dom,
|
|
419
|
+
form,
|
|
420
|
+
headerAction: {
|
|
421
|
+
type: 'button',
|
|
422
|
+
label: 'Add More',
|
|
423
|
+
ariaLabel: 'Add another education entry',
|
|
424
|
+
onClick: triggerAddMore
|
|
425
|
+
},
|
|
426
|
+
submitLabel: _texts.dialogSubmitLabelText,
|
|
427
|
+
cancelLabel: _texts.dialogCancelLabelText,
|
|
428
|
+
validate: async () => {
|
|
429
|
+
if (viewerMode !== 'owner') {
|
|
430
|
+
return _texts.ownerLoginRequiredDialogMessageText;
|
|
431
|
+
}
|
|
432
|
+
const plan = (0, _rowState.summarizeRowOps)(formState.educationData, rowHasContent);
|
|
433
|
+
const hasChanges = plan.create.length > 0 || plan.update.length > 0 || plan.remove.length > 0;
|
|
434
|
+
if (!hasChanges) {
|
|
435
|
+
return 'No education changes detected.';
|
|
436
|
+
}
|
|
437
|
+
const validation = validateEducationBeforeSave(formState.educationData);
|
|
438
|
+
if (!validation.ok) {
|
|
439
|
+
return validation.message || 'Please complete the required education fields.';
|
|
440
|
+
}
|
|
441
|
+
return null;
|
|
442
|
+
},
|
|
443
|
+
onSave: async () => {
|
|
444
|
+
const plan = (0, _rowState.summarizeRowOps)(formState.educationData, rowHasContent);
|
|
445
|
+
await (0, _mutations.processEducationMutations)(store, subject, plan);
|
|
446
|
+
rerender();
|
|
447
|
+
},
|
|
448
|
+
formatSaveError: error => {
|
|
449
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
450
|
+
return `${_texts.saveEducationUpdatesFailedPrefixText} ${message}`;
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
if (!result) return;
|
|
454
|
+
if (onSaved) {
|
|
455
|
+
await onSaved();
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
await (0, _dialog.alertDialog)('Education updates saved. Refresh to see latest values.', 'Saved', dom);
|
|
459
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EducationDetails } from './types';
|
|
2
|
+
import { ViewerMode } from '../../types';
|
|
3
|
+
import '../../styles/EducationCard.css';
|
|
4
|
+
import { LiveStore, NamedNode } from 'rdflib';
|
|
5
|
+
export declare const EducationCard: (educationData: EducationDetails[], viewerMode: ViewerMode) => import("lit-html").TemplateResult<1>;
|
|
6
|
+
export declare function renderEducationSection(store: LiveStore, subject: NamedNode, educationData: EducationDetails[], viewerMode: ViewerMode, onSaved?: () => Promise<void> | void): import("lit-html").TemplateResult<1> | "";
|
|
7
|
+
//# sourceMappingURL=EducationSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EducationSection.d.ts","sourceRoot":"","sources":["../../../src/sections/education/EducationSection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,gCAAgC,CAAA;AAEvC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAyE7C,eAAO,MAAM,aAAa,GACxB,eAAe,gBAAgB,EAAE,EACjC,YAAY,UAAU,yCAevB,CAAA;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,gBAAgB,EAAE,EACjC,UAAU,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,6CAiDrC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EducationCard = void 0;
|
|
7
|
+
exports.renderEducationSection = renderEducationSection;
|
|
8
|
+
var _litHtml = require("lit-html");
|
|
9
|
+
require("../../styles/EducationCard.css");
|
|
10
|
+
var _texts = require("../../texts");
|
|
11
|
+
var _EducationEditDialog = require("./EducationEditDialog");
|
|
12
|
+
var _sectionCardHelpers = require("../shared/sectionCardHelpers");
|
|
13
|
+
var _collapsibleSection = require("../shared/collapsibleSection");
|
|
14
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
15
|
+
function formatEducationMonthYearFull(date) {
|
|
16
|
+
if (!date) return '';
|
|
17
|
+
const value = date;
|
|
18
|
+
const year = value.slice(0, 4);
|
|
19
|
+
const month = value.slice(5, 7);
|
|
20
|
+
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
21
|
+
const monthIndex = Number(month) - 1;
|
|
22
|
+
if (!year || monthIndex < 0 || monthIndex > 11) return value;
|
|
23
|
+
return `${monthNames[monthIndex]} ${year}`;
|
|
24
|
+
}
|
|
25
|
+
function renderEducationEntry(educationEntry, index) {
|
|
26
|
+
if (!educationEntry) return (0, _litHtml.html)``;
|
|
27
|
+
const schoolId = `school-title-${index}`;
|
|
28
|
+
const educationPeriodId = `education-period-${index}`;
|
|
29
|
+
const educationOrgId = `education-org-${index}`;
|
|
30
|
+
const educationDescriptionId = `education-description-${index}`;
|
|
31
|
+
const ariaDescribedBy = educationEntry.description ? `${educationPeriodId} ${educationOrgId} ${educationDescriptionId}` : `${educationPeriodId} ${educationOrgId}`;
|
|
32
|
+
return (0, _litHtml.html)`
|
|
33
|
+
<li class="education" role="listitem" aria-labelledby=${schoolId} aria-describedby=${ariaDescribedBy}>
|
|
34
|
+
<div class="educationHeader">
|
|
35
|
+
<h4 id=${schoolId}>${educationEntry.school}</h4>
|
|
36
|
+
<p id=${educationPeriodId} class="educationPeriod">
|
|
37
|
+
${educationEntry.endDate ? (0, _litHtml.html)`<time datetime=${(0, _sectionCardHelpers.toMonthDateTime)(educationEntry.endDate)}>${formatEducationMonthYearFull(educationEntry.endDate)}</time>` : (0, _litHtml.html)`<span>End date unknown</span>`}
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
<p class="educationOrg" id=${educationOrgId}>
|
|
41
|
+
<strong>${educationEntry.degree}</strong>${educationEntry.location ? (0, _litHtml.html)` | ${educationEntry.location}` : ''}
|
|
42
|
+
</p>
|
|
43
|
+
${educationEntry.description ? (0, _litHtml.html)`
|
|
44
|
+
<div class="cvDescriptionWrap">
|
|
45
|
+
<p class="cvDescriptionText" id=${educationDescriptionId}>${educationEntry.description}</p>
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
class="cvDescriptionToggle"
|
|
49
|
+
aria-controls=${educationDescriptionId}
|
|
50
|
+
aria-expanded="false"
|
|
51
|
+
hidden
|
|
52
|
+
@click=${_sectionCardHelpers.toggleDescription}
|
|
53
|
+
>
|
|
54
|
+
...more
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
` : ''}
|
|
58
|
+
</li>
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
function renderEducation(educationData) {
|
|
62
|
+
if (!educationData || !educationData.length) return (0, _litHtml.html)``;
|
|
63
|
+
return (0, _litHtml.html)`${educationData.map((educationEntry, index) => renderEducationEntry(educationEntry, index))}`;
|
|
64
|
+
}
|
|
65
|
+
const EducationCard = (educationData, viewerMode) => {
|
|
66
|
+
void viewerMode;
|
|
67
|
+
const hasEducation = Array.isArray(educationData) && educationData.length > 0;
|
|
68
|
+
if (!hasEducation) return (0, _litHtml.html)``;
|
|
69
|
+
return (0, _litHtml.html)`
|
|
70
|
+
<article class="educationCard" aria-label="Education" data-testid="education">
|
|
71
|
+
<section class="educationSection">
|
|
72
|
+
<ul role="list" aria-label="Education in chronological order">
|
|
73
|
+
${renderEducation(educationData)}
|
|
74
|
+
</ul>
|
|
75
|
+
</section>
|
|
76
|
+
</article>
|
|
77
|
+
`;
|
|
78
|
+
};
|
|
79
|
+
exports.EducationCard = EducationCard;
|
|
80
|
+
function renderEducationSection(store, subject, educationData, viewerMode, onSaved) {
|
|
81
|
+
(0, _sectionCardHelpers.scheduleDescriptionOverflowCheck)();
|
|
82
|
+
const educationCard = EducationCard(educationData, viewerMode);
|
|
83
|
+
const educationDetails = educationData || [];
|
|
84
|
+
const hasEducation = educationDetails && educationDetails.length > 0;
|
|
85
|
+
const showSection = true;
|
|
86
|
+
const isOwner = viewerMode === 'owner';
|
|
87
|
+
return showSection ? (0, _litHtml.html)`
|
|
88
|
+
<section
|
|
89
|
+
aria-labelledby="education-heading"
|
|
90
|
+
class="profile-section-collapsible section-bg"
|
|
91
|
+
role="region"
|
|
92
|
+
tabindex="-1"
|
|
93
|
+
data-expanded="false"
|
|
94
|
+
>
|
|
95
|
+
<header class="profile__section-header profile-section-collapsible__header">
|
|
96
|
+
<h2 id="education-heading" tabindex="-1">${_texts.educationHeadingText}</h2>
|
|
97
|
+
<div class="profile-section-collapsible__actions flex-column">
|
|
98
|
+
${isOwner ? (0, _litHtml.html)`
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
class="profile__action-button profile-action-text flex-center profile-section-collapsible__edit-button"
|
|
102
|
+
aria-label="Edit education details"
|
|
103
|
+
@click=${event => (0, _EducationEditDialog.createEducationEditDialog)(event, store, subject, educationDetails, viewerMode, onSaved)}
|
|
104
|
+
>
|
|
105
|
+
<span class="profile-section-collapsible__edit-label">${_profileIcons.editIcon} Edit</span>
|
|
106
|
+
<span class="profile-section-collapsible__edit-icon" aria-hidden="true">${_profileIcons.editIcon}</span>
|
|
107
|
+
</button>
|
|
108
|
+
` : (0, _litHtml.html)``}
|
|
109
|
+
<button
|
|
110
|
+
type="button"
|
|
111
|
+
class="inline-flex-row"
|
|
112
|
+
aria-label="Toggle education section"
|
|
113
|
+
aria-controls="education-panel"
|
|
114
|
+
aria-expanded="false"
|
|
115
|
+
@click=${_collapsibleSection.toggleCollapsibleSection}
|
|
116
|
+
>
|
|
117
|
+
<span class="profile-section-collapsible__chevron" aria-hidden="true">⌄</span>
|
|
118
|
+
</button>
|
|
119
|
+
</div>
|
|
120
|
+
</header>
|
|
121
|
+
<div id="education-panel" class="profile-section-collapsible__content" aria-hidden="true">
|
|
122
|
+
${hasEducation ? educationCard : (0, _litHtml.html)`<p>No education details added yet.</p>`}
|
|
123
|
+
</div>
|
|
124
|
+
</section>
|
|
125
|
+
` : '';
|
|
126
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LiveStore, NamedNode } from 'rdflib';
|
|
2
|
+
import { EducationMutationPlan } from './types';
|
|
3
|
+
export declare function processEducationMutations(store: LiveStore, subject: NamedNode, mutationPlan: EducationMutationPlan): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/sections/education/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAqB,MAAM,QAAQ,CAAA;AAEhE,OAAO,EAAE,qBAAqB,EAAgB,MAAM,SAAS,CAAA;AAgE7D,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,qBAAqB,iBAOxH"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.processEducationMutations = processEducationMutations;
|
|
7
|
+
var _rdflib = require("rdflib");
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
9
|
+
var _rdfMutationHelpers = require("../shared/rdfMutationHelpers");
|
|
10
|
+
var _texts = require("../../texts");
|
|
11
|
+
const educationMembershipType = _solidUi.ns.schema('EducationalOccupationalCredential');
|
|
12
|
+
function isEducationMembership(store, node, doc) {
|
|
13
|
+
return store.holds(node, _solidUi.ns.rdf('type'), educationMembershipType, doc);
|
|
14
|
+
}
|
|
15
|
+
function buildEducationStatements(subject, doc, node, education, includeMembershipLink = true) {
|
|
16
|
+
const inserts = includeMembershipLink ? [(0, _rdflib.st)(node, _solidUi.ns.org('member'), subject, doc)] : [];
|
|
17
|
+
inserts.push((0, _rdflib.st)(node, _solidUi.ns.rdf('type'), educationMembershipType, doc));
|
|
18
|
+
if (education.school) inserts.push((0, _rdflib.st)(node, _solidUi.ns.schema('name'), (0, _rdflib.literal)(education.school), doc));
|
|
19
|
+
if (education.degree) inserts.push((0, _rdflib.st)(node, _solidUi.ns.schema('educationalCredentialAwarded'), (0, _rdflib.literal)(education.degree), doc));
|
|
20
|
+
if (education.location) inserts.push((0, _rdflib.st)(node, _solidUi.ns.schema('location'), (0, _rdflib.literal)(education.location), doc));
|
|
21
|
+
if (education.startDate) inserts.push((0, _rdflib.st)(node, _solidUi.ns.schema('startDate'), (0, _rdflib.literal)(education.startDate), doc));
|
|
22
|
+
if (education.endDate) inserts.push((0, _rdflib.st)(node, _solidUi.ns.schema('endDate'), (0, _rdflib.literal)(education.endDate), doc));
|
|
23
|
+
if (education.description) inserts.push((0, _rdflib.st)(node, _solidUi.ns.schema('description'), (0, _rdflib.literal)(education.description), doc));
|
|
24
|
+
return inserts;
|
|
25
|
+
}
|
|
26
|
+
async function mutateEducationEntries(store, subject, educationOps) {
|
|
27
|
+
const doc = subject.doc();
|
|
28
|
+
const existingEducationNodes = store.each(null, _solidUi.ns.org('member'), subject, doc).filter(node => isEducationMembership(store, node, doc));
|
|
29
|
+
const deletions = [];
|
|
30
|
+
const insertions = [];
|
|
31
|
+
educationOps.remove.forEach(education => {
|
|
32
|
+
if (!education.entryNode) return;
|
|
33
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingEducationNodes, education.entryNode);
|
|
34
|
+
if (existingNode) {
|
|
35
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
educationOps.update.forEach(education => {
|
|
39
|
+
if (!education.entryNode) return;
|
|
40
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingEducationNodes, education.entryNode);
|
|
41
|
+
if (!existingNode) {
|
|
42
|
+
insertions.push(...buildEducationStatements(subject, doc, store.bnode(), education));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
46
|
+
insertions.push(...buildEducationStatements(subject, doc, existingNode, education));
|
|
47
|
+
});
|
|
48
|
+
educationOps.create.forEach(education => {
|
|
49
|
+
insertions.push(...buildEducationStatements(subject, doc, store.bnode(), education));
|
|
50
|
+
});
|
|
51
|
+
await (0, _rdfMutationHelpers.applyUpdaterPatch)(store, deletions, insertions);
|
|
52
|
+
}
|
|
53
|
+
async function processEducationMutations(store, subject, mutationPlan) {
|
|
54
|
+
try {
|
|
55
|
+
await mutateEducationEntries(store, subject, mutationPlan);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
58
|
+
throw new Error(`${_texts.mutationEducationFailedPrefixText} ${message}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/sections/education/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAQ,MAAM,QAAQ,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AA2E1C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,gBAAgB,EAAE,CAGzF"}
|