@onereach/ui-components 3.0.4-beta.2497.0 → 3.0.4-beta.2502.0
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/bundled/v2/OrDatePicker-19e467e2.js +330 -0
- package/dist/bundled/v2/OrDateTimePicker-1011dc69.js +440 -0
- package/dist/bundled/v2/OrDateTimePickerMonthSelect-9e64d257.js +408 -0
- package/dist/bundled/v2/OrDateTimePickerPopoverHeader-c8672c0d.js +239 -0
- package/dist/bundled/v2/OrDateTimePickerTimeSelect-158d717b.js +179 -0
- package/dist/bundled/v2/OrTimePicker-1b3a758a.js +318 -0
- package/dist/bundled/v2/components/index.d.ts +2 -0
- package/dist/bundled/v2/components/index.js +7 -2
- package/dist/bundled/v2/components/or-date-picker-v3/OrDatePicker.vue.d.ts +183 -0
- package/dist/bundled/v2/components/or-date-picker-v3/index.d.ts +2 -0
- package/dist/bundled/v2/components/or-date-picker-v3/index.js +31 -0
- package/dist/bundled/v2/components/or-date-picker-v3/props.d.ts +1 -0
- package/dist/bundled/v2/components/or-date-picker-v3/styles.d.ts +2 -0
- package/dist/bundled/v2/components/or-date-time-picker-v3/OrDateTimePicker.vue.d.ts +11 -0
- package/dist/bundled/v2/components/or-date-time-picker-v3/index.js +7 -5
- package/dist/bundled/v2/components/or-date-time-picker-v3/partials/or-date-time-picker-day-select/OrDateTimePickerDaySelect.vue.d.ts +12 -0
- package/dist/bundled/v2/components/or-date-time-picker-v3/partials/or-date-time-picker-month-select/OrDateTimePickerMonthSelect.vue.d.ts +12 -0
- package/dist/bundled/v2/components/or-date-time-picker-v3/partials/or-date-time-picker-time-select/OrDateTimePickerTimeSelect.vue.d.ts +12 -0
- package/dist/bundled/v2/components/or-time-picker-v3/OrTimePicker.vue.d.ts +183 -0
- package/dist/bundled/v2/components/or-time-picker-v3/index.d.ts +2 -0
- package/dist/bundled/v2/components/or-time-picker-v3/index.js +29 -0
- package/dist/bundled/v2/components/or-time-picker-v3/props.d.ts +1 -0
- package/dist/bundled/v2/components/or-time-picker-v3/styles.d.ts +2 -0
- package/dist/bundled/v2/index.js +8 -3
- package/dist/bundled/v3/OrDatePicker.vue_vue_type_script_lang-8eafbe6b.js +177 -0
- package/dist/bundled/v3/OrDateTimePicker.vue_vue_type_script_lang-b2a9ef8d.js +226 -0
- package/dist/bundled/v3/OrDateTimePickerMonthSelect-8989be5a.js +341 -0
- package/dist/bundled/v3/OrDateTimePickerPopoverHeader-caffcc00.js +162 -0
- package/dist/bundled/v3/OrDateTimePickerTimeSelect-e3a89bed.js +148 -0
- package/dist/bundled/v3/OrTimePicker.vue_vue_type_script_lang-f46eb37f.js +176 -0
- package/dist/bundled/v3/components/index.d.ts +2 -0
- package/dist/bundled/v3/components/index.js +8 -3
- package/dist/bundled/v3/components/or-date-picker-v3/OrDatePicker.vue.d.ts +183 -0
- package/dist/bundled/v3/components/or-date-picker-v3/index.d.ts +2 -0
- package/dist/bundled/v3/components/or-date-picker-v3/index.js +37 -0
- package/dist/bundled/v3/components/or-date-picker-v3/props.d.ts +1 -0
- package/dist/bundled/v3/components/or-date-picker-v3/styles.d.ts +2 -0
- package/dist/bundled/v3/components/or-date-time-picker-v3/OrDateTimePicker.vue.d.ts +11 -0
- package/dist/bundled/v3/components/or-date-time-picker-v3/index.js +7 -4
- package/dist/bundled/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-day-select/OrDateTimePickerDaySelect.vue.d.ts +12 -0
- package/dist/bundled/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-month-select/OrDateTimePickerMonthSelect.vue.d.ts +12 -0
- package/dist/bundled/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-time-select/OrDateTimePickerTimeSelect.vue.d.ts +12 -0
- package/dist/bundled/v3/components/or-time-picker-v3/OrTimePicker.vue.d.ts +183 -0
- package/dist/bundled/v3/components/or-time-picker-v3/index.d.ts +2 -0
- package/dist/bundled/v3/components/or-time-picker-v3/index.js +33 -0
- package/dist/bundled/v3/components/or-time-picker-v3/props.d.ts +1 -0
- package/dist/bundled/v3/components/or-time-picker-v3/styles.d.ts +2 -0
- package/dist/bundled/v3/index.js +638 -408
- package/dist/esm/v2/OrDatePicker-454f5267.js +329 -0
- package/dist/esm/v2/OrDateTimePicker-3f533d0c.js +439 -0
- package/dist/esm/v2/OrDateTimePickerMonthSelect-380d9c90.js +406 -0
- package/dist/esm/v2/OrDateTimePickerPopoverHeader-e11d3222.js +235 -0
- package/dist/esm/v2/OrDateTimePickerTimeSelect-83dd1e81.js +177 -0
- package/dist/esm/v2/OrTimePicker-f23c8577.js +317 -0
- package/dist/esm/v2/components/index.d.ts +2 -0
- package/dist/esm/v2/components/index.js +8 -3
- package/dist/esm/v2/components/or-date-picker-v3/OrDatePicker.vue.d.ts +183 -0
- package/dist/esm/v2/components/or-date-picker-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-date-picker-v3/index.js +29 -0
- package/dist/esm/v2/components/or-date-picker-v3/props.d.ts +1 -0
- package/dist/esm/v2/components/or-date-picker-v3/styles.d.ts +2 -0
- package/dist/esm/v2/components/or-date-time-picker-v3/OrDateTimePicker.vue.d.ts +11 -0
- package/dist/esm/v2/components/or-date-time-picker-v3/index.js +4 -2
- package/dist/esm/v2/components/or-date-time-picker-v3/partials/or-date-time-picker-day-select/OrDateTimePickerDaySelect.vue.d.ts +12 -0
- package/dist/esm/v2/components/or-date-time-picker-v3/partials/or-date-time-picker-month-select/OrDateTimePickerMonthSelect.vue.d.ts +12 -0
- package/dist/esm/v2/components/or-date-time-picker-v3/partials/or-date-time-picker-time-select/OrDateTimePickerTimeSelect.vue.d.ts +12 -0
- package/dist/esm/v2/components/or-time-picker-v3/OrTimePicker.vue.d.ts +183 -0
- package/dist/esm/v2/components/or-time-picker-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-time-picker-v3/index.js +27 -0
- package/dist/esm/v2/components/or-time-picker-v3/props.d.ts +1 -0
- package/dist/esm/v2/components/or-time-picker-v3/styles.d.ts +2 -0
- package/dist/esm/v2/index.js +8 -3
- package/dist/esm/v3/OrDatePicker-390f7f11.js +288 -0
- package/dist/esm/v3/OrDateTimePicker-54db4170.js +390 -0
- package/dist/esm/v3/OrDateTimePickerMonthSelect-709b673d.js +338 -0
- package/dist/esm/v3/OrDateTimePickerPopoverHeader-c771a251.js +161 -0
- package/dist/esm/v3/OrDateTimePickerTimeSelect-2c8a7f9c.js +148 -0
- package/dist/esm/v3/OrTimePicker-362ca566.js +282 -0
- package/dist/esm/v3/components/index.d.ts +2 -0
- package/dist/esm/v3/components/index.js +7 -2
- package/dist/esm/v3/components/or-date-picker-v3/OrDatePicker.vue.d.ts +183 -0
- package/dist/esm/v3/components/or-date-picker-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-date-picker-v3/index.js +27 -0
- package/dist/esm/v3/components/or-date-picker-v3/props.d.ts +1 -0
- package/dist/esm/v3/components/or-date-picker-v3/styles.d.ts +2 -0
- package/dist/esm/v3/components/or-date-time-picker-v3/OrDateTimePicker.vue.d.ts +11 -0
- package/dist/esm/v3/components/or-date-time-picker-v3/index.js +4 -2
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-day-select/OrDateTimePickerDaySelect.vue.d.ts +12 -0
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-month-select/OrDateTimePickerMonthSelect.vue.d.ts +12 -0
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-time-select/OrDateTimePickerTimeSelect.vue.d.ts +12 -0
- package/dist/esm/v3/components/or-time-picker-v3/OrTimePicker.vue.d.ts +183 -0
- package/dist/esm/v3/components/or-time-picker-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-time-picker-v3/index.js +25 -0
- package/dist/esm/v3/components/or-time-picker-v3/props.d.ts +1 -0
- package/dist/esm/v3/components/or-time-picker-v3/styles.d.ts +2 -0
- package/dist/esm/v3/index.js +7 -2
- package/package.json +2 -2
- package/src/components/index.ts +2 -0
- package/src/components/or-date-picker-v3/OrDatePicker.docs.mdx +7 -0
- package/src/components/or-date-picker-v3/OrDatePicker.stories3.ts +160 -0
- package/src/components/or-date-picker-v3/OrDatePicker.vue +308 -0
- package/src/components/or-date-picker-v3/index.ts +2 -0
- package/src/components/or-date-picker-v3/props.ts +1 -0
- package/src/components/or-date-picker-v3/styles.ts +12 -0
- package/src/components/or-date-time-picker-v3/OrDateTimePicker.stories3.ts +4 -0
- package/src/components/or-date-time-picker-v3/OrDateTimePicker.vue +17 -37
- package/src/components/or-date-time-picker-v3/partials/or-date-time-picker-day-select/OrDateTimePickerDaySelect.vue +7 -1
- package/src/components/or-date-time-picker-v3/partials/or-date-time-picker-month-select/OrDateTimePickerMonthSelect.vue +8 -1
- package/src/components/or-date-time-picker-v3/partials/or-date-time-picker-time-select/OrDateTimePickerTimeSelect.vue +8 -1
- package/src/components/or-time-picker-v3/OrTimePicker.docs.mdx +7 -0
- package/src/components/or-time-picker-v3/OrTimePicker.stories3.ts +160 -0
- package/src/components/or-time-picker-v3/OrTimePicker.vue +302 -0
- package/src/components/or-time-picker-v3/index.ts +2 -0
- package/src/components/or-time-picker-v3/props.ts +1 -0
- package/src/components/or-time-picker-v3/styles.ts +12 -0
- package/dist/bundled/v2/OrDateTimePicker-d6f327ad.js +0 -1215
- package/dist/bundled/v3/OrDateTimePicker.vue_vue_type_script_lang-ba3ac4fb.js +0 -834
- package/dist/esm/v2/OrDateTimePicker-57094f24.js +0 -1208
- package/dist/esm/v3/OrDateTimePicker-a8247a84.js +0 -997
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, reactive, watch } from 'vue';
|
|
2
|
+
import { s as script$1, a as script$3 } from './OrDateTimePickerMonthSelect-8989be5a.js';
|
|
3
|
+
import { s as script$2, a as script$4, b as script$5 } from './OrDateTimePickerPopoverHeader-caffcc00.js';
|
|
4
|
+
import './OrHint-fcd2563e.js';
|
|
5
|
+
import './OrIconButton-55238a89.js';
|
|
6
|
+
import './OrInputBox-688eb48b.js';
|
|
7
|
+
import './OrLabel-4da10c50.js';
|
|
8
|
+
import './OrPopover-40d53b57.js';
|
|
9
|
+
import { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0a494cc1.js';
|
|
10
|
+
import { a as useIdAttribute, u as useControlAttributes } from './useIdAttribute-b2e42f31.js';
|
|
11
|
+
import { u as useValidationAttributes } from './useValidationAttributes-5428d8fa.js';
|
|
12
|
+
import { s as script$6 } from './OrError.vue_vue_type_script_lang-7305a1d9.js';
|
|
13
|
+
import { s as script$7 } from './OrHint.vue_vue_type_script_lang-47d9b9ed.js';
|
|
14
|
+
import { s as script$8 } from './OrIconButton.vue_vue_type_script_lang-3aeb76ac.js';
|
|
15
|
+
import { s as script$9 } from './OrInputBox.vue_vue_type_script_lang-0e3ff329.js';
|
|
16
|
+
import { s as script$a } from './OrLabel.vue_vue_type_script_lang-5ba2b33c.js';
|
|
17
|
+
import { s as script$b } from './OrPopover.vue_vue_type_script_lang-9bf2361c.js';
|
|
18
|
+
import { I as InputBoxSize } from './props-c966ae5f.js';
|
|
19
|
+
|
|
20
|
+
const DatePicker = [
|
|
21
|
+
// Layout
|
|
22
|
+
'layout-column',
|
|
23
|
+
// Spacing
|
|
24
|
+
'gap-xs'];
|
|
25
|
+
const DatePickerControl = [
|
|
26
|
+
// Layout
|
|
27
|
+
'layout-inline-row justify-center'];
|
|
28
|
+
|
|
29
|
+
var script = defineComponent({
|
|
30
|
+
name: 'OrDatePicker',
|
|
31
|
+
components: {
|
|
32
|
+
OrDateTimePickerDaySelect: script$1,
|
|
33
|
+
OrDateTimePickerMobileControl: script$2,
|
|
34
|
+
OrDateTimePickerMonthSelect: script$3,
|
|
35
|
+
OrDateTimePickerPopoverFooter: script$4,
|
|
36
|
+
OrDateTimePickerPopoverHeader: script$5,
|
|
37
|
+
OrError: script$6,
|
|
38
|
+
OrHint: script$7,
|
|
39
|
+
OrIconButton: script$8,
|
|
40
|
+
OrInputBox: script$9,
|
|
41
|
+
OrLabel: script$a,
|
|
42
|
+
OrPopover: script$b
|
|
43
|
+
},
|
|
44
|
+
directives: {
|
|
45
|
+
DropdownClose,
|
|
46
|
+
DropdownOpen
|
|
47
|
+
},
|
|
48
|
+
model: {
|
|
49
|
+
prop: 'modelValue',
|
|
50
|
+
event: 'update:modelValue'
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
modelValue: {
|
|
54
|
+
type: Date,
|
|
55
|
+
default: undefined
|
|
56
|
+
},
|
|
57
|
+
filter: {
|
|
58
|
+
type: Function,
|
|
59
|
+
default: undefined
|
|
60
|
+
},
|
|
61
|
+
size: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: InputBoxSize.M
|
|
64
|
+
},
|
|
65
|
+
label: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: undefined
|
|
68
|
+
},
|
|
69
|
+
hint: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: undefined
|
|
72
|
+
},
|
|
73
|
+
error: {
|
|
74
|
+
type: [String, Boolean],
|
|
75
|
+
default: undefined
|
|
76
|
+
},
|
|
77
|
+
required: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
readonly: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
disabled: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
disableDefaultStyles: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
emits: ['update:modelValue', 'keydown', 'keyup', 'focus', 'blur'],
|
|
95
|
+
expose: ['root', 'focus', 'blur'],
|
|
96
|
+
setup(props, context) {
|
|
97
|
+
// Refs
|
|
98
|
+
const root = ref();
|
|
99
|
+
const control = ref();
|
|
100
|
+
const popover = ref();
|
|
101
|
+
const popoverState = computed(() => {
|
|
102
|
+
var _a;
|
|
103
|
+
return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
104
|
+
});
|
|
105
|
+
// Styles
|
|
106
|
+
const rootStyles = computed(() => ['or-date-picker', ...DatePicker]);
|
|
107
|
+
const controlStyles = computed(() => [...DatePickerControl]);
|
|
108
|
+
// State
|
|
109
|
+
const controlAttributes = reactive({
|
|
110
|
+
id: useIdAttribute(),
|
|
111
|
+
...useControlAttributes(),
|
|
112
|
+
...useValidationAttributes()
|
|
113
|
+
});
|
|
114
|
+
const proxyModelValue = computed({
|
|
115
|
+
get: () => props.modelValue,
|
|
116
|
+
set: value => {
|
|
117
|
+
context.emit('update:modelValue', value);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
const draftModelValue = ref();
|
|
121
|
+
watch(proxyModelValue, value => {
|
|
122
|
+
draftModelValue.value = value;
|
|
123
|
+
}, {
|
|
124
|
+
immediate: true
|
|
125
|
+
});
|
|
126
|
+
// Methods
|
|
127
|
+
function togglePopover() {
|
|
128
|
+
if (!props.readonly && !props.disabled) {
|
|
129
|
+
const popoverInstance = popover.value;
|
|
130
|
+
if (popoverInstance) {
|
|
131
|
+
if (popoverState.value === 'open') {
|
|
132
|
+
popoverInstance.close();
|
|
133
|
+
} else {
|
|
134
|
+
popoverInstance.open();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function closePopover() {
|
|
140
|
+
const popoverInstance = popover.value;
|
|
141
|
+
if (popoverInstance) {
|
|
142
|
+
popoverInstance.close();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function formatDate(value) {
|
|
146
|
+
var _a;
|
|
147
|
+
return (_a = value === null || value === void 0 ? void 0 : value.toLocaleString('default', {
|
|
148
|
+
dateStyle: 'short',
|
|
149
|
+
timeZone: 'UTC'
|
|
150
|
+
})) !== null && _a !== void 0 ? _a : '--';
|
|
151
|
+
}
|
|
152
|
+
function formatDateAlt(value) {
|
|
153
|
+
var _a;
|
|
154
|
+
return (_a = value === null || value === void 0 ? void 0 : value.toLocaleString('default', {
|
|
155
|
+
dateStyle: 'medium',
|
|
156
|
+
timeZone: 'UTC'
|
|
157
|
+
})) !== null && _a !== void 0 ? _a : '--';
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
root,
|
|
161
|
+
control,
|
|
162
|
+
popover,
|
|
163
|
+
popoverState,
|
|
164
|
+
rootStyles,
|
|
165
|
+
controlStyles,
|
|
166
|
+
controlAttributes,
|
|
167
|
+
proxyModelValue,
|
|
168
|
+
draftModelValue,
|
|
169
|
+
togglePopover,
|
|
170
|
+
closePopover,
|
|
171
|
+
formatDate,
|
|
172
|
+
formatDateAlt
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
export { script as s };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, reactive, watch } from 'vue';
|
|
2
|
+
import { s as script$1, a as script$3 } from './OrDateTimePickerMonthSelect-8989be5a.js';
|
|
3
|
+
import { s as script$2, a as script$4, b as script$5 } from './OrDateTimePickerPopoverHeader-caffcc00.js';
|
|
4
|
+
import { s as script$6 } from './OrDateTimePickerTimeSelect-e3a89bed.js';
|
|
5
|
+
import './OrHint-fcd2563e.js';
|
|
6
|
+
import './OrIconButton-55238a89.js';
|
|
7
|
+
import './OrInputBox-688eb48b.js';
|
|
8
|
+
import './OrLabel-4da10c50.js';
|
|
9
|
+
import './OrPopover-40d53b57.js';
|
|
10
|
+
import { a as useIdAttribute, u as useControlAttributes } from './useIdAttribute-b2e42f31.js';
|
|
11
|
+
import { u as useValidationAttributes } from './useValidationAttributes-5428d8fa.js';
|
|
12
|
+
import { s as script$7 } from './OrError.vue_vue_type_script_lang-7305a1d9.js';
|
|
13
|
+
import { s as script$8 } from './OrHint.vue_vue_type_script_lang-47d9b9ed.js';
|
|
14
|
+
import { s as script$9 } from './OrIconButton.vue_vue_type_script_lang-3aeb76ac.js';
|
|
15
|
+
import { s as script$a } from './OrInputBox.vue_vue_type_script_lang-0e3ff329.js';
|
|
16
|
+
import { s as script$b } from './OrLabel.vue_vue_type_script_lang-5ba2b33c.js';
|
|
17
|
+
import { s as script$c } from './OrPopover.vue_vue_type_script_lang-9bf2361c.js';
|
|
18
|
+
import { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0a494cc1.js';
|
|
19
|
+
import { I as InputBoxSize } from './props-c966ae5f.js';
|
|
20
|
+
|
|
21
|
+
const DateTimePicker = [
|
|
22
|
+
// Layout
|
|
23
|
+
'layout-column',
|
|
24
|
+
// Spacing
|
|
25
|
+
'gap-xs'];
|
|
26
|
+
const DateTimePickerControl = [
|
|
27
|
+
// Layout
|
|
28
|
+
'layout-inline-row justify-center',
|
|
29
|
+
// Theme (focus)
|
|
30
|
+
'focus:theme-border-2-current', 'dark:focus:theme-border-2-current-dark', 'focus:theme-border-underline', 'dark:focus:theme-border-underline'];
|
|
31
|
+
|
|
32
|
+
var script = defineComponent({
|
|
33
|
+
name: 'OrDateTimePicker',
|
|
34
|
+
components: {
|
|
35
|
+
OrDateTimePickerDaySelect: script$1,
|
|
36
|
+
OrDateTimePickerMobileControl: script$2,
|
|
37
|
+
OrDateTimePickerMonthSelect: script$3,
|
|
38
|
+
OrDateTimePickerPopoverFooter: script$4,
|
|
39
|
+
OrDateTimePickerPopoverHeader: script$5,
|
|
40
|
+
OrDateTimePickerTimeSelect: script$6,
|
|
41
|
+
OrError: script$7,
|
|
42
|
+
OrHint: script$8,
|
|
43
|
+
OrIconButton: script$9,
|
|
44
|
+
OrInputBox: script$a,
|
|
45
|
+
OrLabel: script$b,
|
|
46
|
+
OrPopover: script$c
|
|
47
|
+
},
|
|
48
|
+
directives: {
|
|
49
|
+
DropdownClose,
|
|
50
|
+
DropdownOpen
|
|
51
|
+
},
|
|
52
|
+
model: {
|
|
53
|
+
prop: 'modelValue',
|
|
54
|
+
event: 'update:modelValue'
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
modelValue: {
|
|
58
|
+
type: Date,
|
|
59
|
+
default: undefined
|
|
60
|
+
},
|
|
61
|
+
filter: {
|
|
62
|
+
type: Function,
|
|
63
|
+
default: undefined
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: InputBoxSize.M
|
|
68
|
+
},
|
|
69
|
+
label: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: undefined
|
|
72
|
+
},
|
|
73
|
+
hint: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: undefined
|
|
76
|
+
},
|
|
77
|
+
error: {
|
|
78
|
+
type: [String, Boolean],
|
|
79
|
+
default: undefined
|
|
80
|
+
},
|
|
81
|
+
required: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
readonly: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
disabled: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
disableDefaultStyles: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
emits: ['update:modelValue', 'keydown', 'keyup', 'focus', 'blur'],
|
|
99
|
+
expose: ['root', 'focus', 'blur'],
|
|
100
|
+
setup(props, context) {
|
|
101
|
+
// Refs
|
|
102
|
+
const root = ref();
|
|
103
|
+
const dateControl = ref();
|
|
104
|
+
const timeControl = ref();
|
|
105
|
+
const datePopover = ref();
|
|
106
|
+
const timePopover = ref();
|
|
107
|
+
const datePopoverState = computed(() => {
|
|
108
|
+
var _a;
|
|
109
|
+
return (_a = datePopover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
110
|
+
});
|
|
111
|
+
const timePopoverState = computed(() => {
|
|
112
|
+
var _a;
|
|
113
|
+
return (_a = timePopover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
114
|
+
});
|
|
115
|
+
// Styles
|
|
116
|
+
const rootStyles = computed(() => ['or-date-time-picker', ...DateTimePicker]);
|
|
117
|
+
const controlStyles = computed(() => [...DateTimePickerControl]);
|
|
118
|
+
// State
|
|
119
|
+
const controlAttributes = reactive({
|
|
120
|
+
id: useIdAttribute(),
|
|
121
|
+
...useControlAttributes(),
|
|
122
|
+
...useValidationAttributes()
|
|
123
|
+
});
|
|
124
|
+
const proxyModelValue = computed({
|
|
125
|
+
get: () => props.modelValue,
|
|
126
|
+
set: value => {
|
|
127
|
+
context.emit('update:modelValue', value);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
const draftModelValue = ref();
|
|
131
|
+
watch(proxyModelValue, value => {
|
|
132
|
+
draftModelValue.value = value;
|
|
133
|
+
}, {
|
|
134
|
+
immediate: true
|
|
135
|
+
});
|
|
136
|
+
// Methods
|
|
137
|
+
function toggleDatePopover() {
|
|
138
|
+
if (!props.readonly && !props.disabled) {
|
|
139
|
+
const popoverInstance = datePopover.value;
|
|
140
|
+
if (popoverInstance) {
|
|
141
|
+
if (datePopoverState.value === 'open') {
|
|
142
|
+
popoverInstance.close();
|
|
143
|
+
} else {
|
|
144
|
+
popoverInstance.open();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function toggleTimePopover() {
|
|
150
|
+
if (!props.readonly && !props.disabled) {
|
|
151
|
+
const popoverInstance = timePopover.value;
|
|
152
|
+
if (popoverInstance) {
|
|
153
|
+
if (timePopoverState.value === 'open') {
|
|
154
|
+
popoverInstance.close();
|
|
155
|
+
} else {
|
|
156
|
+
popoverInstance.open();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function closeDatePopover() {
|
|
162
|
+
const popoverInstance = datePopover.value;
|
|
163
|
+
if (popoverInstance) {
|
|
164
|
+
popoverInstance.close();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function closeTimePopover() {
|
|
168
|
+
const popoverInstance = timePopover.value;
|
|
169
|
+
if (popoverInstance) {
|
|
170
|
+
popoverInstance.close();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function formatDate(value) {
|
|
174
|
+
var _a;
|
|
175
|
+
return (_a = value === null || value === void 0 ? void 0 : value.toLocaleString('default', {
|
|
176
|
+
dateStyle: 'short',
|
|
177
|
+
timeZone: 'UTC'
|
|
178
|
+
})) !== null && _a !== void 0 ? _a : '--';
|
|
179
|
+
}
|
|
180
|
+
function formatTime(value) {
|
|
181
|
+
var _a;
|
|
182
|
+
return (_a = value === null || value === void 0 ? void 0 : value.toLocaleString('default', {
|
|
183
|
+
timeStyle: 'short',
|
|
184
|
+
timeZone: 'UTC'
|
|
185
|
+
})) !== null && _a !== void 0 ? _a : '--';
|
|
186
|
+
}
|
|
187
|
+
function formatDateAlt(value) {
|
|
188
|
+
var _a;
|
|
189
|
+
return (_a = value === null || value === void 0 ? void 0 : value.toLocaleString('default', {
|
|
190
|
+
dateStyle: 'medium',
|
|
191
|
+
timeZone: 'UTC'
|
|
192
|
+
})) !== null && _a !== void 0 ? _a : '--';
|
|
193
|
+
}
|
|
194
|
+
function formatTimeAlt(value) {
|
|
195
|
+
var _a;
|
|
196
|
+
return (_a = value === null || value === void 0 ? void 0 : value.toLocaleString('default', {
|
|
197
|
+
timeStyle: 'short',
|
|
198
|
+
timeZone: 'UTC'
|
|
199
|
+
})) !== null && _a !== void 0 ? _a : '--';
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
root,
|
|
203
|
+
dateControl,
|
|
204
|
+
timeControl,
|
|
205
|
+
datePopover,
|
|
206
|
+
timePopover,
|
|
207
|
+
datePopoverState,
|
|
208
|
+
timePopoverState,
|
|
209
|
+
rootStyles,
|
|
210
|
+
controlStyles,
|
|
211
|
+
controlAttributes,
|
|
212
|
+
proxyModelValue,
|
|
213
|
+
draftModelValue,
|
|
214
|
+
toggleDatePopover,
|
|
215
|
+
toggleTimePopover,
|
|
216
|
+
closeDatePopover,
|
|
217
|
+
closeTimePopover,
|
|
218
|
+
formatDate,
|
|
219
|
+
formatTime,
|
|
220
|
+
formatDateAlt,
|
|
221
|
+
formatTimeAlt
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export { script as s };
|