namirasoft-core 1.4.19 → 1.4.22
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/BaseMetaColumn.d.ts +3 -1
- package/dist/BaseMetaColumn.js +2 -1
- package/dist/BaseMetaColumn.js.map +1 -1
- package/dist/BaseMetaTable.d.ts +3 -1
- package/dist/BaseMetaTable.js +2 -1
- package/dist/BaseMetaTable.js.map +1 -1
- package/dist/FilterItem.d.ts +5 -15
- package/dist/FilterItem.js +2 -2
- package/dist/FilterItem.js.map +1 -1
- package/dist/NamingConvention.d.ts +5 -3
- package/dist/NamingConvention.js +64 -34
- package/dist/NamingConvention.js.map +1 -1
- package/dist/SortItem.d.ts +5 -15
- package/dist/SortItem.js +2 -2
- package/dist/SortItem.js.map +1 -1
- package/package.json +1 -1
- package/src/BaseMetaColumn.ts +5 -1
- package/src/BaseMetaTable.ts +4 -1
- package/src/FilterItem.ts +5 -5
- package/src/NamingConvention.ts +74 -36
- package/src/SortItem.ts +5 -5
package/dist/BaseMetaColumn.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { BaseMetaTable } from "./BaseMetaTable";
|
|
1
2
|
export declare class BaseMetaColumn {
|
|
3
|
+
table: BaseMetaTable;
|
|
2
4
|
name: string;
|
|
3
5
|
text: string;
|
|
4
6
|
type: string;
|
|
5
7
|
required: boolean;
|
|
6
|
-
constructor(name: string, text: string, type: string, required: boolean);
|
|
8
|
+
constructor(table: BaseMetaTable, name: string, text: string, type: string, required: boolean);
|
|
7
9
|
}
|
package/dist/BaseMetaColumn.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseMetaColumn = void 0;
|
|
4
4
|
class BaseMetaColumn {
|
|
5
|
-
constructor(name, text, type, required) {
|
|
5
|
+
constructor(table, name, text, type, required) {
|
|
6
|
+
this.table = table;
|
|
6
7
|
this.name = name;
|
|
7
8
|
this.text = text;
|
|
8
9
|
this.type = type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMetaColumn.js","sourceRoot":"","sources":["../src/BaseMetaColumn.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"BaseMetaColumn.js","sourceRoot":"","sources":["../src/BaseMetaColumn.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAOvB,YAAY,KAAoB,EAAE,IAAY,EAAE,IAAY,EAAE,IAAY,EAAE,QAAiB;QAEzF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAfD,wCAeC"}
|
package/dist/BaseMetaTable.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BaseMetaColumn } from "./BaseMetaColumn";
|
|
2
|
+
import { BaseMetaDatabase } from "./BaseMetaDatabase";
|
|
2
3
|
export declare class BaseMetaTable {
|
|
4
|
+
database: BaseMetaDatabase | null;
|
|
3
5
|
name: string;
|
|
4
6
|
text: string;
|
|
5
7
|
columns: {
|
|
6
8
|
[name: string]: BaseMetaColumn;
|
|
7
9
|
};
|
|
8
|
-
constructor(name: string, text: string);
|
|
10
|
+
constructor(database: BaseMetaDatabase | null, name: string, text: string);
|
|
9
11
|
forEachColumn<T, MC extends BaseMetaColumn>(handler: (table: MC) => T | null): T | null;
|
|
10
12
|
getColumns<MC extends BaseMetaColumn>(): MC[];
|
|
11
13
|
}
|
package/dist/BaseMetaTable.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseMetaTable = void 0;
|
|
4
4
|
class BaseMetaTable {
|
|
5
|
-
constructor(name, text) {
|
|
5
|
+
constructor(database, name, text) {
|
|
6
6
|
this.columns = {};
|
|
7
|
+
this.database = database;
|
|
7
8
|
this.name = name;
|
|
8
9
|
this.text = text;
|
|
9
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMetaTable.js","sourceRoot":"","sources":["../src/BaseMetaTable.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"BaseMetaTable.js","sourceRoot":"","sources":["../src/BaseMetaTable.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IAMtB,YAAY,QAAiC,EAAE,IAAY,EAAE,IAAY;QADlE,YAAO,GAAuC,EAAE,CAAC;QAGpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,aAAa,CAA+B,OAAgC;QAExE,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,EAC9B,CAAC;YACG,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,GAAG,GAAG,OAAO,CAAC,OAAa,CAAC,CAAC;YACjC,IAAI,GAAG,IAAI,IAAI;gBACX,OAAO,GAAG,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,UAAU;QAEN,IAAI,GAAG,GAAS,EAAE,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE,EAAE;YAE1B,GAAG,CAAC,IAAI,CAAC,MAAY,CAAC,CAAC;YACvB,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAjCD,sCAiCC"}
|
package/dist/FilterItem.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
import { BaseMetaColumn } from "./BaseMetaColumn";
|
|
2
|
+
import { BaseMetaTable } from "./BaseMetaTable";
|
|
1
3
|
import { FilterItemOperator } from "./FilterItemOperator";
|
|
2
4
|
export declare class FilterItem {
|
|
3
|
-
table:
|
|
4
|
-
|
|
5
|
-
text: string;
|
|
6
|
-
};
|
|
7
|
-
column: {
|
|
8
|
-
name: string;
|
|
9
|
-
text: string;
|
|
10
|
-
};
|
|
5
|
+
table: BaseMetaTable;
|
|
6
|
+
column: BaseMetaColumn;
|
|
11
7
|
not: boolean;
|
|
12
8
|
operator: FilterItemOperator;
|
|
13
9
|
values: string[];
|
|
@@ -16,13 +12,7 @@ export declare class FilterItem {
|
|
|
16
12
|
static stringify(filters: FilterItem[] | null): string;
|
|
17
13
|
static parse(item: string | null): FilterItem[];
|
|
18
14
|
static test(filters: FilterItem[] | null, object: any): boolean;
|
|
19
|
-
constructor(table:
|
|
20
|
-
name: string;
|
|
21
|
-
text: string;
|
|
22
|
-
}, column: {
|
|
23
|
-
name: string;
|
|
24
|
-
text: string;
|
|
25
|
-
}, not: boolean, operator: FilterItemOperator, ...values: string[]);
|
|
15
|
+
constructor(table: BaseMetaTable, column: BaseMetaColumn, not: boolean, operator: FilterItemOperator, ...values: string[]);
|
|
26
16
|
getCommand(): string;
|
|
27
17
|
isAllColumns(): boolean;
|
|
28
18
|
toString(): string;
|
package/dist/FilterItem.js
CHANGED
|
@@ -35,9 +35,9 @@ class FilterItem {
|
|
|
35
35
|
};
|
|
36
36
|
while (thereIsMore()) {
|
|
37
37
|
let value_table = next("Table");
|
|
38
|
-
let table = new BaseMetaTable_1.BaseMetaTable(value_table, value_table);
|
|
38
|
+
let table = new BaseMetaTable_1.BaseMetaTable(null, value_table, value_table);
|
|
39
39
|
let value_column = next("Column");
|
|
40
|
-
let column = new BaseMetaColumn_1.BaseMetaColumn(value_column, value_column, "", false);
|
|
40
|
+
let column = new BaseMetaColumn_1.BaseMetaColumn(table, value_column, value_column, "", false);
|
|
41
41
|
let value_not = next("Not");
|
|
42
42
|
let not = value_not != "0";
|
|
43
43
|
if (value_not != "0" && value_not != "1")
|
package/dist/FilterItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterItem.js","sourceRoot":"","sources":["../src/FilterItem.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,mDAAgD;AAChD,2DAAwD;AACxD,qDAAkD;AAClD,6DAA0D;AAE1D,MAAa,UAAU;IAOZ,MAAM,CAAC,MAAM,CAAC,OAA4B;QAE7C,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACpC,OAAO,qCAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,KAAa;QAE9B,IAAI,OAAO,GAAG,qCAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IACM,MAAM,CAAC,SAAS,CAAC,OAA4B;QAEhD,IAAI,OAAO;YACP,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,EAAE,CAAC;IACd,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,IAAmB;QAEnC,IAAI,GAAG,GAAiB,EAAE,CAAC;QAC3B,IAAI,IAAI,EACR,CAAC;YACG,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACnC,IAAI,WAAW,GAAG,GAAY,EAAE;gBAE5B,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;YAChC,CAAC,CAAC;YACF,IAAI,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE;gBAEhC,IAAI,WAAW,EAAE;oBACb,OA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jC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACJ;AA1HD,gCA0HC"}
|
|
@@ -5,6 +5,7 @@ export declare class NamingConvention {
|
|
|
5
5
|
static formatter_camel: (word: string, index: number) => string;
|
|
6
6
|
static formatter_sentence: (word: string, index: number) => string;
|
|
7
7
|
static splitter_normal: (name: string, delimiter: string) => string[];
|
|
8
|
+
static splitter_pascal: (name: string, delimiter: string) => string[];
|
|
8
9
|
static splitter_uppercase: (name: string) => string[];
|
|
9
10
|
static splitter_none: (name: string) => string[];
|
|
10
11
|
static lower_case: NamingConvention;
|
|
@@ -39,10 +40,11 @@ export declare class NamingConvention {
|
|
|
39
40
|
static First_word_case_slash: NamingConvention;
|
|
40
41
|
name: string;
|
|
41
42
|
delimiter: string;
|
|
43
|
+
revertable: boolean;
|
|
42
44
|
formatter: (word: string, index: number) => string;
|
|
43
45
|
splitter: (name: string, delimiter: string) => string[];
|
|
44
|
-
constructor(name: string, delimiter: string, formatter: (word: string, index: number) => string, splitter: (name: string, delimiter: string) => string[]);
|
|
46
|
+
constructor(name: string, delimiter: string, revertable: boolean, formatter: (word: string, index: number) => string, splitter: (name: string, delimiter: string) => string[]);
|
|
45
47
|
getWords(name: string): string[];
|
|
46
|
-
convertByWords(words: string[]): string;
|
|
47
|
-
convert(name: string, to: NamingConvention): string;
|
|
48
|
+
convertByWords(words: string[], revertable?: boolean): string;
|
|
49
|
+
convert(name: string, to: NamingConvention, revertable?: boolean): string;
|
|
48
50
|
}
|
package/dist/NamingConvention.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NamingConvention = void 0;
|
|
4
4
|
class NamingConvention {
|
|
5
|
-
constructor(name, delimiter, formatter, splitter) {
|
|
5
|
+
constructor(name, delimiter, revertable, formatter, splitter) {
|
|
6
6
|
this.name = name;
|
|
7
7
|
this.delimiter = delimiter;
|
|
8
|
+
this.revertable = revertable;
|
|
8
9
|
this.formatter = formatter;
|
|
9
10
|
this.splitter = splitter;
|
|
10
11
|
}
|
|
@@ -13,14 +14,36 @@ class NamingConvention {
|
|
|
13
14
|
ans = ans.filter(w => w);
|
|
14
15
|
return ans;
|
|
15
16
|
}
|
|
16
|
-
convertByWords(words) {
|
|
17
|
+
convertByWords(words, revertable = true) {
|
|
17
18
|
for (let i = 0; i < words.length; i++)
|
|
18
19
|
words[i] = this.formatter(words[i], i);
|
|
20
|
+
let single_found = false;
|
|
21
|
+
if (this.revertable || !revertable) {
|
|
22
|
+
let combined = [];
|
|
23
|
+
for (let i = 0; i < words.length; i++) {
|
|
24
|
+
let word = words[i];
|
|
25
|
+
if (word) {
|
|
26
|
+
if (i == 0 || word.length > 1) {
|
|
27
|
+
combined.push(word);
|
|
28
|
+
single_found = false;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (!single_found) {
|
|
32
|
+
combined.push(word);
|
|
33
|
+
single_found = true;
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
combined[combined.length - 1] += word;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
words = combined;
|
|
41
|
+
}
|
|
19
42
|
return words.join(this.delimiter);
|
|
20
43
|
}
|
|
21
|
-
convert(name, to) {
|
|
44
|
+
convert(name, to, revertable = true) {
|
|
22
45
|
let words = this.getWords(name);
|
|
23
|
-
return to.convertByWords(words);
|
|
46
|
+
return to.convertByWords(words, revertable);
|
|
24
47
|
}
|
|
25
48
|
}
|
|
26
49
|
exports.NamingConvention = NamingConvention;
|
|
@@ -52,40 +75,47 @@ NamingConvention.formatter_sentence = (word, index) => {
|
|
|
52
75
|
NamingConvention.splitter_normal = (name, delimiter) => {
|
|
53
76
|
return name.split(delimiter);
|
|
54
77
|
};
|
|
78
|
+
NamingConvention.splitter_pascal = (name, delimiter) => {
|
|
79
|
+
let words = NamingConvention.splitter_uppercase(name);
|
|
80
|
+
let ans = [];
|
|
81
|
+
for (let word of words)
|
|
82
|
+
ans.push(...NamingConvention.splitter_normal(word, delimiter));
|
|
83
|
+
return ans;
|
|
84
|
+
};
|
|
55
85
|
NamingConvention.splitter_uppercase = (name) => {
|
|
56
86
|
return name.split(/(?=[A-Z])/);
|
|
57
87
|
};
|
|
58
88
|
NamingConvention.splitter_none = (name) => {
|
|
59
89
|
return [name];
|
|
60
90
|
};
|
|
61
|
-
NamingConvention.lower_case = new NamingConvention("lowercase", "", NamingConvention.formatter_lower, NamingConvention.splitter_none);
|
|
62
|
-
NamingConvention.UPPER_CASE = new NamingConvention("UPPERCASE", "", NamingConvention.formatter_upper, NamingConvention.splitter_none);
|
|
63
|
-
NamingConvention.Pascal_Case = new NamingConvention("PascalCase", "", NamingConvention.formatter_pascal, NamingConvention.splitter_uppercase);
|
|
64
|
-
NamingConvention.camel_Case = new NamingConvention("camelCase", "", NamingConvention.formatter_camel, NamingConvention.splitter_uppercase);
|
|
65
|
-
NamingConvention.First_word_case = new NamingConvention("Firstwordcase", "", NamingConvention.formatter_sentence, NamingConvention.splitter_none);
|
|
66
|
-
NamingConvention.lower_case_underscore = new NamingConvention("snake_case", "_", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
67
|
-
NamingConvention.UPPER_CASE_UNDERSCORE = new NamingConvention("SNAKE_CASE", "_", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
68
|
-
NamingConvention.Pascal_Case_Underscore = new NamingConvention("Pascal_CASE", "_", NamingConvention.formatter_pascal, NamingConvention.
|
|
69
|
-
NamingConvention.camel_Case_Underscore = new NamingConvention("camel_Case", "_", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
70
|
-
NamingConvention.First_word_case_underscore = new NamingConvention("First_word_case", "_", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
71
|
-
NamingConvention.lower_case_dash = new NamingConvention("kebab-case", "-", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
72
|
-
NamingConvention.UPPER_CASE_DASH = new NamingConvention("UPPER-CASE", "-", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
73
|
-
NamingConvention.Pascal_Case_Dash = new NamingConvention("Pascal-Case", "-", NamingConvention.formatter_pascal, NamingConvention.
|
|
74
|
-
NamingConvention.camel_Case_Dash = new NamingConvention("camel-Case", "-", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
75
|
-
NamingConvention.First_word_case_dash = new NamingConvention("First-word-case", "-", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
76
|
-
NamingConvention.lower_case_dot = new NamingConvention("domain.case", ".", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
77
|
-
NamingConvention.UPPER_CASE_DOT = new NamingConvention("UPPER.CASE", ".", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
78
|
-
NamingConvention.Pascal_Case_Dot = new NamingConvention("Pascal.Case", ".", NamingConvention.formatter_pascal, NamingConvention.
|
|
79
|
-
NamingConvention.camel_Case_Dot = new NamingConvention("camel.Case", ".", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
80
|
-
NamingConvention.First_word_case_dot = new NamingConvention("First.word.case", ".", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
81
|
-
NamingConvention.lower_case_space = new NamingConvention("lower case", " ", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
82
|
-
NamingConvention.UPPER_CASE_SPACE = new NamingConvention("UPPRE CASE", " ", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
83
|
-
NamingConvention.Pascal_Case_Space = new NamingConvention("Title Case", " ", NamingConvention.formatter_pascal, NamingConvention.
|
|
84
|
-
NamingConvention.camel_Case_Space = new NamingConvention("camel Case", " ", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
85
|
-
NamingConvention.First_word_case_space = new NamingConvention("Sentence case", " ", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
86
|
-
NamingConvention.lower_case_slash = new NamingConvention("path/case", "/", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
87
|
-
NamingConvention.UPPER_CASE_SLASH = new NamingConvention("UPPER/CASE", "/", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
88
|
-
NamingConvention.Pascal_Case_Slash = new NamingConvention("Pascal/Case", "/", NamingConvention.formatter_pascal, NamingConvention.
|
|
89
|
-
NamingConvention.camel_Case_Slash = new NamingConvention("camel/Case", "/", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
90
|
-
NamingConvention.First_word_case_slash = new NamingConvention("First/word/case", "/", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
91
|
+
NamingConvention.lower_case = new NamingConvention("lowercase", "", false, NamingConvention.formatter_lower, NamingConvention.splitter_none);
|
|
92
|
+
NamingConvention.UPPER_CASE = new NamingConvention("UPPERCASE", "", false, NamingConvention.formatter_upper, NamingConvention.splitter_none);
|
|
93
|
+
NamingConvention.Pascal_Case = new NamingConvention("PascalCase", "", true, NamingConvention.formatter_pascal, NamingConvention.splitter_uppercase);
|
|
94
|
+
NamingConvention.camel_Case = new NamingConvention("camelCase", "", true, NamingConvention.formatter_camel, NamingConvention.splitter_uppercase);
|
|
95
|
+
NamingConvention.First_word_case = new NamingConvention("Firstwordcase", "", false, NamingConvention.formatter_sentence, NamingConvention.splitter_none);
|
|
96
|
+
NamingConvention.lower_case_underscore = new NamingConvention("snake_case", "_", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
97
|
+
NamingConvention.UPPER_CASE_UNDERSCORE = new NamingConvention("SNAKE_CASE", "_", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
98
|
+
NamingConvention.Pascal_Case_Underscore = new NamingConvention("Pascal_CASE", "_", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
99
|
+
NamingConvention.camel_Case_Underscore = new NamingConvention("camel_Case", "_", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
100
|
+
NamingConvention.First_word_case_underscore = new NamingConvention("First_word_case", "_", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
101
|
+
NamingConvention.lower_case_dash = new NamingConvention("kebab-case", "-", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
102
|
+
NamingConvention.UPPER_CASE_DASH = new NamingConvention("UPPER-CASE", "-", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
103
|
+
NamingConvention.Pascal_Case_Dash = new NamingConvention("Pascal-Case", "-", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
104
|
+
NamingConvention.camel_Case_Dash = new NamingConvention("camel-Case", "-", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
105
|
+
NamingConvention.First_word_case_dash = new NamingConvention("First-word-case", "-", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
106
|
+
NamingConvention.lower_case_dot = new NamingConvention("domain.case", ".", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
107
|
+
NamingConvention.UPPER_CASE_DOT = new NamingConvention("UPPER.CASE", ".", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
108
|
+
NamingConvention.Pascal_Case_Dot = new NamingConvention("Pascal.Case", ".", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
109
|
+
NamingConvention.camel_Case_Dot = new NamingConvention("camel.Case", ".", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
110
|
+
NamingConvention.First_word_case_dot = new NamingConvention("First.word.case", ".", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
111
|
+
NamingConvention.lower_case_space = new NamingConvention("lower case", " ", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
112
|
+
NamingConvention.UPPER_CASE_SPACE = new NamingConvention("UPPRE CASE", " ", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
113
|
+
NamingConvention.Pascal_Case_Space = new NamingConvention("Title Case", " ", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
114
|
+
NamingConvention.camel_Case_Space = new NamingConvention("camel Case", " ", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
115
|
+
NamingConvention.First_word_case_space = new NamingConvention("Sentence case", " ", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
116
|
+
NamingConvention.lower_case_slash = new NamingConvention("path/case", "/", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
117
|
+
NamingConvention.UPPER_CASE_SLASH = new NamingConvention("UPPER/CASE", "/", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
118
|
+
NamingConvention.Pascal_Case_Slash = new NamingConvention("Pascal/Case", "/", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
119
|
+
NamingConvention.camel_Case_Slash = new NamingConvention("camel/Case", "/", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
120
|
+
NamingConvention.First_word_case_slash = new NamingConvention("First/word/case", "/", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
91
121
|
//# sourceMappingURL=NamingConvention.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamingConvention.js","sourceRoot":"","sources":["../src/NamingConvention.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"NamingConvention.js","sourceRoot":"","sources":["../src/NamingConvention.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IA4FzB,YAAY,IAAY,EAAE,SAAiB,EAAE,UAAmB,EAAE,SAAkD,EAAE,QAAuD;QAEzK,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,I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,EAAE,KAAK,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC"}
|
package/dist/SortItem.d.ts
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
|
+
import { BaseMetaColumn } from "./BaseMetaColumn";
|
|
2
|
+
import { BaseMetaTable } from "./BaseMetaTable";
|
|
1
3
|
export declare class SortItem {
|
|
2
|
-
table:
|
|
3
|
-
|
|
4
|
-
text: string;
|
|
5
|
-
};
|
|
6
|
-
column: {
|
|
7
|
-
name: string;
|
|
8
|
-
text: string;
|
|
9
|
-
};
|
|
4
|
+
table: BaseMetaTable;
|
|
5
|
+
column: BaseMetaColumn;
|
|
10
6
|
ascending: boolean;
|
|
11
7
|
static encode(sorts: SortItem[] | null): string;
|
|
12
8
|
static decode(value: string): SortItem[] | null;
|
|
13
9
|
static stringify(sorts: SortItem[] | null): string;
|
|
14
10
|
static parse(item: string | null): SortItem[];
|
|
15
|
-
constructor(table:
|
|
16
|
-
name: string;
|
|
17
|
-
text: string;
|
|
18
|
-
}, column: {
|
|
19
|
-
name: string;
|
|
20
|
-
text: string;
|
|
21
|
-
}, ascending: boolean);
|
|
11
|
+
constructor(table: BaseMetaTable, column: BaseMetaColumn, ascending: boolean);
|
|
22
12
|
getCommand(): string;
|
|
23
13
|
toString(): string;
|
|
24
14
|
}
|
package/dist/SortItem.js
CHANGED
|
@@ -34,9 +34,9 @@ class SortItem {
|
|
|
34
34
|
};
|
|
35
35
|
while (thereIsMore()) {
|
|
36
36
|
let value_table = next("Table");
|
|
37
|
-
let table = new BaseMetaTable_1.BaseMetaTable(value_table, value_table);
|
|
37
|
+
let table = new BaseMetaTable_1.BaseMetaTable(null, value_table, value_table);
|
|
38
38
|
let value_column = next("Column");
|
|
39
|
-
let column = new BaseMetaColumn_1.BaseMetaColumn(value_column, value_column, "", false);
|
|
39
|
+
let column = new BaseMetaColumn_1.BaseMetaColumn(table, value_column, value_column, "", false);
|
|
40
40
|
let value_asc = next("Asending").toLowerCase();
|
|
41
41
|
let asc = value_asc === "asc";
|
|
42
42
|
if (value_asc != "asc" && value_asc != "desc")
|
package/dist/SortItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortItem.js","sourceRoot":"","sources":["../src/SortItem.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,mDAAgD;AAChD,2DAAwD;AACxD,qDAAkD;AAElD,MAAa,QAAQ;IAKV,MAAM,CAAC,MAAM,CAAC,KAAwB;QAEzC,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,qCAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,KAAa;QAE9B,IAAI,OAAO,GAAG,qCAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IACM,MAAM,CAAC,SAAS,CAAC,KAAwB;QAE5C,IAAI,KAAK;YACL,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpD,OAAO,EAAE,CAAC;IACd,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,IAAmB;QAEnC,IAAI,GAAG,GAAe,EAAE,CAAC;QACzB,IAAI,IAAI,EACR,CAAC;YACG,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACnC,IAAI,WAAW,GAAG,GAAY,EAAE;gBAE5B,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;YAChC,CAAC,CAAC;YACF,IAAI,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE;gBAEhC,IAAI,WAAW,EAAE;oBACb,O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AAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IACD,UAAU;QAEN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1F,CAAC;IACD,QAAQ;QAEJ,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI;YACf,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;;YAE1B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI;YAChB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;;YAE3B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,IAAI,CAAC,SAAS;YACd,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;;YAEtB,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACJ;AAnFD,4BAmFC"}
|
package/package.json
CHANGED
package/src/BaseMetaColumn.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { BaseMetaTable } from "./BaseMetaTable";
|
|
2
|
+
|
|
1
3
|
export class BaseMetaColumn
|
|
2
4
|
{
|
|
5
|
+
table: BaseMetaTable;
|
|
3
6
|
name: string;
|
|
4
7
|
text: string;
|
|
5
8
|
type: string; // todo
|
|
6
9
|
required: boolean;
|
|
7
|
-
constructor(name: string, text: string, type: string, required: boolean)
|
|
10
|
+
constructor(table: BaseMetaTable, name: string, text: string, type: string, required: boolean)
|
|
8
11
|
{
|
|
12
|
+
this.table = table;
|
|
9
13
|
this.name = name;
|
|
10
14
|
this.text = text;
|
|
11
15
|
this.type = type;
|
package/src/BaseMetaTable.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BaseMetaColumn } from "./BaseMetaColumn";
|
|
2
|
+
import { BaseMetaDatabase } from "./BaseMetaDatabase";
|
|
2
3
|
|
|
3
4
|
export class BaseMetaTable
|
|
4
5
|
{
|
|
6
|
+
database: BaseMetaDatabase | null;
|
|
5
7
|
name: string;
|
|
6
8
|
text: string;
|
|
7
9
|
public columns: { [name: string]: BaseMetaColumn } = {};
|
|
8
|
-
constructor(name: string, text: string)
|
|
10
|
+
constructor(database: BaseMetaDatabase | null, name: string, text: string)
|
|
9
11
|
{
|
|
12
|
+
this.database = database;
|
|
10
13
|
this.name = name;
|
|
11
14
|
this.text = text;
|
|
12
15
|
}
|
package/src/FilterItem.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { FilterItemOperator } from "./FilterItemOperator";
|
|
|
6
6
|
|
|
7
7
|
export class FilterItem
|
|
8
8
|
{
|
|
9
|
-
public table:
|
|
10
|
-
public column:
|
|
9
|
+
public table: BaseMetaTable;
|
|
10
|
+
public column: BaseMetaColumn;
|
|
11
11
|
public not: boolean;
|
|
12
12
|
public operator: FilterItemOperator;
|
|
13
13
|
public values: string[];
|
|
@@ -47,10 +47,10 @@ export class FilterItem
|
|
|
47
47
|
while (thereIsMore())
|
|
48
48
|
{
|
|
49
49
|
let value_table = next("Table");
|
|
50
|
-
let table = new BaseMetaTable(value_table, value_table);
|
|
50
|
+
let table = new BaseMetaTable(null, value_table, value_table);
|
|
51
51
|
|
|
52
52
|
let value_column = next("Column");
|
|
53
|
-
let column = new BaseMetaColumn(value_column, value_column, "", false)
|
|
53
|
+
let column = new BaseMetaColumn(table, value_column, value_column, "", false)
|
|
54
54
|
|
|
55
55
|
let value_not = next("Not");
|
|
56
56
|
let not = value_not != "0"
|
|
@@ -85,7 +85,7 @@ export class FilterItem
|
|
|
85
85
|
}
|
|
86
86
|
return true;
|
|
87
87
|
}
|
|
88
|
-
constructor(table:
|
|
88
|
+
constructor(table: BaseMetaTable, column: BaseMetaColumn, not: boolean, operator: FilterItemOperator, ...values: string[])
|
|
89
89
|
{
|
|
90
90
|
this.table = table;
|
|
91
91
|
this.column = column;
|
package/src/NamingConvention.ts
CHANGED
|
@@ -34,6 +34,14 @@ export class NamingConvention
|
|
|
34
34
|
{
|
|
35
35
|
return name.split(delimiter);
|
|
36
36
|
};
|
|
37
|
+
public static splitter_pascal = (name: string, delimiter: string) =>
|
|
38
|
+
{
|
|
39
|
+
let words = NamingConvention.splitter_uppercase(name);
|
|
40
|
+
let ans = [];
|
|
41
|
+
for (let word of words)
|
|
42
|
+
ans.push(...NamingConvention.splitter_normal(word, delimiter));
|
|
43
|
+
return ans;
|
|
44
|
+
};
|
|
37
45
|
public static splitter_uppercase = (name: string) =>
|
|
38
46
|
{
|
|
39
47
|
return name.split(/(?=[A-Z])/);
|
|
@@ -42,49 +50,51 @@ export class NamingConvention
|
|
|
42
50
|
{
|
|
43
51
|
return [name];
|
|
44
52
|
};
|
|
45
|
-
public static lower_case: NamingConvention = new NamingConvention("lowercase", "", NamingConvention.formatter_lower, NamingConvention.splitter_none);
|
|
46
|
-
public static UPPER_CASE: NamingConvention = new NamingConvention("UPPERCASE", "", NamingConvention.formatter_upper, NamingConvention.splitter_none);
|
|
47
|
-
public static Pascal_Case: NamingConvention = new NamingConvention("PascalCase", "", NamingConvention.formatter_pascal, NamingConvention.splitter_uppercase);
|
|
48
|
-
public static camel_Case: NamingConvention = new NamingConvention("camelCase", "", NamingConvention.formatter_camel, NamingConvention.splitter_uppercase);
|
|
49
|
-
public static First_word_case: NamingConvention = new NamingConvention("Firstwordcase", "", NamingConvention.formatter_sentence, NamingConvention.splitter_none);
|
|
53
|
+
public static lower_case: NamingConvention = new NamingConvention("lowercase", "", false, NamingConvention.formatter_lower, NamingConvention.splitter_none);
|
|
54
|
+
public static UPPER_CASE: NamingConvention = new NamingConvention("UPPERCASE", "", false, NamingConvention.formatter_upper, NamingConvention.splitter_none);
|
|
55
|
+
public static Pascal_Case: NamingConvention = new NamingConvention("PascalCase", "", true, NamingConvention.formatter_pascal, NamingConvention.splitter_uppercase);
|
|
56
|
+
public static camel_Case: NamingConvention = new NamingConvention("camelCase", "", true, NamingConvention.formatter_camel, NamingConvention.splitter_uppercase);
|
|
57
|
+
public static First_word_case: NamingConvention = new NamingConvention("Firstwordcase", "", false, NamingConvention.formatter_sentence, NamingConvention.splitter_none);
|
|
50
58
|
|
|
51
|
-
public static lower_case_underscore: NamingConvention = new NamingConvention("snake_case", "_", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
52
|
-
public static UPPER_CASE_UNDERSCORE: NamingConvention = new NamingConvention("SNAKE_CASE", "_", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
53
|
-
public static Pascal_Case_Underscore: NamingConvention = new NamingConvention("Pascal_CASE", "_", NamingConvention.formatter_pascal, NamingConvention.
|
|
54
|
-
public static camel_Case_Underscore: NamingConvention = new NamingConvention("camel_Case", "_", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
55
|
-
public static First_word_case_underscore: NamingConvention = new NamingConvention("First_word_case", "_", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
59
|
+
public static lower_case_underscore: NamingConvention = new NamingConvention("snake_case", "_", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
60
|
+
public static UPPER_CASE_UNDERSCORE: NamingConvention = new NamingConvention("SNAKE_CASE", "_", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
61
|
+
public static Pascal_Case_Underscore: NamingConvention = new NamingConvention("Pascal_CASE", "_", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
62
|
+
public static camel_Case_Underscore: NamingConvention = new NamingConvention("camel_Case", "_", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
63
|
+
public static First_word_case_underscore: NamingConvention = new NamingConvention("First_word_case", "_", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
56
64
|
|
|
57
|
-
public static lower_case_dash: NamingConvention = new NamingConvention("kebab-case", "-", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
58
|
-
public static UPPER_CASE_DASH: NamingConvention = new NamingConvention("UPPER-CASE", "-", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
59
|
-
public static Pascal_Case_Dash: NamingConvention = new NamingConvention("Pascal-Case", "-", NamingConvention.formatter_pascal, NamingConvention.
|
|
60
|
-
public static camel_Case_Dash: NamingConvention = new NamingConvention("camel-Case", "-", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
61
|
-
public static First_word_case_dash: NamingConvention = new NamingConvention("First-word-case", "-", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
65
|
+
public static lower_case_dash: NamingConvention = new NamingConvention("kebab-case", "-", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
66
|
+
public static UPPER_CASE_DASH: NamingConvention = new NamingConvention("UPPER-CASE", "-", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
67
|
+
public static Pascal_Case_Dash: NamingConvention = new NamingConvention("Pascal-Case", "-", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
68
|
+
public static camel_Case_Dash: NamingConvention = new NamingConvention("camel-Case", "-", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
69
|
+
public static First_word_case_dash: NamingConvention = new NamingConvention("First-word-case", "-", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
62
70
|
|
|
63
|
-
public static lower_case_dot: NamingConvention = new NamingConvention("domain.case", ".", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
64
|
-
public static UPPER_CASE_DOT: NamingConvention = new NamingConvention("UPPER.CASE", ".", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
65
|
-
public static Pascal_Case_Dot: NamingConvention = new NamingConvention("Pascal.Case", ".", NamingConvention.formatter_pascal, NamingConvention.
|
|
66
|
-
public static camel_Case_Dot: NamingConvention = new NamingConvention("camel.Case", ".", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
67
|
-
public static First_word_case_dot: NamingConvention = new NamingConvention("First.word.case", ".", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
71
|
+
public static lower_case_dot: NamingConvention = new NamingConvention("domain.case", ".", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
72
|
+
public static UPPER_CASE_DOT: NamingConvention = new NamingConvention("UPPER.CASE", ".", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
73
|
+
public static Pascal_Case_Dot: NamingConvention = new NamingConvention("Pascal.Case", ".", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
74
|
+
public static camel_Case_Dot: NamingConvention = new NamingConvention("camel.Case", ".", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
75
|
+
public static First_word_case_dot: NamingConvention = new NamingConvention("First.word.case", ".", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
68
76
|
|
|
69
|
-
public static lower_case_space: NamingConvention = new NamingConvention("lower case", " ", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
70
|
-
public static UPPER_CASE_SPACE: NamingConvention = new NamingConvention("UPPRE CASE", " ", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
71
|
-
public static Pascal_Case_Space: NamingConvention = new NamingConvention("Title Case", " ", NamingConvention.formatter_pascal, NamingConvention.
|
|
72
|
-
public static camel_Case_Space: NamingConvention = new NamingConvention("camel Case", " ", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
73
|
-
public static First_word_case_space: NamingConvention = new NamingConvention("Sentence case", " ", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
77
|
+
public static lower_case_space: NamingConvention = new NamingConvention("lower case", " ", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
78
|
+
public static UPPER_CASE_SPACE: NamingConvention = new NamingConvention("UPPRE CASE", " ", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
79
|
+
public static Pascal_Case_Space: NamingConvention = new NamingConvention("Title Case", " ", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
80
|
+
public static camel_Case_Space: NamingConvention = new NamingConvention("camel Case", " ", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
81
|
+
public static First_word_case_space: NamingConvention = new NamingConvention("Sentence case", " ", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
74
82
|
|
|
75
|
-
public static lower_case_slash: NamingConvention = new NamingConvention("path/case", "/", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
76
|
-
public static UPPER_CASE_SLASH: NamingConvention = new NamingConvention("UPPER/CASE", "/", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
77
|
-
public static Pascal_Case_Slash: NamingConvention = new NamingConvention("Pascal/Case", "/", NamingConvention.formatter_pascal, NamingConvention.
|
|
78
|
-
public static camel_Case_Slash: NamingConvention = new NamingConvention("camel/Case", "/", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
79
|
-
public static First_word_case_slash: NamingConvention = new NamingConvention("First/word/case", "/", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
80
|
-
name: string;
|
|
81
|
-
delimiter: string;
|
|
83
|
+
public static lower_case_slash: NamingConvention = new NamingConvention("path/case", "/", false, NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
84
|
+
public static UPPER_CASE_SLASH: NamingConvention = new NamingConvention("UPPER/CASE", "/", false, NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
85
|
+
public static Pascal_Case_Slash: NamingConvention = new NamingConvention("Pascal/Case", "/", true, NamingConvention.formatter_pascal, NamingConvention.splitter_pascal);
|
|
86
|
+
public static camel_Case_Slash: NamingConvention = new NamingConvention("camel/Case", "/", true, NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
87
|
+
public static First_word_case_slash: NamingConvention = new NamingConvention("First/word/case", "/", false, NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
88
|
+
public name: string;
|
|
89
|
+
public delimiter: string;
|
|
90
|
+
public revertable: boolean;
|
|
82
91
|
formatter: (word: string, index: number) => string;
|
|
83
92
|
splitter: (name: string, delimiter: string) => string[];
|
|
84
|
-
constructor(name: string, delimiter: string, formatter: (word: string, index: number) => string, splitter: (name: string, delimiter: string) => string[])
|
|
93
|
+
constructor(name: string, delimiter: string, revertable: boolean, formatter: (word: string, index: number) => string, splitter: (name: string, delimiter: string) => string[])
|
|
85
94
|
{
|
|
86
95
|
this.name = name;
|
|
87
96
|
this.delimiter = delimiter;
|
|
97
|
+
this.revertable = revertable;
|
|
88
98
|
this.formatter = formatter;
|
|
89
99
|
this.splitter = splitter;
|
|
90
100
|
}
|
|
@@ -94,15 +104,43 @@ export class NamingConvention
|
|
|
94
104
|
ans = ans.filter(w => w);
|
|
95
105
|
return ans;
|
|
96
106
|
}
|
|
97
|
-
convertByWords(words: string[])
|
|
107
|
+
convertByWords(words: string[], revertable: boolean = true)
|
|
98
108
|
{
|
|
99
109
|
for (let i = 0; i < words.length; i++)
|
|
100
110
|
words[i] = this.formatter(words[i], i);
|
|
111
|
+
let single_found: boolean = false;
|
|
112
|
+
if (this.revertable || !revertable)
|
|
113
|
+
{
|
|
114
|
+
let combined = [];
|
|
115
|
+
for (let i = 0; i < words.length; i++)
|
|
116
|
+
{
|
|
117
|
+
let word = words[i];
|
|
118
|
+
if (word)
|
|
119
|
+
{
|
|
120
|
+
if (i == 0 || word.length > 1)
|
|
121
|
+
{
|
|
122
|
+
combined.push(word);
|
|
123
|
+
single_found = false;
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
{
|
|
127
|
+
if (!single_found)
|
|
128
|
+
{
|
|
129
|
+
combined.push(word);
|
|
130
|
+
single_found = true;
|
|
131
|
+
}
|
|
132
|
+
else
|
|
133
|
+
combined[combined.length - 1] += word;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
words = combined;
|
|
138
|
+
}
|
|
101
139
|
return words.join(this.delimiter);
|
|
102
140
|
}
|
|
103
|
-
convert(name: string, to: NamingConvention)
|
|
141
|
+
convert(name: string, to: NamingConvention, revertable: boolean = true)
|
|
104
142
|
{
|
|
105
143
|
let words = this.getWords(name);
|
|
106
|
-
return to.convertByWords(words);
|
|
144
|
+
return to.convertByWords(words, revertable);
|
|
107
145
|
}
|
|
108
146
|
}
|
package/src/SortItem.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { ErrorOperation } from "./ErrorOperation";
|
|
|
5
5
|
|
|
6
6
|
export class SortItem
|
|
7
7
|
{
|
|
8
|
-
public table:
|
|
9
|
-
public column:
|
|
8
|
+
public table: BaseMetaTable;
|
|
9
|
+
public column: BaseMetaColumn;
|
|
10
10
|
public ascending: boolean;
|
|
11
11
|
public static encode(sorts: SortItem[] | null): string
|
|
12
12
|
{
|
|
@@ -44,10 +44,10 @@ export class SortItem
|
|
|
44
44
|
while (thereIsMore())
|
|
45
45
|
{
|
|
46
46
|
let value_table = next("Table");
|
|
47
|
-
let table = new BaseMetaTable(value_table, value_table);
|
|
47
|
+
let table = new BaseMetaTable(null, value_table, value_table);
|
|
48
48
|
|
|
49
49
|
let value_column = next("Column");
|
|
50
|
-
let column = new BaseMetaColumn(value_column, value_column, "", false)
|
|
50
|
+
let column = new BaseMetaColumn(table, value_column, value_column, "", false)
|
|
51
51
|
|
|
52
52
|
let value_asc = next("Asending").toLowerCase();
|
|
53
53
|
let asc = value_asc === "asc"
|
|
@@ -59,7 +59,7 @@ export class SortItem
|
|
|
59
59
|
}
|
|
60
60
|
return ans;
|
|
61
61
|
}
|
|
62
|
-
constructor(table:
|
|
62
|
+
constructor(table: BaseMetaTable, column: BaseMetaColumn, ascending: boolean)
|
|
63
63
|
{
|
|
64
64
|
this.table = table;
|
|
65
65
|
this.column = column;
|