cnhis-design-vue 3.1.7 → 3.1.8
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/es/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.mjs +18 -0
- package/es/node_modules/date-fns/esm/_lib/requiredArgs/index.mjs +7 -0
- package/es/node_modules/date-fns/esm/compareAsc/index.mjs +56 -0
- package/es/node_modules/date-fns/esm/differenceInCalendarDays/index.mjs +53 -0
- package/es/node_modules/date-fns/esm/differenceInCalendarMonths/index.mjs +39 -0
- package/es/node_modules/date-fns/esm/differenceInDays/index.mjs +90 -0
- package/es/node_modules/date-fns/esm/differenceInMonths/index.mjs +63 -0
- package/es/node_modules/date-fns/esm/endOfDay/index.mjs +34 -0
- package/es/node_modules/date-fns/esm/endOfMonth/index.mjs +36 -0
- package/es/node_modules/date-fns/esm/isLastDayOfMonth/index.mjs +34 -0
- package/es/node_modules/date-fns/esm/startOfDay/index.mjs +34 -0
- package/es/node_modules/date-fns/esm/toDate/index.mjs +55 -0
- package/es/packages/big-table/index2.mjs +5 -3
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.mjs +10 -11
- package/es/packages/big-table/src/components/NoData.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/big-table/src/components/edit-form/edit-select-table.d.ts +1 -1
- package/es/packages/bpmn-workflow/index2.mjs +2 -2
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/button-print/index2.mjs +2 -2
- package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.mjs +6 -7
- package/es/packages/button-print/src/components/IdentityVerification.vue.d.ts +54 -107
- package/es/packages/button-print/src/components/IdentityVerification.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/chunk-upload/index2.mjs +4 -2
- package/es/packages/chunk-upload/src/chunk-upload-new.vue_vue_type_script_setup_true_lang.mjs +2 -3
- package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue_vue_type_script_setup_true_lang.mjs +11 -12
- package/es/packages/drag-layout/index.d.ts +294 -430
- package/es/packages/drag-layout/index2.mjs +4 -2
- package/es/packages/drag-layout/src/DragFormLeftItem.vue.d.ts +92 -119
- package/es/packages/drag-layout/src/DragFormLeftItem.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/drag-layout/src/DragFormRightItem.vue.d.ts +77 -98
- package/es/packages/drag-layout/src/DragFormRightItem.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/drag-layout/src/DragLayout.vue.d.ts +297 -430
- package/es/packages/drag-layout/src/DragLayout.vue_vue_type_script_setup_true_lang.mjs +44 -45
- package/es/packages/editor/index2.mjs +2 -2
- package/es/packages/field-set/index2.mjs +2 -2
- package/es/packages/field-set/src/FieldSet.vue_vue_type_script_setup_true_lang.mjs +4 -5
- package/es/packages/field-set/src/NewFieldSet.vue_vue_type_script_setup_true_lang.mjs +5 -8
- package/es/packages/form-render/index.mjs +10 -0
- package/es/packages/form-render/index2.mjs +15 -0
- package/es/packages/form-render/src/FormRender.mjs +2 -0
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.mjs +91 -0
- package/es/packages/form-render/src/FormRender2.mjs +4 -0
- package/es/packages/form-render/src/components/cascader.d.ts +40 -0
- package/es/packages/form-render/src/components/cascader.mjs +1 -0
- package/es/packages/form-render/src/components/cascader2.mjs +108 -0
- package/es/packages/form-render/src/components/checkbox.d.ts +24 -0
- package/es/packages/form-render/src/components/checkbox.mjs +1 -0
- package/es/packages/form-render/src/components/checkbox2.mjs +42 -0
- package/es/packages/form-render/src/components/collapse.d.ts +31 -0
- package/es/packages/form-render/src/components/collapse.mjs +1 -0
- package/es/packages/form-render/src/components/collapse2.mjs +54 -0
- package/es/packages/form-render/src/components/combination.d.ts +142 -0
- package/es/packages/form-render/src/components/combination.mjs +1 -0
- package/es/packages/form-render/src/components/combination2.mjs +116 -0
- package/es/packages/form-render/src/components/date.d.ts +5033 -0
- package/es/packages/form-render/src/components/date.mjs +1 -0
- package/es/packages/form-render/src/components/date2.mjs +34 -0
- package/es/packages/form-render/src/components/formItem.d.ts +292 -0
- package/es/packages/form-render/src/components/formItem.mjs +1 -0
- package/es/packages/form-render/src/components/formItem2.mjs +22 -0
- package/es/packages/form-render/src/components/index.d.ts +15 -0
- package/es/packages/form-render/src/components/index.mjs +15 -0
- package/es/packages/form-render/src/components/index2.mjs +15 -0
- package/es/packages/form-render/src/components/input.d.ts +15 -0
- package/es/packages/form-render/src/components/input.mjs +1 -0
- package/es/packages/form-render/src/components/input2.mjs +40 -0
- package/es/packages/form-render/src/components/inputGroup.d.ts +11 -0
- package/es/packages/form-render/src/components/inputGroup.mjs +1 -0
- package/es/packages/form-render/src/components/inputGroup2.mjs +8 -0
- package/es/packages/{map/src/Map.vue.d.ts → form-render/src/components/inputNumber.d.ts} +1002 -1150
- package/es/packages/form-render/src/components/inputNumber.mjs +1 -0
- package/es/packages/form-render/src/components/inputNumber2.mjs +7 -0
- package/es/packages/form-render/src/components/labelSelect.d.ts +1 -0
- package/es/packages/form-render/src/components/labelSelect.mjs +1 -0
- package/es/packages/form-render/src/components/labelSelect2.mjs +18 -0
- package/es/packages/form-render/src/components/radio.d.ts +24 -0
- package/es/packages/form-render/src/components/radio.mjs +1 -0
- package/es/packages/form-render/src/components/radio2.mjs +44 -0
- package/es/packages/form-render/src/components/select.d.ts +29 -0
- package/es/packages/form-render/src/components/select.mjs +1 -0
- package/es/packages/form-render/src/components/select2.mjs +97 -0
- package/es/packages/form-render/src/components/slider.d.ts +347 -0
- package/es/packages/form-render/src/components/slider.mjs +1 -0
- package/es/packages/form-render/src/components/slider2.mjs +16 -0
- package/es/packages/form-render/src/components/switch.d.ts +21 -0
- package/es/packages/form-render/src/components/switch.mjs +1 -0
- package/es/packages/form-render/src/components/switch2.mjs +48 -0
- package/es/packages/form-render/src/components/textarea.d.ts +845 -0
- package/es/packages/form-render/src/components/textarea.mjs +1 -0
- package/es/packages/form-render/src/components/textarea2.mjs +11 -0
- package/es/packages/form-render/src/constants/index.d.ts +23 -0
- package/es/packages/form-render/src/constants/index.mjs +1 -0
- package/es/packages/form-render/src/constants/index2.mjs +24 -0
- package/es/packages/form-render/src/hooks/index.d.ts +9 -0
- package/es/packages/form-render/src/hooks/index.mjs +9 -0
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +60 -0
- package/es/packages/form-render/src/hooks/useAsyncQueue.mjs +1 -0
- package/es/packages/form-render/src/hooks/useAsyncQueue2.mjs +138 -0
- package/es/packages/form-render/src/hooks/useBusinessBinding.d.ts +13 -0
- package/es/packages/form-render/src/hooks/useBusinessBinding.mjs +1 -0
- package/es/packages/form-render/src/hooks/useBusinessBinding2.mjs +48 -0
- package/es/packages/form-render/src/hooks/useCommonLog.d.ts +3 -0
- package/es/packages/form-render/src/hooks/useCommonLog.mjs +1 -0
- package/es/packages/form-render/src/hooks/useCommonLog2.mjs +10 -0
- package/es/packages/form-render/src/hooks/useFieldList2Schema.d.ts +64 -0
- package/es/packages/form-render/src/hooks/useFieldList2Schema.mjs +1 -0
- package/es/packages/form-render/src/hooks/useFieldList2Schema2.mjs +184 -0
- package/es/packages/form-render/src/hooks/useFieldVisitor.d.ts +4 -0
- package/es/packages/form-render/src/hooks/useFieldVisitor.mjs +1 -0
- package/es/packages/form-render/src/hooks/useFieldVisitor2.mjs +38 -0
- package/es/packages/form-render/src/hooks/useFormField.d.ts +4 -0
- package/es/packages/form-render/src/hooks/useFormField.mjs +1 -0
- package/es/packages/form-render/src/hooks/useFormField2.mjs +9 -0
- package/es/packages/form-render/src/hooks/useFormRequest.d.ts +6 -0
- package/es/packages/form-render/src/hooks/useFormRequest.mjs +1 -0
- package/es/packages/form-render/src/hooks/useFormRequest2.mjs +12 -0
- package/es/packages/form-render/src/hooks/useFormValidator.d.ts +5 -0
- package/es/packages/form-render/src/hooks/useFormValidator.mjs +1 -0
- package/es/packages/form-render/src/hooks/useFormValidator2.mjs +48 -0
- package/es/packages/form-render/src/hooks/useTypeNormalize.d.ts +4 -0
- package/es/packages/form-render/src/hooks/useTypeNormalize.mjs +1 -0
- package/es/packages/form-render/src/hooks/useTypeNormalize2.mjs +37 -0
- package/es/packages/form-render/src/types/fieldItem.d.ts +44 -0
- package/es/packages/form-render/src/types/fieldItem.mjs +1 -0
- package/es/packages/form-render/src/types/index.d.ts +26 -0
- package/es/packages/form-render/src/types/index.mjs +1 -0
- package/es/packages/form-render/src/utils/index.d.ts +10 -0
- package/es/packages/form-render/src/utils/index.mjs +1 -0
- package/es/packages/form-render/src/utils/index2.mjs +59 -0
- package/es/packages/form-render/style/index.css +80 -0
- package/es/packages/form-render/style/index.less +116 -0
- package/es/packages/form-table/index2.mjs +2 -2
- package/es/packages/form-table/src/FormTable.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-age.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-date-picker.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-digital.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-input-password.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-input.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-month-picker.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-search-more.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-search.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-select-multiple.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-select.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-textarea.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-time-picker.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/table-tree-select.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/form-table/src/components/text-over-tooltip.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/grid/index2.mjs +4 -2
- package/es/packages/index.css +81 -1
- package/es/packages/index.d.ts +5 -2
- package/es/packages/index.less +118 -1
- package/es/packages/index.mjs +10 -0
- package/es/packages/index2.mjs +7 -7
- package/es/packages/info-header/index2.mjs +2 -2
- package/es/packages/info-header/src/HiddenContent.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/info-header/src/InfoHeader.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/info-header/style/index.css +1 -1
- package/es/packages/info-header/style/index.less +1 -1
- package/es/packages/map/index2.mjs +2 -2
- package/es/packages/map/src/Map.vue_vue_type_script_setup_true_lang.mjs +5 -6
- package/es/packages/scale-view/index2.mjs +8 -6
- package/es/packages/scale-view/src/ScaleView.vue_vue_type_script_setup_true_lang.mjs +16 -14
- package/es/packages/scale-view/src/components/AnswerParse.vue_vue_type_script_setup_true_lang.mjs +2 -3
- package/es/packages/scale-view/src/components/EvaluateCountdown.vue_vue_type_script_setup_true_lang.mjs +1 -2
- package/es/packages/scale-view/src/components/EvaluatePage.vue_vue_type_script_setup_true_lang.mjs +3 -4
- package/es/packages/scale-view/src/components/NoData.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/scale-view/src/components/ScaleScore2.mjs +1 -1
- package/es/packages/scale-view/src/components/composables/choose-common.d.ts +1 -1
- package/es/packages/scale-view/src/components/formitem/r-checkbox2.mjs +3 -3
- package/es/packages/scale-view/src/components/formitem/r-collection2.mjs +1 -1
- package/es/packages/scale-view/src/components/formitem/r-radio2.mjs +4 -4
- package/es/packages/scale-view/src/components/formitem/r-select2.mjs +3 -3
- package/es/packages/scale-view/src/components/formitem/text-over-tooltip/TextOverTooltip.vue.d.ts +2 -6
- package/es/packages/select-label/index2.mjs +3 -3
- package/es/packages/select-label/src/LabelFormContent.vue.d.ts +96 -303
- package/es/packages/select-label/src/LabelFormContent.vue_vue_type_script_setup_true_lang.mjs +4 -5
- package/es/packages/select-label/src/SelectLabel.vue_vue_type_script_setup_true_lang.mjs +19 -17
- package/es/packages/select-label/src/components/label-classify.vue.d.ts +68 -236
- package/es/packages/select-label/src/components/label-classify.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/packages/select-person/index2.mjs +2 -2
- package/es/packages/select-person/src/SearchTree.vue_vue_type_script_setup_true_lang.mjs +2 -3
- package/es/packages/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.mjs +23 -24
- package/es/packages/time-line/index.d.ts +28 -47
- package/es/packages/time-line/index2.mjs +2 -2
- package/es/packages/time-line/src/TimeLine.vue.d.ts +28 -47
- package/es/packages/time-line/src/TimeLine.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/src/components/SelectPage/SelectPage.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/src/components/SvgIcon/SvgIcon.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/src/components/TextOverTooltip/TextOverTooltip.vue.d.ts +2 -6
- package/es/src/components/TextOverTooltip/TextOverTooltip.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/src/components/player-vod/index.vue_vue_type_script_setup_true_lang.mjs +0 -1
- package/es/src/utils/anime.d.ts +35 -0
- package/es/src/utils/anime.mjs +1 -0
- package/es/src/utils/anime2.mjs +126 -0
- package/es/src/utils/utilExpand.d.ts +1 -0
- package/es/src/utils/utilExpand.mjs +1 -0
- package/es/src/utils/utilExpand2.mjs +714 -0
- package/es/src/utils/vexutils2.mjs +2 -708
- package/md-plugin.ts +201 -0
- package/package.json +125 -119
- package/uno.config.ts +22 -0
- package/es/packages/big-table/index.d.ts +0 -2047
- package/es/packages/big-table/src/BigTable.vue.d.ts +0 -2046
- package/es/packages/big-table/src/components/NoData.vue.d.ts +0 -51
- package/es/packages/bpmn-workflow/index.d.ts +0 -74
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.vue.d.ts +0 -77
- package/es/packages/button-print/index.d.ts +0 -7378
- package/es/packages/button-print/src/ButtonPrint.vue.d.ts +0 -7377
- package/es/packages/chunk-upload/index.d.ts +0 -1748
- package/es/packages/chunk-upload/src/chunk-upload-new.vue.d.ts +0 -1905
- package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +0 -1749
- package/es/packages/field-set/index.d.ts +0 -5284
- package/es/packages/field-set/src/FieldSet.vue.d.ts +0 -2602
- package/es/packages/field-set/src/NewFieldSet.vue.d.ts +0 -2599
- package/es/packages/form-table/index.d.ts +0 -35928
- package/es/packages/form-table/src/FormTable.vue.d.ts +0 -35928
- package/es/packages/form-table/src/components/index.d.ts +0 -35687
- package/es/packages/form-table/src/components/table-age.vue.d.ts +0 -4308
- package/es/packages/form-table/src/components/table-date-picker.vue.d.ts +0 -5287
- package/es/packages/form-table/src/components/table-digital.vue.d.ts +0 -2919
- package/es/packages/form-table/src/components/table-input-password.vue.d.ts +0 -1627
- package/es/packages/form-table/src/components/table-input.vue.d.ts +0 -1584
- package/es/packages/form-table/src/components/table-month-picker.vue.d.ts +0 -5230
- package/es/packages/form-table/src/components/table-search-more.vue.d.ts +0 -1785
- package/es/packages/form-table/src/components/table-search.vue.d.ts +0 -3111
- package/es/packages/form-table/src/components/table-select-multiple.vue.d.ts +0 -1567
- package/es/packages/form-table/src/components/table-select.vue.d.ts +0 -1566
- package/es/packages/form-table/src/components/table-textarea.vue.d.ts +0 -1643
- package/es/packages/form-table/src/components/table-time-picker.vue.d.ts +0 -2674
- package/es/packages/form-table/src/components/table-tree-select.vue.d.ts +0 -1881
- package/es/packages/form-table/src/components/text-over-tooltip.vue.d.ts +0 -546
- package/es/packages/info-header/index.d.ts +0 -1846
- package/es/packages/info-header/src/HiddenContent.vue.d.ts +0 -363
- package/es/packages/info-header/src/InfoHeader.vue.d.ts +0 -1847
- package/es/packages/map/index.d.ts +0 -2315
- package/es/packages/scale-view/index.d.ts +0 -4297
- package/es/packages/scale-view/src/ScaleView.vue.d.ts +0 -4141
- package/es/packages/scale-view/src/components/AnswerParse.vue.d.ts +0 -72
- package/es/packages/scale-view/src/components/EvaluateCountdown.vue.d.ts +0 -150
- package/es/packages/scale-view/src/components/EvaluatePage.vue.d.ts +0 -1503
- package/es/packages/scale-view/src/components/NoData.vue.d.ts +0 -51
- package/es/packages/scale-view/src/hooks/use-component.d.ts +0 -2673
- package/es/packages/select-label/index.d.ts +0 -12120
- package/es/packages/select-label/src/SelectLabel.vue.d.ts +0 -7546
- package/es/packages/select-person/index.d.ts +0 -3502
- package/es/packages/select-person/src/SearchTree.vue.d.ts +0 -344
- package/es/packages/select-person/src/SelectPerson.vue.d.ts +0 -3505
- package/es/src/components/SelectPage/SelectPage.vue.d.ts +0 -1446
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
3
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
4
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
5
|
+
* and GMT+01:00:00 after that date)
|
|
6
|
+
*
|
|
7
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
8
|
+
* which would lead to incorrect calculations.
|
|
9
|
+
*
|
|
10
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
11
|
+
*/
|
|
12
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
13
|
+
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
14
|
+
utcDate.setUTCFullYear(date.getFullYear());
|
|
15
|
+
return date.getTime() - utcDate.getTime();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getTimezoneOffsetInMilliseconds as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @name compareAsc
|
|
6
|
+
* @category Common Helpers
|
|
7
|
+
* @summary Compare the two dates and return -1, 0 or 1.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Compare the two dates and return 1 if the first date is after the second,
|
|
11
|
+
* -1 if the first date is before the second or 0 if dates are equal.
|
|
12
|
+
*
|
|
13
|
+
* ### v2.0.0 breaking changes:
|
|
14
|
+
*
|
|
15
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
16
|
+
*
|
|
17
|
+
* @param {Date|Number} dateLeft - the first date to compare
|
|
18
|
+
* @param {Date|Number} dateRight - the second date to compare
|
|
19
|
+
* @returns {Number} the result of the comparison
|
|
20
|
+
* @throws {TypeError} 2 arguments required
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Compare 11 February 1987 and 10 July 1989:
|
|
24
|
+
* const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
|
|
25
|
+
* //=> -1
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Sort the array of dates:
|
|
29
|
+
* const result = [
|
|
30
|
+
* new Date(1995, 6, 2),
|
|
31
|
+
* new Date(1987, 1, 11),
|
|
32
|
+
* new Date(1989, 6, 10)
|
|
33
|
+
* ].sort(compareAsc)
|
|
34
|
+
* //=> [
|
|
35
|
+
* // Wed Feb 11 1987 00:00:00,
|
|
36
|
+
* // Mon Jul 10 1989 00:00:00,
|
|
37
|
+
* // Sun Jul 02 1995 00:00:00
|
|
38
|
+
* // ]
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
function compareAsc(dirtyDateLeft, dirtyDateRight) {
|
|
42
|
+
requiredArgs(2, arguments);
|
|
43
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
44
|
+
var dateRight = toDate(dirtyDateRight);
|
|
45
|
+
var diff = dateLeft.getTime() - dateRight.getTime();
|
|
46
|
+
|
|
47
|
+
if (diff < 0) {
|
|
48
|
+
return -1;
|
|
49
|
+
} else if (diff > 0) {
|
|
50
|
+
return 1; // Return 0 if diff is 0; return NaN if diff is NaN
|
|
51
|
+
} else {
|
|
52
|
+
return diff;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { compareAsc as default };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.mjs';
|
|
2
|
+
import startOfDay from '../startOfDay/index.mjs';
|
|
3
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
4
|
+
|
|
5
|
+
var MILLISECONDS_IN_DAY = 86400000;
|
|
6
|
+
/**
|
|
7
|
+
* @name differenceInCalendarDays
|
|
8
|
+
* @category Day Helpers
|
|
9
|
+
* @summary Get the number of calendar days between the given dates.
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* Get the number of calendar days between the given dates. This means that the times are removed
|
|
13
|
+
* from the dates and then the difference in days is calculated.
|
|
14
|
+
*
|
|
15
|
+
* ### v2.0.0 breaking changes:
|
|
16
|
+
*
|
|
17
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
18
|
+
*
|
|
19
|
+
* @param {Date|Number} dateLeft - the later date
|
|
20
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
21
|
+
* @returns {Number} the number of calendar days
|
|
22
|
+
* @throws {TypeError} 2 arguments required
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // How many calendar days are between
|
|
26
|
+
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
27
|
+
* const result = differenceInCalendarDays(
|
|
28
|
+
* new Date(2012, 6, 2, 0, 0),
|
|
29
|
+
* new Date(2011, 6, 2, 23, 0)
|
|
30
|
+
* )
|
|
31
|
+
* //=> 366
|
|
32
|
+
* // How many calendar days are between
|
|
33
|
+
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
34
|
+
* const result = differenceInCalendarDays(
|
|
35
|
+
* new Date(2011, 6, 3, 0, 1),
|
|
36
|
+
* new Date(2011, 6, 2, 23, 59)
|
|
37
|
+
* )
|
|
38
|
+
* //=> 1
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
|
|
42
|
+
requiredArgs(2, arguments);
|
|
43
|
+
var startOfDayLeft = startOfDay(dirtyDateLeft);
|
|
44
|
+
var startOfDayRight = startOfDay(dirtyDateRight);
|
|
45
|
+
var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);
|
|
46
|
+
var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight); // Round the number of days to the nearest integer
|
|
47
|
+
// because the number of milliseconds in a day is not constant
|
|
48
|
+
// (e.g. it's different in the day of the daylight saving time clock shift)
|
|
49
|
+
|
|
50
|
+
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { differenceInCalendarDays as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @name differenceInCalendarMonths
|
|
6
|
+
* @category Month Helpers
|
|
7
|
+
* @summary Get the number of calendar months between the given dates.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Get the number of calendar months between the given dates.
|
|
11
|
+
*
|
|
12
|
+
* ### v2.0.0 breaking changes:
|
|
13
|
+
*
|
|
14
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
15
|
+
*
|
|
16
|
+
* @param {Date|Number} dateLeft - the later date
|
|
17
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
18
|
+
* @returns {Number} the number of calendar months
|
|
19
|
+
* @throws {TypeError} 2 arguments required
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // How many calendar months are between 31 January 2014 and 1 September 2014?
|
|
23
|
+
* var result = differenceInCalendarMonths(
|
|
24
|
+
* new Date(2014, 8, 1),
|
|
25
|
+
* new Date(2014, 0, 31)
|
|
26
|
+
* )
|
|
27
|
+
* //=> 8
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {
|
|
31
|
+
requiredArgs(2, arguments);
|
|
32
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
33
|
+
var dateRight = toDate(dirtyDateRight);
|
|
34
|
+
var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();
|
|
35
|
+
var monthDiff = dateLeft.getMonth() - dateRight.getMonth();
|
|
36
|
+
return yearDiff * 12 + monthDiff;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { differenceInCalendarMonths as default };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import differenceInCalendarDays from '../differenceInCalendarDays/index.mjs';
|
|
3
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
4
|
+
|
|
5
|
+
// for accurate equality comparisons of UTC timestamps that end up
|
|
6
|
+
// having the same representation in local time, e.g. one hour before
|
|
7
|
+
// DST ends vs. the instant that DST ends.
|
|
8
|
+
|
|
9
|
+
function compareLocalAsc(dateLeft, dateRight) {
|
|
10
|
+
var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();
|
|
11
|
+
|
|
12
|
+
if (diff < 0) {
|
|
13
|
+
return -1;
|
|
14
|
+
} else if (diff > 0) {
|
|
15
|
+
return 1; // Return 0 if diff is 0; return NaN if diff is NaN
|
|
16
|
+
} else {
|
|
17
|
+
return diff;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @name differenceInDays
|
|
22
|
+
* @category Day Helpers
|
|
23
|
+
* @summary Get the number of full days between the given dates.
|
|
24
|
+
*
|
|
25
|
+
* @description
|
|
26
|
+
* Get the number of full day periods between two dates. Fractional days are
|
|
27
|
+
* truncated towards zero.
|
|
28
|
+
*
|
|
29
|
+
* One "full day" is the distance between a local time in one day to the same
|
|
30
|
+
* local time on the next or previous day. A full day can sometimes be less than
|
|
31
|
+
* or more than 24 hours if a daylight savings change happens between two dates.
|
|
32
|
+
*
|
|
33
|
+
* To ignore DST and only measure exact 24-hour periods, use this instead:
|
|
34
|
+
* `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
* ### v2.0.0 breaking changes:
|
|
38
|
+
*
|
|
39
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
40
|
+
*
|
|
41
|
+
* @param {Date|Number} dateLeft - the later date
|
|
42
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
43
|
+
* @returns {Number} the number of full days according to the local timezone
|
|
44
|
+
* @throws {TypeError} 2 arguments required
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // How many full days are between
|
|
48
|
+
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
49
|
+
* const result = differenceInDays(
|
|
50
|
+
* new Date(2012, 6, 2, 0, 0),
|
|
51
|
+
* new Date(2011, 6, 2, 23, 0)
|
|
52
|
+
* )
|
|
53
|
+
* //=> 365
|
|
54
|
+
* // How many full days are between
|
|
55
|
+
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
56
|
+
* const result = differenceInDays(
|
|
57
|
+
* new Date(2011, 6, 3, 0, 1),
|
|
58
|
+
* new Date(2011, 6, 2, 23, 59)
|
|
59
|
+
* )
|
|
60
|
+
* //=> 0
|
|
61
|
+
* // How many full days are between
|
|
62
|
+
* // 1 March 2020 0:00 and 1 June 2020 0:00 ?
|
|
63
|
+
* // Note: because local time is used, the
|
|
64
|
+
* // result will always be 92 days, even in
|
|
65
|
+
* // time zones where DST starts and the
|
|
66
|
+
* // period has only 92*24-1 hours.
|
|
67
|
+
* const result = differenceInDays(
|
|
68
|
+
* new Date(2020, 5, 1),
|
|
69
|
+
* new Date(2020, 2, 1)
|
|
70
|
+
* )
|
|
71
|
+
//=> 92
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
function differenceInDays(dirtyDateLeft, dirtyDateRight) {
|
|
76
|
+
requiredArgs(2, arguments);
|
|
77
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
78
|
+
var dateRight = toDate(dirtyDateRight);
|
|
79
|
+
var sign = compareLocalAsc(dateLeft, dateRight);
|
|
80
|
+
var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight));
|
|
81
|
+
dateLeft.setDate(dateLeft.getDate() - sign * difference); // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full
|
|
82
|
+
// If so, result must be decreased by 1 in absolute value
|
|
83
|
+
|
|
84
|
+
var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);
|
|
85
|
+
var result = sign * (difference - isLastDayNotFull); // Prevent negative zero
|
|
86
|
+
|
|
87
|
+
return result === 0 ? 0 : result;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { differenceInDays as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import differenceInCalendarMonths from '../differenceInCalendarMonths/index.mjs';
|
|
3
|
+
import compareAsc from '../compareAsc/index.mjs';
|
|
4
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
5
|
+
import isLastDayOfMonth from '../isLastDayOfMonth/index.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @name differenceInMonths
|
|
9
|
+
* @category Month Helpers
|
|
10
|
+
* @summary Get the number of full months between the given dates.
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Get the number of full months between the given dates using trunc as a default rounding method.
|
|
14
|
+
*
|
|
15
|
+
* ### v2.0.0 breaking changes:
|
|
16
|
+
*
|
|
17
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
18
|
+
*
|
|
19
|
+
* @param {Date|Number} dateLeft - the later date
|
|
20
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
21
|
+
* @returns {Number} the number of full months
|
|
22
|
+
* @throws {TypeError} 2 arguments required
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // How many full months are between 31 January 2014 and 1 September 2014?
|
|
26
|
+
* const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
|
|
27
|
+
* //=> 7
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
|
|
31
|
+
requiredArgs(2, arguments);
|
|
32
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
33
|
+
var dateRight = toDate(dirtyDateRight);
|
|
34
|
+
var sign = compareAsc(dateLeft, dateRight);
|
|
35
|
+
var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));
|
|
36
|
+
var result; // Check for the difference of less than month
|
|
37
|
+
|
|
38
|
+
if (difference < 1) {
|
|
39
|
+
result = 0;
|
|
40
|
+
} else {
|
|
41
|
+
if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {
|
|
42
|
+
// This will check if the date is end of Feb and assign a higher end of month date
|
|
43
|
+
// to compare it with Jan
|
|
44
|
+
dateLeft.setDate(30);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
dateLeft.setMonth(dateLeft.getMonth() - sign * difference); // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full
|
|
48
|
+
// If so, result must be decreased by 1 in absolute value
|
|
49
|
+
|
|
50
|
+
var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign; // Check for cases of one full calendar month
|
|
51
|
+
|
|
52
|
+
if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {
|
|
53
|
+
isLastMonthNotFull = false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
result = sign * (difference - Number(isLastMonthNotFull));
|
|
57
|
+
} // Prevent negative zero
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
return result === 0 ? 0 : result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { differenceInMonths as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @name endOfDay
|
|
6
|
+
* @category Day Helpers
|
|
7
|
+
* @summary Return the end of a day for the given date.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Return the end of a day for the given date.
|
|
11
|
+
* The result will be in the local timezone.
|
|
12
|
+
*
|
|
13
|
+
* ### v2.0.0 breaking changes:
|
|
14
|
+
*
|
|
15
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
16
|
+
*
|
|
17
|
+
* @param {Date|Number} date - the original date
|
|
18
|
+
* @returns {Date} the end of a day
|
|
19
|
+
* @throws {TypeError} 1 argument required
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // The end of a day for 2 September 2014 11:55:00:
|
|
23
|
+
* const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
|
|
24
|
+
* //=> Tue Sep 02 2014 23:59:59.999
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
function endOfDay(dirtyDate) {
|
|
28
|
+
requiredArgs(1, arguments);
|
|
29
|
+
var date = toDate(dirtyDate);
|
|
30
|
+
date.setHours(23, 59, 59, 999);
|
|
31
|
+
return date;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { endOfDay as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @name endOfMonth
|
|
6
|
+
* @category Month Helpers
|
|
7
|
+
* @summary Return the end of a month for the given date.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Return the end of a month for the given date.
|
|
11
|
+
* The result will be in the local timezone.
|
|
12
|
+
*
|
|
13
|
+
* ### v2.0.0 breaking changes:
|
|
14
|
+
*
|
|
15
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
16
|
+
*
|
|
17
|
+
* @param {Date|Number} date - the original date
|
|
18
|
+
* @returns {Date} the end of a month
|
|
19
|
+
* @throws {TypeError} 1 argument required
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // The end of a month for 2 September 2014 11:55:00:
|
|
23
|
+
* const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
|
|
24
|
+
* //=> Tue Sep 30 2014 23:59:59.999
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
function endOfMonth(dirtyDate) {
|
|
28
|
+
requiredArgs(1, arguments);
|
|
29
|
+
var date = toDate(dirtyDate);
|
|
30
|
+
var month = date.getMonth();
|
|
31
|
+
date.setFullYear(date.getFullYear(), month + 1, 0);
|
|
32
|
+
date.setHours(23, 59, 59, 999);
|
|
33
|
+
return date;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { endOfMonth as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import endOfDay from '../endOfDay/index.mjs';
|
|
3
|
+
import endOfMonth from '../endOfMonth/index.mjs';
|
|
4
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @name isLastDayOfMonth
|
|
8
|
+
* @category Month Helpers
|
|
9
|
+
* @summary Is the given date the last day of a month?
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* Is the given date the last day of a month?
|
|
13
|
+
*
|
|
14
|
+
* ### v2.0.0 breaking changes:
|
|
15
|
+
*
|
|
16
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
17
|
+
*
|
|
18
|
+
* @param {Date|Number} date - the date to check
|
|
19
|
+
* @returns {Boolean} the date is the last day of a month
|
|
20
|
+
* @throws {TypeError} 1 argument required
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Is 28 February 2014 the last day of a month?
|
|
24
|
+
* var result = isLastDayOfMonth(new Date(2014, 1, 28))
|
|
25
|
+
* //=> true
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
function isLastDayOfMonth(dirtyDate) {
|
|
29
|
+
requiredArgs(1, arguments);
|
|
30
|
+
var date = toDate(dirtyDate);
|
|
31
|
+
return endOfDay(date).getTime() === endOfMonth(date).getTime();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { isLastDayOfMonth as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import toDate from '../toDate/index.mjs';
|
|
2
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @name startOfDay
|
|
6
|
+
* @category Day Helpers
|
|
7
|
+
* @summary Return the start of a day for the given date.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Return the start of a day for the given date.
|
|
11
|
+
* The result will be in the local timezone.
|
|
12
|
+
*
|
|
13
|
+
* ### v2.0.0 breaking changes:
|
|
14
|
+
*
|
|
15
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
16
|
+
*
|
|
17
|
+
* @param {Date|Number} date - the original date
|
|
18
|
+
* @returns {Date} the start of a day
|
|
19
|
+
* @throws {TypeError} 1 argument required
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // The start of a day for 2 September 2014 11:55:00:
|
|
23
|
+
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
|
|
24
|
+
* //=> Tue Sep 02 2014 00:00:00
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
function startOfDay(dirtyDate) {
|
|
28
|
+
requiredArgs(1, arguments);
|
|
29
|
+
var date = toDate(dirtyDate);
|
|
30
|
+
date.setHours(0, 0, 0, 0);
|
|
31
|
+
return date;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { startOfDay as default };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import requiredArgs from '../_lib/requiredArgs/index.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @name toDate
|
|
5
|
+
* @category Common Helpers
|
|
6
|
+
* @summary Convert the given argument to an instance of Date.
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* Convert the given argument to an instance of Date.
|
|
10
|
+
*
|
|
11
|
+
* If the argument is an instance of Date, the function returns its clone.
|
|
12
|
+
*
|
|
13
|
+
* If the argument is a number, it is treated as a timestamp.
|
|
14
|
+
*
|
|
15
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
|
16
|
+
*
|
|
17
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
18
|
+
*
|
|
19
|
+
* @param {Date|Number} argument - the value to convert
|
|
20
|
+
* @returns {Date} the parsed date in the local time zone
|
|
21
|
+
* @throws {TypeError} 1 argument required
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Clone the date:
|
|
25
|
+
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
26
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Convert the timestamp to date:
|
|
30
|
+
* const result = toDate(1392098430000)
|
|
31
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function toDate(argument) {
|
|
35
|
+
requiredArgs(1, arguments);
|
|
36
|
+
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
37
|
+
|
|
38
|
+
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
|
|
39
|
+
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
40
|
+
return new Date(argument.getTime());
|
|
41
|
+
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
42
|
+
return new Date(argument);
|
|
43
|
+
} else {
|
|
44
|
+
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
|
|
47
|
+
|
|
48
|
+
console.warn(new Error().stack);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return new Date(NaN);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { toDate as default };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { KEY_COMPONENT_NAME } from 'cnhis-design-vue/es/src/global/variable';
|
|
2
|
-
import { safeComponentRegister
|
|
2
|
+
import { safeComponentRegister } from 'cnhis-design-vue/es/src/utils';
|
|
3
3
|
import { loadVxeTable } from 'cnhis-design-vue/es/src/utils/loadVxe';
|
|
4
|
+
import { expandXEUtils } from 'cnhis-design-vue/es/src/utils/utilExpand';
|
|
4
5
|
import { CGrid } from 'cnhis-design-vue/es/packages/index';
|
|
5
6
|
import './src/BigTable2.mjs';
|
|
6
7
|
import script from './src/BigTable.vue_vue_type_script_setup_true_lang.mjs';
|
|
7
8
|
|
|
8
9
|
const BigTable = script;
|
|
9
10
|
BigTable.install = function(app) {
|
|
10
|
-
safeComponentRegister(app, BigTable, KEY_COMPONENT_NAME +
|
|
11
|
-
safeComponentRegister(app, CGrid, KEY_COMPONENT_NAME +
|
|
11
|
+
safeComponentRegister(app, BigTable, KEY_COMPONENT_NAME + "BigTable");
|
|
12
|
+
safeComponentRegister(app, CGrid, KEY_COMPONENT_NAME + "Grid");
|
|
12
13
|
loadVxeTable(app);
|
|
14
|
+
expandXEUtils();
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export { BigTable as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, reactive, useAttrs, computed, onMounted, onUnmounted, onActivated, createVNode, h, resolveComponent, Teleport, createTextVNode, isVNode, nextTick, watch, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createCommentVNode, withDirectives, toDisplayString,
|
|
1
|
+
import { defineComponent, ref, reactive, useAttrs, computed, onMounted, onUnmounted, onActivated, createVNode, h, resolveComponent, Teleport, createTextVNode, isVNode, nextTick, watch, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createElementVNode, createCommentVNode, withDirectives, toDisplayString, vShow, Fragment, mergeProps, withCtx, createBlock, renderSlot } from 'vue';
|
|
2
2
|
import bigTableState from './bigTableState2.mjs';
|
|
3
3
|
import bigTableProps from './bigTableProps2.mjs';
|
|
4
4
|
import bigTableEmits from './bigTableEmits2.mjs';
|
|
@@ -58,7 +58,6 @@ function _isSlot(s) {
|
|
|
58
58
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
59
59
|
}
|
|
60
60
|
var script = /* @__PURE__ */ defineComponent({
|
|
61
|
-
name: "BigTable",
|
|
62
61
|
props: bigTableProps,
|
|
63
62
|
emits: bigTableEmits,
|
|
64
63
|
setup(__props, {
|
|
@@ -2182,18 +2181,18 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
2182
2181
|
return (_ctx, _cache) => {
|
|
2183
2182
|
return openBlock(), createElementBlock("div", {
|
|
2184
2183
|
class: normalizeClass(["big-table custom-big-table", {
|
|
2185
|
-
mt: state.visibleCheckAllWrap || state.visibleTreeCheck || state.hasRefresh,
|
|
2184
|
+
mt: unref(state).visibleCheckAllWrap || unref(state).visibleTreeCheck || unref(state).hasRefresh,
|
|
2186
2185
|
"expand-padding": !props.isNestTable
|
|
2187
2186
|
}]),
|
|
2188
2187
|
style: normalizeStyle({
|
|
2189
|
-
height: state.tableHeight
|
|
2188
|
+
height: unref(state).tableHeight
|
|
2190
2189
|
})
|
|
2191
|
-
}, [state.hasRefresh && !props.isNestTable ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("p", {
|
|
2190
|
+
}, [unref(state).hasRefresh && !props.isNestTable ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("p", {
|
|
2192
2191
|
class: "check-wrap-title"
|
|
2193
2192
|
}, [_hoisted_2, createElementVNode("span", {
|
|
2194
2193
|
class: "check-wrap-btn",
|
|
2195
2194
|
onClick: refreshTable
|
|
2196
|
-
}, "\u70B9\u51FB\u67E5\u770B")])])) : createCommentVNode("v-if", true), createCommentVNode(" \u5168\u9009 \u9009\u62E9\u6846 "), withDirectives(createElementVNode("div", _hoisted_3, [createElementVNode("p", _hoisted_4, [createElementVNode("span", null, "\u5DF2\u52FE\u9009\u6570\u636E\u5171" + toDisplayString(unref(allSelectedLength)) + "\u6761", 1), withDirectives(createElementVNode("span", null, " \uFF08\u5F53\u524D\u9875" + toDisplayString(state.currentPageSelectedLength) + "\u6761\uFF09 ", 513), [[vShow, state.visibleCheckAllWrapMore]])]), state.visibleCheckAllWrapMore && !props.asyncCount ? (openBlock(), createElementBlock(Fragment, {
|
|
2195
|
+
}, "\u70B9\u51FB\u67E5\u770B")])])) : createCommentVNode("v-if", true), createCommentVNode(" \u5168\u9009 \u9009\u62E9\u6846 "), withDirectives(createElementVNode("div", _hoisted_3, [createElementVNode("p", _hoisted_4, [createElementVNode("span", null, "\u5DF2\u52FE\u9009\u6570\u636E\u5171" + toDisplayString(unref(allSelectedLength)) + "\u6761", 1), withDirectives(createElementVNode("span", null, " \uFF08\u5F53\u524D\u9875" + toDisplayString(unref(state).currentPageSelectedLength) + "\u6761\uFF09 ", 513), [[vShow, unref(state).visibleCheckAllWrapMore]])]), unref(state).visibleCheckAllWrapMore && !props.asyncCount ? (openBlock(), createElementBlock(Fragment, {
|
|
2197
2196
|
key: 0
|
|
2198
2197
|
}, [!unref(visibleCancelCheckAllBtn) ? (openBlock(), createElementBlock("p", {
|
|
2199
2198
|
key: 0,
|
|
@@ -2203,7 +2202,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
2203
2202
|
key: 1,
|
|
2204
2203
|
class: "check-wrap-btn",
|
|
2205
2204
|
onClick: handleCancelAllCheck
|
|
2206
|
-
}, "\u53D6\u6D88\u5168\u90E8\u52FE\u9009"))],
|
|
2205
|
+
}, "\u53D6\u6D88\u5168\u90E8\u52FE\u9009"))], 2112)) : createCommentVNode("v-if", true)], 512), [[vShow, unref(state).visibleCheckAllWrap && !props.isInlineOperating && !props.isNestTable]]), createCommentVNode(" \u6811\u72B6\u8868\u683C\u5DF2\u9009 "), withDirectives(createElementVNode("div", _hoisted_7, [createElementVNode("p", _hoisted_8, [createElementVNode("span", null, "\u5DF2\u52FE\u9009\u6570\u636E\u5171" + toDisplayString(unref(state).treeTableLength) + "\u6761", 1)])], 512), [[vShow, unref(state).visibleTreeCheck && !props.isInlineOperating && !props.isNestTable]]), createVNode(unref(CGrid), mergeProps({
|
|
2207
2206
|
ref_key: "xGrid",
|
|
2208
2207
|
ref: xGrid,
|
|
2209
2208
|
border: "",
|
|
@@ -2222,7 +2221,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
2222
2221
|
"tree-config": unref(treeConfig),
|
|
2223
2222
|
"row-id": unref(handleRowId),
|
|
2224
2223
|
"row-class-name": getRowClassName,
|
|
2225
|
-
"row-config": state.rowConfig,
|
|
2224
|
+
"row-config": unref(state).rowConfig,
|
|
2226
2225
|
"show-footer": _ctx.showFooter && !props.isInlineOperating,
|
|
2227
2226
|
"footer-method": footerMethod,
|
|
2228
2227
|
"sort-config": {
|
|
@@ -2255,7 +2254,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
2255
2254
|
gt: 50
|
|
2256
2255
|
},
|
|
2257
2256
|
"row-style": unref(getRowStyle),
|
|
2258
|
-
"edit-config": state.editConfig,
|
|
2257
|
+
"edit-config": unref(state).editConfig,
|
|
2259
2258
|
"expand-config": {
|
|
2260
2259
|
lazy: true,
|
|
2261
2260
|
accordion: _ctx.columnConfig && _ctx.columnConfig.accordion,
|
|
@@ -2276,7 +2275,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
2276
2275
|
onCellMouseenter: handleCellMouseenter,
|
|
2277
2276
|
onKeydown: unref(keyDown)
|
|
2278
2277
|
}), {
|
|
2279
|
-
empty: withCtx(() => [state.isShowEmpty ? (openBlock(), createElementBlock("div", _hoisted_9, [createVNode(script$1, {
|
|
2278
|
+
empty: withCtx(() => [unref(state).isShowEmpty ? (openBlock(), createElementBlock("div", _hoisted_9, [createVNode(script$1, {
|
|
2280
2279
|
"no-data-img": props.emptyItems.noDataImg,
|
|
2281
2280
|
"no-data-tip": props.emptyItems.noDataTip,
|
|
2282
2281
|
"show-img": !props.isNestTable
|
|
@@ -2301,7 +2300,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
2301
2300
|
column
|
|
2302
2301
|
}) => [createCommentVNode(" \u5206\u7EC4\u7EDF\u8BA1 "), _ctx.groupCountFields && _ctx.groupCountFields.length ? (openBlock(), createElementBlock("span", {
|
|
2303
2302
|
key: 0,
|
|
2304
|
-
innerHTML: state.groupText
|
|
2303
|
+
innerHTML: unref(state).groupText
|
|
2305
2304
|
}, null, 8, _hoisted_11)) : (openBlock(), createElementBlock(Fragment, {
|
|
2306
2305
|
key: 1
|
|
2307
2306
|
}, [createCommentVNode(" \u4E00\u822C\u7EDF\u8BA1 "), createVNode(unref(NTooltip), {
|
|
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
type: StringConstructor;
|
|
12
12
|
default: string;
|
|
13
13
|
};
|
|
14
|
-
}, () => JSX.Element[], unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("
|
|
14
|
+
}, () => JSX.Element[], unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "clickSelectTable")[], "update:value" | "clickSelectTable", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
15
|
row: {
|
|
16
16
|
type: ObjectConstructor;
|
|
17
17
|
default: {};
|