Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zenginehq/frontend-config

Package Overview
Dependencies
Maintainers
6
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zenginehq/frontend-config - npm Package Compare versions

Comparing version 3.13.1 to 3.14.0

2

package.json
{
"name": "@zenginehq/frontend-config",
"version": "3.13.1",
"version": "3.14.0",
"description": "Helper module for implementing Zengine plugin configuration forms.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -207,3 +207,3 @@ plugin.service('wgnConfigInputs', [function () {

valid = valid && opts.format ?
['M/d/yyyy', 'yyyy', 'yy'].indexOf(opts.format) !== -1 :
['MM/dd/yyyy', 'M/d/yyyy', 'yyyy', 'yy'].indexOf(opts.format) !== -1 :
valid;

@@ -219,3 +219,5 @@

valid = valid && opts.date ? opts.date instanceof Date : valid;
Object.keys(opts).forEach(function(option) {
valid = valid && ['format', 'mode', 'showWeeks'].indexOf(option) !== -1;
});

@@ -222,0 +224,0 @@ return valid;

plugin.controller('wgnDateInputCtrl', ['$scope', function ($scope) {
// UI Bootstrap Datepicker Popup directive https://angular-ui.github.io/bootstrap/
// UI Bootstrap Datepicker Popup directive:
// http://angular-ui.github.io/bootstrap/versioned-docs/0.12.1/#/datepicker
/**
* Default options
* Configuration - only used if custom options are provided
*/
$scope.picker = {
date: new Date(),
format: 'M/d/yyyy',
date: null,
format: 'MM/dd/yyyy',
mode: 'day',
opened: false,
settings: {
datepickerMode: "'day'",
minMode: 'day',
showWeeks: 'true'
showWeeks: true
}

@@ -20,7 +21,11 @@ };

* Add the provided settings to the default datepicker configuration.
* Verify that the settings align with any previously stored value.
*/
var init = function init() {
var configureOptions = function configureOptions() {
var field = $scope.editing.config[$scope.field.id];
var options = $scope.field.options;
// implement the provided options
for (var opt in options) {
if (options.hasOwnProperty(opt)) {

@@ -38,14 +43,57 @@

// datepickerMode and minMode need to be the same value
if (opt === 'mode') {
// datepickerMode needs to be a nested string; "'month'"
$scope.picker.settings.datepickerMode = '"'.concat(options[opt], '"');
$scope.picker.settings.minMode = options[opt];
}
}
}
$scope.picker.settings.minMode = $scope.picker.mode;
if (field) {
field = field.toString();
if (field.length === 2 && $scope.picker.format === 'yy') {
// convert two digit year to full date
$scope.picker.date = new Date();
$scope.picker.date.setFullYear(
$scope.picker.date
.getFullYear()
.toString()
.slice(0, 2)
.concat(field)
);
} else if (field.length === 4 && $scope.picker.format === 'yyyy') {
// convert 4 digit year to full date
$scope.picker.date = new Date();
$scope.picker.date.setFullYear(field);
} else if (field.length === $scope.picker.format.length) {
// full date; 'MM/dd/yyyy' or 'M/d/yyyy'
$scope.picker.date = new Date(field);
} else {
throw new Error(
'Config: '.concat(
'Date picker options do not match the format of the stored value. ',
"\n",
'Clear the original value before modifying the options.'
)
);
}
}
};
var init = function init() {
if ($scope.field.options) { configureOptions(); }
};
/**

@@ -57,15 +105,26 @@ * Return a formatted string of the currently selected date.

$scope.picker._format = function _format() {
var date = this.date;
var formats = {
'MM/dd/yyyy': function() {
return date ? date.toLocaleDateString('en-us', {
day: '2-digit',
month: '2-digit',
year: 'numeric'
}) :
null;
},
'M/d/yyyy': function() {
return $scope.picker.date.toLocaleDateString('en-us', {
return date ? date.toLocaleDateString('en-us', {
day: 'numeric',
month: 'numeric',
day: 'numeric',
year: 'numeric'
});
}) :
null;
},
'yyyy': function() {
return $scope.picker.date.getFullYear();
return date ? date.getFullYear().toString() : null;
},
'yy': function() {
return ($scope.picker.date.getFullYear() + '').slice(2, 4);
return date ? date.getFullYear().toString().slice(2, 4) : null;
}

@@ -78,5 +137,5 @@ };

/**
* Open the picker.
* Toggle the picker
*/
$scope.picker.open = function open($event) {
$scope.picker.toggle = function toggle($event) {
this.opened = !this.opened;

@@ -88,3 +147,3 @@ };

*/
$scope.setModel = function setModel($event) {
$scope.setModel = function setModel() {
$scope.editing.config[$scope.field.id] = $scope.picker._format();

@@ -91,0 +150,0 @@ };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc