pgo-uiux2 1.0.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/.env +1 -0
- package/.env.production +1 -0
- package/.prettierrc +13 -0
- package/.vscode/extensions.json +3 -0
- package/BUTTON_GUIDE.md +257 -0
- package/README.md +49 -0
- package/THEME_REFERENCE.md +310 -0
- package/eslint.config.ts +27 -0
- package/index.html +13 -0
- package/package.json +85 -0
- package/public/favicon.ico +0 -0
- package/src/App.vue +368 -0
- package/src/assets/fonts/Faruma.ttf +0 -0
- package/src/components/examples/AppBarExample.vue +101 -0
- package/src/components/examples/AvatarExample.vue +47 -0
- package/src/components/examples/BannerExample.vue +287 -0
- package/src/components/examples/BaseInputExample.vue +25 -0
- package/src/components/examples/BreadcrumbExample.vue +53 -0
- package/src/components/examples/CardExample.vue +77 -0
- package/src/components/examples/ChipExample.vue +225 -0
- package/src/components/examples/DatePickerExample.vue +31 -0
- package/src/components/examples/DropdownExample.vue +84 -0
- package/src/components/examples/EditorExample.vue +200 -0
- package/src/components/examples/ExpansionPanelExample.vue +42 -0
- package/src/components/examples/FileUploadExample.vue +40 -0
- package/src/components/examples/FormExample.vue +121 -0
- package/src/components/examples/HugeTest.vue +8 -0
- package/src/components/examples/LayoutContainerExample.vue +80 -0
- package/src/components/examples/ModalExample.vue +82 -0
- package/src/components/examples/NavDrawerExample.vue +170 -0
- package/src/components/examples/NumberFieldExample.vue +145 -0
- package/src/components/examples/RadioButtonExample.vue +161 -0
- package/src/components/examples/SearchExample.vue +322 -0
- package/src/components/examples/SelectExample.vue +121 -0
- package/src/components/examples/StackedTableViewExample.vue +53 -0
- package/src/components/examples/TabExample.vue +336 -0
- package/src/components/examples/TableExample.vue +228 -0
- package/src/components/examples/TextFieldExample.vue +181 -0
- package/src/components/examples/TextareaExample.vue +173 -0
- package/src/components/examples/ThemeToggle.vue +50 -0
- package/src/components/examples/TimelineExample.vue +66 -0
- package/src/components/examples/TipTapEditorExample.vue +20 -0
- package/src/components/examples/TooltipExample.vue +53 -0
- package/src/components/examples/VueDatePickerShowcase.vue +214 -0
- package/src/components/examples/_DatePickerExample.vue +33 -0
- package/src/components/examples/__FormExample.vue +77 -0
- package/src/components/index.ts +25 -0
- package/src/components/pgo/AppBar.vue +347 -0
- package/src/components/pgo/Avatar.vue +139 -0
- package/src/components/pgo/Banner.vue +300 -0
- package/src/components/pgo/Breadcrumb.vue +101 -0
- package/src/components/pgo/Button.vue +171 -0
- package/src/components/pgo/Card.vue +178 -0
- package/src/components/pgo/ConfirmationModel.vue +32 -0
- package/src/components/pgo/DataTable.vue +845 -0
- package/src/components/pgo/DatePicker/CalendarPanel.vue +43 -0
- package/src/components/pgo/DatePicker/__DatePicker.vue +122 -0
- package/src/components/pgo/DatePicker/types.ts +11 -0
- package/src/components/pgo/DatePicker/useCalendar.ts +39 -0
- package/src/components/pgo/DatePicker/useDatePicker.ts +31 -0
- package/src/components/pgo/Deprecated/ToastContainer.vue +51 -0
- package/src/components/pgo/Deprecated/ToastItem.vue +55 -0
- package/src/components/pgo/Dropdown.vue +296 -0
- package/src/components/pgo/DropdownItem.vue +40 -0
- package/src/components/pgo/Editor.vue +511 -0
- package/src/components/pgo/ExpansionPanel.vue +185 -0
- package/src/components/pgo/Footer.vue +39 -0
- package/src/components/pgo/HeroIcon.vue +124 -0
- package/src/components/pgo/InputSearch.vue +194 -0
- package/src/components/pgo/LayoutContainer.vue +104 -0
- package/src/components/pgo/Main.vue +37 -0
- package/src/components/pgo/Modal.vue +273 -0
- package/src/components/pgo/NavDrawer.vue +127 -0
- package/src/components/pgo/NavDrawerItem.vue +161 -0
- package/src/components/pgo/NavigationDrawer.vue +849 -0
- package/src/components/pgo/OLDNavDrawer.vue +661 -0
- package/src/components/pgo/OldAppBar.vue +223 -0
- package/src/components/pgo/PApp.vue +102 -0
- package/src/components/pgo/Pagination.vue +242 -0
- package/src/components/pgo/Search copy.vue +310 -0
- package/src/components/pgo/Search.vue +411 -0
- package/src/components/pgo/StackedTableView.vue +167 -0
- package/src/components/pgo/Tab.vue +617 -0
- package/src/components/pgo/TestInput.vue +395 -0
- package/src/components/pgo/Timeline.vue +367 -0
- package/src/components/pgo/TimelineItem.vue +80 -0
- package/src/components/pgo/TipTapEditor.vue +315 -0
- package/src/components/pgo/Tooltip.NOTES.md +12 -0
- package/src/components/pgo/Tooltip.PROPS.md +21 -0
- package/src/components/pgo/Tooltip.vue +281 -0
- package/src/components/pgo/base/Base.vue +444 -0
- package/src/components/pgo/buttons/Chip.vue +324 -0
- package/src/components/pgo/buttons/ChipGroup.vue +224 -0
- package/src/components/pgo/buttons/Radio.vue +424 -0
- package/src/components/pgo/filters/FilterSection.vue +188 -0
- package/src/components/pgo/filters/Searchbar.vue +216 -0
- package/src/components/pgo/forms/DynamicForm.vue +45 -0
- package/src/components/pgo/forms/Form.vue +132 -0
- package/src/components/pgo/index.ts +15 -0
- package/src/components/pgo/inputs/Checkbox.vue +320 -0
- package/src/components/pgo/inputs/DatePicker.vue +395 -0
- package/src/components/pgo/inputs/FileUpload.vue +326 -0
- package/src/components/pgo/inputs/NumberField.vue +243 -0
- package/src/components/pgo/inputs/Radio.vue +162 -0
- package/src/components/pgo/inputs/RadioGroup.vue +188 -0
- package/src/components/pgo/inputs/Select.vue +535 -0
- package/src/components/pgo/inputs/TextField.vue +194 -0
- package/src/components/pgo/inputs/Textarea.vue +181 -0
- package/src/main.js +12 -0
- package/src/pgo-components/_index.js +31 -0
- package/src/pgo-components/assets/fonts/Faruma.ttf +0 -0
- package/src/pgo-components/assets/fonts/logo.png +0 -0
- package/src/pgo-components/composables/useTheme.js +10 -0
- package/src/pgo-components/directives/tooltip-directive.ts +393 -0
- package/src/pgo-components/index.js +96 -0
- package/src/pgo-components/lib/componentConfig.js +147 -0
- package/src/pgo-components/lib/core/composables/_useCalendar.ts +127 -0
- package/src/pgo-components/lib/core/composables/useDefaults.ts +15 -0
- package/src/pgo-components/lib/core/composables/useLanguageSelect.js +0 -0
- package/src/pgo-components/lib/core/composables/useRtl.ts +12 -0
- package/src/pgo-components/lib/core/defaults/createDefaults.ts +5 -0
- package/src/pgo-components/lib/core/defaults/defaults.ts +7 -0
- package/src/pgo-components/lib/core/rtl/rtl.ts +3 -0
- package/src/pgo-components/lib/core/rtl/setRtl.ts +19 -0
- package/src/pgo-components/lib/drawerState.ts +3 -0
- package/src/pgo-components/lib/i18n/defaultLables.js +71 -0
- package/src/pgo-components/lib/i18n/i18nPlugin.js +52 -0
- package/src/pgo-components/lib/i18n/useI18n.js +35 -0
- package/src/pgo-components/lib/index.ts +38 -0
- package/src/pgo-components/pages/Component.vue +7 -0
- package/src/pgo-components/pages/ComponentRenderer.vue +85 -0
- package/src/pgo-components/pages/Home.vue +130 -0
- package/src/pgo-components/pages/ListView.vue +370 -0
- package/src/pgo-components/pages/Page1.vue +296 -0
- package/src/pgo-components/pages/_Page1.vue +180 -0
- package/src/pgo-components/plugins/SnackBar.vue +251 -0
- package/src/pgo-components/plugins/SnackBarContainer.vue +53 -0
- package/src/pgo-components/plugins/SnackBarPlugin.ts +136 -0
- package/src/pgo-components/plugins/theme-plugin.js +114 -0
- package/src/pgo-components/plugins/types.ts +46 -0
- package/src/pgo-components/plugins/useSnackBar.js +11 -0
- package/src/pgo-components/plugins/useSnackBar.ts +21 -0
- package/src/pgo-components/plugins/validation-plugin.js +11 -0
- package/src/pgo-components/services/Entry.json +813 -0
- package/src/pgo-components/services/axios.js +54 -0
- package/src/pgo-components/services/data.json +90 -0
- package/src/pgo-components/services/person.json +260 -0
- package/src/pgo-components/services/toast.ts +44 -0
- package/src/pgo-components/styles/global.css +234 -0
- package/src/pgo-components/styles/reset.css +96 -0
- package/src/pgo-components/styles/tokens.css +18 -0
- package/src/pgo-components/styles/utilities/border-radius.css +57 -0
- package/src/pgo-components/styles/utilities/borders.css +85 -0
- package/src/pgo-components/styles/utilities/colors.css +38 -0
- package/src/pgo-components/styles/utilities/cursor.css +19 -0
- package/src/pgo-components/styles/utilities/display.css +78 -0
- package/src/pgo-components/styles/utilities/elevation.css +33 -0
- package/src/pgo-components/styles/utilities/flex.css +403 -0
- package/src/pgo-components/styles/utilities/float.css +41 -0
- package/src/pgo-components/styles/utilities/hover.css +9 -0
- package/src/pgo-components/styles/utilities/index.css +18 -0
- package/src/pgo-components/styles/utilities/opacity.css +27 -0
- package/src/pgo-components/styles/utilities/overflow.css +26 -0
- package/src/pgo-components/styles/utilities/palette.css +515 -0
- package/src/pgo-components/styles/utilities/position.css +14 -0
- package/src/pgo-components/styles/utilities/sizing.css +70 -0
- package/src/pgo-components/styles/utilities/spacing.css +578 -0
- package/src/pgo-components/styles/utilities/transitions.css +58 -0
- package/src/pgo-components/styles/utilities/typography.css +91 -0
- package/src/pgo-components/styles/utilities/z-index.css +11 -0
- package/src/pgo-components/tokens/index.js +337 -0
- package/src/router/index.js +88 -0
- package/src/shims-vue.d.ts +14 -0
- package/src/validations/validationRules.js +50 -0
- package/tailwind.config.js +73 -0
- package/test.php +5 -0
- package/tsconfig.json +25 -0
- package/ui +31 -0
- package/ui.pgo.mv.conf +18 -0
- package/vite.config.js +42 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ref, computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type PickerMode = 'date' | 'week' | 'month' | 'quarter' | 'year' | 'time'
|
|
4
|
+
|
|
5
|
+
export interface CalendarOptions {
|
|
6
|
+
locale?: string
|
|
7
|
+
firstDayOfWeek?: number // 0=Sunday ... 6=Saturday
|
|
8
|
+
min?: Date
|
|
9
|
+
max?: Date
|
|
10
|
+
disabledDate?: (d: Date) => boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function clampDate(d: Date, min?: Date, max?: Date) {
|
|
14
|
+
if (min && d < min) return new Date(min)
|
|
15
|
+
if (max && d > max) return new Date(max)
|
|
16
|
+
return d
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function startOfMonth(d: Date) {
|
|
20
|
+
const x = new Date(d)
|
|
21
|
+
x.setDate(1)
|
|
22
|
+
x.setHours(0, 0, 0, 0)
|
|
23
|
+
return x
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function endOfMonth(d: Date) {
|
|
27
|
+
const x = new Date(d)
|
|
28
|
+
x.setMonth(x.getMonth() + 1)
|
|
29
|
+
x.setDate(0)
|
|
30
|
+
x.setHours(23, 59, 59, 999)
|
|
31
|
+
return x
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function addMonths(d: Date, m: number) {
|
|
35
|
+
const x = new Date(d)
|
|
36
|
+
x.setMonth(x.getMonth() + m)
|
|
37
|
+
return x
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function addYears(d: Date, y: number) {
|
|
41
|
+
const x = new Date(d)
|
|
42
|
+
x.setFullYear(x.getFullYear() + y)
|
|
43
|
+
return x
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function isSameDay(a: Date, b: Date) {
|
|
47
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isBetween(d: Date, a?: Date, b?: Date) {
|
|
51
|
+
if (!a || !b) return false
|
|
52
|
+
const min = a < b ? a : b
|
|
53
|
+
const max = a < b ? b : a
|
|
54
|
+
return d >= min && d <= max
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function startOfWeek(d: Date, firstDay: number) {
|
|
58
|
+
const x = new Date(d)
|
|
59
|
+
const day = x.getDay()
|
|
60
|
+
const diff = (day - firstDay + 7) % 7
|
|
61
|
+
x.setDate(x.getDate() - diff)
|
|
62
|
+
x.setHours(0, 0, 0, 0)
|
|
63
|
+
return x
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function useCalendar(initial: Date, opts: CalendarOptions = {}) {
|
|
67
|
+
const locale = opts.locale || 'en-US'
|
|
68
|
+
const firstDayOfWeek = typeof opts.firstDayOfWeek === 'number' ? opts.firstDayOfWeek : 0
|
|
69
|
+
|
|
70
|
+
const viewDate = ref(clampDate(initial, opts.min, opts.max))
|
|
71
|
+
const monthStart = computed(() => startOfMonth(viewDate.value))
|
|
72
|
+
const monthEnd = computed(() => endOfMonth(viewDate.value))
|
|
73
|
+
|
|
74
|
+
const monthLabel = computed(() => new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(viewDate.value))
|
|
75
|
+
|
|
76
|
+
const weekdays = computed(() => {
|
|
77
|
+
const base = startOfWeek(new Date(2020, 7, 2), firstDayOfWeek) // arbitrary week
|
|
78
|
+
return Array.from({ length: 7 }).map((_, i) => {
|
|
79
|
+
const d = new Date(base)
|
|
80
|
+
d.setDate(d.getDate() + i)
|
|
81
|
+
return new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(d)
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const grid = computed(() => {
|
|
86
|
+
// Calendar grid of 6 rows x 7 cols
|
|
87
|
+
const start = startOfWeek(monthStart.value, firstDayOfWeek)
|
|
88
|
+
const days = [] as Date[]
|
|
89
|
+
for (let i = 0; i < 42; i++) {
|
|
90
|
+
const d = new Date(start)
|
|
91
|
+
d.setDate(d.getDate() + i)
|
|
92
|
+
days.push(d)
|
|
93
|
+
}
|
|
94
|
+
return days
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
function isDisabled(d: Date) {
|
|
98
|
+
if (opts.min && d < opts.min) return true
|
|
99
|
+
if (opts.max && d > opts.max) return true
|
|
100
|
+
if (opts.disabledDate && opts.disabledDate(d)) return true
|
|
101
|
+
return false
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function prevMonth() { viewDate.value = addMonths(viewDate.value, -1) }
|
|
105
|
+
function nextMonth() { viewDate.value = addMonths(viewDate.value, 1) }
|
|
106
|
+
function prevYear() { viewDate.value = addYears(viewDate.value, -1) }
|
|
107
|
+
function nextYear() { viewDate.value = addYears(viewDate.value, 1) }
|
|
108
|
+
function setMonth(m: number) { const x = new Date(viewDate.value); x.setMonth(m); viewDate.value = clampDate(x, opts.min, opts.max) }
|
|
109
|
+
function setYear(y: number) { const x = new Date(viewDate.value); x.setFullYear(y); viewDate.value = clampDate(x, opts.min, opts.max) }
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
viewDate,
|
|
113
|
+
monthLabel,
|
|
114
|
+
weekdays,
|
|
115
|
+
grid,
|
|
116
|
+
isDisabled,
|
|
117
|
+
prevMonth,
|
|
118
|
+
nextMonth,
|
|
119
|
+
prevYear,
|
|
120
|
+
nextYear,
|
|
121
|
+
setMonth,
|
|
122
|
+
setYear,
|
|
123
|
+
isSameDay,
|
|
124
|
+
isBetween,
|
|
125
|
+
startOfWeek,
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { computed } from "vue"
|
|
2
|
+
import { globalDefaults } from "../defaults/defaults.ts"
|
|
3
|
+
|
|
4
|
+
export function useDefaults(componentName: string, props: Record<string, any>) {
|
|
5
|
+
|
|
6
|
+
const mergedProps = computed(() => {
|
|
7
|
+
const componentDefaults = globalDefaults[componentName] || {}
|
|
8
|
+
return {
|
|
9
|
+
...componentDefaults,
|
|
10
|
+
...props
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
return mergedProps
|
|
15
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { globalRtl } from "../rtl/rtl.ts";
|
|
3
|
+
|
|
4
|
+
export function useRtl(localOverride?: boolean) {
|
|
5
|
+
const isRtl = computed(() =>
|
|
6
|
+
typeof localOverride === "boolean" ? localOverride : globalRtl.value
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
const rtlClass = computed(() => (isRtl.value ? "rtl" : "ltr"))
|
|
10
|
+
|
|
11
|
+
return { isRtl, rtlClass }
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { globalRtl } from './rtl.ts'
|
|
2
|
+
import { computed, inject, ref, onMounted } from 'vue'
|
|
3
|
+
|
|
4
|
+
export function setRtl(value: boolean) {
|
|
5
|
+
globalRtl.value = value
|
|
6
|
+
|
|
7
|
+
localStorage.setItem('rtlSetting', JSON.stringify(value));
|
|
8
|
+
|
|
9
|
+
// Update document direction and toggle a global font class
|
|
10
|
+
if (typeof document !== 'undefined') {
|
|
11
|
+
document.documentElement.setAttribute('dir', value ? 'rtl' : 'ltr')
|
|
12
|
+
document.documentElement.setAttribute('lang', (value == true) ? 'dv' : 'en')
|
|
13
|
+
if (value) {
|
|
14
|
+
document.documentElement.classList.add('rtl-font')
|
|
15
|
+
} else {
|
|
16
|
+
document.documentElement.classList.remove('rtl-font')
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
export const messages = {
|
|
3
|
+
en: {
|
|
4
|
+
buttons: {
|
|
5
|
+
submit: 'Submit',
|
|
6
|
+
cancel: 'Cancel',
|
|
7
|
+
save: 'Save',
|
|
8
|
+
add: 'Add',
|
|
9
|
+
ok: 'OK',
|
|
10
|
+
print: 'Print',
|
|
11
|
+
download: 'Download',
|
|
12
|
+
yes: 'Yes',
|
|
13
|
+
no: 'No',
|
|
14
|
+
delete: 'Delete',
|
|
15
|
+
edit: 'Edit',
|
|
16
|
+
close: 'Close',
|
|
17
|
+
search: 'Search',
|
|
18
|
+
},
|
|
19
|
+
placeholders: {
|
|
20
|
+
search: 'Search...',
|
|
21
|
+
select: 'Select an option',
|
|
22
|
+
},
|
|
23
|
+
labels: {
|
|
24
|
+
name: 'Name',
|
|
25
|
+
email: 'Email',
|
|
26
|
+
password: 'Password',
|
|
27
|
+
},
|
|
28
|
+
pagination: {
|
|
29
|
+
itemsPerPage: 'Items per page:',
|
|
30
|
+
jumpToPage: 'Jump to page:',
|
|
31
|
+
of: 'of',
|
|
32
|
+
next: 'Next',
|
|
33
|
+
previous: 'Previous',
|
|
34
|
+
page: 'Page',
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
dv: {
|
|
38
|
+
buttons: {
|
|
39
|
+
submit: 'ސަބްމިޓް',
|
|
40
|
+
cancel: 'ކެންސަލް',
|
|
41
|
+
add: 'އެޑް',
|
|
42
|
+
save: 'ސޭވް',
|
|
43
|
+
ok: 'އޯކޭ',
|
|
44
|
+
print: 'ޕްރިންޓް',
|
|
45
|
+
download: 'ޑައިންލޯޑް',
|
|
46
|
+
yes: 'ރަގަނޅު',
|
|
47
|
+
no: 'ނޫން',
|
|
48
|
+
delete: 'ޑިލިޓް',
|
|
49
|
+
edit: 'އެޑިޓް',
|
|
50
|
+
close: 'ކްލޯސް',
|
|
51
|
+
search: 'ހޯދާ',
|
|
52
|
+
},
|
|
53
|
+
placeholders: {
|
|
54
|
+
search: 'ހޯދާ...',
|
|
55
|
+
select: 'އޮޕްޝަން',
|
|
56
|
+
},
|
|
57
|
+
labels: {
|
|
58
|
+
name: 'ނަން',
|
|
59
|
+
email: 'އީމެއިލް',
|
|
60
|
+
password: 'ޕާސްވަޑް',
|
|
61
|
+
},
|
|
62
|
+
pagination: {
|
|
63
|
+
itemsPerPage: 'ކޮންމެ ސަފުހާއަކަށް:',
|
|
64
|
+
jumpToPage: 'ސަފުހާއަށް ދާން:',
|
|
65
|
+
of: 'ގެ',
|
|
66
|
+
next: 'ކުރިޔަން',
|
|
67
|
+
previous: 'ފަހަތަށް',
|
|
68
|
+
page: 'ސަފުހާ',
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useI18n } from './useI18n.js'
|
|
2
|
+
import { setRtl } from '../core/rtl/setRtl.ts'
|
|
3
|
+
import { watch } from 'vue'
|
|
4
|
+
|
|
5
|
+
export const i18nPlugin = {
|
|
6
|
+
install(app) {
|
|
7
|
+
const { t, setLanguage, language } = useI18n()
|
|
8
|
+
|
|
9
|
+
// Create useLanguageSelect helper
|
|
10
|
+
// const useLanguageSelect = (value, lang = '') => {
|
|
11
|
+
// // If lang prop is provided, use it; otherwise use global language
|
|
12
|
+
// const currentLang = lang || language.value
|
|
13
|
+
|
|
14
|
+
// // If value is a string, return it directly
|
|
15
|
+
// if (typeof value === 'string' && value !== '') {
|
|
16
|
+
// return value
|
|
17
|
+
// }
|
|
18
|
+
|
|
19
|
+
// // If value is an object with language keys
|
|
20
|
+
// if (value && typeof value === 'object') {
|
|
21
|
+
// return value[currentLang] || value['en'] || ''
|
|
22
|
+
// }
|
|
23
|
+
|
|
24
|
+
// return ''
|
|
25
|
+
// }
|
|
26
|
+
|
|
27
|
+
// Changing RTL with language change
|
|
28
|
+
watch (language, (newLang) => {
|
|
29
|
+
if (newLang === 'dv') {
|
|
30
|
+
setRtl(true)
|
|
31
|
+
} else {
|
|
32
|
+
setRtl(false)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// Provide i18n with useLanguageSelect
|
|
39
|
+
app.provide('i18n', {
|
|
40
|
+
t,
|
|
41
|
+
setLanguage,
|
|
42
|
+
language,
|
|
43
|
+
// useLanguageSelect
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// Global properties
|
|
47
|
+
app.config.globalProperties.$t = t
|
|
48
|
+
app.config.globalProperties.$setLanguage = setLanguage
|
|
49
|
+
app.config.globalProperties.$language = language
|
|
50
|
+
// app.config.globalProperties.$useLanguageSelect = useLanguageSelect
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ref, computed } from 'vue'
|
|
2
|
+
import { messages } from './defaultLables.js'
|
|
3
|
+
|
|
4
|
+
const currentLanguage = ref(localStorage.getItem('language') || 'en')
|
|
5
|
+
|
|
6
|
+
export const useI18n = () => {
|
|
7
|
+
const t = (key, lang = '') => {
|
|
8
|
+
// Use provided lang or fall back to current language
|
|
9
|
+
const selectedLang = lang || currentLanguage.value
|
|
10
|
+
const keys = key.split('.')
|
|
11
|
+
let value = messages[selectedLang]
|
|
12
|
+
|
|
13
|
+
for (const k of keys) {
|
|
14
|
+
value = value?.[k]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return value || key
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const setLanguage = (lang) => {
|
|
21
|
+
if (messages[lang]) {
|
|
22
|
+
currentLanguage.value = lang
|
|
23
|
+
localStorage.setItem('language', lang)
|
|
24
|
+
document.documentElement.lang = lang
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const language = computed(() => currentLanguage.value)
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
t,
|
|
32
|
+
setLanguage,
|
|
33
|
+
language,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import { createDefaults } from './core/defaults/createDefaults.ts'
|
|
3
|
+
import { setRtl } from './core/rtl/setRtl.ts'
|
|
4
|
+
import { i18nPlugin } from './i18n/i18nPlugin.js'
|
|
5
|
+
import * as components from '../../components/index.ts'
|
|
6
|
+
|
|
7
|
+
// Export all components individually
|
|
8
|
+
export * from '../../components/index.ts'
|
|
9
|
+
|
|
10
|
+
// Export composables
|
|
11
|
+
export { useTheme } from '../composables/useTheme.js'
|
|
12
|
+
export { useI18n } from './i18n/useI18n.js'
|
|
13
|
+
|
|
14
|
+
// Export plugin
|
|
15
|
+
const UiUxPlugin = {
|
|
16
|
+
install(app: App, options: any = {}) {
|
|
17
|
+
// Install i18n plugin first (required by components)
|
|
18
|
+
app.use(i18nPlugin)
|
|
19
|
+
|
|
20
|
+
// Inject defaults if provided
|
|
21
|
+
if (options.defaults){
|
|
22
|
+
createDefaults(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Inject RTL if provided
|
|
26
|
+
if (typeof options.rtl === 'boolean'){
|
|
27
|
+
setRtl(options.rtl)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Register components
|
|
31
|
+
for (const key in components) {
|
|
32
|
+
app.component(key, (components as any)[key])
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default UiUxPlugin
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<component
|
|
4
|
+
v-if="componentMap[componentName]"
|
|
5
|
+
:is="componentMap[componentName]"
|
|
6
|
+
:items="items"
|
|
7
|
+
:loading="loading"
|
|
8
|
+
@update:query-params="handleQueryParamsUpdate"
|
|
9
|
+
/>
|
|
10
|
+
<div v-else>
|
|
11
|
+
<p>Component not found: {{ componentName }}</p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { ref, onMounted, watch, inject, computed, defineAsyncComponent } from 'vue'
|
|
18
|
+
import { useRoute } from 'vue-router'
|
|
19
|
+
|
|
20
|
+
const { language } = inject('i18n')
|
|
21
|
+
const api = inject('api')
|
|
22
|
+
const route = useRoute()
|
|
23
|
+
|
|
24
|
+
const modelName = computed(() => route.params.modelName || '')
|
|
25
|
+
const componentName = computed(() => route.params.componentName || '')
|
|
26
|
+
|
|
27
|
+
const items = ref({})
|
|
28
|
+
const loading = ref(false)
|
|
29
|
+
|
|
30
|
+
const componentMap = computed(() => {
|
|
31
|
+
const map = {}
|
|
32
|
+
const usedTypes = componentName.value
|
|
33
|
+
|
|
34
|
+
if (usedTypes == "listView" || usedTypes == 'ListView') {
|
|
35
|
+
map['listView'] = defineAsyncComponent(() => import('../../pgo-components/pages/ListView.vue'))
|
|
36
|
+
map['ListView'] = defineAsyncComponent(() => import('../../pgo-components/pages/ListView.vue'))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return map
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const fetchData = async (queryParams = {}) => {
|
|
43
|
+
try {
|
|
44
|
+
loading.value = true
|
|
45
|
+
|
|
46
|
+
// Build query string from params
|
|
47
|
+
const params = new URLSearchParams({
|
|
48
|
+
component: componentName.value,
|
|
49
|
+
lang: language.value || 'dv',
|
|
50
|
+
...queryParams
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// console.log('Fetching with params:', params.toString())
|
|
54
|
+
|
|
55
|
+
const response = await api.get(`/ccs/${modelName.value}?${params}`) // uncomment this line to use real API
|
|
56
|
+
// const response = person // comment this line to use real API
|
|
57
|
+
items.value = response
|
|
58
|
+
|
|
59
|
+
console.log('Fetched data:', items.value)
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error('Error fetching data:', error)
|
|
62
|
+
} finally {
|
|
63
|
+
loading.value = false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Handle query params update from child component
|
|
68
|
+
const handleQueryParamsUpdate = (queryParams) => {
|
|
69
|
+
console.log('Query params updated:', queryParams)
|
|
70
|
+
fetchData(queryParams)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Initial fetch
|
|
74
|
+
fetchData()
|
|
75
|
+
|
|
76
|
+
onMounted(() => {
|
|
77
|
+
console.log('Model Name:', modelName.value)
|
|
78
|
+
console.log('Component Name:', componentName.value)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// Watch for route changes
|
|
82
|
+
watch([modelName, componentName], () => {
|
|
83
|
+
fetchData()
|
|
84
|
+
})
|
|
85
|
+
</script>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
5
|
+
<ModalExample />
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
9
|
+
<BreadcrumbExample />
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
13
|
+
<ThemeToggle />
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
17
|
+
<!-- <TipTapEditorExample /> -->
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
21
|
+
<ExpansionPanelExample />
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
25
|
+
<EditorExample />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
29
|
+
<TabExample />
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
33
|
+
<TooltipExample />
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
37
|
+
<AvatarExample />
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
41
|
+
<!-- <DatePickerExample /> -->
|
|
42
|
+
<!-- <DatePickerExample /> -->
|
|
43
|
+
<VueDatePickerShowcase />
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
47
|
+
<TimelineExample />
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
51
|
+
<FileUploadExample />
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
55
|
+
<FormExample />
|
|
56
|
+
</div>
|
|
57
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
58
|
+
<RadioButtonExample />
|
|
59
|
+
</div>
|
|
60
|
+
<div class="max-w-5xl mx-auto p-4 mt-6 border space-y-3">
|
|
61
|
+
<NumberFieldExample />
|
|
62
|
+
</div>
|
|
63
|
+
<!-- <LayoutContainer>
|
|
64
|
+
<template #default>
|
|
65
|
+
<div>
|
|
66
|
+
<h1 class="text-2xl font-bold mb-4">Dashboard</h1>
|
|
67
|
+
<p>Main content goes here.</p>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<template #footer>
|
|
72
|
+
<div class="text-center text-sm text-gray-500">© 2025 My App</div>
|
|
73
|
+
</template>
|
|
74
|
+
</LayoutContainer> -->
|
|
75
|
+
|
|
76
|
+
<!-- <LayoutContainerExample /> -->
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup>
|
|
82
|
+
import { ref } from "vue";
|
|
83
|
+
import ExpansionPanelExample from '../../components/examples/ExpansionPanelExample.vue'
|
|
84
|
+
import TabExample from '../../components/examples/TabExample.vue'
|
|
85
|
+
import TooltipExample from '../../components/examples/TooltipExample.vue'
|
|
86
|
+
import AvatarExample from '../../components/examples/AvatarExample.vue'
|
|
87
|
+
import VueDatePickerShowcase from '../../components/examples/VueDatePickerShowcase.vue'
|
|
88
|
+
import TimelineExample from '../../components/examples/TimelineExample.vue'
|
|
89
|
+
import FileUploadExample from '../../components/examples/FileUploadExample.vue'
|
|
90
|
+
import EditorExample from '../../components/examples/EditorExample.vue'
|
|
91
|
+
import FormExample from '../../components/examples/FormExample.vue'
|
|
92
|
+
import BreadcrumbExample from '../../components/examples/BreadcrumbExample.vue'
|
|
93
|
+
import ModalExample from '../../components/examples/ModalExample.vue'
|
|
94
|
+
import ThemeToggle from '../../components/examples/ThemeToggle.vue'
|
|
95
|
+
import { drawerOpen } from '../../pgo-components/lib/drawerState'
|
|
96
|
+
import { globalRtl } from '../../pgo-components/lib/core/rtl/rtl'
|
|
97
|
+
import { useSnackBar } from '../../pgo-components/plugins/useSnackBar.js'
|
|
98
|
+
import AppBarExample from "../../components/examples/AppBarExample.vue";
|
|
99
|
+
import NavDrawerExample from "../../components/examples/NavDrawerExample.vue";
|
|
100
|
+
import ChipExample from "../../components/examples/ChipExample.vue";
|
|
101
|
+
import TableExample from "../../components/examples/TableExample.vue";
|
|
102
|
+
import SelectExample from "../../components/examples/SelectExample.vue";
|
|
103
|
+
import CardExample from "../../components/examples/CardExample.vue";
|
|
104
|
+
import DropdownExample from "../../components/examples/DropdownExample.vue";
|
|
105
|
+
import TextareaExample from "../../components/examples/TextareaExample.vue";
|
|
106
|
+
import TextFieldExample from "../../components/examples/TextFieldExample.vue";
|
|
107
|
+
import BannerExample from "../../components/examples/BannerExample.vue";
|
|
108
|
+
import SearchExample from "../../components/examples/SearchExample.vue";
|
|
109
|
+
import StackedTableViewExample from "../../components/examples/StackedTableViewExample.vue";
|
|
110
|
+
import LayoutContainer from "../../components/pgo/LayoutContainer.vue";
|
|
111
|
+
import RadioButtonExample from "../../components/examples/RadioButtonExample.vue";
|
|
112
|
+
|
|
113
|
+
import LayoutContainerExample from "../../components/examples/LayoutContainerExample.vue";
|
|
114
|
+
|
|
115
|
+
import Button from "../../components/pgo/Button.vue";
|
|
116
|
+
import NumberFieldExample from "../../components/examples/NumberFieldExample.vue";
|
|
117
|
+
|
|
118
|
+
const appBarOffset = ref(false)
|
|
119
|
+
const overlayAppBar = ref(true)
|
|
120
|
+
const zIndex = ref(undefined)
|
|
121
|
+
const isStuck = ref(true)
|
|
122
|
+
const location = ref(globalRtl.value ? 'right' : 'left')
|
|
123
|
+
const persistent = ref(false)
|
|
124
|
+
const permanent = ref(true)
|
|
125
|
+
const temporary = ref(false)
|
|
126
|
+
const rail = ref(false)
|
|
127
|
+
const hoverExpand = ref(false)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
</script>
|