@gemafajarramadhan/dynamic-ui 1.1.23 → 1.1.25
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/README.md +26 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -547,6 +547,7 @@ Setelah library di-import, dua custom element berikut akan terdaftar secara glob
|
|
|
547
547
|
| ------------------------- | ----------------------------------------------------------- |
|
|
548
548
|
| `<micro-dynamic-form>` | Render form dinamis berdasarkan JSON config `config` prop. |
|
|
549
549
|
| `<micro-dynamic-datatable>` | Render tabel dinamis berdasarkan JSON config `config` prop. |
|
|
550
|
+
| `<micro-data-table>` | Render Data Table base component secara independen. Menerima props seperti `columns`, `data`, `apiUrl`. |
|
|
550
551
|
|
|
551
552
|
#### Properties (set via JavaScript/DOM)
|
|
552
553
|
|
|
@@ -607,8 +608,11 @@ Cara paling sederhana. Import library dari bundler, lalu gunakan custom element
|
|
|
607
608
|
<!-- Dynamic Form -->
|
|
608
609
|
<micro-dynamic-form id="myForm"></micro-dynamic-form>
|
|
609
610
|
|
|
610
|
-
<!-- Dynamic DataTable -->
|
|
611
|
-
<micro-dynamic-datatable id="
|
|
611
|
+
<!-- Dynamic DataTable (AutoLayout version) -->
|
|
612
|
+
<micro-dynamic-datatable id="myAutoTable"></micro-dynamic-datatable>
|
|
613
|
+
|
|
614
|
+
<!-- Base DataTable (Stand-alone version) -->
|
|
615
|
+
<micro-data-table id="myBaseTable"></micro-data-table>
|
|
612
616
|
|
|
613
617
|
<!-- Import library (registrasi Web Components otomatis) -->
|
|
614
618
|
<script type="module">
|
|
@@ -653,8 +657,8 @@ Cara paling sederhana. Import library dari bundler, lalu gunakan custom element
|
|
|
653
657
|
})
|
|
654
658
|
|
|
655
659
|
// --- Setup DataTable ---
|
|
656
|
-
const
|
|
657
|
-
|
|
660
|
+
const autoTable = document.querySelector('#myAutoTable')
|
|
661
|
+
autoTable.config = {
|
|
658
662
|
titleID: 'Daftar User',
|
|
659
663
|
headers: [
|
|
660
664
|
{ text: 'Nama', value: 'name' },
|
|
@@ -662,9 +666,26 @@ Cara paling sederhana. Import library dari bundler, lalu gunakan custom element
|
|
|
662
666
|
],
|
|
663
667
|
}
|
|
664
668
|
|
|
665
|
-
|
|
669
|
+
autoTable.addEventListener('action', (e) => {
|
|
666
670
|
console.log('Action:', e.detail)
|
|
667
671
|
})
|
|
672
|
+
|
|
673
|
+
// --- Setup Base MicroDataTable ---
|
|
674
|
+
const baseTable = document.querySelector('#myBaseTable')
|
|
675
|
+
// Untuk MicroDataTable (base component), Anda bisa mengirimkan prop langsung:
|
|
676
|
+
baseTable.columns = [
|
|
677
|
+
{ key: 'name', label: 'Nama', sortable: true },
|
|
678
|
+
{ key: 'email', label: 'Email' }
|
|
679
|
+
]
|
|
680
|
+
// Memberikan data secara statis
|
|
681
|
+
baseTable.data = [
|
|
682
|
+
{ name: 'John Doe', email: 'john@example.com' },
|
|
683
|
+
{ name: 'Jane Smith', email: 'jane@example.com' }
|
|
684
|
+
]
|
|
685
|
+
|
|
686
|
+
// Atau bisa diset melalui API:
|
|
687
|
+
// baseTable.apiUrl = '/api/users'
|
|
688
|
+
// baseTable.apiMethod = 'GET'
|
|
668
689
|
</script>
|
|
669
690
|
|
|
670
691
|
</body>
|
package/package.json
CHANGED