@amalto/helpers
Advanced tools
Comparing version 1.9.85 to 1.9.86
@@ -7,9 +7,9 @@ "use strict"; | ||
label: 'EN', | ||
locale: 'en-US' | ||
locale: 'en-US', | ||
}, | ||
{ | ||
label: 'FR', | ||
locale: 'fr-FR' | ||
} | ||
locale: 'fr-FR', | ||
}, | ||
]; | ||
//# sourceMappingURL=Config.js.map |
@@ -64,3 +64,3 @@ "use strict"; | ||
function compileWordings(wordings, locale) { | ||
locale = locale || "en-US"; | ||
locale = locale || 'en-US'; | ||
var res = Object.keys(wordings).reduce(function (dic, key) { | ||
@@ -132,3 +132,3 @@ dic[key] = wordings[key][locale]; | ||
return '&'; | ||
case '\'': | ||
case "'": | ||
return '&apos'; | ||
@@ -157,3 +157,3 @@ case '"': | ||
return arr.reduce(function (prev, next) { | ||
return (prev < next ? prev : next); | ||
return prev < next ? prev : next; | ||
}); | ||
@@ -164,3 +164,3 @@ } | ||
return arr.reduce(function (prev, next) { | ||
return (prev > next ? prev : next); | ||
return prev > next ? prev : next; | ||
}); | ||
@@ -199,6 +199,8 @@ } | ||
if (link.search) { | ||
link.search += ('&' + encodeURIComponent(key) + '=' + encodeURIComponent(value)); | ||
link.search += | ||
'&' + encodeURIComponent(key) + '=' + encodeURIComponent(value); | ||
} | ||
else { | ||
link.search = ('?' + encodeURIComponent(key) + '=' + encodeURIComponent(value)); | ||
link.search = | ||
'?' + encodeURIComponent(key) + '=' + encodeURIComponent(value); | ||
} | ||
@@ -210,3 +212,5 @@ return link; | ||
var result = {}; | ||
Object.keys(object).sort().forEach(function (key) { | ||
Object.keys(object) | ||
.sort() | ||
.forEach(function (key) { | ||
result[key] = object[key]; | ||
@@ -219,3 +223,6 @@ }); | ||
var result = {}; | ||
Object.keys(object).sort().reverse().forEach(function (key) { | ||
Object.keys(object) | ||
.sort() | ||
.reverse() | ||
.forEach(function (key) { | ||
result[key] = object[key]; | ||
@@ -229,3 +236,3 @@ }); | ||
var blob = new Blob([json], { | ||
type: 'application/json' | ||
type: 'application/json', | ||
}); | ||
@@ -241,3 +248,5 @@ triggerDataDownload(blob, "".concat(fileName, "_").concat(new Date().toISOString().substr(0, 19)).concat(extension || '.json')); | ||
function triggerDataDownload(data, fileName, dataUrl) { | ||
var url = dataUrl ? data : URL.createObjectURL(data); | ||
var url = dataUrl | ||
? data | ||
: URL.createObjectURL(data); | ||
var link = document.createElement('a'); | ||
@@ -274,4 +283,12 @@ link.href = url; | ||
if (flagName !== 'eunread') { | ||
if ((flagDef.inversed && flags.indexOf(flagName) === -1) || (!flagDef.inversed && flags.indexOf(flagName) !== -1)) { | ||
flagsHtml += '<span class="fa-fw right-spaced text-xlarge ' + flagDef.iconColor + ' ' + flagDef.iconShape + '" title="' + flagDef.flagLabel[locale] + '"></span>'; | ||
if ((flagDef.inversed && flags.indexOf(flagName) === -1) || | ||
(!flagDef.inversed && flags.indexOf(flagName) !== -1)) { | ||
flagsHtml += | ||
'<span class="fa-fw right-spaced text-xlarge ' + | ||
flagDef.iconColor + | ||
' ' + | ||
flagDef.iconShape + | ||
'" title="' + | ||
flagDef.flagLabel[locale] + | ||
'"></span>'; | ||
} | ||
@@ -292,3 +309,3 @@ } | ||
btn: null, | ||
color: null | ||
color: null, | ||
}; | ||
@@ -313,3 +330,5 @@ styles.forEach(function (style) { | ||
}).map(function (language, idx) { | ||
return language.locale.substr(0, 2).toLowerCase() + ';q=' + (0.8 - (idx / 10)).toString(); | ||
return (language.locale.substr(0, 2).toLowerCase() + | ||
';q=' + | ||
(0.8 - idx / 10).toString()); | ||
}); | ||
@@ -346,23 +365,31 @@ return locale.substr(0, 2).toLowerCase() + ',' + notSelected.join(','); | ||
function getJSTreeData(orgTreeData, openedNodes) { | ||
return orgTreeData ? { | ||
id: orgTreeData.id, | ||
text: orgTreeData.id === '0' ? '' : orgTreeData.elementName, | ||
data: { | ||
description: orgTreeData.description, | ||
propertiesMap: orgTreeData.propertiesMap, | ||
parentId: orgTreeData.parentId, | ||
childNames: orgTreeData.children ? orgTreeData.children.map(function (child) { return child.elementName; }) : [] | ||
}, | ||
children: orgTreeData.children ? orgTreeData.children.map(function (child) { | ||
return getJSTreeData(child, openedNodes); | ||
}) : null, | ||
icon: (0, classnames_1.default)('fas fa-fw', { | ||
'fa-th-large font-color-lighter': orgTreeData.id !== '0', | ||
'fa-terminal black-color': orgTreeData.id === '0', | ||
}), | ||
state: { | ||
opened: openedNodes ? openedNodes.indexOf(orgTreeData.id) !== -1 : false, | ||
disabled: orgTreeData.id === '-1' | ||
return orgTreeData | ||
? { | ||
id: orgTreeData.id, | ||
text: orgTreeData.id === '0' ? '' : orgTreeData.elementName, | ||
data: { | ||
description: orgTreeData.description, | ||
propertiesMap: orgTreeData.propertiesMap, | ||
parentId: orgTreeData.parentId, | ||
childNames: orgTreeData.children | ||
? orgTreeData.children.map(function (child) { return child.elementName; }) | ||
: [], | ||
}, | ||
children: orgTreeData.children | ||
? orgTreeData.children.map(function (child) { | ||
return getJSTreeData(child, openedNodes); | ||
}) | ||
: null, | ||
icon: (0, classnames_1.default)('fas fa-fw', { | ||
'fa-th-large font-color-lighter': orgTreeData.id !== '0', | ||
'fa-terminal black-color': orgTreeData.id === '0', | ||
}), | ||
state: { | ||
opened: openedNodes | ||
? openedNodes.indexOf(orgTreeData.id) !== -1 | ||
: false, | ||
disabled: orgTreeData.id === '-1', | ||
}, | ||
} | ||
} : null; | ||
: null; | ||
} | ||
@@ -375,3 +402,3 @@ exports.getJSTreeData = getJSTreeData; | ||
container: 'body', | ||
placement: 'auto top' | ||
placement: 'auto top', | ||
}); | ||
@@ -428,14 +455,19 @@ $elementTooltips_1.on('click', function () { | ||
var searchElements = searchString.toLowerCase().split(' '); | ||
var filteredCollection = searchString ? collection.filter(function (item) { | ||
var data = properties.map(function (property) { | ||
if (property.split('.').length > 1) { | ||
return getNestedValue(item, property); | ||
} | ||
else { | ||
return item[property]; | ||
} | ||
}).join().toLowerCase(); | ||
var matches = searchElements.map(function (search) { return data.indexOf(search) !== -1; }); | ||
return matches.filter(function (matched) { return !matched; }).length === 0; | ||
}) : collection; | ||
var filteredCollection = searchString | ||
? collection.filter(function (item) { | ||
var data = properties | ||
.map(function (property) { | ||
if (property.split('.').length > 1) { | ||
return getNestedValue(item, property); | ||
} | ||
else { | ||
return item[property]; | ||
} | ||
}) | ||
.join() | ||
.toLowerCase(); | ||
var matches = searchElements.map(function (search) { return data.indexOf(search) !== -1; }); | ||
return matches.filter(function (matched) { return !matched; }).length === 0; | ||
}) | ||
: collection; | ||
return filteredCollection; | ||
@@ -482,7 +514,11 @@ } | ||
function displayString(value, defaultValue) { | ||
return isNotEmpty(value) ? value : isNotEmpty(defaultValue) ? defaultValue : '-'; | ||
return isNotEmpty(value) | ||
? value | ||
: isNotEmpty(defaultValue) | ||
? defaultValue | ||
: '-'; | ||
} | ||
exports.displayString = displayString; | ||
function areJsonEqual(first, second) { | ||
if (!first && !second || !first || !second) { | ||
if ((!first && !second) || !first || !second) { | ||
return false; | ||
@@ -501,3 +537,6 @@ } | ||
function nestedPathAttributesExist(collection, attributes) { | ||
if (!collection || $.isEmptyObject(collection) || !attributes || attributes.length === 0) { | ||
if (!collection || | ||
$.isEmptyObject(collection) || | ||
!attributes || | ||
attributes.length === 0) { | ||
return false; | ||
@@ -504,0 +543,0 @@ } |
export interface Language { | ||
label: string, | ||
locale: string | ||
label: string; | ||
locale: string; | ||
} | ||
export const AVAILABLE_LANGUAGES: Language[] = [ | ||
{ | ||
label: 'EN', | ||
locale: 'en-US' | ||
}, | ||
{ | ||
label: 'FR', | ||
locale: 'fr-FR' | ||
} | ||
] | ||
{ | ||
label: 'EN', | ||
locale: 'en-US', | ||
}, | ||
{ | ||
label: 'FR', | ||
locale: 'fr-FR', | ||
}, | ||
]; |
interface OrgModel { | ||
id?: string; | ||
parentId?: string; | ||
elementName?: string; | ||
description?: string; | ||
propertiesMap?: { | ||
[key: string]: { | ||
contentType: string; | ||
contentBytes: string; | ||
}; | ||
id?: string; | ||
parentId?: string; | ||
elementName?: string; | ||
description?: string; | ||
propertiesMap?: { | ||
[key: string]: { | ||
contentType: string; | ||
contentBytes: string; | ||
}; | ||
children?: OrgModel[]; | ||
}; | ||
children?: OrgModel[]; | ||
} | ||
@@ -17,24 +17,24 @@ | ||
interface TreeNodeModel { | ||
id: string; | ||
text: string; | ||
children?: TreeNodeModel[]; | ||
icon?: string; | ||
data?: { | ||
description?: string; | ||
propertiesMap?: { | ||
[key: string]: { | ||
contentType: string; | ||
contentBytes: string; | ||
}; | ||
}; | ||
parentId?: string; | ||
childNames?: string[]; | ||
id: string; | ||
text: string; | ||
children?: TreeNodeModel[]; | ||
icon?: string; | ||
data?: { | ||
description?: string; | ||
propertiesMap?: { | ||
[key: string]: { | ||
contentType: string; | ||
contentBytes: string; | ||
}; | ||
}; | ||
state?: { | ||
opened?: boolean; | ||
disabled?: boolean; | ||
selected?: boolean; | ||
} | ||
parentId?: string; | ||
childNames?: string[]; | ||
}; | ||
state?: { | ||
opened?: boolean; | ||
disabled?: boolean; | ||
selected?: boolean; | ||
}; | ||
} | ||
export { OrgModel, TreeNodeModel } | ||
export { OrgModel, TreeNodeModel }; |
170
package.json
{ | ||
"name": "@amalto/helpers", | ||
"displayName": "Helpers", | ||
"description": "Helpers functions used across Platform 6 core and components.", | ||
"version": "1.9.85", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/amalto/platform6-ui-components" | ||
}, | ||
"keywords": [ | ||
"user-interface", | ||
"react", | ||
"typescript" | ||
"name": "@amalto/helpers", | ||
"displayName": "Helpers", | ||
"description": "Helpers functions used across Platform 6 core and components.", | ||
"version": "1.9.86", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/amalto/platform6-ui-components" | ||
}, | ||
"keywords": [ | ||
"user-interface", | ||
"react", | ||
"typescript" | ||
], | ||
"main": "./build/index.js", | ||
"typings": "./build/index.d.ts", | ||
"author": "Amalto Technologies", | ||
"scripts": { | ||
"setup": "npm install", | ||
"build": "rm -rf ./build/; tsc", | ||
"test": "nyc ava ./test/test.js --verbose" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@amalto/typings": "1.9.69", | ||
"@amalto/wordings": "1.9.34", | ||
"base-64": "0.1.0", | ||
"classnames": "^2.2.6", | ||
"md5": "2.2.1", | ||
"react": "15.6.2", | ||
"react-dom": "15.6.2" | ||
}, | ||
"devDependencies": { | ||
"@ava/babel-preset-stage-4": "2.0.0", | ||
"@ava/babel-preset-transform-test-files": "^4.0.1", | ||
"@babel/core": "^7.2.2", | ||
"@babel/plugin-syntax-jsx": "^7.2.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/register": "^7.0.0", | ||
"@types/base-64": "0.1.2", | ||
"@types/bootstrap": "3.3.36", | ||
"@types/classnames": "^2.2.3", | ||
"@types/jquery": "^3.3.31", | ||
"@types/modernizr": "3.5.1", | ||
"@types/react": "15.6.10", | ||
"@types/react-dom": "15.5.6", | ||
"ava": "1.2.1", | ||
"babel-preset-react": "6.24.1", | ||
"enzyme": "3.8.0", | ||
"enzyme-adapter-react-15": "1.3.0", | ||
"jsdom": "11.6.2", | ||
"nyc": "^15.1.0", | ||
"react-addons-test-utils": "15.6.2", | ||
"react-test-renderer": "15.6.2", | ||
"sinon": "4.5.0", | ||
"ts-loader": "8.4.0", | ||
"typescript": "4.7.4", | ||
"webpack": "4.41.2" | ||
}, | ||
"ava": { | ||
"concurrency": 5, | ||
"failFast": true, | ||
"failWithoutAssertions": false, | ||
"powerAssert": true, | ||
"require": [ | ||
"@babel/register", | ||
"./test/utils.js" | ||
], | ||
"main": "./build/index.js", | ||
"typings": "./build/index.d.ts", | ||
"author": "Amalto Technologies", | ||
"scripts": { | ||
"setup": "npm install", | ||
"build": "rm -rf ./build/; tsc", | ||
"test": "nyc ava ./test/test.js --verbose" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@amalto/typings": "1.9.68", | ||
"@amalto/wordings": "1.9.33", | ||
"base-64": "0.1.0", | ||
"classnames": "^2.2.6", | ||
"md5": "2.2.1", | ||
"react": "15.6.2", | ||
"react-dom": "15.6.2" | ||
}, | ||
"devDependencies": { | ||
"@ava/babel-preset-stage-4": "2.0.0", | ||
"@ava/babel-preset-transform-test-files": "^4.0.1", | ||
"@babel/core": "^7.2.2", | ||
"@babel/plugin-syntax-jsx": "^7.2.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/register": "^7.0.0", | ||
"@types/base-64": "0.1.2", | ||
"@types/bootstrap": "3.3.36", | ||
"@types/classnames": "^2.2.3", | ||
"@types/jquery": "^3.3.31", | ||
"@types/modernizr": "3.5.1", | ||
"@types/react": "15.6.10", | ||
"@types/react-dom": "15.5.6", | ||
"ava": "1.2.1", | ||
"babel-preset-react": "6.24.1", | ||
"enzyme": "3.8.0", | ||
"enzyme-adapter-react-15": "1.3.0", | ||
"jsdom": "11.6.2", | ||
"nyc": "^15.1.0", | ||
"react-addons-test-utils": "15.6.2", | ||
"react-test-renderer": "15.6.2", | ||
"sinon": "4.5.0", | ||
"ts-loader": "8.4.0", | ||
"typescript": "4.7.4", | ||
"webpack": "4.41.2" | ||
}, | ||
"ava": { | ||
"concurrency": 5, | ||
"failFast": true, | ||
"failWithoutAssertions": false, | ||
"powerAssert": true, | ||
"require": [ | ||
"@babel/register", | ||
"./test/utils.js" | ||
"babel": { | ||
"extensions": [ | ||
"js", | ||
"jsx" | ||
], | ||
"testOptions": { | ||
"plugins": [ | ||
"@babel/plugin-syntax-jsx" | ||
], | ||
"babel": { | ||
"extensions": [ | ||
"js", | ||
"jsx" | ||
], | ||
"testOptions": { | ||
"plugins": [ | ||
"@babel/plugin-syntax-jsx" | ||
], | ||
"presets": [ | ||
"@ava/babel-preset-stage-4", | ||
"@babel/preset-react" | ||
] | ||
} | ||
} | ||
}, | ||
"gitHead": "bcde0e0743a37bc4509fc97c93b7b42f212ae402" | ||
"presets": [ | ||
"@ava/babel-preset-stage-4", | ||
"@babel/preset-react" | ||
] | ||
} | ||
} | ||
}, | ||
"gitHead": "801edce8493e39ebe12b6e14e26eac8c1b910d12" | ||
} |
@@ -6,5 +6,7 @@ # Helpers | ||
## Install | ||
To install the Helpers component run: | ||
```terminal | ||
npm install --save @amalto/helpers | ||
``` | ||
``` |
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": [ | ||
"dom", | ||
"dom.iterable", | ||
"esnext", | ||
"es5", | ||
"es6", | ||
"es7", | ||
"es2015", | ||
"es2016", | ||
"es2017", | ||
"es2018" | ||
], | ||
"skipLibCheck": true, | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"jsx": "react", | ||
"outDir": "./build", | ||
"noImplicitAny": false, | ||
"noUnusedParameters": true, | ||
"removeComments": true, | ||
"sourceMap": true, | ||
"declaration": true, | ||
"experimentalDecorators": true | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": [ | ||
"dom", | ||
"dom.iterable", | ||
"esnext", | ||
"es5", | ||
"es6", | ||
"es7", | ||
"es2015", | ||
"es2016", | ||
"es2017", | ||
"es2018" | ||
], | ||
"skipLibCheck": true, | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"jsx": "react", | ||
"outDir": "./build", | ||
"noImplicitAny": false, | ||
"noUnusedParameters": true, | ||
"removeComments": true, | ||
"sourceMap": true, | ||
"declaration": true, | ||
"experimentalDecorators": true | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
const { resolve } = require('path'); | ||
module.exports = { | ||
entry: [ | ||
// the entry points of our app | ||
'./index.tsx' | ||
], | ||
entry: [ | ||
// the entry points of our app | ||
'./index.tsx', | ||
], | ||
output: { | ||
// the output bundle | ||
filename: 'index.js', | ||
path: resolve(__dirname, './build'), | ||
// necessary for HMR to know where to load the hot update chunks | ||
publicPath: '/build/' | ||
}, | ||
output: { | ||
// the output bundle | ||
filename: 'index.js', | ||
path: resolve(__dirname, './build'), | ||
// necessary for HMR to know where to load the hot update chunks | ||
publicPath: '/build/', | ||
}, | ||
resolve: { | ||
extensions: ['.webpack.js', '.scss', '.css', '.js', '.ts', '.tsx'] | ||
}, | ||
node: { | ||
fs: 'empty' | ||
}, | ||
resolve: { | ||
extensions: ['.webpack.js', '.scss', '.css', '.js', '.ts', '.tsx'], | ||
}, | ||
node: { | ||
fs: 'empty', | ||
}, | ||
externals: { | ||
'jquery': 'jQuery', | ||
'pikaday': 'Pikaday', | ||
'moment': 'moment' | ||
}, | ||
externals: { | ||
jquery: 'jQuery', | ||
pikaday: 'Pikaday', | ||
moment: 'moment', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts(x)?$/, | ||
loader: 'ts-loader', | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /\.js$/, | ||
exclude: [/node_modules/, /test/] | ||
} | ||
] | ||
}, | ||
devtool: 'source-map' | ||
}; | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts(x)?$/, | ||
loader: 'ts-loader', | ||
exclude: /node_modules/, | ||
}, | ||
{ | ||
test: /\.js$/, | ||
exclude: [/node_modules/, /test/], | ||
}, | ||
], | ||
}, | ||
devtool: 'source-map', | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6523
12
287842
+ Added@amalto/typings@1.9.69(transitive)
+ Added@amalto/wordings@1.9.34(transitive)
- Removed@amalto/typings@1.9.68(transitive)
- Removed@amalto/wordings@1.9.33(transitive)
Updated@amalto/typings@1.9.69
Updated@amalto/wordings@1.9.34