@shival99/z-ui 1.0.1 → 1.0.2
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/assets/css/animations.css +207 -0
- package/assets/css/base.css +76 -0
- package/assets/css/tailwind.css +53 -0
- package/assets/css/themes/gray.css +73 -0
- package/assets/css/themes/green.css +75 -0
- package/assets/css/themes/hospital.css +79 -0
- package/assets/css/themes/neutral.css +73 -0
- package/assets/css/themes/orange.css +73 -0
- package/assets/css/themes/slate.css +73 -0
- package/assets/css/themes/stone.css +73 -0
- package/assets/css/themes/violet.css +73 -0
- package/assets/css/themes/zinc.css +73 -0
- package/assets/images/avatar.svg +6 -0
- package/assets/images/logo.svg +6 -0
- package/fesm2022/shival99-z-ui-components-z-accordion.mjs +148 -0
- package/fesm2022/shival99-z-ui-components-z-accordion.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-breadcrumb.mjs +74 -0
- package/fesm2022/shival99-z-ui-components-z-breadcrumb.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-button.mjs +155 -0
- package/fesm2022/shival99-z-ui-components-z-button.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-calendar.mjs +2335 -0
- package/fesm2022/shival99-z-ui-components-z-calendar.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-checkbox.mjs +240 -0
- package/fesm2022/shival99-z-ui-components-z-checkbox.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-code.mjs +139 -0
- package/fesm2022/shival99-z-ui-components-z-code.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs +664 -0
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs +55 -0
- package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-editor.mjs +411 -0
- package/fesm2022/shival99-z-ui-components-z-editor.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-filter.mjs +794 -0
- package/fesm2022/shival99-z-ui-components-z-filter.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-icon.mjs +451 -0
- package/fesm2022/shival99-z-ui-components-z-icon.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-input.mjs +804 -0
- package/fesm2022/shival99-z-ui-components-z-input.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-loading.mjs +105 -0
- package/fesm2022/shival99-z-ui-components-z-loading.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-menu.mjs +351 -0
- package/fesm2022/shival99-z-ui-components-z-menu.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-modal.mjs +722 -0
- package/fesm2022/shival99-z-ui-components-z-modal.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-pagination.mjs +131 -0
- package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-popover.mjs +917 -0
- package/fesm2022/shival99-z-ui-components-z-popover.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-radio.mjs +154 -0
- package/fesm2022/shival99-z-ui-components-z-radio.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-select.mjs +998 -0
- package/fesm2022/shival99-z-ui-components-z-select.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-skeleton.mjs +139 -0
- package/fesm2022/shival99-z-ui-components-z-skeleton.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-switch.mjs +127 -0
- package/fesm2022/shival99-z-ui-components-z-switch.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-table.mjs +2628 -0
- package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs +259 -0
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-timeline.mjs +335 -0
- package/fesm2022/shival99-z-ui-components-z-timeline.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-toast.mjs +93 -0
- package/fesm2022/shival99-z-ui-components-z-toast.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs +660 -0
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-upload.mjs +504 -0
- package/fesm2022/shival99-z-ui-components-z-upload.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-i18n.mjs +258 -0
- package/fesm2022/shival99-z-ui-i18n.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-pipes.mjs +116 -0
- package/fesm2022/shival99-z-ui-pipes.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-providers.mjs +203 -0
- package/fesm2022/shival99-z-ui-providers.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-services.mjs +919 -0
- package/fesm2022/shival99-z-ui-services.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-utils.mjs +591 -0
- package/fesm2022/shival99-z-ui-utils.mjs.map +1 -0
- package/fesm2022/z-ui.mjs +3 -19924
- package/fesm2022/z-ui.mjs.map +1 -1
- package/package.json +129 -1
- package/types/shival99-z-ui-components-z-accordion.d.ts +55 -0
- package/types/shival99-z-ui-components-z-breadcrumb.d.ts +36 -0
- package/types/shival99-z-ui-components-z-button.d.ts +41 -0
- package/types/shival99-z-ui-components-z-calendar.d.ts +300 -0
- package/types/shival99-z-ui-components-z-checkbox.d.ts +84 -0
- package/types/shival99-z-ui-components-z-code.d.ts +35 -0
- package/types/shival99-z-ui-components-z-drawer.d.ts +232 -0
- package/types/shival99-z-ui-components-z-dropdown-menu.d.ts +50 -0
- package/types/shival99-z-ui-components-z-editor.d.ts +115 -0
- package/types/shival99-z-ui-components-z-filter.d.ts +268 -0
- package/types/shival99-z-ui-components-z-icon.d.ts +291 -0
- package/types/shival99-z-ui-components-z-input.d.ts +188 -0
- package/types/shival99-z-ui-components-z-loading.d.ts +46 -0
- package/types/shival99-z-ui-components-z-menu.d.ts +116 -0
- package/types/shival99-z-ui-components-z-modal.d.ts +270 -0
- package/types/shival99-z-ui-components-z-pagination.d.ts +52 -0
- package/types/shival99-z-ui-components-z-popover.d.ts +134 -0
- package/types/shival99-z-ui-components-z-radio.d.ts +63 -0
- package/types/shival99-z-ui-components-z-select.d.ts +268 -0
- package/types/shival99-z-ui-components-z-skeleton.d.ts +55 -0
- package/types/shival99-z-ui-components-z-switch.d.ts +48 -0
- package/types/shival99-z-ui-components-z-table.d.ts +482 -0
- package/types/shival99-z-ui-components-z-tabs.d.ts +75 -0
- package/types/shival99-z-ui-components-z-timeline.d.ts +98 -0
- package/types/shival99-z-ui-components-z-toast.d.ts +61 -0
- package/types/shival99-z-ui-components-z-tooltip.d.ts +85 -0
- package/types/shival99-z-ui-components-z-upload.d.ts +136 -0
- package/types/shival99-z-ui-i18n.d.ts +50 -0
- package/types/shival99-z-ui-pipes.d.ts +36 -0
- package/types/shival99-z-ui-providers.d.ts +132 -0
- package/types/shival99-z-ui-services.d.ts +364 -0
- package/types/shival99-z-ui-utils.d.ts +145 -0
- package/types/z-ui.d.ts +3 -4977
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Z-UI English translations
|
|
3
|
+
*/
|
|
4
|
+
const Z_UI_EN_TRANSLATIONS = {
|
|
5
|
+
// Table
|
|
6
|
+
i18n_z_ui_table_noData: 'No data available',
|
|
7
|
+
i18n_z_ui_table_loading: 'Loading...',
|
|
8
|
+
i18n_z_ui_table_search: 'Search...',
|
|
9
|
+
i18n_z_ui_table_settings: 'Settings',
|
|
10
|
+
i18n_z_ui_table_columns: 'Columns',
|
|
11
|
+
i18n_z_ui_table_showAll: 'Show all',
|
|
12
|
+
i18n_z_ui_table_hideAll: 'Hide all',
|
|
13
|
+
i18n_z_ui_table_pinLeft: 'Pin left',
|
|
14
|
+
i18n_z_ui_table_pinRight: 'Pin right',
|
|
15
|
+
i18n_z_ui_table_unpin: 'Unpin',
|
|
16
|
+
i18n_z_ui_table_sortAsc: 'Sort ascending',
|
|
17
|
+
i18n_z_ui_table_sortDesc: 'Sort descending',
|
|
18
|
+
i18n_z_ui_table_clearSort: 'Clear sort',
|
|
19
|
+
i18n_z_ui_table_filter: 'Filter',
|
|
20
|
+
i18n_z_ui_table_clearFilter: 'Clear filter',
|
|
21
|
+
i18n_z_ui_table_rowsPerPage: 'Rows per page',
|
|
22
|
+
i18n_z_ui_table_of: 'of',
|
|
23
|
+
i18n_z_ui_table_selected: 'selected',
|
|
24
|
+
i18n_z_ui_table_expandAll: 'Expand all',
|
|
25
|
+
i18n_z_ui_table_collapseAll: 'Collapse all',
|
|
26
|
+
// Calendar
|
|
27
|
+
i18n_z_ui_calendar_today: 'Today',
|
|
28
|
+
i18n_z_ui_calendar_clear: 'Clear',
|
|
29
|
+
i18n_z_ui_calendar_ok: 'OK',
|
|
30
|
+
i18n_z_ui_calendar_cancel: 'Cancel',
|
|
31
|
+
i18n_z_ui_calendar_startDate: 'Start date',
|
|
32
|
+
i18n_z_ui_calendar_endDate: 'End date',
|
|
33
|
+
i18n_z_ui_calendar_selectDate: 'Select date',
|
|
34
|
+
i18n_z_ui_calendar_selectTime: 'Select time',
|
|
35
|
+
i18n_z_ui_calendar_thisWeek: 'This week',
|
|
36
|
+
i18n_z_ui_calendar_lastWeek: 'Last week',
|
|
37
|
+
i18n_z_ui_calendar_thisMonth: 'This month',
|
|
38
|
+
i18n_z_ui_calendar_lastMonth: 'Last month',
|
|
39
|
+
i18n_z_ui_calendar_last7Days: 'Last 7 days',
|
|
40
|
+
i18n_z_ui_calendar_last30Days: 'Last 30 days',
|
|
41
|
+
i18n_z_ui_calendar_last90Days: 'Last 90 days',
|
|
42
|
+
i18n_z_ui_calendar_thisYear: 'This year',
|
|
43
|
+
i18n_z_ui_calendar_lastYear: 'Last year',
|
|
44
|
+
// Input
|
|
45
|
+
i18n_z_ui_input_required: 'This field is required',
|
|
46
|
+
i18n_z_ui_input_minLength: 'Minimum {min} characters',
|
|
47
|
+
i18n_z_ui_input_maxLength: 'Maximum {max} characters',
|
|
48
|
+
i18n_z_ui_input_email: 'Invalid email format',
|
|
49
|
+
i18n_z_ui_input_pattern: 'Invalid format',
|
|
50
|
+
i18n_z_ui_input_min: 'Minimum value is {min}',
|
|
51
|
+
i18n_z_ui_input_max: 'Maximum value is {max}',
|
|
52
|
+
// Select
|
|
53
|
+
i18n_z_ui_select_placeholder: 'Select...',
|
|
54
|
+
i18n_z_ui_select_noOptions: 'No options available',
|
|
55
|
+
i18n_z_ui_select_noResults: 'No results found',
|
|
56
|
+
i18n_z_ui_select_loading: 'Loading...',
|
|
57
|
+
i18n_z_ui_select_selectAll: 'Select all',
|
|
58
|
+
i18n_z_ui_select_clearAll: 'Clear all',
|
|
59
|
+
i18n_z_ui_select_selected: '{count} selected',
|
|
60
|
+
// Modal
|
|
61
|
+
i18n_z_ui_modal_close: 'Close',
|
|
62
|
+
i18n_z_ui_modal_confirm: 'Confirm',
|
|
63
|
+
i18n_z_ui_modal_cancel: 'Cancel',
|
|
64
|
+
// Drawer
|
|
65
|
+
i18n_z_ui_drawer_close: 'Close',
|
|
66
|
+
// Upload
|
|
67
|
+
i18n_z_ui_upload_dragDrop: 'Drag & drop files here',
|
|
68
|
+
i18n_z_ui_upload_or: 'or',
|
|
69
|
+
i18n_z_ui_upload_browse: 'Browse files',
|
|
70
|
+
i18n_z_ui_upload_uploading: 'Uploading...',
|
|
71
|
+
i18n_z_ui_upload_uploaded: 'Uploaded',
|
|
72
|
+
i18n_z_ui_upload_failed: 'Upload failed',
|
|
73
|
+
i18n_z_ui_upload_remove: 'Remove',
|
|
74
|
+
i18n_z_ui_upload_maxSize: 'Maximum file size: {size}',
|
|
75
|
+
i18n_z_ui_upload_invalidType: 'Invalid file type',
|
|
76
|
+
// Pagination
|
|
77
|
+
i18n_z_ui_pagination_first: 'First',
|
|
78
|
+
i18n_z_ui_pagination_last: 'Last',
|
|
79
|
+
i18n_z_ui_pagination_next: 'Next',
|
|
80
|
+
i18n_z_ui_pagination_previous: 'Previous',
|
|
81
|
+
i18n_z_ui_pagination_page: 'Page',
|
|
82
|
+
i18n_z_ui_pagination_of: 'of',
|
|
83
|
+
// Common
|
|
84
|
+
i18n_z_ui_common_loading: 'Loading...',
|
|
85
|
+
i18n_z_ui_common_save: 'Save',
|
|
86
|
+
i18n_z_ui_common_cancel: 'Cancel',
|
|
87
|
+
i18n_z_ui_common_confirm: 'Confirm',
|
|
88
|
+
i18n_z_ui_common_delete: 'Delete',
|
|
89
|
+
i18n_z_ui_common_edit: 'Edit',
|
|
90
|
+
i18n_z_ui_common_add: 'Add',
|
|
91
|
+
i18n_z_ui_common_search: 'Search',
|
|
92
|
+
i18n_z_ui_common_clear: 'Clear',
|
|
93
|
+
i18n_z_ui_common_reset: 'Reset',
|
|
94
|
+
i18n_z_ui_common_apply: 'Apply',
|
|
95
|
+
i18n_z_ui_common_yes: 'Yes',
|
|
96
|
+
i18n_z_ui_common_no: 'No',
|
|
97
|
+
i18n_z_ui_common_ok: 'OK',
|
|
98
|
+
i18n_z_ui_common_error: 'Error',
|
|
99
|
+
i18n_z_ui_common_success: 'Success',
|
|
100
|
+
i18n_z_ui_common_warning: 'Warning',
|
|
101
|
+
i18n_z_ui_common_info: 'Info',
|
|
102
|
+
// Toast
|
|
103
|
+
i18n_z_ui_toast_close: 'Close',
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Z-UI Vietnamese translations
|
|
108
|
+
*/
|
|
109
|
+
const Z_UI_VI_TRANSLATIONS = {
|
|
110
|
+
// Table
|
|
111
|
+
i18n_z_ui_table_noData: 'Không có dữ liệu',
|
|
112
|
+
i18n_z_ui_table_loading: 'Đang tải...',
|
|
113
|
+
i18n_z_ui_table_search: 'Tìm kiếm...',
|
|
114
|
+
i18n_z_ui_table_settings: 'Cài đặt',
|
|
115
|
+
i18n_z_ui_table_columns: 'Cột',
|
|
116
|
+
i18n_z_ui_table_showAll: 'Hiện tất cả',
|
|
117
|
+
i18n_z_ui_table_hideAll: 'Ẩn tất cả',
|
|
118
|
+
i18n_z_ui_table_pinLeft: 'Ghim trái',
|
|
119
|
+
i18n_z_ui_table_pinRight: 'Ghim phải',
|
|
120
|
+
i18n_z_ui_table_unpin: 'Bỏ ghim',
|
|
121
|
+
i18n_z_ui_table_sortAsc: 'Sắp xếp tăng dần',
|
|
122
|
+
i18n_z_ui_table_sortDesc: 'Sắp xếp giảm dần',
|
|
123
|
+
i18n_z_ui_table_clearSort: 'Bỏ sắp xếp',
|
|
124
|
+
i18n_z_ui_table_filter: 'Lọc',
|
|
125
|
+
i18n_z_ui_table_clearFilter: 'Xóa bộ lọc',
|
|
126
|
+
i18n_z_ui_table_rowsPerPage: 'Số dòng mỗi trang',
|
|
127
|
+
i18n_z_ui_table_of: 'của',
|
|
128
|
+
i18n_z_ui_table_selected: 'đã chọn',
|
|
129
|
+
i18n_z_ui_table_expandAll: 'Mở rộng tất cả',
|
|
130
|
+
i18n_z_ui_table_collapseAll: 'Thu gọn tất cả',
|
|
131
|
+
// Calendar
|
|
132
|
+
i18n_z_ui_calendar_today: 'Hôm nay',
|
|
133
|
+
i18n_z_ui_calendar_clear: 'Xóa',
|
|
134
|
+
i18n_z_ui_calendar_ok: 'Đồng ý',
|
|
135
|
+
i18n_z_ui_calendar_cancel: 'Hủy',
|
|
136
|
+
i18n_z_ui_calendar_startDate: 'Ngày bắt đầu',
|
|
137
|
+
i18n_z_ui_calendar_endDate: 'Ngày kết thúc',
|
|
138
|
+
i18n_z_ui_calendar_selectDate: 'Chọn ngày',
|
|
139
|
+
i18n_z_ui_calendar_selectTime: 'Chọn giờ',
|
|
140
|
+
i18n_z_ui_calendar_thisWeek: 'Tuần này',
|
|
141
|
+
i18n_z_ui_calendar_lastWeek: 'Tuần trước',
|
|
142
|
+
i18n_z_ui_calendar_thisMonth: 'Tháng này',
|
|
143
|
+
i18n_z_ui_calendar_lastMonth: 'Tháng trước',
|
|
144
|
+
i18n_z_ui_calendar_last7Days: '7 ngày qua',
|
|
145
|
+
i18n_z_ui_calendar_last30Days: '30 ngày qua',
|
|
146
|
+
i18n_z_ui_calendar_last90Days: '90 ngày qua',
|
|
147
|
+
i18n_z_ui_calendar_thisYear: 'Năm nay',
|
|
148
|
+
i18n_z_ui_calendar_lastYear: 'Năm trước',
|
|
149
|
+
// Input
|
|
150
|
+
i18n_z_ui_input_required: 'Trường này là bắt buộc',
|
|
151
|
+
i18n_z_ui_input_minLength: 'Tối thiểu {min} ký tự',
|
|
152
|
+
i18n_z_ui_input_maxLength: 'Tối đa {max} ký tự',
|
|
153
|
+
i18n_z_ui_input_email: 'Định dạng email không hợp lệ',
|
|
154
|
+
i18n_z_ui_input_pattern: 'Định dạng không hợp lệ',
|
|
155
|
+
i18n_z_ui_input_min: 'Giá trị tối thiểu là {min}',
|
|
156
|
+
i18n_z_ui_input_max: 'Giá trị tối đa là {max}',
|
|
157
|
+
// Select
|
|
158
|
+
i18n_z_ui_select_placeholder: 'Chọn...',
|
|
159
|
+
i18n_z_ui_select_noOptions: 'Không có tùy chọn',
|
|
160
|
+
i18n_z_ui_select_noResults: 'Không tìm thấy kết quả',
|
|
161
|
+
i18n_z_ui_select_loading: 'Đang tải...',
|
|
162
|
+
i18n_z_ui_select_selectAll: 'Chọn tất cả',
|
|
163
|
+
i18n_z_ui_select_clearAll: 'Bỏ chọn tất cả',
|
|
164
|
+
i18n_z_ui_select_selected: 'Đã chọn {count}',
|
|
165
|
+
// Modal
|
|
166
|
+
i18n_z_ui_modal_close: 'Đóng',
|
|
167
|
+
i18n_z_ui_modal_confirm: 'Xác nhận',
|
|
168
|
+
i18n_z_ui_modal_cancel: 'Hủy',
|
|
169
|
+
// Drawer
|
|
170
|
+
i18n_z_ui_drawer_close: 'Đóng',
|
|
171
|
+
// Upload
|
|
172
|
+
i18n_z_ui_upload_dragDrop: 'Kéo thả file vào đây',
|
|
173
|
+
i18n_z_ui_upload_or: 'hoặc',
|
|
174
|
+
i18n_z_ui_upload_browse: 'Chọn file',
|
|
175
|
+
i18n_z_ui_upload_uploading: 'Đang tải lên...',
|
|
176
|
+
i18n_z_ui_upload_uploaded: 'Đã tải lên',
|
|
177
|
+
i18n_z_ui_upload_failed: 'Tải lên thất bại',
|
|
178
|
+
i18n_z_ui_upload_remove: 'Xóa',
|
|
179
|
+
i18n_z_ui_upload_maxSize: 'Kích thước tối đa: {size}',
|
|
180
|
+
i18n_z_ui_upload_invalidType: 'Loại file không hợp lệ',
|
|
181
|
+
// Pagination
|
|
182
|
+
i18n_z_ui_pagination_first: 'Đầu',
|
|
183
|
+
i18n_z_ui_pagination_last: 'Cuối',
|
|
184
|
+
i18n_z_ui_pagination_next: 'Tiếp',
|
|
185
|
+
i18n_z_ui_pagination_previous: 'Trước',
|
|
186
|
+
i18n_z_ui_pagination_page: 'Trang',
|
|
187
|
+
i18n_z_ui_pagination_of: 'của',
|
|
188
|
+
// Common
|
|
189
|
+
i18n_z_ui_common_loading: 'Đang tải...',
|
|
190
|
+
i18n_z_ui_common_save: 'Lưu',
|
|
191
|
+
i18n_z_ui_common_cancel: 'Hủy',
|
|
192
|
+
i18n_z_ui_common_confirm: 'Xác nhận',
|
|
193
|
+
i18n_z_ui_common_delete: 'Xóa',
|
|
194
|
+
i18n_z_ui_common_edit: 'Sửa',
|
|
195
|
+
i18n_z_ui_common_add: 'Thêm',
|
|
196
|
+
i18n_z_ui_common_search: 'Tìm kiếm',
|
|
197
|
+
i18n_z_ui_common_clear: 'Xóa',
|
|
198
|
+
i18n_z_ui_common_reset: 'Đặt lại',
|
|
199
|
+
i18n_z_ui_common_apply: 'Áp dụng',
|
|
200
|
+
i18n_z_ui_common_yes: 'Có',
|
|
201
|
+
i18n_z_ui_common_no: 'Không',
|
|
202
|
+
i18n_z_ui_common_ok: 'OK',
|
|
203
|
+
i18n_z_ui_common_error: 'Lỗi',
|
|
204
|
+
i18n_z_ui_common_success: 'Thành công',
|
|
205
|
+
i18n_z_ui_common_warning: 'Cảnh báo',
|
|
206
|
+
i18n_z_ui_common_info: 'Thông tin',
|
|
207
|
+
// Toast
|
|
208
|
+
i18n_z_ui_toast_close: 'Đóng',
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Z-UI Internationalization
|
|
213
|
+
*
|
|
214
|
+
* This module provides default translations for all Z-UI components.
|
|
215
|
+
* Users can override any translation by providing their own values.
|
|
216
|
+
*
|
|
217
|
+
* Key format: i18n_z_ui_{component}_{key}
|
|
218
|
+
* Example: i18n_z_ui_table_noData
|
|
219
|
+
*/
|
|
220
|
+
/**
|
|
221
|
+
* Default translations for Z-UI components
|
|
222
|
+
*/
|
|
223
|
+
const Z_UI_TRANSLATIONS = {
|
|
224
|
+
en: Z_UI_EN_TRANSLATIONS,
|
|
225
|
+
vi: Z_UI_VI_TRANSLATIONS,
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Get translations for a specific language
|
|
229
|
+
* Falls back to English if language not found
|
|
230
|
+
*/
|
|
231
|
+
function getZUITranslations(lang) {
|
|
232
|
+
return Z_UI_TRANSLATIONS[lang] ?? Z_UI_TRANSLATIONS['en'];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Merge custom translations with Z-UI defaults
|
|
236
|
+
* Custom translations take precedence
|
|
237
|
+
*/
|
|
238
|
+
function mergeTranslations(lang, customTranslations) {
|
|
239
|
+
const defaults = getZUITranslations(lang);
|
|
240
|
+
if (!customTranslations) {
|
|
241
|
+
return defaults;
|
|
242
|
+
}
|
|
243
|
+
return { ...defaults, ...customTranslations };
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get all Z-UI translation keys
|
|
247
|
+
* Useful for documentation or tooling
|
|
248
|
+
*/
|
|
249
|
+
function getZUITranslationKeys() {
|
|
250
|
+
return Object.keys(Z_UI_EN_TRANSLATIONS);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Generated bundle index. Do not edit.
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
export { Z_UI_EN_TRANSLATIONS, Z_UI_TRANSLATIONS, Z_UI_VI_TRANSLATIONS, getZUITranslationKeys, getZUITranslations, mergeTranslations };
|
|
258
|
+
//# sourceMappingURL=shival99-z-ui-i18n.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shival99-z-ui-i18n.mjs","sources":["../../../../libs/core-ui/i18n/en.ts","../../../../libs/core-ui/i18n/vi.ts","../../../../libs/core-ui/i18n/index.ts","../../../../libs/core-ui/i18n/shival99-z-ui-i18n.ts"],"sourcesContent":["/**\n * Z-UI English translations\n */\nexport const Z_UI_EN_TRANSLATIONS: Record<string, string> = {\n // Table\n i18n_z_ui_table_noData: 'No data available',\n i18n_z_ui_table_loading: 'Loading...',\n i18n_z_ui_table_search: 'Search...',\n i18n_z_ui_table_settings: 'Settings',\n i18n_z_ui_table_columns: 'Columns',\n i18n_z_ui_table_showAll: 'Show all',\n i18n_z_ui_table_hideAll: 'Hide all',\n i18n_z_ui_table_pinLeft: 'Pin left',\n i18n_z_ui_table_pinRight: 'Pin right',\n i18n_z_ui_table_unpin: 'Unpin',\n i18n_z_ui_table_sortAsc: 'Sort ascending',\n i18n_z_ui_table_sortDesc: 'Sort descending',\n i18n_z_ui_table_clearSort: 'Clear sort',\n i18n_z_ui_table_filter: 'Filter',\n i18n_z_ui_table_clearFilter: 'Clear filter',\n i18n_z_ui_table_rowsPerPage: 'Rows per page',\n i18n_z_ui_table_of: 'of',\n i18n_z_ui_table_selected: 'selected',\n i18n_z_ui_table_expandAll: 'Expand all',\n i18n_z_ui_table_collapseAll: 'Collapse all',\n\n // Calendar\n i18n_z_ui_calendar_today: 'Today',\n i18n_z_ui_calendar_clear: 'Clear',\n i18n_z_ui_calendar_ok: 'OK',\n i18n_z_ui_calendar_cancel: 'Cancel',\n i18n_z_ui_calendar_startDate: 'Start date',\n i18n_z_ui_calendar_endDate: 'End date',\n i18n_z_ui_calendar_selectDate: 'Select date',\n i18n_z_ui_calendar_selectTime: 'Select time',\n i18n_z_ui_calendar_thisWeek: 'This week',\n i18n_z_ui_calendar_lastWeek: 'Last week',\n i18n_z_ui_calendar_thisMonth: 'This month',\n i18n_z_ui_calendar_lastMonth: 'Last month',\n i18n_z_ui_calendar_last7Days: 'Last 7 days',\n i18n_z_ui_calendar_last30Days: 'Last 30 days',\n i18n_z_ui_calendar_last90Days: 'Last 90 days',\n i18n_z_ui_calendar_thisYear: 'This year',\n i18n_z_ui_calendar_lastYear: 'Last year',\n\n // Input\n i18n_z_ui_input_required: 'This field is required',\n i18n_z_ui_input_minLength: 'Minimum {min} characters',\n i18n_z_ui_input_maxLength: 'Maximum {max} characters',\n i18n_z_ui_input_email: 'Invalid email format',\n i18n_z_ui_input_pattern: 'Invalid format',\n i18n_z_ui_input_min: 'Minimum value is {min}',\n i18n_z_ui_input_max: 'Maximum value is {max}',\n\n // Select\n i18n_z_ui_select_placeholder: 'Select...',\n i18n_z_ui_select_noOptions: 'No options available',\n i18n_z_ui_select_noResults: 'No results found',\n i18n_z_ui_select_loading: 'Loading...',\n i18n_z_ui_select_selectAll: 'Select all',\n i18n_z_ui_select_clearAll: 'Clear all',\n i18n_z_ui_select_selected: '{count} selected',\n\n // Modal\n i18n_z_ui_modal_close: 'Close',\n i18n_z_ui_modal_confirm: 'Confirm',\n i18n_z_ui_modal_cancel: 'Cancel',\n\n // Drawer\n i18n_z_ui_drawer_close: 'Close',\n\n // Upload\n i18n_z_ui_upload_dragDrop: 'Drag & drop files here',\n i18n_z_ui_upload_or: 'or',\n i18n_z_ui_upload_browse: 'Browse files',\n i18n_z_ui_upload_uploading: 'Uploading...',\n i18n_z_ui_upload_uploaded: 'Uploaded',\n i18n_z_ui_upload_failed: 'Upload failed',\n i18n_z_ui_upload_remove: 'Remove',\n i18n_z_ui_upload_maxSize: 'Maximum file size: {size}',\n i18n_z_ui_upload_invalidType: 'Invalid file type',\n\n // Pagination\n i18n_z_ui_pagination_first: 'First',\n i18n_z_ui_pagination_last: 'Last',\n i18n_z_ui_pagination_next: 'Next',\n i18n_z_ui_pagination_previous: 'Previous',\n i18n_z_ui_pagination_page: 'Page',\n i18n_z_ui_pagination_of: 'of',\n\n // Common\n i18n_z_ui_common_loading: 'Loading...',\n i18n_z_ui_common_save: 'Save',\n i18n_z_ui_common_cancel: 'Cancel',\n i18n_z_ui_common_confirm: 'Confirm',\n i18n_z_ui_common_delete: 'Delete',\n i18n_z_ui_common_edit: 'Edit',\n i18n_z_ui_common_add: 'Add',\n i18n_z_ui_common_search: 'Search',\n i18n_z_ui_common_clear: 'Clear',\n i18n_z_ui_common_reset: 'Reset',\n i18n_z_ui_common_apply: 'Apply',\n i18n_z_ui_common_yes: 'Yes',\n i18n_z_ui_common_no: 'No',\n i18n_z_ui_common_ok: 'OK',\n i18n_z_ui_common_error: 'Error',\n i18n_z_ui_common_success: 'Success',\n i18n_z_ui_common_warning: 'Warning',\n i18n_z_ui_common_info: 'Info',\n\n // Toast\n i18n_z_ui_toast_close: 'Close',\n};\n","/**\n * Z-UI Vietnamese translations\n */\nexport const Z_UI_VI_TRANSLATIONS: Record<string, string> = {\n // Table\n i18n_z_ui_table_noData: 'Không có dữ liệu',\n i18n_z_ui_table_loading: 'Đang tải...',\n i18n_z_ui_table_search: 'Tìm kiếm...',\n i18n_z_ui_table_settings: 'Cài đặt',\n i18n_z_ui_table_columns: 'Cột',\n i18n_z_ui_table_showAll: 'Hiện tất cả',\n i18n_z_ui_table_hideAll: 'Ẩn tất cả',\n i18n_z_ui_table_pinLeft: 'Ghim trái',\n i18n_z_ui_table_pinRight: 'Ghim phải',\n i18n_z_ui_table_unpin: 'Bỏ ghim',\n i18n_z_ui_table_sortAsc: 'Sắp xếp tăng dần',\n i18n_z_ui_table_sortDesc: 'Sắp xếp giảm dần',\n i18n_z_ui_table_clearSort: 'Bỏ sắp xếp',\n i18n_z_ui_table_filter: 'Lọc',\n i18n_z_ui_table_clearFilter: 'Xóa bộ lọc',\n i18n_z_ui_table_rowsPerPage: 'Số dòng mỗi trang',\n i18n_z_ui_table_of: 'của',\n i18n_z_ui_table_selected: 'đã chọn',\n i18n_z_ui_table_expandAll: 'Mở rộng tất cả',\n i18n_z_ui_table_collapseAll: 'Thu gọn tất cả',\n\n // Calendar\n i18n_z_ui_calendar_today: 'Hôm nay',\n i18n_z_ui_calendar_clear: 'Xóa',\n i18n_z_ui_calendar_ok: 'Đồng ý',\n i18n_z_ui_calendar_cancel: 'Hủy',\n i18n_z_ui_calendar_startDate: 'Ngày bắt đầu',\n i18n_z_ui_calendar_endDate: 'Ngày kết thúc',\n i18n_z_ui_calendar_selectDate: 'Chọn ngày',\n i18n_z_ui_calendar_selectTime: 'Chọn giờ',\n i18n_z_ui_calendar_thisWeek: 'Tuần này',\n i18n_z_ui_calendar_lastWeek: 'Tuần trước',\n i18n_z_ui_calendar_thisMonth: 'Tháng này',\n i18n_z_ui_calendar_lastMonth: 'Tháng trước',\n i18n_z_ui_calendar_last7Days: '7 ngày qua',\n i18n_z_ui_calendar_last30Days: '30 ngày qua',\n i18n_z_ui_calendar_last90Days: '90 ngày qua',\n i18n_z_ui_calendar_thisYear: 'Năm nay',\n i18n_z_ui_calendar_lastYear: 'Năm trước',\n\n // Input\n i18n_z_ui_input_required: 'Trường này là bắt buộc',\n i18n_z_ui_input_minLength: 'Tối thiểu {min} ký tự',\n i18n_z_ui_input_maxLength: 'Tối đa {max} ký tự',\n i18n_z_ui_input_email: 'Định dạng email không hợp lệ',\n i18n_z_ui_input_pattern: 'Định dạng không hợp lệ',\n i18n_z_ui_input_min: 'Giá trị tối thiểu là {min}',\n i18n_z_ui_input_max: 'Giá trị tối đa là {max}',\n\n // Select\n i18n_z_ui_select_placeholder: 'Chọn...',\n i18n_z_ui_select_noOptions: 'Không có tùy chọn',\n i18n_z_ui_select_noResults: 'Không tìm thấy kết quả',\n i18n_z_ui_select_loading: 'Đang tải...',\n i18n_z_ui_select_selectAll: 'Chọn tất cả',\n i18n_z_ui_select_clearAll: 'Bỏ chọn tất cả',\n i18n_z_ui_select_selected: 'Đã chọn {count}',\n\n // Modal\n i18n_z_ui_modal_close: 'Đóng',\n i18n_z_ui_modal_confirm: 'Xác nhận',\n i18n_z_ui_modal_cancel: 'Hủy',\n\n // Drawer\n i18n_z_ui_drawer_close: 'Đóng',\n\n // Upload\n i18n_z_ui_upload_dragDrop: 'Kéo thả file vào đây',\n i18n_z_ui_upload_or: 'hoặc',\n i18n_z_ui_upload_browse: 'Chọn file',\n i18n_z_ui_upload_uploading: 'Đang tải lên...',\n i18n_z_ui_upload_uploaded: 'Đã tải lên',\n i18n_z_ui_upload_failed: 'Tải lên thất bại',\n i18n_z_ui_upload_remove: 'Xóa',\n i18n_z_ui_upload_maxSize: 'Kích thước tối đa: {size}',\n i18n_z_ui_upload_invalidType: 'Loại file không hợp lệ',\n\n // Pagination\n i18n_z_ui_pagination_first: 'Đầu',\n i18n_z_ui_pagination_last: 'Cuối',\n i18n_z_ui_pagination_next: 'Tiếp',\n i18n_z_ui_pagination_previous: 'Trước',\n i18n_z_ui_pagination_page: 'Trang',\n i18n_z_ui_pagination_of: 'của',\n\n // Common\n i18n_z_ui_common_loading: 'Đang tải...',\n i18n_z_ui_common_save: 'Lưu',\n i18n_z_ui_common_cancel: 'Hủy',\n i18n_z_ui_common_confirm: 'Xác nhận',\n i18n_z_ui_common_delete: 'Xóa',\n i18n_z_ui_common_edit: 'Sửa',\n i18n_z_ui_common_add: 'Thêm',\n i18n_z_ui_common_search: 'Tìm kiếm',\n i18n_z_ui_common_clear: 'Xóa',\n i18n_z_ui_common_reset: 'Đặt lại',\n i18n_z_ui_common_apply: 'Áp dụng',\n i18n_z_ui_common_yes: 'Có',\n i18n_z_ui_common_no: 'Không',\n i18n_z_ui_common_ok: 'OK',\n i18n_z_ui_common_error: 'Lỗi',\n i18n_z_ui_common_success: 'Thành công',\n i18n_z_ui_common_warning: 'Cảnh báo',\n i18n_z_ui_common_info: 'Thông tin',\n\n // Toast\n i18n_z_ui_toast_close: 'Đóng',\n};\n","/**\n * Z-UI Internationalization\n *\n * This module provides default translations for all Z-UI components.\n * Users can override any translation by providing their own values.\n *\n * Key format: i18n_z_ui_{component}_{key}\n * Example: i18n_z_ui_table_noData\n */\n\nimport { Z_UI_EN_TRANSLATIONS } from './en';\nimport { Z_UI_VI_TRANSLATIONS } from './vi';\n\nexport type ZUILanguage = 'en' | 'vi' | string;\n\nexport interface ZUITranslations {\n [key: string]: string;\n}\n\nexport interface ZUITranslationSet {\n en: ZUITranslations;\n vi: ZUITranslations;\n [lang: string]: ZUITranslations;\n}\n\n/**\n * Default translations for Z-UI components\n */\nexport const Z_UI_TRANSLATIONS: ZUITranslationSet = {\n en: Z_UI_EN_TRANSLATIONS,\n vi: Z_UI_VI_TRANSLATIONS,\n};\n\n/**\n * Get translations for a specific language\n * Falls back to English if language not found\n */\nexport function getZUITranslations(lang: ZUILanguage): ZUITranslations {\n return Z_UI_TRANSLATIONS[lang] ?? Z_UI_TRANSLATIONS['en'];\n}\n\n/**\n * Merge custom translations with Z-UI defaults\n * Custom translations take precedence\n */\nexport function mergeTranslations(lang: ZUILanguage, customTranslations?: ZUITranslations): ZUITranslations {\n const defaults = getZUITranslations(lang);\n if (!customTranslations) {\n return defaults;\n }\n return { ...defaults, ...customTranslations };\n}\n\n/**\n * Get all Z-UI translation keys\n * Useful for documentation or tooling\n */\nexport function getZUITranslationKeys(): string[] {\n return Object.keys(Z_UI_EN_TRANSLATIONS);\n}\n\n// Re-export individual translations\nexport { Z_UI_EN_TRANSLATIONS } from './en';\nexport { Z_UI_VI_TRANSLATIONS } from './vi';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;AAEG;AACI,MAAM,oBAAoB,GAA2B;;AAE1D,IAAA,sBAAsB,EAAE,mBAAmB;AAC3C,IAAA,uBAAuB,EAAE,YAAY;AACrC,IAAA,sBAAs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AiB,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC;AAC3D;AAEA;;;AAGG;AACG,SAAU,iBAAiB,CAAC,IAAiB,EAAE,kBAAoC,EAAA;AACvF,IAAA,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,CAAC;IACzC,IAAI,CAAC,kBAAkB,EAAE;AACvB,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,kBAAkB,EAAE;AAC/C;AAEA;;;AAGG;SACa,qBAAqB,GAAA;AACnC,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;AAC1C;;AC3DA;;AAEG;;;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, TemplateRef, inject } from '@angular/core';
|
|
3
|
+
import { zRemoveVietnamese } from '@shival99/z-ui/utils';
|
|
4
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
5
|
+
import DOMPurify from 'dompurify';
|
|
6
|
+
|
|
7
|
+
class ZCapitalizePipe {
|
|
8
|
+
transform(value, type = 'first') {
|
|
9
|
+
if (!value) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
switch (type) {
|
|
13
|
+
case 'all':
|
|
14
|
+
return value.toUpperCase();
|
|
15
|
+
case 'sentence':
|
|
16
|
+
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
17
|
+
case 'first':
|
|
18
|
+
default:
|
|
19
|
+
return value
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.split(' ')
|
|
22
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
23
|
+
.join(' ');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZCapitalizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
27
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: ZCapitalizePipe, isStandalone: true, name: "zCapitalize" });
|
|
28
|
+
}
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZCapitalizePipe, decorators: [{
|
|
30
|
+
type: Pipe,
|
|
31
|
+
args: [{
|
|
32
|
+
name: 'zCapitalize',
|
|
33
|
+
standalone: true,
|
|
34
|
+
}]
|
|
35
|
+
}] });
|
|
36
|
+
|
|
37
|
+
class ZContentTypePipe {
|
|
38
|
+
transform(value) {
|
|
39
|
+
if (!value) {
|
|
40
|
+
return 'string';
|
|
41
|
+
}
|
|
42
|
+
if (value instanceof TemplateRef) {
|
|
43
|
+
return 'template';
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === 'string' && this._containsHtml(value)) {
|
|
46
|
+
return 'html';
|
|
47
|
+
}
|
|
48
|
+
return 'string';
|
|
49
|
+
}
|
|
50
|
+
_containsHtml(str) {
|
|
51
|
+
const htmlTagPattern = /<[a-z][\s\S]*>/i;
|
|
52
|
+
return htmlTagPattern.test(str);
|
|
53
|
+
}
|
|
54
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZContentTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
55
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: ZContentTypePipe, isStandalone: true, name: "zContentType" });
|
|
56
|
+
}
|
|
57
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZContentTypePipe, decorators: [{
|
|
58
|
+
type: Pipe,
|
|
59
|
+
args: [{
|
|
60
|
+
name: 'zContentType',
|
|
61
|
+
standalone: true,
|
|
62
|
+
}]
|
|
63
|
+
}] });
|
|
64
|
+
|
|
65
|
+
class ZHighlightPipe {
|
|
66
|
+
transform(value, searchText, klass = 'text-primary') {
|
|
67
|
+
if (!searchText?.trim() || !value) {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
const normalizedValue = zRemoveVietnamese(value.toLowerCase());
|
|
71
|
+
const normalizedSearch = zRemoveVietnamese(searchText.toLowerCase().trim());
|
|
72
|
+
const matchIndex = normalizedValue.indexOf(normalizedSearch);
|
|
73
|
+
if (matchIndex === -1) {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
const before = value.substring(0, matchIndex);
|
|
77
|
+
const match = value.substring(matchIndex, matchIndex + searchText.length);
|
|
78
|
+
const after = value.substring(matchIndex + searchText.length);
|
|
79
|
+
return `${before}<span class="${klass}">${match}</span>${after}`;
|
|
80
|
+
}
|
|
81
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZHighlightPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
82
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: ZHighlightPipe, isStandalone: true, name: "zHighlight" });
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZHighlightPipe, decorators: [{
|
|
85
|
+
type: Pipe,
|
|
86
|
+
args: [{
|
|
87
|
+
name: 'zHighlight',
|
|
88
|
+
standalone: true,
|
|
89
|
+
}]
|
|
90
|
+
}] });
|
|
91
|
+
|
|
92
|
+
class ZSafeHtmlPipe {
|
|
93
|
+
_sanitizer = inject(DomSanitizer);
|
|
94
|
+
transform(value) {
|
|
95
|
+
if (!value) {
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
return this._sanitizer.bypassSecurityTrustHtml(DOMPurify.sanitize(value));
|
|
99
|
+
}
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZSafeHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
101
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: ZSafeHtmlPipe, isStandalone: true, name: "zSafeHtml" });
|
|
102
|
+
}
|
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZSafeHtmlPipe, decorators: [{
|
|
104
|
+
type: Pipe,
|
|
105
|
+
args: [{
|
|
106
|
+
name: 'zSafeHtml',
|
|
107
|
+
standalone: true,
|
|
108
|
+
}]
|
|
109
|
+
}] });
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Generated bundle index. Do not edit.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
export { ZCapitalizePipe, ZContentTypePipe, ZHighlightPipe, ZSafeHtmlPipe };
|
|
116
|
+
//# sourceMappingURL=shival99-z-ui-pipes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shival99-z-ui-pipes.mjs","sources":["../../../../libs/core-ui/pipes/z-capitalize.pipe.ts","../../../../libs/core-ui/pipes/z-content-type.pipe.ts","../../../../libs/core-ui/pipes/z-highlight.pipe.ts","../../../../libs/core-ui/pipes/z-safe-html.pipe.ts","../../../../libs/core-ui/pipes/shival99-z-ui-pipes.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport type { ZCapitalizeType } from './types/z-capitalize.types';\n\n@Pipe({\n name: 'zCapitalize',\n standalone: true,\n})\nexport class ZCapitalizePipe implements PipeTransform {\n public transform(value: string | null | undefined, type: ZCapitalizeType = 'first'): string {\n if (!value) {\n return '';\n }\n\n switch (type) {\n case 'all':\n return value.toUpperCase();\n\n case 'sentence':\n return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();\n\n case 'first':\n default:\n return value\n .toLowerCase()\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n }\n}\n","import { Pipe, PipeTransform, TemplateRef } from '@angular/core';\nimport { Z_CONTENT_TYPE } from './types';\n\n@Pipe({\n name: 'zContentType',\n standalone: true,\n})\nexport class ZContentTypePipe implements PipeTransform {\n transform(value: string | TemplateRef<unknown> | null | undefined): Z_CONTENT_TYPE {\n if (!value) {\n return 'string';\n }\n\n if (value instanceof TemplateRef) {\n return 'template';\n }\n\n if (typeof value === 'string' && this._containsHtml(value)) {\n return 'html';\n }\n\n return 'string';\n }\n\n private _containsHtml(str: string): boolean {\n const htmlTagPattern = /<[a-z][\\s\\S]*>/i;\n return htmlTagPattern.test(str);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { zRemoveVietnamese } from '@shival99/z-ui/utils';\n\n@Pipe({\n name: 'zHighlight',\n standalone: true,\n})\nexport class ZHighlightPipe implements PipeTransform {\n transform(value: string, searchText: string, klass = 'text-primary'): string {\n if (!searchText?.trim() || !value) {\n return value;\n }\n\n const normalizedValue = zRemoveVietnamese(value.toLowerCase());\n const normalizedSearch = zRemoveVietnamese(searchText.toLowerCase().trim());\n\n const matchIndex = normalizedValue.indexOf(normalizedSearch);\n if (matchIndex === -1) {\n return value;\n }\n\n const before = value.substring(0, matchIndex);\n const match = value.substring(matchIndex, matchIndex + searchText.length);\n const after = value.substring(matchIndex + searchText.length);\n\n return `${before}<span class=\"${klass}\">${match}</span>${after}`;\n }\n}\n","import { inject, Pipe, type PipeTransform } from '@angular/core';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\nimport DOMPurify from 'dompurify';\n\n@Pipe({\n name: 'zSafeHtml',\n standalone: true,\n})\nexport class ZSafeHtmlPipe implements PipeTransform {\n private _sanitizer = inject(DomSanitizer);\n\n transform(value: string | null | undefined): SafeHtml {\n if (!value) {\n return '';\n }\n\n return this._sanitizer.bypassSecurityTrustHtml(DOMPurify.sanitize(value));\n }\n}\n","/**\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1,203 @@
|
|
|
1
|
+
import { InjectionToken, makeEnvironmentProviders, inject, APP_INITIALIZER } from '@angular/core';
|
|
2
|
+
import { ZIndexDbService, ZCacheService } from '@shival99/z-ui/services';
|
|
3
|
+
import { provideEnvironmentNgxMask } from 'ngx-mask';
|
|
4
|
+
import { provideScrollbarOptions } from 'ngx-scrollbar';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
import { TranslateService, provideTranslateService, TranslateLoader } from '@ngx-translate/core';
|
|
7
|
+
import { of, forkJoin, map } from 'rxjs';
|
|
8
|
+
import { catchError } from 'rxjs/operators';
|
|
9
|
+
import { Z_UI_TRANSLATIONS } from '@shival99/z-ui/i18n';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Z-IndexDB Provider
|
|
13
|
+
* Provides IndexDB service with multi-store configuration
|
|
14
|
+
*/
|
|
15
|
+
/** Injection token for ZIndexDbService */
|
|
16
|
+
const Z_INDEXDB_SERVICE = new InjectionToken('ZIndexDbService');
|
|
17
|
+
/**
|
|
18
|
+
* Provide Z-IndexDB service with configuration
|
|
19
|
+
* @param config - IndexDB configuration with multi-store support
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // In app.config.ts
|
|
24
|
+
* export const appConfig: ApplicationConfig = {
|
|
25
|
+
* providers: [
|
|
26
|
+
* provideZIndexDb({
|
|
27
|
+
* dbName: 'MyApp',
|
|
28
|
+
* version: 1,
|
|
29
|
+
* stores: [
|
|
30
|
+
* { name: 'cache', encrypt: true },
|
|
31
|
+
* { name: 'userData', encrypt: true, protectedKeys: ['profile'] },
|
|
32
|
+
* { name: 'settings', encrypt: false },
|
|
33
|
+
* ],
|
|
34
|
+
* defaultStore: 'cache',
|
|
35
|
+
* protectedKeys: ['token'],
|
|
36
|
+
* }),
|
|
37
|
+
* ],
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
function provideZIndexDb(config = {}) {
|
|
42
|
+
return makeEnvironmentProviders([
|
|
43
|
+
{
|
|
44
|
+
provide: Z_INDEXDB_SERVICE,
|
|
45
|
+
useFactory: () => new ZIndexDbService(config),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
provide: ZIndexDbService,
|
|
49
|
+
useExisting: Z_INDEXDB_SERVICE,
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Z-NgxMask Provider
|
|
56
|
+
* Provides ngx-mask configuration based on locale
|
|
57
|
+
*/
|
|
58
|
+
const LANG_CACHE_KEY = 'Z_LANGUAGE';
|
|
59
|
+
/**
|
|
60
|
+
* Get locale-specific mask configuration
|
|
61
|
+
*/
|
|
62
|
+
function getMaskConfig(lang, config = {}) {
|
|
63
|
+
const isVietnamese = lang === 'vi';
|
|
64
|
+
return {
|
|
65
|
+
validation: config.validation ?? true,
|
|
66
|
+
thousandSeparator: isVietnamese ? ',' : '.',
|
|
67
|
+
decimalMarker: (isVietnamese ? '.' : ','),
|
|
68
|
+
allowNegativeNumbers: config.allowNegativeNumbers ?? true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Provide Z-NgxMask with locale-aware configuration
|
|
73
|
+
* @param config - Mask configuration
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* // In app.config.ts
|
|
78
|
+
* export const appConfig: ApplicationConfig = {
|
|
79
|
+
* providers: [
|
|
80
|
+
* provideZNgxMask({ lang: 'vi' }),
|
|
81
|
+
* ],
|
|
82
|
+
* };
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
function provideZNgxMask(config = {}) {
|
|
86
|
+
const savedLang = typeof window !== 'undefined' ? ZCacheService.get(LANG_CACHE_KEY) : null;
|
|
87
|
+
const lang = config.lang ?? savedLang ?? 'vi';
|
|
88
|
+
const maskConfig = getMaskConfig(lang, config);
|
|
89
|
+
return makeEnvironmentProviders([provideEnvironmentNgxMask(maskConfig)]);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Provides global scrollbar options for ngx-scrollbar
|
|
94
|
+
* Use this in app.config.ts: providers: [provideZScrollbar()]
|
|
95
|
+
*/
|
|
96
|
+
function provideZScrollbar() {
|
|
97
|
+
return makeEnvironmentProviders([
|
|
98
|
+
provideScrollbarOptions({
|
|
99
|
+
visibility: 'hover',
|
|
100
|
+
appearance: 'compact',
|
|
101
|
+
withButtons: false,
|
|
102
|
+
sensorThrottleTime: 200,
|
|
103
|
+
}),
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* eslint-disable @stylistic/indent */
|
|
108
|
+
/**
|
|
109
|
+
* Custom loader - merges Z-UI translations with user translations
|
|
110
|
+
* Priority: Z-UI defaults < file overrides < inline overrides < user translations
|
|
111
|
+
*/
|
|
112
|
+
class ZTranslateHttpLoader {
|
|
113
|
+
_http;
|
|
114
|
+
_prefix;
|
|
115
|
+
_suffix;
|
|
116
|
+
_includeZUI;
|
|
117
|
+
_zuiOverridePath;
|
|
118
|
+
_customZUI;
|
|
119
|
+
constructor(_http, _prefix, _suffix, _includeZUI, _zuiOverridePath, _customZUI) {
|
|
120
|
+
this._http = _http;
|
|
121
|
+
this._prefix = _prefix;
|
|
122
|
+
this._suffix = _suffix;
|
|
123
|
+
this._includeZUI = _includeZUI;
|
|
124
|
+
this._zuiOverridePath = _zuiOverridePath;
|
|
125
|
+
this._customZUI = _customZUI;
|
|
126
|
+
}
|
|
127
|
+
getTranslation(lang) {
|
|
128
|
+
const userTranslations$ = this._http
|
|
129
|
+
.get(`${this._prefix}${lang}${this._suffix}`)
|
|
130
|
+
.pipe(catchError(() => of({})));
|
|
131
|
+
if (!this._includeZUI) {
|
|
132
|
+
return userTranslations$;
|
|
133
|
+
}
|
|
134
|
+
const zuiDefaults = Z_UI_TRANSLATIONS[lang] ?? Z_UI_TRANSLATIONS['en'] ?? {};
|
|
135
|
+
const zuiFileOverrides$ = this._zuiOverridePath
|
|
136
|
+
? this._http
|
|
137
|
+
.get(`${this._zuiOverridePath}${lang}${this._suffix}`)
|
|
138
|
+
.pipe(catchError(() => of({})))
|
|
139
|
+
: of({});
|
|
140
|
+
const inlineOverrides = this._customZUI?.[lang] ?? {};
|
|
141
|
+
return forkJoin([of(zuiDefaults), zuiFileOverrides$, userTranslations$]).pipe(map(([defaults, fileOverrides, user]) => ({
|
|
142
|
+
...defaults,
|
|
143
|
+
...fileOverrides,
|
|
144
|
+
...inlineOverrides,
|
|
145
|
+
...user,
|
|
146
|
+
})));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function zCreateTranslateLoader(http, path = './assets/i18n/', extension = '.json', includeZUI = true, zuiOverridePath, customZUI) {
|
|
150
|
+
return new ZTranslateHttpLoader(http, path, extension, includeZUI, zuiOverridePath, customZUI);
|
|
151
|
+
}
|
|
152
|
+
function initializeTranslate(defaultLang) {
|
|
153
|
+
return () => {
|
|
154
|
+
const translate = inject(TranslateService);
|
|
155
|
+
translate.setDefaultLang(defaultLang);
|
|
156
|
+
return translate.use(defaultLang).toPromise();
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Provide Z-Translate service
|
|
161
|
+
* Z-UI translations are auto-included by default
|
|
162
|
+
*/
|
|
163
|
+
function provideZTranslate(config = {}) {
|
|
164
|
+
const { defaultLang = 'vi', translationPath = './assets/i18n/', fileExtension = '.json', includeZUITranslations = true, zuiOverridePath, customZUITranslations, } = config;
|
|
165
|
+
return makeEnvironmentProviders([
|
|
166
|
+
provideTranslateService({
|
|
167
|
+
defaultLanguage: defaultLang,
|
|
168
|
+
loader: {
|
|
169
|
+
provide: TranslateLoader,
|
|
170
|
+
useFactory: (http) => zCreateTranslateLoader(http, translationPath, fileExtension, includeZUITranslations, zuiOverridePath, customZUITranslations),
|
|
171
|
+
deps: [HttpClient],
|
|
172
|
+
},
|
|
173
|
+
}),
|
|
174
|
+
{
|
|
175
|
+
provide: APP_INITIALIZER,
|
|
176
|
+
useFactory: () => initializeTranslate(defaultLang),
|
|
177
|
+
multi: true,
|
|
178
|
+
},
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Z-NgxMask Provider Types
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Z-Translate Provider Types
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Providers types index
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Providers index
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Generated bundle index. Do not edit.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
export { Z_INDEXDB_SERVICE, provideZIndexDb, provideZNgxMask, provideZScrollbar, provideZTranslate, zCreateTranslateLoader };
|
|
203
|
+
//# sourceMappingURL=shival99-z-ui-providers.mjs.map
|