@idevs/corelib 0.0.36 → 0.0.37
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare class DateMonthEditor extends SelectEditor {
|
|
3
3
|
private months;
|
|
4
4
|
constructor(hidden: JQuery, opt: DateMonthEditorOptions);
|
|
5
|
-
|
|
5
|
+
get valueAsMonth(): number;
|
|
6
6
|
getItems(): any[];
|
|
7
7
|
}
|
|
8
8
|
export interface DateMonthEditorOptions extends SelectEditorOptions {
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Decorators, SelectEditor } from '@serenity-is/corelib';
|
|
8
|
+
import { indexOf } from '@serenity-is/corelib/q';
|
|
8
9
|
let DateMonthEditor = class DateMonthEditor extends SelectEditor {
|
|
9
10
|
constructor(hidden, opt) {
|
|
10
11
|
super(hidden, opt);
|
|
11
12
|
this.updateItems();
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
return this.months;
|
|
14
|
+
get valueAsMonth() {
|
|
15
|
+
return indexOf(this.months, x => x == this.value);
|
|
15
16
|
}
|
|
16
17
|
getItems() {
|
|
17
18
|
var _a, _b;
|
|
@@ -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;
|
|
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,MA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BAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;SACvE;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAvCY,eAAe;IAD3B,UAAU,CAAC,cAAc,CAAC,iBAAiB,CAAC;GAChC,eAAe,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"]}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Decorators, SelectEditor, SelectEditorOptions } from '@serenity-is/corelib'
|
|
2
|
+
import { indexOf } from '@serenity-is/corelib/q'
|
|
2
3
|
|
|
3
4
|
@Decorators.registerEditor('DateMonthEditor')
|
|
4
5
|
export class DateMonthEditor extends SelectEditor {
|
|
@@ -10,8 +11,8 @@ export class DateMonthEditor extends SelectEditor {
|
|
|
10
11
|
this.updateItems()
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
return this.months
|
|
14
|
+
get valueAsMonth() {
|
|
15
|
+
return indexOf(this.months, x => x == this.value)
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
getItems() {
|