Skip to content

Commit ffbc106

Browse files
committed
migrate to V18
1 parent 81791a2 commit ffbc106

File tree

6 files changed

+460
-37
lines changed

6 files changed

+460
-37
lines changed

regex/ccm.regex.js

+28-35
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* recommended used framework version
2424
* @type {string}
2525
*/
26-
ccm: 'https://akless.github.io/ccm/version/ccm-11.5.0.min.js',
27-
// ccm: '//akless.github.io/ccm/ccm.js',
26+
ccm: 'https://ccmjs.github.io/ccm/ccm.js',
27+
// ccm: 'https://ccmjs.github.io/ccm/versions/ccm-18.0.4.min.js',
2828

2929
/**
3030
* default instance configuration
@@ -65,10 +65,8 @@
6565
{ tag: 'span', class: 'result' }
6666
] }
6767
},
68-
css: [ 'ccm.load', '//kaul.inf.h-brs.de/data/ccm/regex/resources/default.css' ],
69-
// css: [ 'ccm.load', 'https://mkaul.github.io/ccm-components/regex/resources/default.css' ],
70-
// user: [ 'ccm.instance', 'https://akless.github.io/ccm-components/user/versions/ccm.user-2.0.0.min.js' ],
71-
logger: [ 'ccm.instance', 'https://akless.github.io/ccm-components/log/versions/ccm.log-1.0.0.min.js', [ 'ccm.get', 'https://kaul.inf.h-brs.de/data/2017/se1/json/log_configs.js', 'se_ws17_regex' ] ]
68+
css: [ 'ccm.load', 'https://ccmjs.github.io/mkaul-components/regex/resources/default.css' ]
69+
7270
// onfinish: function( instance, results ){ console.log( results ); }
7371
},
7472

@@ -77,54 +75,50 @@
7775
* @constructor
7876
*/
7977
Instance: function () {
80-
78+
79+
"use strict";
80+
8181
/**
8282
* own reference for inner functions
8383
* @type {Instance}
8484
*/
8585
const self = this;
86-
86+
8787
/**
8888
* shortcut to help functions
89-
* @type {Object}
89+
* @type {Object.<string,function>}
9090
*/
9191
let $;
92-
92+
9393
/**
9494
* init is called once after all dependencies are solved and is then deleted
95-
* @param {function} callback - called after all synchronous and asynchronous operations are complete
9695
*/
97-
this.init = callback => {
98-
99-
// Is content given via LightDOM (inner HTML of Custom Element)?
96+
this.init = async () => {
97+
98+
// set shortcut to help functions
99+
$ = self.ccm.helper;
100+
101+
// Is config given via LightDOM (inner HTML of Custom Element)?
100102
// Then use it with higher priority
101-
if ( self.inner && self.inner.innerHTML.trim() ) self.text = self.inner.innerHTML;
102-
103-
// ToDo interprete LightDOM
103+
if ( self.inner && self.inner.innerHTML.trim() ){
104+
105+
// interprete LightDOM
106+
self.lightDOM = JSON.parse( self.inner.innerHTML );
107+
108+
// merge into config
109+
Object.assign( self, self.lightDOM );
110+
111+
}
104112

105-
callback();
106113
};
107-
108-
/**
109-
* is called once after the initialization and is then deleted
110-
* @param {function} callback - called after all synchronous and asynchronous operations are complete
111-
*/
112-
this.ready = callback => {
113114

114-
// set shortcut to help functions
115-
$ = self.ccm.helper;
116-
117-
callback();
118-
};
119-
120115
/**
121116
* starts the instance
122-
* @param {function} [callback] - called after all synchronous and asynchronous operations are complete
123117
*/
124-
this.start = callback => {
125-
118+
this.start = async () => {
119+
126120
// has logger instance? => log 'start' event
127-
if ( self.logger ) self.logger.log( 'start', self.data );
121+
self.logger && self.logger.log( 'start' );
128122

129123
// prepare main HTML structure
130124
const main_elem = $.html( self.html.main, self.data );
@@ -258,7 +252,6 @@
258252
return data;
259253
}
260254

261-
if ( callback && typeof callback === 'function' ) callback();
262255
};
263256

264257
}

regex/index.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
<meta charset="utf-8">
33
<meta name="author" content="Manfred Kaul <[email protected]> 2017">
44
<meta name="license" content="The MIT License (MIT)">
5-
<!--<script src="https://mkaul.github.io/ccm-components/regex/ccm.regex.js"></script>-->
5+
<!--<script src="https://ccmjs.github.io/mkaul-components/regex/ccm.regex.js"></script>-->
66
<script src="ccm.regex.js"></script>
7-
<ccm-regex></ccm-regex>
7+
<ccm-regex></ccm-regex>
8+
<ccm-regex key='["ccm.get","resources/configs.js","ab"]'></ccm-regex>
9+
<ccm-regex key='["ccm.get","resources/configs.js","zipcode"]'></ccm-regex>
10+
<ccm-regex key='["ccm.get","resources/configs.js","landline_number"]'></ccm-regex>
11+
<ccm-regex key='["ccm.get","resources/configs.js","license_plate"]'></ccm-regex>
12+
<ccm-regex key='["ccm.get","resources/configs.js","e-mail"]'></ccm-regex>
13+
<ccm-regex key='["ccm.get","resources/configs.js","web_address"]'></ccm-regex>

regex/resources/configs.js

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* @overview configs of ccm component regex
3+
* @author Manfred Kaul <[email protected]> 2018
4+
* @license The MIT License (MIT)
5+
*/
6+
7+
ccm.files[ 'configs.js' ] = {
8+
9+
"ab": {
10+
key: "ab",
11+
data: {
12+
regex: "^a.*b$", // (/a.*b/i).source,
13+
options: 'i',
14+
matching: "abcdefb",
15+
non_matching: "bacdef"
16+
}
17+
},
18+
19+
"zipcode": {
20+
key: "zipcode",
21+
data: {
22+
regex: "^(D[- ]{0,1}){0,1}(?!00)\\d{2}\\d{3}$",
23+
options: 'i',
24+
matching: "D-12345",
25+
non_matching: "00345"
26+
}
27+
},
28+
29+
"landline_number": {
30+
key: "landline_number",
31+
data: {
32+
regex: "^0[\\d]{1,3}[-,\\s,/]?[\\d]{3,}$",
33+
options: 'i',
34+
matching: "0123-123456789",
35+
non_matching: "0-123"
36+
}
37+
},
38+
39+
"license_plate": {
40+
key: "license_plate",
41+
data: {
42+
regex: "^[A-Z]{1,3}[-|\\s][A-Z]{1,3}[-|\\s][0-9]{1,4}$",
43+
options: 'i',
44+
matching: "K-AB 123",
45+
non_matching: "1234-567"
46+
}
47+
},
48+
49+
"e-mail": {
50+
key: "e-mail",
51+
data: {
52+
regex: "^[\\w\\d-.]+@[-A-Za-z0-9]+\\.[A-Za-z]{2,5}$",
53+
options: 'i',
54+
matching: "[email protected]",
55+
non_matching: "[email protected]"
56+
}
57+
},
58+
59+
"web_address": {
60+
key: "web_address",
61+
data: {
62+
regex: "^(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*$",
63+
options: 'i',
64+
matching: "https://kaul.inf.h-brs.de",
65+
non_matching: "file://abc.de"
66+
}
67+
}
68+
69+
};

regex/resources/dms.json

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"_id": "regex",
3+
"title": "Regex",
4+
"icon": "https://ccmjs.github.io/mkaul-components/regex/resources/icon.svg",
5+
"abstract": "<a href=https://en.wikipedia.org/wiki/Regular_expression>Regular Expression</a>",
6+
"description": "A <a href=https://en.wikipedia.org/wiki/Regular_expression>Regular Expression</a>, regex or regexp (sometimes called a rational expression) is, in theoretical computer science and formal language theory, a sequence of characters that define a search pattern. Usually this pattern is then used by string searching algorithms for \"find\" or \"find and replace\" operations on strings, or for input validation, see <a href=https://en.wikipedia.org/wiki/Regular_expression>Wikipedia</a>",
7+
"url": "https://ccmjs.github.io/mkaul-components/regex/versions/ccm.regex-1.0.0.js",
8+
"version": "1.0.0",
9+
"website": "https://ccmjs.github.io/mkaul-components/",
10+
"developer": "Manfred Kaul",
11+
"license": "MIT License",
12+
"ignore": {
13+
"demos": [
14+
{
15+
"title": "a*b",
16+
"config": [
17+
"ccm.get",
18+
"https://ccmjs.github.io/mkaul-components/regex/resources/configs.js",
19+
"ab"
20+
]
21+
},
22+
{
23+
"title": "Zip Code",
24+
"config": [
25+
"ccm.get",
26+
"https://ccmjs.github.io/mkaul-components/regex/resources/configs.js",
27+
"zipcode"
28+
]
29+
},
30+
{
31+
"title": "Landline Telefon Number",
32+
"config": [
33+
"ccm.get",
34+
"https://ccmjs.github.io/mkaul-components/regex/resources/configs.js",
35+
"landline_number"
36+
]
37+
},
38+
{
39+
"title": "License Plate",
40+
"config": [
41+
"ccm.get",
42+
"https://ccmjs.github.io/mkaul-components/regex/resources/configs.js",
43+
"license_plate"
44+
]
45+
},
46+
{
47+
"title": "E-Mail",
48+
"config": [
49+
"ccm.get",
50+
"https://ccmjs.github.io/mkaul-components/regex/resources/configs.js",
51+
"e-mail"
52+
]
53+
},
54+
{
55+
"title": "Web Address (URL)",
56+
"config": [
57+
"ccm.get",
58+
"https://ccmjs.github.io/mkaul-components/regex/resources/configs.js",
59+
"web_address"
60+
]
61+
}
62+
],
63+
"builder": [
64+
{
65+
"title": "JSON Builder",
66+
"url": "https://ccmjs.github.io/akless-components/app_builder/versions/ccm.app_builder-1.0.0.js",
67+
"config": {
68+
"builder": [
69+
"ccm.component",
70+
"https://ccmjs.github.io/akless-components/json_builder/versions/ccm.json_builder-1.1.0.js",
71+
{
72+
"html.inner.1": "",
73+
"directly": true
74+
}
75+
]
76+
}
77+
}
78+
]
79+
},
80+
"updated_at": "2018-10-12T14:41:22+02:00",
81+
"created_at": "2018-10-12T14:41:22+02:00"
82+
}

regex/resources/icon.svg

+11
Loading

0 commit comments

Comments
 (0)