@initsolusidigital/worksuite-core 0.2.0 → 0.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@initsolusidigital/worksuite-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "API client, session store, i18n setup and shared composables for the Init Worksuite web apps, shipped as raw source",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@iconify-icons/simple-icons": "^1.2.74",
|
|
24
|
-
"@initsolusidigital/worksuite-ui": ">=0.
|
|
24
|
+
"@initsolusidigital/worksuite-ui": ">=0.3.0 <1.0.0",
|
|
25
25
|
"@lucide/vue": "^1.21.0",
|
|
26
26
|
"@vuepic/vue-datepicker": "^14.0.0",
|
|
27
27
|
"@vueform/multiselect": "^2.6.11",
|
|
@@ -68,7 +68,7 @@ onUnmounted(() => { if (!props.navbar) document.removeEventListener('click', han
|
|
|
68
68
|
:class="[
|
|
69
69
|
compact
|
|
70
70
|
? 'hover:text-blue-600 dark:hover:text-blue-400'
|
|
71
|
-
: 'w-9 h-9 hover:bg-gray-100 dark:hover:bg-gray-700
|
|
71
|
+
: `${navbar ? 'w-8 h-8' : 'w-9 h-9'} hover:bg-gray-100 dark:hover:bg-gray-700`,
|
|
72
72
|
isActive
|
|
73
73
|
? (compact ? 'text-blue-600 dark:text-blue-400' : 'bg-gray-100 dark:bg-gray-700 text-blue-600 dark:text-blue-400')
|
|
74
74
|
: 'text-gray-500 dark:text-gray-400',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref } from 'vue'
|
|
2
2
|
import { useI18n } from 'vue-i18n'
|
|
3
|
-
import { LayoutGrid, HeartHandshake, IdCard, Wallet, Boxes, FolderArchive, ShoppingCart, SquareKanban, UserRound, MessageCircle, Store } from '@lucide/vue'
|
|
3
|
+
import { LayoutGrid, HeartHandshake, IdCard, Wallet, Boxes, FolderArchive, ShoppingCart, SquareKanban, UserRound, MessageCircle, Store, Megaphone, CalendarCheck, GraduationCap, Globe } from '@lucide/vue'
|
|
4
4
|
import { appsApi } from '../api/endpoints/apps.js'
|
|
5
5
|
import { appAccess, isOwnAppLocked, sortByOpenable } from '../utils/appStatus.js'
|
|
6
6
|
import { showMaintenance, whenRecovered } from '../api/maintenance.js'
|
|
@@ -38,11 +38,13 @@ const APP_ICON = {
|
|
|
38
38
|
hub: LayoutGrid, crm: HeartHandshake, hris: IdCard, finance: Wallet,
|
|
39
39
|
inventory: Boxes, dms: FolderArchive, purchasing: ShoppingCart, project: SquareKanban,
|
|
40
40
|
clientzone: UserRound, chat: MessageCircle, pos: Store,
|
|
41
|
+
marketing: Megaphone, booking: CalendarCheck, academic: GraduationCap, sites: Globe,
|
|
41
42
|
}
|
|
42
43
|
const APP_COLOR = {
|
|
43
44
|
hub: 'blue', crm: 'rose', hris: 'purple', finance: 'emerald',
|
|
44
45
|
inventory: 'amber', dms: 'cyan', purchasing: 'orange', project: 'indigo',
|
|
45
46
|
clientzone: 'teal', chat: 'fuchsia', pos: 'lime',
|
|
47
|
+
marketing: 'pink', booking: 'sky', academic: 'violet', sites: 'yellow',
|
|
46
48
|
}
|
|
47
49
|
const COLOR_CLASS = {
|
|
48
50
|
blue: 'bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400',
|
|
@@ -56,6 +58,10 @@ const COLOR_CLASS = {
|
|
|
56
58
|
teal: 'bg-teal-100 dark:bg-teal-900/30 text-teal-600 dark:text-teal-400',
|
|
57
59
|
fuchsia: 'bg-fuchsia-100 dark:bg-fuchsia-900/30 text-fuchsia-600 dark:text-fuchsia-400',
|
|
58
60
|
lime: 'bg-lime-100 dark:bg-lime-900/30 text-lime-600 dark:text-lime-400',
|
|
61
|
+
pink: 'bg-pink-100 dark:bg-pink-900/30 text-pink-600 dark:text-pink-400',
|
|
62
|
+
sky: 'bg-sky-100 dark:bg-sky-900/30 text-sky-600 dark:text-sky-400',
|
|
63
|
+
violet: 'bg-violet-100 dark:bg-violet-900/30 text-violet-600 dark:text-violet-400',
|
|
64
|
+
yellow: 'bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600 dark:text-yellow-400',
|
|
59
65
|
}
|
|
60
66
|
// Aksen border/hover per-warna app (App Launcher): `active` = border + latar tipis utk app yang
|
|
61
67
|
// SEDANG dibuka (dipakai bersama border-dashed); `hover` = tint hover utk app lain. Class literal
|
|
@@ -72,6 +78,10 @@ const COLOR_ACCENT = {
|
|
|
72
78
|
teal: { active: 'border-teal-400 dark:border-teal-500 bg-teal-50/60 dark:bg-teal-900/20', hover: 'hover:bg-teal-50 dark:hover:bg-teal-900/20' },
|
|
73
79
|
fuchsia: { active: 'border-fuchsia-400 dark:border-fuchsia-500 bg-fuchsia-50/60 dark:bg-fuchsia-900/20', hover: 'hover:bg-fuchsia-50 dark:hover:bg-fuchsia-900/20' },
|
|
74
80
|
lime: { active: 'border-lime-400 dark:border-lime-500 bg-lime-50/60 dark:bg-lime-900/20', hover: 'hover:bg-lime-50 dark:hover:bg-lime-900/20' },
|
|
81
|
+
pink: { active: 'border-pink-400 dark:border-pink-500 bg-pink-50/60 dark:bg-pink-900/20', hover: 'hover:bg-pink-50 dark:hover:bg-pink-900/20' },
|
|
82
|
+
sky: { active: 'border-sky-400 dark:border-sky-500 bg-sky-50/60 dark:bg-sky-900/20', hover: 'hover:bg-sky-50 dark:hover:bg-sky-900/20' },
|
|
83
|
+
violet: { active: 'border-violet-400 dark:border-violet-500 bg-violet-50/60 dark:bg-violet-900/20', hover: 'hover:bg-violet-50 dark:hover:bg-violet-900/20' },
|
|
84
|
+
yellow: { active: 'border-yellow-400 dark:border-yellow-500 bg-yellow-50/60 dark:bg-yellow-900/20', hover: 'hover:bg-yellow-50 dark:hover:bg-yellow-900/20' },
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
// State singleton (level modul) — dibagikan semua pemanggil composable.
|
package/src/locales/en.json
CHANGED
|
@@ -219,7 +219,9 @@
|
|
|
219
219
|
"identityGateMissing": "The sign-in gate (worksuite-auth app) is not configured for this environment: set VITE_AUTH_URL in this app's .env file, then restart the dev server.",
|
|
220
220
|
"changeMasked": "edited (the content is not shown in the activity log)",
|
|
221
221
|
"aiBadge": "AI",
|
|
222
|
-
"aiBadgeTitle": "This content was generated by AI — this marker is internal only."
|
|
222
|
+
"aiBadgeTitle": "This content was generated by AI — this marker is internal only.",
|
|
223
|
+
"showPassword": "Show password",
|
|
224
|
+
"hidePassword": "Hide password"
|
|
223
225
|
},
|
|
224
226
|
"notification": {
|
|
225
227
|
"title": "Notifications",
|
package/src/locales/id.json
CHANGED
|
@@ -219,7 +219,9 @@
|
|
|
219
219
|
"identityGateMissing": "Pintu masuk (app worksuite-auth) belum dikonfigurasi untuk lingkungan ini: isi VITE_AUTH_URL di berkas .env app ini, lalu mulai ulang dev server.",
|
|
220
220
|
"changeMasked": "disunting (isinya tidak ditampilkan di log aktivitas)",
|
|
221
221
|
"aiBadge": "AI",
|
|
222
|
-
"aiBadgeTitle": "Konten ini dihasilkan AI — tanda ini hanya tampil di layar internal."
|
|
222
|
+
"aiBadgeTitle": "Konten ini dihasilkan AI — tanda ini hanya tampil di layar internal.",
|
|
223
|
+
"showPassword": "Tampilkan password",
|
|
224
|
+
"hidePassword": "Sembunyikan password"
|
|
223
225
|
},
|
|
224
226
|
"notification": {
|
|
225
227
|
"title": "Notifikasi",
|
package/src/plugins/i18n.js
CHANGED
|
@@ -25,10 +25,40 @@ const i18n = createI18n({
|
|
|
25
25
|
messages: { id, en },
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
// Kamus dirakit dalam tiga lapis dengan urutan tetap: kamus core → kamus paket lain (shell,
|
|
29
|
+
// editor) → kamus app. Tiap pendaftaran merakit ulang seluruh kamus, jadi urutan panggilan
|
|
30
|
+
// `configureWorksuite()` dan `configure*()` paket lain tak menentukan siapa yang menang;
|
|
31
|
+
// `mergeLocaleMessage` saja menang-terakhir, dan kamus paket yang terdaftar sesudah kamus app
|
|
32
|
+
// akan diam-diam menimpa kalimat app.
|
|
33
|
+
const base = { id, en }
|
|
34
|
+
const packageLayers = new Map()
|
|
35
|
+
let appLayer = {}
|
|
36
|
+
|
|
37
|
+
const isObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v)
|
|
38
|
+
function deepMerge(target, source) {
|
|
39
|
+
for (const [k, v] of Object.entries(source ?? {})) {
|
|
40
|
+
target[k] = isObject(v) && isObject(target[k]) ? deepMerge({ ...target[k] }, v) : isObject(v) ? deepMerge({}, v) : v
|
|
41
|
+
}
|
|
42
|
+
return target
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function rebuild() {
|
|
46
|
+
const layers = [base, ...packageLayers.values(), appLayer]
|
|
47
|
+
const locales = new Set(layers.flatMap((l) => Object.keys(l)))
|
|
48
|
+
for (const locale of locales) {
|
|
49
|
+
i18n.global.setLocaleMessage(locale, layers.reduce((acc, l) => deepMerge(acc, l[locale]), {}))
|
|
31
50
|
}
|
|
32
51
|
}
|
|
33
52
|
|
|
53
|
+
/** Kamus milik paket kit lain, dirakit di antara kamus core dan kamus app. */
|
|
54
|
+
export function registerPackageMessages(name, messages) {
|
|
55
|
+
packageLayers.set(name, messages)
|
|
56
|
+
rebuild()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function mergeAppMessages(messages) {
|
|
60
|
+
appLayer = messages
|
|
61
|
+
rebuild()
|
|
62
|
+
}
|
|
63
|
+
|
|
34
64
|
export default i18n
|