@base-framework/base 3.0.121 → 3.0.122

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.
@@ -59,6 +59,22 @@ export class Component extends Unit {
59
59
  *
60
60
  * @protected
61
61
  * @returns {object}
62
+ *
63
+ * @example
64
+ * return {
65
+ *
66
+ * // simple state
67
+ * action: 'state', // any primitive value
68
+ *
69
+ * // a more complex state
70
+ * complexAction: {
71
+ * state: 'state', // any primitive value
72
+ * callBack(state, prevState)
73
+ * {
74
+ * // do something
75
+ * }
76
+ * }
77
+ * };
62
78
  */
63
79
  protected setupStates(): object;
64
80
  /**
@@ -89,6 +105,12 @@ export class Component extends Unit {
89
105
  *
90
106
  * @protected
91
107
  * @returns {array}
108
+ *
109
+ * @example
110
+ * return [
111
+ * // event, element, function, capture
112
+ * ['click', this.element, function(e){}, false]
113
+ * ];
92
114
  */
93
115
  protected setupEvents(): any[];
94
116
  /**
@@ -20,10 +20,10 @@ export namespace DateTime {
20
20
  * This will convert a date.
21
21
  *
22
22
  * @param {string} dateString
23
- * @param {boolean} addYear
23
+ * @param {boolean} [addYear]
24
24
  * @returns {string}
25
25
  */
26
- function convertDate(dateString: string, addYear: boolean): string;
26
+ function convertDate(dateString: string, addYear?: boolean): string;
27
27
  /**
28
28
  * This will add leading zero to number less than 10.
29
29
  *
@@ -41,11 +41,11 @@ export namespace DateTime {
41
41
  /**
42
42
  * This will format a date.
43
43
  *
44
- * @param {string} type
44
+ * @param {string} formatType
45
45
  * @param {string} dateString
46
46
  * @returns {string}
47
47
  */
48
- function format(type: string, dateString: string): string;
48
+ function format(formatType: string, dateString: string): string;
49
49
  /**
50
50
  * This will format time.
51
51
  *
@@ -54,6 +54,48 @@ export namespace DateTime {
54
54
  * @returns {string}
55
55
  */
56
56
  function formatTime(dateString: string, format: number): string;
57
+ /**
58
+ * This will get the meridian.
59
+ *
60
+ * @param {number|string} hours
61
+ * @returns {string}
62
+ */
63
+ function getMeridian(hours: string | number): string;
64
+ /**
65
+ * This will convert 24 hour time to 12 hour time.
66
+ *
67
+ * @param {number|string} hours
68
+ * @returns {number}
69
+ */
70
+ function convert24To12(hours: string | number): number;
71
+ /**
72
+ * This will convert 12 hour time to 24 hour time.
73
+ *
74
+ * @param {number|string} hours
75
+ * @param {string} meridian
76
+ * @returns {number}
77
+ */
78
+ function convert12To24(hours: string | number, meridian: string): number;
79
+ /**
80
+ * This will render a date.
81
+ *
82
+ * @param {number} year
83
+ * @param {number|string} month
84
+ * @param {number|string} day
85
+ * @param {string} [format='sql']
86
+ * @returns {string}
87
+ */
88
+ function renderDate(year: number, month: string | number, day: string | number, format?: string): string;
89
+ /**
90
+ * This will render time.
91
+ *
92
+ * @param {number} hours
93
+ * @param {number} minutes
94
+ * @param {number} [seconds=0]
95
+ * @param {string} [format='sql']
96
+ * @returns {string}
97
+ */
98
+ function renderTime(hours: number, minutes: number, seconds?: number, format?: string): string;
57
99
  /**
58
100
  * This will check for leap year.
59
101
  *
@@ -84,6 +126,24 @@ export namespace DateTime {
84
126
  * @returns {array}
85
127
  */
86
128
  function getMonthsLength(year?: number): any[];
129
+ /**
130
+ * This will get the local date.
131
+ *
132
+ * @param {string} remoteData
133
+ * @param {string} [remoteTimeZone]
134
+ * @returns {Date}
135
+ */
136
+ function getLocalDate(remoteData: string, remoteTimeZone?: string): Date;
137
+ /**
138
+ * This will convert a remote date to local time.
139
+ *
140
+ * @param {string} remoteData
141
+ * @param {boolean} sqlformat
142
+ * @param {boolean} timeOnly
143
+ * @param {string} [remoteTimeZone]
144
+ * @returns {string}
145
+ */
146
+ function getLocalTime(remoteData: string, sqlformat?: boolean, timeOnly?: boolean, remoteTimeZone?: string): string;
87
147
  /**
88
148
  * This will get the difference from now.
89
149
  *
@@ -38,11 +38,11 @@ export class Html {
38
38
  * This will add an element attribute.
39
39
  *
40
40
  * @param {object} obj
41
- * @param {object} attr
41
+ * @param {string} attr
42
42
  * @param {*} value
43
43
  * @returns {void}
44
44
  */
45
- static addAttr(obj: object, attr: object, value: any): void;
45
+ static addAttr(obj: object, attr: string, value: any): void;
46
46
  /**
47
47
  * This will create a doc fragment.
48
48
  *
@@ -32,11 +32,11 @@ export class HtmlHelper extends Html {
32
32
  * This will add an element attribute.
33
33
  *
34
34
  * @param {object} ele
35
- * @param {object} attr
35
+ * @param {string} attr
36
36
  * @param {*} value
37
37
  * @returns {void}
38
38
  */
39
- static addAttr(ele: object, attr: object, value: any, parent: any): void;
39
+ static addAttr(ele: object, attr: string, value: any, parent: any): void;
40
40
  /**
41
41
  * This will add content to an element.
42
42
  *
@@ -7,6 +7,14 @@
7
7
  * @name Strings
8
8
  */
9
9
  export class Strings {
10
+ /**
11
+ * This will limit the length of a string.
12
+ *
13
+ * @param {string} str
14
+ * @param {number} [maxLength]
15
+ * @returns {string}
16
+ */
17
+ static limit(str: string, maxLength?: number): string;
10
18
  /**
11
19
  * This will parse a query string.
12
20
  *
@@ -31,4 +39,11 @@ export class Strings {
31
39
  * @returns {string} The string.
32
40
  */
33
41
  static uncamelCase(str: string, delimiter?: string): string;
42
+ /**
43
+ * This will title case a string.
44
+ *
45
+ * @param {string} str
46
+ * @returns {string} The string.
47
+ */
48
+ static titleCase(str: string): string;
34
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/base",
3
- "version": "3.0.121",
3
+ "version": "3.0.122",
4
4
  "description": "This is a javascript framework.",
5
5
  "main": "./dist/base.js",
6
6
  "type": "module",