@idevs/corelib 0.0.37 → 0.0.38

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.
@@ -15,7 +15,7 @@ let DateMonthEditor = class DateMonthEditor extends SelectEditor {
15
15
  return indexOf(this.months, x => x == this.value);
16
16
  }
17
17
  getItems() {
18
- var _a, _b;
18
+ var _a, _b, _c;
19
19
  const opt = this.options;
20
20
  if (opt.items != null && opt.items.length >= 1) {
21
21
  return opt.items;
@@ -23,14 +23,14 @@ let DateMonthEditor = class DateMonthEditor extends SelectEditor {
23
23
  this.months = [];
24
24
  const locale = (_a = opt.locale) !== null && _a !== void 0 ? _a : 'en';
25
25
  const options = { month: (_b = opt.display) !== null && _b !== void 0 ? _b : '2-digit' };
26
- for (let i = 11; i >= 0; i--) {
26
+ for (let i = 0; i <= 11; i++) {
27
27
  this.months.push(new Date(2000, i, 1).toLocaleDateString(locale, options));
28
28
  }
29
- if (opt.descending) {
29
+ if (!((_c = opt.descending) !== null && _c !== void 0 ? _c : false)) {
30
30
  return this.months;
31
31
  }
32
32
  const months = [];
33
- for (let i1 = 0; i1 <= 11; i1++) {
33
+ for (let i1 = 11; i1 >= 0; i1--) {
34
34
  months.push(new Date(2000, i1, 1).toLocaleDateString(locale, options));
35
35
  }
36
36
  return months;
@@ -1 +1 @@
1
- {"version":3,"file":"dateMonthEditor.js","sourceRoot":"","sources":["../../src/editors/dateMonthEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAuB,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAGzC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,YAAY;IAG/C,YAAY,MAAc,EAAE,GAA2B;QACrD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAElB,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;IAED,IAAI,YAAY;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,CAuC3B;SAvCY,eAAe","sourcesContent":["import { Decorators, SelectEditor, SelectEditorOptions } from '@serenity-is/corelib'\nimport { indexOf } from '@serenity-is/corelib/q'\n\n@Decorators.registerEditor('DateMonthEditor')\nexport class DateMonthEditor extends SelectEditor {\n private months: string[]\n\n constructor(hidden: JQuery, opt: DateMonthEditorOptions) {\n super(hidden, opt)\n\n this.updateItems()\n }\n\n get valueAsMonth() {\n return indexOf(this.months, x => x == this.value)\n }\n\n getItems() {\n const opt = this.options as DateMonthEditorOptions\n\n if (opt.items != null && opt.items.length >= 1) {\n return opt.items\n }\n\n this.months = []\n const locale = opt.locale ?? 'en'\n const options = { month: opt.display ?? '2-digit' }\n\n for (let i = 11; i >= 0; i--) {\n this.months.push(new Date(2000, i, 1).toLocaleDateString(locale, options))\n }\n\n if (opt.descending) {\n return this.months\n }\n\n const months: string[] = []\n for (let i1 = 0; i1 <= 11; i1++) {\n months.push(new Date(2000, i1, 1).toLocaleDateString(locale, options))\n }\n\n return months\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface DateMonthEditorOptions extends SelectEditorOptions {\n display?: '2-digit' | 'short' | 'long'\n locale?: 'en' | 'th'\n descending?: boolean\n}\n"]}
1
+ {"version":3,"file":"dateMonthEditor.js","sourceRoot":"","sources":["../../src/editors/dateMonthEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAuB,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAGzC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,YAAY;IAG/C,YAAY,MAAc,EAAE,GAA2B;QACrD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAElB,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CA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ent":["import { Decorators, SelectEditor, SelectEditorOptions } from '@serenity-is/corelib'\nimport { indexOf } from '@serenity-is/corelib/q'\n\n@Decorators.registerEditor('DateMonthEditor')\nexport class DateMonthEditor extends SelectEditor {\n private months: string[]\n\n constructor(hidden: JQuery, opt: DateMonthEditorOptions) {\n super(hidden, opt)\n\n this.updateItems()\n }\n\n get valueAsMonth() {\n return indexOf(this.months, x => x == this.value)\n }\n\n getItems() {\n const opt = this.options as DateMonthEditorOptions\n\n if (opt.items != null && opt.items.length >= 1) {\n return opt.items\n }\n\n this.months = []\n const locale = opt.locale ?? 'en'\n const options = { month: opt.display ?? '2-digit' }\n\n for (let i = 0; i <= 11; i++) {\n this.months.push(new Date(2000, i, 1).toLocaleDateString(locale, options))\n }\n\n if (!(opt.descending ?? false)) {\n return this.months\n }\n\n const months: string[] = []\n for (let i1 = 11; i1 >= 0; i1--) {\n months.push(new Date(2000, i1, 1).toLocaleDateString(locale, options))\n }\n\n return months\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface DateMonthEditorOptions extends SelectEditorOptions {\n display?: '2-digit' | 'short' | 'long'\n locale?: 'en' | 'th'\n descending?: boolean\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idevs/corelib",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "description": "Extended library for Serenity Framework",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -26,16 +26,16 @@ export class DateMonthEditor extends SelectEditor {
26
26
  const locale = opt.locale ?? 'en'
27
27
  const options = { month: opt.display ?? '2-digit' }
28
28
 
29
- for (let i = 11; i >= 0; i--) {
29
+ for (let i = 0; i <= 11; i++) {
30
30
  this.months.push(new Date(2000, i, 1).toLocaleDateString(locale, options))
31
31
  }
32
32
 
33
- if (opt.descending) {
33
+ if (!(opt.descending ?? false)) {
34
34
  return this.months
35
35
  }
36
36
 
37
37
  const months: string[] = []
38
- for (let i1 = 0; i1 <= 11; i1++) {
38
+ for (let i1 = 11; i1 >= 0; i1--) {
39
39
  months.push(new Date(2000, i1, 1).toLocaleDateString(locale, options))
40
40
  }
41
41