forms-angular 0.12.0-beta.354 → 0.12.0-beta.355
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/dist/client/forms-angular-bs-common.less +19 -0
- package/dist/client/forms-angular-with-bs2.css +1 -1
- package/dist/client/forms-angular-with-bs3.css +1 -1
- package/dist/client/forms-angular.js +29 -7
- package/dist/client/forms-angular.min.js +1 -1
- package/dist/client/index.d.ts +10 -1
- package/dist/server/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4131,8 +4131,24 @@ var fng;
|
|
|
4131
4131
|
* All methods should be state-less
|
|
4132
4132
|
*
|
|
4133
4133
|
*/
|
|
4134
|
-
|
|
4134
|
+
// Most severe first
|
|
4135
4135
|
RecordHandlerService.$inject = ["$location", "$window", "$filter", "$timeout", "$sce", "RoutingService", "CssFrameworkService", "SubmissionsService", "SchemasService"];
|
|
4136
|
+
var MESSAGE_TYPE_SEVERITY = ["error", "warning", "info", "success"];
|
|
4137
|
+
var DEFAULT_MESSAGE_TITLES = {
|
|
4138
|
+
error: "Error!",
|
|
4139
|
+
warning: "Warning",
|
|
4140
|
+
info: "Information",
|
|
4141
|
+
success: "Success",
|
|
4142
|
+
};
|
|
4143
|
+
function normaliseMessageType(type) {
|
|
4144
|
+
return MESSAGE_TYPE_SEVERITY.includes(type) ? type : "error";
|
|
4145
|
+
}
|
|
4146
|
+
function mostSevereMessageType(a, b) {
|
|
4147
|
+
var aSeverity = MESSAGE_TYPE_SEVERITY.indexOf(normaliseMessageType(a));
|
|
4148
|
+
var bSeverity = MESSAGE_TYPE_SEVERITY.indexOf(normaliseMessageType(b));
|
|
4149
|
+
return MESSAGE_TYPE_SEVERITY[Math.min(aSeverity, bSeverity)];
|
|
4150
|
+
}
|
|
4151
|
+
/*@ngInject*/
|
|
4136
4152
|
function RecordHandlerService($location, $window, $filter, $timeout, $sce, RoutingService, CssFrameworkService, SubmissionsService, SchemasService) {
|
|
4137
4153
|
var _this = this;
|
|
4138
4154
|
// TODO: Put this in a service
|
|
@@ -4740,7 +4756,7 @@ var fng;
|
|
|
4740
4756
|
if ((resp === null || resp === void 0 ? void 0 : resp.dirty) === true) {
|
|
4741
4757
|
$scope.cancel();
|
|
4742
4758
|
setTimeout(function () {
|
|
4743
|
-
$scope.showError(resp.dirtyMessage, "Record Locked");
|
|
4759
|
+
$scope.showError(resp.dirtyMessage, "Record Locked", "warning");
|
|
4744
4760
|
});
|
|
4745
4761
|
}
|
|
4746
4762
|
}
|
|
@@ -5281,13 +5297,14 @@ var fng;
|
|
|
5281
5297
|
// scope.$emit('showErrorMessage', {title: 'Your error Title', body: 'The body of the error message'});
|
|
5282
5298
|
// or
|
|
5283
5299
|
// scope.$broadcast('showErrorMessage', {title: 'Your error Title', body: 'The body of the error message'});
|
|
5300
|
+
// add type: 'warning' | 'info' | 'success' for messages that are not errors (the default type is 'error')
|
|
5284
5301
|
$scope.$on("showErrorMessage", function (event, args) {
|
|
5285
5302
|
if (!event.defaultPrevented) {
|
|
5286
5303
|
event.defaultPrevented = true;
|
|
5287
|
-
$scope.showError(args.body, args.title);
|
|
5304
|
+
$scope.showError(args.body, args.title, args.type);
|
|
5288
5305
|
}
|
|
5289
5306
|
});
|
|
5290
|
-
$scope.showError = function (error, alertTitle) {
|
|
5307
|
+
$scope.showError = function (error, alertTitle, type) {
|
|
5291
5308
|
function generateErrorText() {
|
|
5292
5309
|
$timeout(function () {
|
|
5293
5310
|
$scope.phase = "ready";
|
|
@@ -5324,7 +5341,11 @@ var fng;
|
|
|
5324
5341
|
$scope.errorMessage = "";
|
|
5325
5342
|
}
|
|
5326
5343
|
$scope.errorMessage += generateErrorText();
|
|
5327
|
-
|
|
5344
|
+
// when a message is added to one that is already showing, the more severe type wins
|
|
5345
|
+
$scope.alertType = $scope.errorVisible
|
|
5346
|
+
? mostSevereMessageType($scope.alertType, type)
|
|
5347
|
+
: normaliseMessageType(type);
|
|
5348
|
+
$scope.alertTitle = alertTitle ? alertTitle : DEFAULT_MESSAGE_TITLES[$scope.alertType];
|
|
5328
5349
|
$scope.errorHideTimer = window.setTimeout(function () {
|
|
5329
5350
|
$scope.dismissError();
|
|
5330
5351
|
$scope.$digest();
|
|
@@ -5346,6 +5367,7 @@ var fng;
|
|
|
5346
5367
|
$scope.errorVisible = false;
|
|
5347
5368
|
delete $scope.errorMessage;
|
|
5348
5369
|
delete $scope.alertTitle;
|
|
5370
|
+
delete $scope.alertType;
|
|
5349
5371
|
};
|
|
5350
5372
|
$scope.stickError = function () {
|
|
5351
5373
|
clearTimeout($scope.errorHideTimer);
|
|
@@ -6187,8 +6209,8 @@ $templateCache.put('base-edit.html','<div ng-controller="BaseCtrl">\n <error-
|
|
|
6187
6209
|
$templateCache.put('base-list-view.html','<div ng-controller="BaseCtrl">\n <error-display></error-display>\n <div ng-hide="!showLoading" class="loading">Loading…</div>\n <div ng-class="css(\'rowFluid\')" class="page-header list-header">\n <div class="header-lhs col-sm-8 span8">\n <h1>{{modelNameDisplay}}</h1>\n </div>\n </div>\n <div class="page-body list-body">\n <div ng-class="css(\'rowFluid\')" infinite-scroll="scrollTheList()">\n <a ng-repeat="record in recordList" ng-href="{{generateViewUrl(record)}}">\n <div class="list-item">\n <div ng-class="css(\'span\',12/listSchema.length)" ng-repeat="field in listSchema">{{getListData(record, field.name)}} </div>\n </div>\n </a>\n </div>\n </div>\n</div>\n');
|
|
6188
6210
|
$templateCache.put('base-list.html','<div ng-controller="BaseCtrl">\n <error-display></error-display>\n <div ng-hide="!showLoading" class="loading">Loading…</div>\n <div ng-class="css(\'rowFluid\')" class="page-header list-header">\n <div class="header-lhs col-sm-8 span8">\n <h1>{{modelNameDisplay}}</h1>\n </div>\n <div class="header-rhs col-sm-2 span2">\n <a ng-href="{{generateNewUrl()}}"><button id="newBtn" class="btn btn-default"><i class="icon-plus"></i> New</button></a>\n </div>\n </div>\n <div class="page-body list-body">\n <div ng-class="css(\'rowFluid\')" infinite-scroll="scrollTheList()">\n <a ng-repeat="record in recordList" ng-href="{{generateEditUrl(record)}}">\n <div class="list-item">\n <div ng-class="css(\'span\',12/listSchema.length)" ng-repeat="field in listSchema">{{getListData(record, field.name)}} </div>\n </div>\n </a>\n </div>\n </div>\n</div>\n');
|
|
6189
6211
|
$templateCache.put('base-view.html','<div ng-controller="BaseCtrl">\n <error-display></error-display>\n <div ng-hide="phase == \'ready\' && !spinning" class="loading">Loading…</div>\n <div ng-class="css(\'rowFluid\')" class="page-header edit-header">\n <div class="header-lhs col-sm-8 span8">\n <h1 id="header-text">{{modelNameDisplay}} :\n <span ng-repeat="field in listSchema" ng-bind-html="getListData(record, field.name) + \' \'"></span>\n </h1>\n </div>\n </div>\n <div class="container-fluid page-body edit-body">\n <form-input name="baseForm" schema="baseSchema()" formstyle="compact" viewform="true"></form-input>\n </div>\n</div>\n');
|
|
6190
|
-
$templateCache.put('error-display-bs2.html','<div id="display-error" ng-show="errorVisible" class="
|
|
6191
|
-
$templateCache.put('error-display-bs3.html','<div id="display-error" ng-show="errorVisible" class="
|
|
6212
|
+
$templateCache.put('error-display-bs2.html','<div id="display-error" ng-show="errorVisible" class="ng-hide">\n <div class="alert" ng-class="{\'error\': \'alert-error\', \'warning\': \'\', \'info\': \'alert-info\', \'success\': \'alert-success\'}[alertType || \'error\']" role="{{ alertType === \'error\' || alertType === \'warning\' || !alertType ? \'alert\' : \'status\' }}">\n <button type="button" id="err-hide" class="close" ng-click="dismissError()"><i class="icon-remove"></i></button>\n <button type="button" id="err-pin" class="close" ng-click="stickError()"><i class="icon-eye-open"></i></button>\n <h4 id="err-title">{{alertTitle}}</h4>\n <div id="err-msg" ng-bind-html="errorMessage"></div>\n </div>\n</div>\n');
|
|
6213
|
+
$templateCache.put('error-display-bs3.html','<div id="display-error" ng-show="errorVisible" class="ng-hide">\n <div class="alert" ng-class="{\'error\': \'alert-error alert-danger\', \'warning\': \'alert-warning\', \'info\': \'alert-info\', \'success\': \'alert-success\'}[alertType || \'error\']" role="{{ alertType === \'error\' || alertType === \'warning\' || !alertType ? \'alert\' : \'status\' }}">\n <button type="button" id="err-hide" class="close" ng-click="dismissError()"><i class="glyphicon glyphicon-remove"></i></button>\n <button type="button" id="err-pin" class="close" ng-click="stickError()"><i class="glyphicon glyphicon-pushpin"></i></button>\n <h4 id="err-title">{{alertTitle}}</h4>\n <div id="err-msg" ng-bind-html="errorMessage"></div>\n </div>\n</div>\n');
|
|
6192
6214
|
$templateCache.put('error-messages.html','<div ng-message="required">A value is required for this field</div>\n<div ng-message="minlength">Too few characters entered</div>\n<div ng-message="maxlength">Too many characters entered</div>\n<div ng-message="min">That value is too small</div>\n<div ng-message="max">That value is too large</div>\n<div ng-message="email">You need to enter a valid email address</div>\n<div ng-message="pattern">This field does not match the expected pattern</div>\n');
|
|
6193
6215
|
$templateCache.put('form-button-bs2.html','<div class="form-btn-grp">\n <div class="btn-group pull-right">\n <button id="saveButton" class="btn btn-mini btn-primary form-btn" ng-click="save()" ng-disabled="isSaveDisabled()"><i class="icon-ok"></i> Save</button>\n <div id="why-disabled" ng-class="{showwhy:!!whyDisabled}" ng-bind-html="whyDisabled"></div>\n <button id="cancelButton" class="btn btn-mini btn-warning form-btn" ng-click="cancel()" ng-disabled="isCancelDisabled()"><i class="icon-remove"></i> Cancel</button>\n </div>\n <div class="btn-group pull-right">\n <button id="newButton" class="btn btn-mini btn-success form-btn" ng-click="newClick()" ng-disabled="isNewDisabled()"><i class="icon-plus"></i> New</button>\n <button id="deleteButton" class="btn btn-mini btn-danger form-btn" ng-click="deleteClick()" ng-disabled="isDeleteDisabled()"><i class="icon-minus"></i> Delete</button>\n </div>\n</div>\n');
|
|
6194
6216
|
$templateCache.put('form-button-bs3.html','<div class="form-btn-grp">\n <div class="btn-group pull-right">\n <button id="saveButton" class="btn btn-primary form-btn btn-xs" ng-click="save()" ng-disabled="isSaveDisabled()"><i class="glyphicon glyphicon-ok"></i> Save</button>\n <div id="why-disabled" ng-class="{showwhy:!!whyDisabled}" ng-bind-html="whyDisabled"></div>\n <button id="cancelButton" class="btn btn-warning form-btn btn-xs" ng-click="cancel()" ng-disabled="isCancelDisabled()"><i class="glyphicon glyphicon-remove"></i> Cancel</button>\n </div>\n <div class="btn-group pull-right">\n <button id="newButton" class="btn btn-success form-btn btn-xs" ng-click="newClick()" ng-disabled="isNewDisabled()"><i class="glyphicon glyphicon-plus"></i> New</button>\n <button id="deleteButton" class="btn btn-danger form-btn btn-xs" ng-click="deleteClick()" ng-disabled="isDeleteDisabled()"><i class="glyphicon glyphicon-minus"></i> Delete</button>\n </div>\n</div>\n');
|