studiokit-scaffolding-js 4.11.3 → 4.11.4

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.
@@ -53,6 +53,8 @@ export interface UserRolesOwnProps extends CollectionComponentWrappedProps<UserR
53
53
  renderAddDescription?: (entityName?: string) => JSX.Element;
54
54
  /** (Optional) Provide custom user-friendly names for displayed roles */
55
55
  textForRole?: (role: string) => string;
56
+ /** (Optional) Provide custom user-friendly names for displayed roles that require custom casing */
57
+ lowercaseTextForRole?: (role: string) => string;
56
58
  /** (Optional) Provide custom user-friendly articles ("a" vs. "an") for displayed roles */
57
59
  singularArticleForRole?: (role: string) => string;
58
60
  }
@@ -92,7 +94,7 @@ export declare class UserRoles extends Component<UserRolesProps, UserRolesState>
92
94
  componentDidMount(): void;
93
95
  componentDidUpdate(prevProps: UserRolesProps): void;
94
96
  setStateFromProps: (props: UserRolesProps) => void;
95
- textForRole: (role: string) => string;
97
+ textForRole: (role: string, lowercase?: boolean) => string;
96
98
  singularArticleForRole: (role: string) => string;
97
99
  addUserRoles: (identifiers: string[], role: string) => void;
98
100
  didAdd: (data?: FetchError | AddBusinessModel | undefined) => void;
@@ -106,5 +108,5 @@ export declare class UserRoles extends Component<UserRolesProps, UserRolesState>
106
108
  render(): JSX.Element;
107
109
  }
108
110
  export declare const mapStateToProps: (state: BaseReduxState, ownProps: UserRolesOwnProps) => UserRolesReduxProps;
109
- declare const _default: import("react-redux").ConnectedComponent<typeof UserRoles, Pick<React.ClassAttributes<UserRoles> & UserRolesProps, "externalProviders" | "model" | "ref" | "key" | "readOnly" | "guid" | "load" | "modelName" | "pathParams" | "modelStatus" | "queryParams" | "disableAutoLoad" | "modelArray" | "stopPeriodicLoad" | "create" | "update" | "delete" | "previousModelStatus" | "fetchingId" | "textForRole" | "entityName" | "defaultRole" | "roleDescriptions" | "renderAddDescription" | "isUpdateDisabled" | "isDeleteDisabled" | "allowMultipleRoles" | "requiredRole" | "isAddDisabled" | "modifyUserRoleActivityName" | "deleteOwnUserRoleActivityName" | "addRoleExcludeList" | "entity" | "filterUsers" | "onAdd" | "onUpdate" | "onRemove" | "renderTableDescription" | "singularArticleForRole"> & UserRolesOwnProps>;
111
+ declare const _default: import("react-redux").ConnectedComponent<typeof UserRoles, Pick<React.ClassAttributes<UserRoles> & UserRolesProps, "externalProviders" | "model" | "ref" | "key" | "readOnly" | "guid" | "load" | "modelName" | "pathParams" | "modelStatus" | "queryParams" | "disableAutoLoad" | "modelArray" | "stopPeriodicLoad" | "create" | "update" | "delete" | "previousModelStatus" | "fetchingId" | "textForRole" | "entityName" | "defaultRole" | "roleDescriptions" | "renderAddDescription" | "isUpdateDisabled" | "isDeleteDisabled" | "allowMultipleRoles" | "requiredRole" | "isAddDisabled" | "modifyUserRoleActivityName" | "deleteOwnUserRoleActivityName" | "addRoleExcludeList" | "entity" | "filterUsers" | "onAdd" | "onUpdate" | "onRemove" | "renderTableDescription" | "lowercaseTextForRole" | "singularArticleForRole"> & UserRolesOwnProps>;
110
112
  export default _default;
@@ -96,8 +96,13 @@ var UserRoles = /** @class */ (function (_super) {
96
96
  sortedUsers: sortedUsers
97
97
  });
98
98
  };
99
- _this.textForRole = function (role) {
100
- return _this.props.textForRole ? _this.props.textForRole(role) : baseRole_2.textForBaseRole(role);
99
+ _this.textForRole = function (role, lowercase) {
100
+ if (lowercase === void 0) { lowercase = false; }
101
+ if (lowercase && _this.props.lowercaseTextForRole) {
102
+ return _this.props.lowercaseTextForRole(role);
103
+ }
104
+ var roleString = _this.props.textForRole ? _this.props.textForRole(role) : baseRole_2.textForBaseRole(role);
105
+ return lowercase ? roleString.toLowerCase() : roleString;
101
106
  };
102
107
  _this.singularArticleForRole = function (role) {
103
108
  return _this.props.singularArticleForRole
@@ -153,7 +158,7 @@ var UserRoles = /** @class */ (function (_super) {
153
158
  return;
154
159
  }
155
160
  var _c = data, addedUserRoles = _c.addedUserRoles, existingUserRoles = _c.existingUserRoles, blockedUserRoles = _c.blockedUserRoles, invalidIdentifiers = _c.invalidIdentifiers, allowedDomains = _c.allowedDomains, invalidDomainIdentifiers = _c.invalidDomainIdentifiers;
156
- var roleString = _this.textForRole(roleForAdd).toLowerCase();
161
+ var roleString = _this.textForRole(roleForAdd, true);
157
162
  var singularArticleString = _this.singularArticleForRole(roleForAdd);
158
163
  var addedNames = !!addedUserRoles && addedUserRoles.length > 0
159
164
  ? addedUserRoles
@@ -242,7 +247,7 @@ var UserRoles = /** @class */ (function (_super) {
242
247
  throw new Error('`didUpdate` was called without setting `roleForUpdate` in state');
243
248
  }
244
249
  var name = user_1.displayName(userRoleToUpdate);
245
- var roleString = _this.textForRole(roleForUpdate).toLowerCase();
250
+ var roleString = _this.textForRole(roleForUpdate, true);
246
251
  var singularArticleString = _this.singularArticleForRole(roleForUpdate);
247
252
  if (!isSuccess) {
248
253
  var failMessage = "Oops! There was an error updating " + name + " to " + singularArticleString + " " + roleString + (entityName ? " in your " + entityName : '') + ". Please try again.";
@@ -279,7 +284,7 @@ var UserRoles = /** @class */ (function (_super) {
279
284
  _this.renderRemoveUserRoleDescription = function (userRoleToRemove, warning) {
280
285
  var _a = _this.props, entity = _a.entity, externalProviders = _a.externalProviders;
281
286
  var group = entity && entity.externalGroups ? entity : undefined;
282
- var roleString = _this.textForRole(userRoleToRemove.role).toLowerCase();
287
+ var roleString = _this.textForRole(userRoleToRemove.role, true);
283
288
  var singularArticleString = _this.singularArticleForRole(userRoleToRemove.role);
284
289
  var defaultWarning = warning !== null && warning !== void 0 ? warning : (react_1.default.createElement("p", { className: "ma0" },
285
290
  "Are you sure you want to ",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "studiokit-scaffolding-js",
3
- "version": "4.11.3",
3
+ "version": "4.11.4",
4
4
  "description": "Common scaffolding for Studio apps at Purdue",
5
5
  "repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
6
6
  "license": "MIT",