@react-pakistan/util-functions 1.25.90 → 2.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/README.md +74 -315
- package/constants/api-methods.d.ts +3 -1
- package/constants/api-methods.js +1 -15
- package/constants/cache-time.d.ts +7 -5
- package/constants/cache-time.js +1 -8
- package/constants/countries-timezones.d.ts +4 -2
- package/constants/countries-timezones.js +1 -1411
- package/constants/currencies.d.ts +4 -2
- package/constants/currencies.js +1 -1076
- package/constants/dial-codes.d.ts +5 -3
- package/constants/dial-codes.js +1 -1216
- package/constants/layout-direction.d.ts +3 -1
- package/constants/layout-direction.js +1 -8
- package/constants/react-pakistan-meta.d.ts +4 -2
- package/constants/react-pakistan-meta.js +1 -35
- package/constants/react-pakistan.d.ts +5 -3
- package/constants/react-pakistan.js +12 -104
- package/constants/select-value-delimiter.d.ts +3 -1
- package/constants/select-value-delimiter.js +1 -13
- package/constants/social-media-colors.d.ts +3 -1
- package/constants/social-media-colors.js +1 -42
- package/constants/social-media-sizes.d.ts +6 -4
- package/constants/social-media-sizes.js +1 -327
- package/constants/user-roles.d.ts +3 -1
- package/constants/user-roles.js +1 -9
- package/edu-pilot-pro/types/academics.d.ts +2 -266
- package/edu-pilot-pro/types/academics.js +1 -9
- package/edu-pilot-pro/types/admission.d.ts +803 -10
- package/edu-pilot-pro/types/admission.js +1 -7
- package/edu-pilot-pro/types/communication.d.ts +2 -165
- package/edu-pilot-pro/types/communication.js +1 -8
- package/edu-pilot-pro/types/enums.d.ts +30 -28
- package/edu-pilot-pro/types/enums.js +1 -445
- package/edu-pilot-pro/types/finance.d.ts +2 -128
- package/edu-pilot-pro/types/finance.js +1 -8
- package/edu-pilot-pro/types/index.d.ts +2 -12
- package/edu-pilot-pro/types/index.js +1 -28
- package/edu-pilot-pro/types/user-management.d.ts +2 -236
- package/edu-pilot-pro/types/user-management.js +1 -8
- package/factory/generic-component-factory.d.ts +12 -9
- package/factory/generic-component-factory.js +1 -131
- package/factory/generic-module-factory.d.ts +14 -10
- package/factory/generic-module-factory.js +1 -190
- package/general/basic-get.d.ts +8 -1
- package/general/basic-get.js +1 -83
- package/general/basic-post.d.ts +8 -1
- package/general/basic-post.js +1 -70
- package/general/calculate-pages.d.ts +9 -1
- package/general/calculate-pages.js +1 -7
- package/general/camel-to-sentence-case.d.ts +3 -1
- package/general/camel-to-sentence-case.js +1 -20
- package/general/check-even-odd-length.d.ts +3 -1
- package/general/check-even-odd-length.js +1 -17
- package/general/clear-cache.d.ts +7 -2
- package/general/clear-cache.js +1 -12
- package/general/cnic-formatter.d.ts +16 -3
- package/general/cnic-formatter.js +1 -53
- package/general/convert-url-to-base64.d.ts +8 -6
- package/general/convert-url-to-base64.js +1 -231
- package/general/countries.d.ts +5 -3
- package/general/countries.js +1 -514
- package/general/create-date.d.ts +3 -1
- package/general/create-date.js +1 -22
- package/general/crypto.d.ts +4 -2
- package/general/crypto.js +1 -45
- package/general/currencies.d.ts +2 -0
- package/general/currencies.js +0 -1077
- package/general/delete-image-from-private-supabase.d.ts +10 -2
- package/general/delete-image-from-private-supabase.js +1 -66
- package/general/delete-image-from-public-supabase.d.ts +10 -2
- package/general/delete-image-from-public-supabase.js +1 -66
- package/general/download-from-url.d.ts +8 -1
- package/general/download-from-url.js +1 -82
- package/general/dynamic-page-limit.d.ts +9 -3
- package/general/dynamic-page-limit.js +1 -7
- package/general/enum-to-text.d.ts +8 -1
- package/general/enum-to-text.js +1 -11
- package/general/fetch-data.d.ts +16 -4
- package/general/fetch-data.js +1 -95
- package/general/fetch-supabase-image.d.ts +11 -2
- package/general/fetch-supabase-image.js +1 -67
- package/general/fetch-supabase-private-assets.d.ts +11 -2
- package/general/fetch-supabase-private-assets.js +1 -69
- package/general/format-date.d.ts +10 -2
- package/general/format-date.js +1 -49
- package/general/format-number.d.ts +12 -2
- package/general/format-number.js +1 -35
- package/general/format-phone-display.d.ts +9 -1
- package/general/format-phone-display.js +1 -32
- package/general/format-phone.d.ts +10 -2
- package/general/format-phone.js +1 -20
- package/general/format-pricing.d.ts +8 -1
- package/general/format-pricing.js +1 -23
- package/general/format-secs.d.ts +8 -1
- package/general/format-secs.js +1 -21
- package/general/format-time.d.ts +8 -2
- package/general/format-time.js +1 -38
- package/general/format-value.d.ts +8 -1
- package/general/format-value.js +1 -7
- package/general/full-month-range.d.ts +3 -2
- package/general/full-month-range.js +1 -24
- package/general/full-year-range.d.ts +3 -2
- package/general/full-year-range.js +1 -20
- package/general/generate-article-schema.d.ts +3 -2
- package/general/generate-article-schema.js +1 -100
- package/general/generate-blog-schema.d.ts +3 -2
- package/general/generate-blog-schema.js +1 -32
- package/general/generate-book-schema.d.ts +3 -2
- package/general/generate-book-schema.js +1 -109
- package/general/generate-breadcrumb-schema.d.ts +3 -2
- package/general/generate-breadcrumb-schema.js +1 -34
- package/general/generate-carousel-schema.d.ts +3 -2
- package/general/generate-carousel-schema.js +1 -172
- package/general/generate-course-schema.d.ts +3 -2
- package/general/generate-course-schema.js +1 -124
- package/general/generate-dataset-schema.d.ts +3 -2
- package/general/generate-dataset-schema.js +1 -156
- package/general/generate-discussion-forum-schema.d.ts +3 -2
- package/general/generate-discussion-forum-schema.js +1 -67
- package/general/generate-education-schema.d.ts +3 -2
- package/general/generate-education-schema.js +1 -137
- package/general/generate-employer-aggregate-rating-schema.d.ts +3 -2
- package/general/generate-employer-aggregate-rating-schema.js +1 -64
- package/general/generate-event-schema.d.ts +3 -2
- package/general/generate-event-schema.js +1 -214
- package/general/generate-faq-schema.d.ts +3 -2
- package/general/generate-faq-schema.js +1 -43
- package/general/generate-grid.d.ts +3 -2
- package/general/generate-grid.js +1 -55
- package/general/generate-image-metadata-schema.d.ts +3 -2
- package/general/generate-image-metadata-schema.js +1 -73
- package/general/generate-job-posting-schema.d.ts +3 -2
- package/general/generate-job-posting-schema.js +1 -120
- package/general/generate-local-business-schema.d.ts +3 -2
- package/general/generate-local-business-schema.js +1 -75
- package/general/generate-math-solver-schema.d.ts +3 -2
- package/general/generate-math-solver-schema.js +1 -83
- package/general/generate-movie-carousel-schema.d.ts +3 -2
- package/general/generate-movie-carousel-schema.js +1 -160
- package/general/generate-organization-schema.d.ts +3 -2
- package/general/generate-organization-schema.js +1 -39
- package/general/generate-profile-page-schema.d.ts +3 -2
- package/general/generate-profile-page-schema.js +1 -82
- package/general/generate-qa-page-schema.d.ts +3 -2
- package/general/generate-qa-page-schema.js +1 -67
- package/general/generate-recipe-schema.d.ts +3 -2
- package/general/generate-recipe-schema.js +1 -104
- package/general/generate-ref.d.ts +8 -2
- package/general/generate-ref.js +1 -12
- package/general/generate-review-snippet-schema.d.ts +3 -2
- package/general/generate-review-snippet-schema.js +1 -137
- package/general/generate-shopping-loyalty-program-schema.d.ts +3 -2
- package/general/generate-shopping-loyalty-program-schema.js +1 -59
- package/general/generate-shopping-merchant-listing-schema.d.ts +3 -2
- package/general/generate-shopping-merchant-listing-schema.js +1 -153
- package/general/generate-shopping-merchant-return-policy-schema.d.ts +3 -2
- package/general/generate-shopping-merchant-return-policy-schema.js +1 -68
- package/general/generate-shopping-merchant-shipping-policy-schema.d.ts +3 -2
- package/general/generate-shopping-merchant-shipping-policy-schema.js +1 -74
- package/general/generate-shopping-overview-schema.d.ts +3 -2
- package/general/generate-shopping-overview-schema.js +1 -157
- package/general/generate-shopping-product-snippet-schema.d.ts +3 -2
- package/general/generate-shopping-product-snippet-schema.js +1 -167
- package/general/generate-shopping-variants-schema.d.ts +3 -2
- package/general/generate-shopping-variants-schema.js +1 -143
- package/general/generate-software-app-schema.d.ts +3 -2
- package/general/generate-software-app-schema.js +1 -143
- package/general/generate-speakable-schema.d.ts +3 -2
- package/general/generate-speakable-schema.js +1 -139
- package/general/generate-subscription-schema.d.ts +3 -2
- package/general/generate-subscription-schema.js +1 -133
- package/general/generate-vacation-rental-schema.d.ts +3 -2
- package/general/generate-vacation-rental-schema.js +1 -135
- package/general/generate-video-schema.d.ts +3 -2
- package/general/generate-video-schema.js +1 -163
- package/general/generic-cache.d.ts +17 -15
- package/general/generic-cache.js +1 -659
- package/general/get-available-page-limit.d.ts +8 -2
- package/general/get-available-page-limit.js +1 -31
- package/general/get-calendar-current-month.d.ts +11 -3
- package/general/get-calendar-current-month.js +1 -31
- package/general/get-calendar-dates.d.ts +11 -3
- package/general/get-calendar-dates.js +1 -42
- package/general/get-calendar-next-month.d.ts +12 -3
- package/general/get-calendar-next-month.js +1 -32
- package/general/get-calendar-previous-month.d.ts +12 -3
- package/general/get-calendar-previous-month.js +1 -36
- package/general/get-current-year.d.ts +7 -1
- package/general/get-current-year.js +1 -5
- package/general/get-day-name.d.ts +5 -3
- package/general/get-day-name.js +1 -14
- package/general/get-dial-code.d.ts +8 -1
- package/general/get-dial-code.js +1 -8
- package/general/get-full-name.d.ts +9 -2
- package/general/get-full-name.js +1 -8
- package/general/get-href.d.ts +3 -1
- package/general/get-href.js +1 -13
- package/general/get-month-name.d.ts +5 -3
- package/general/get-month-name.js +1 -19
- package/general/get-month-number.d.ts +5 -3
- package/general/get-month-number.js +1 -29
- package/general/get-number-of-days-in-month.d.ts +9 -2
- package/general/get-number-of-days-in-month.js +1 -12
- package/general/get-pathname.d.ts +3 -1
- package/general/get-pathname.js +1 -16
- package/general/get-week-day.d.ts +8 -1
- package/general/get-week-day.js +1 -9
- package/general/image-url-to-base64.d.ts +3 -1
- package/general/image-url-to-base64.js +1 -80
- package/general/is-created-or-updated.d.ts +3 -1
- package/general/is-created-or-updated.js +1 -26
- package/general/is-next-button-disabled.d.ts +9 -1
- package/general/is-next-button-disabled.js +1 -5
- package/general/is-odd.d.ts +3 -1
- package/general/is-odd.js +1 -13
- package/general/is-previous-button-disabled.d.ts +8 -1
- package/general/is-previous-button-disabled.js +1 -7
- package/general/linear-gradients.d.ts +4 -2
- package/general/linear-gradients.js +1 -52
- package/general/multi-part-search.d.ts +10 -2
- package/general/multi-part-search.js +1 -16
- package/general/normalize-phone.d.ts +15 -2
- package/general/normalize-phone.js +1 -40
- package/general/parse-frontmatter.d.ts +11 -4
- package/general/parse-frontmatter.js +2 -35
- package/general/remove-data-image-prefix.d.ts +8 -1
- package/general/remove-data-image-prefix.js +1 -7
- package/general/repeat-times.d.ts +3 -1
- package/general/repeat-times.js +1 -21
- package/general/resolve-anchor-link.d.ts +3 -1
- package/general/resolve-anchor-link.js +1 -26
- package/general/resolve-current-date.d.ts +3 -1
- package/general/resolve-current-date.js +1 -22
- package/general/resolve-grid.d.ts +3 -1
- package/general/resolve-grid.js +1 -18
- package/general/resolve-initials.d.ts +3 -1
- package/general/resolve-initials.js +1 -17
- package/general/set-timezone.d.ts +11 -1
- package/general/set-timezone.js +1 -12
- package/general/slugify.d.ts +3 -1
- package/general/slugify.js +1 -24
- package/general/text-to-enum.d.ts +8 -1
- package/general/text-to-enum.js +1 -10
- package/general/text-to-sentence-case.d.ts +3 -1
- package/general/text-to-sentence-case.js +1 -16
- package/general/time-out.d.ts +3 -1
- package/general/time-out.js +1 -16
- package/general/time-zones.d.ts +3 -1
- package/general/time-zones.js +1 -437
- package/general/truncate-text.d.ts +3 -1
- package/general/truncate-text.js +1 -18
- package/general/type.d.ts +3 -1
- package/general/type.js +1 -2
- package/general/upload-blob-to-private-supabase.d.ts +14 -2
- package/general/upload-blob-to-private-supabase.js +1 -62
- package/general/upload-blob-to-public-supabase.d.ts +14 -2
- package/general/upload-blob-to-public-supabase.js +1 -62
- package/general/upload-image-to-private-supabase.d.ts +15 -3
- package/general/upload-image-to-private-supabase.js +1 -66
- package/general/upload-image-to-public-supabase.d.ts +15 -3
- package/general/upload-image-to-public-supabase.js +1 -66
- package/general/url-to-sentence-case.d.ts +3 -1
- package/general/url-to-sentence-case.js +1 -19
- package/general/validate-comment.d.ts +3 -1
- package/general/validate-comment.js +1 -21
- package/general/validate-email.d.ts +3 -1
- package/general/validate-email.js +1 -24
- package/general/validate-form.d.ts +12 -3
- package/general/validate-form.js +1 -29
- package/general/validate-name.d.ts +3 -1
- package/general/validate-name.js +1 -21
- package/hooks/use-change.d.ts +11 -2
- package/hooks/use-change.js +1 -23
- package/hooks/use-debounce.d.ts +10 -1
- package/hooks/use-debounce.js +1 -14
- package/hooks/use-fetch.d.ts +7 -5
- package/hooks/use-fetch.js +1 -239
- package/hooks/use-force-render.d.ts +6 -2
- package/hooks/use-force-render.js +1 -17
- package/hooks/use-ip-geo-location.d.ts +8 -1
- package/hooks/use-ip-geo-location.js +1 -79
- package/hooks/use-is-mobile.d.ts +8 -1
- package/hooks/use-is-mobile.js +1 -22
- package/hooks/use-module-entity-v2.d.ts +7 -4
- package/hooks/use-module-entity-v2.js +1 -188
- package/hooks/use-module-entity.d.ts +7 -4
- package/hooks/use-module-entity.js +1 -177
- package/hooks/use-phone-formatter.d.ts +10 -2
- package/hooks/use-phone-formatter.js +1 -23
- package/hooks/use-position.d.ts +6 -3
- package/hooks/use-position.js +1 -43
- package/hooks/use-rtl.d.ts +4 -2
- package/hooks/use-rtl.js +1 -84
- package/hooks/use-sticky.d.ts +3 -1
- package/hooks/use-sticky.js +1 -39
- package/hooks/use-toggle-state.d.ts +3 -2
- package/hooks/use-toggle-state.js +1 -26
- package/hooks/use-window-event-listener.d.ts +9 -1
- package/hooks/use-window-event-listener.js +1 -11
- package/hooks/with-seo.d.ts +11 -2
- package/hooks/with-seo.js +1 -37
- package/local-storage/get-storage-value.d.ts +5 -2
- package/local-storage/get-storage-value.js +1 -20
- package/local-storage/remove-storage-value.d.ts +3 -1
- package/local-storage/remove-storage-value.js +1 -14
- package/local-storage/set-storage-value.d.ts +3 -1
- package/local-storage/set-storage-value.js +1 -14
- package/local-storage/type.d.ts +3 -1
- package/local-storage/type.js +1 -2
- package/npm.d.d.ts +2 -0
- package/npm.d.js +0 -0
- package/package.json +20 -18
- package/storybook/generate-sitemap.d.ts +3 -1
- package/storybook/generate-sitemap.js +17 -26
- package/storybook/preview.d.ts +4 -2
- package/storybook/preview.js +1 -62
- package/storybook/react-design-story-script.d.ts +3 -1
- package/storybook/react-design-story-script.js +5 -27
- package/storybook/react-emoji-collection.d.ts +3 -1
- package/storybook/react-emoji-collection.js +10 -55
- package/storybook/react-emoji-story-script.d.ts +3 -1
- package/storybook/react-emoji-story-script.js +5 -31
- package/storybook/react-emoji-story-template.d.ts +3 -1
- package/storybook/react-emoji-story-template.js +45 -15
- package/storybook/react-icon-collection.d.ts +3 -1
- package/storybook/react-icon-collection.js +10 -42
- package/storybook/react-icon-story-script.d.ts +3 -1
- package/storybook/react-icon-story-script.js +5 -27
- package/storybook/react-icon-story-template.d.ts +3 -1
- package/storybook/react-icon-story-template.js +45 -14
- package/storybook/react-logo-collection.d.ts +3 -1
- package/storybook/react-logo-collection.js +10 -42
- package/storybook/react-logo-story-script.d.ts +3 -1
- package/storybook/react-logo-story-script.js +5 -27
- package/storybook/react-logo-story-template.d.ts +3 -1
- package/storybook/react-logo-story-template.js +45 -14
- package/storybook/react-pakistan-theme.d.ts +3 -1
- package/storybook/react-pakistan-theme.js +1 -31
- package/storybook/responsive-args.d.ts +11 -10
- package/storybook/responsive-args.js +1 -19
- package/storybook/responsive-component.d.ts +4 -2
- package/storybook/responsive-component.js +37 -23
- package/storybook/responsive-screens.d.ts +3 -1
- package/storybook/responsive-screens.js +1 -109
- package/storybook/theme.d.ts +17 -15
- package/storybook/theme.js +1 -1022
- package/api/stellar-solutions/app-user/index.d.ts +0 -51
- package/api/stellar-solutions/app-user/index.js +0 -210
- package/api/stellar-solutions/bank/index.d.ts +0 -59
- package/api/stellar-solutions/bank/index.js +0 -210
- package/api/stellar-solutions/branch/index.d.ts +0 -58
- package/api/stellar-solutions/branch/index.js +0 -220
- package/api/stellar-solutions/company/index.d.ts +0 -57
- package/api/stellar-solutions/company/index.js +0 -218
- package/api/stellar-solutions/company-report/index.d.ts +0 -15
- package/api/stellar-solutions/company-report/index.js +0 -74
- package/api/stellar-solutions/constants.d.ts +0 -19
- package/api/stellar-solutions/constants.js +0 -22
- package/api/stellar-solutions/contact/index.d.ts +0 -56
- package/api/stellar-solutions/contact/index.js +0 -217
- package/api/stellar-solutions/currency/index.d.ts +0 -55
- package/api/stellar-solutions/currency/index.js +0 -212
- package/api/stellar-solutions/customer/index.d.ts +0 -68
- package/api/stellar-solutions/customer/index.js +0 -249
- package/api/stellar-solutions/expense/index.d.ts +0 -58
- package/api/stellar-solutions/expense/index.js +0 -229
- package/api/stellar-solutions/expense-category/index.d.ts +0 -53
- package/api/stellar-solutions/expense-category/index.js +0 -214
- package/api/stellar-solutions/lead/index.d.ts +0 -51
- package/api/stellar-solutions/lead/index.js +0 -206
- package/api/stellar-solutions/menu-order/index.d.ts +0 -53
- package/api/stellar-solutions/menu-order/index.js +0 -202
- package/api/stellar-solutions/payment/index.d.ts +0 -65
- package/api/stellar-solutions/payment/index.js +0 -230
- package/api/stellar-solutions/payment-mode/index.d.ts +0 -53
- package/api/stellar-solutions/payment-mode/index.js +0 -191
- package/api/stellar-solutions/preference/index.d.ts +0 -25
- package/api/stellar-solutions/preference/index.js +0 -114
- package/api/stellar-solutions/product/index.d.ts +0 -64
- package/api/stellar-solutions/product/index.js +0 -235
- package/api/stellar-solutions/product-category/index.d.ts +0 -51
- package/api/stellar-solutions/product-category/index.js +0 -212
- package/api/stellar-solutions/profile/index.d.ts +0 -78
- package/api/stellar-solutions/profile/index.js +0 -234
- package/api/stellar-solutions/quote-invoice/index.d.ts +0 -97
- package/api/stellar-solutions/quote-invoice/index.js +0 -369
- package/api/stellar-solutions/quote-invoice-report/index.d.ts +0 -15
- package/api/stellar-solutions/quote-invoice-report/index.js +0 -74
- package/api/stellar-solutions/tax/index.d.ts +0 -55
- package/api/stellar-solutions/tax/index.js +0 -224
- package/api/stellar-solutions/types/common.d.ts +0 -24
- package/api/stellar-solutions/types/common.js +0 -22
- package/api/stellar-solutions/types/erp.d.ts +0 -302
- package/api/stellar-solutions/types/erp.js +0 -73
- package/api/stellar-solutions/types/index.d.ts +0 -3
- package/api/stellar-solutions/types/index.js +0 -19
- package/api/stellar-solutions/types/pos.d.ts +0 -176
- package/api/stellar-solutions/types/pos.js +0 -61
- package/constants/index.d.ts +0 -12
- package/constants/index.js +0 -28
- package/factory/index.d.ts +0 -2
- package/factory/index.js +0 -18
- package/general/index.d.ts +0 -95
- package/general/index.js +0 -111
- package/index.d.ts +0 -28
- package/index.js +0 -44
- package/local-storage/index.d.ts +0 -4
- package/local-storage/index.js +0 -20
- package/setupTests.d.ts +0 -1
- package/setupTests.js +0 -52
- package/storybook/index.d.ts +0 -17
- package/storybook/index.js +0 -33
|
@@ -1,236 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This file contains TypeScript interfaces for user, workspace, role,
|
|
5
|
-
* permission, plan, school, and campus domain models.
|
|
6
|
-
*/
|
|
7
|
-
import { USER_ROLE, ACCESS_LEVEL, CURRENCY, BILLING_INTERVAL, PLAN_TYPE } from './enums';
|
|
8
|
-
import type { AdmissionBE } from './admission';
|
|
9
|
-
import type { AttendanceBE, ClassBE, CourseBE, FamilyBE, GradeBE, ScheduleBE, SectionBE, SubjectBE, TeacherBE } from './academics';
|
|
10
|
-
import type { ExpenseBE, FeeStructureBE, DiscountCodeBE, StudentFeeBE } from './finance';
|
|
11
|
-
import type { BlogPostBE, BlogCommentBE, BlogPostClapBE, BlogCommentClapBE, MobileNotificationBE, NotificationPreferenceBE, UserPushTokenBE } from './communication';
|
|
12
|
-
/**
|
|
13
|
-
* Subscription plan defining usage limits and features for workspaces
|
|
14
|
-
*/
|
|
15
|
-
export interface PlanBE {
|
|
16
|
-
createdAt: string;
|
|
17
|
-
currency: CURRENCY;
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
id: string;
|
|
20
|
-
maxClasses: number;
|
|
21
|
-
maxCourses: number;
|
|
22
|
-
maxFamilies: number;
|
|
23
|
-
maxStaffAccounts: number;
|
|
24
|
-
maxStudents: number;
|
|
25
|
-
maxTeachers: number;
|
|
26
|
-
name: string;
|
|
27
|
-
priceMonthly: number;
|
|
28
|
-
priceYearly: number;
|
|
29
|
-
storageLimitMB: number;
|
|
30
|
-
type: PLAN_TYPE;
|
|
31
|
-
updatedAt: string;
|
|
32
|
-
workspaces?: WorkspaceBE[];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Workspace represents a tenant in the multi-vendor system
|
|
36
|
-
* Each workspace has exactly ONE school (1:1 relationship)
|
|
37
|
-
*/
|
|
38
|
-
export interface WorkspaceBE {
|
|
39
|
-
agreedCurrency: CURRENCY;
|
|
40
|
-
agreedPrice: number;
|
|
41
|
-
billingDate: number;
|
|
42
|
-
billingInterval: BILLING_INTERVAL;
|
|
43
|
-
classesCount: number;
|
|
44
|
-
coursesCount: number;
|
|
45
|
-
createdAt: string;
|
|
46
|
-
description: string | null;
|
|
47
|
-
dueDateLength: number;
|
|
48
|
-
enabled: boolean;
|
|
49
|
-
familiesCount: number;
|
|
50
|
-
id: string;
|
|
51
|
-
logo: string | null;
|
|
52
|
-
name: string;
|
|
53
|
-
planEndDate: Date | string | null;
|
|
54
|
-
planId: string | null;
|
|
55
|
-
planStartDate: Date | string | null;
|
|
56
|
-
secrets?: any | null;
|
|
57
|
-
staffAccountsCount: number;
|
|
58
|
-
storageUsedMB: number;
|
|
59
|
-
studentsCount: number;
|
|
60
|
-
subdomain: string;
|
|
61
|
-
teachersCount: number;
|
|
62
|
-
updatedAt: string;
|
|
63
|
-
customRoles?: RoleBE[];
|
|
64
|
-
plan?: PlanBE;
|
|
65
|
-
rolePermissions?: RolePermissionBE[];
|
|
66
|
-
school?: SchoolBE;
|
|
67
|
-
users?: WorkspaceUserBE[];
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Join table managing user-workspace relationships and roles
|
|
71
|
-
* Allows users to belong to multiple workspaces with different roles
|
|
72
|
-
*/
|
|
73
|
-
export interface WorkspaceUserBE {
|
|
74
|
-
createdAt: string;
|
|
75
|
-
enabled: boolean;
|
|
76
|
-
id: string;
|
|
77
|
-
roleId: string | null;
|
|
78
|
-
updatedAt: string;
|
|
79
|
-
userId: string;
|
|
80
|
-
workspaceId: string;
|
|
81
|
-
role?: RoleBE;
|
|
82
|
-
user?: UserBE;
|
|
83
|
-
workspace?: WorkspaceBE;
|
|
84
|
-
workspaceUserPermissions?: WorkspaceUserPermissionBE[];
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Role defines a named set of default permissions.
|
|
88
|
-
* System roles (isSystem = true) are seeded once and map 1:1 with UserRole enum values.
|
|
89
|
-
* Workspace custom roles (isSystem = false, workspaceId set) are created by SCHOOL_ADMINs.
|
|
90
|
-
*/
|
|
91
|
-
export interface RoleBE {
|
|
92
|
-
createdAt: string;
|
|
93
|
-
description: string | null;
|
|
94
|
-
id: string;
|
|
95
|
-
isSystem: boolean;
|
|
96
|
-
name: string;
|
|
97
|
-
updatedAt: string;
|
|
98
|
-
userRole: USER_ROLE | null;
|
|
99
|
-
workspaceId: string | null;
|
|
100
|
-
rolePermissions?: RolePermissionBE[];
|
|
101
|
-
workspace?: WorkspaceBE;
|
|
102
|
-
workspaceUsers?: WorkspaceBE[];
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Permission describes a module-level capability and access level (e.g., 'courses', READ/READ_WRITE).
|
|
106
|
-
*/
|
|
107
|
-
export interface PermissionBE {
|
|
108
|
-
access: ACCESS_LEVEL;
|
|
109
|
-
createdAt: string;
|
|
110
|
-
description: string | null;
|
|
111
|
-
id: string;
|
|
112
|
-
module: string;
|
|
113
|
-
updatedAt: string;
|
|
114
|
-
rolePermissions?: RolePermissionBE[];
|
|
115
|
-
workspaceUserPermissions?: WorkspaceUserPermissionBE[];
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* RolePermission links a Permission to a Role, with an optional workspace scope.
|
|
119
|
-
* workspaceId IS NULL → global default grant for the role (seeded by system)
|
|
120
|
-
* workspaceId IS SET → workspace-level override set by SCHOOL_ADMIN for their workspace
|
|
121
|
-
* allowed = true → explicitly grant the permission
|
|
122
|
-
* allowed = false → explicitly deny/revoke the permission (overrides the global default)
|
|
123
|
-
*/
|
|
124
|
-
export interface RolePermissionBE {
|
|
125
|
-
allowed: boolean;
|
|
126
|
-
createdAt: string;
|
|
127
|
-
id: string;
|
|
128
|
-
permissionId: string;
|
|
129
|
-
roleId: string;
|
|
130
|
-
updatedAt: string;
|
|
131
|
-
workspaceId: string | null;
|
|
132
|
-
permission?: PermissionBE;
|
|
133
|
-
role?: RoleBE;
|
|
134
|
-
workspace?: WorkspaceBE;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* WorkspaceUserPermission is a per-user override for a given Permission within a workspace.
|
|
138
|
-
* allowed indicates explicit allow (true) or deny (false); overrides take precedence over role grants.
|
|
139
|
-
*/
|
|
140
|
-
export interface WorkspaceUserPermissionBE {
|
|
141
|
-
allowed: boolean;
|
|
142
|
-
createdAt: string;
|
|
143
|
-
id: string;
|
|
144
|
-
permissionId: string;
|
|
145
|
-
updatedAt: string;
|
|
146
|
-
workspaceUserId: string;
|
|
147
|
-
permission?: PermissionBE;
|
|
148
|
-
workspaceUser?: WorkspaceUserBE;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* School represents an individual educational institution
|
|
152
|
-
* Has a 1:1 relationship with Workspace (each school is a separate tenant)
|
|
153
|
-
*/
|
|
154
|
-
export interface SchoolBE {
|
|
155
|
-
address: string | null;
|
|
156
|
-
city: string | null;
|
|
157
|
-
code: string;
|
|
158
|
-
country: string | null;
|
|
159
|
-
createdAt: string;
|
|
160
|
-
currency: CURRENCY;
|
|
161
|
-
email: string | null;
|
|
162
|
-
enabled: boolean;
|
|
163
|
-
id: string;
|
|
164
|
-
logo: string | null;
|
|
165
|
-
name: string;
|
|
166
|
-
phone: string | null;
|
|
167
|
-
postalCode: string | null;
|
|
168
|
-
principalId: string | null;
|
|
169
|
-
state: string | null;
|
|
170
|
-
updatedAt: string;
|
|
171
|
-
website: string | null;
|
|
172
|
-
workspaceId: string;
|
|
173
|
-
attendances?: AttendanceBE[];
|
|
174
|
-
blogPosts?: BlogPostBE[];
|
|
175
|
-
classes?: ClassBE[];
|
|
176
|
-
courses?: CourseBE[];
|
|
177
|
-
expenses?: ExpenseBE[];
|
|
178
|
-
families?: FamilyBE[];
|
|
179
|
-
feeStructures?: FeeStructureBE[];
|
|
180
|
-
discountCodes?: DiscountCodeBE[];
|
|
181
|
-
grades?: GradeBE[];
|
|
182
|
-
schedules?: ScheduleBE[];
|
|
183
|
-
sections?: SectionBE[];
|
|
184
|
-
admissions?: AdmissionBE[];
|
|
185
|
-
studentFees?: StudentFeeBE[];
|
|
186
|
-
subjects?: SubjectBE[];
|
|
187
|
-
teachers?: TeacherBE[];
|
|
188
|
-
workspace?: WorkspaceBE;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Core user model synchronized with Supabase Auth
|
|
192
|
-
* Shared by entire family - parents and students use same login
|
|
193
|
-
*/
|
|
194
|
-
export interface UserBE {
|
|
195
|
-
avatar: string | null;
|
|
196
|
-
createdAt: string;
|
|
197
|
-
email: string;
|
|
198
|
-
enabled: boolean;
|
|
199
|
-
id: string;
|
|
200
|
-
name: string | null;
|
|
201
|
-
phone: string | null;
|
|
202
|
-
updatedAt: string;
|
|
203
|
-
blogCommentClaps?: BlogCommentClapBE[];
|
|
204
|
-
blogComments?: BlogCommentBE[];
|
|
205
|
-
blogPostClaps?: BlogPostClapBE[];
|
|
206
|
-
blogPosts?: BlogPostBE[];
|
|
207
|
-
mobileNotifications?: MobileNotificationBE[];
|
|
208
|
-
notificationPreference?: NotificationPreferenceBE;
|
|
209
|
-
pushTokens?: UserPushTokenBE[];
|
|
210
|
-
teacherProfile?: TeacherBE;
|
|
211
|
-
workspaces?: WorkspaceUserBE[];
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Campus represents a physical branch/location of a school
|
|
215
|
-
*/
|
|
216
|
-
export interface CampusBE {
|
|
217
|
-
address: string | null;
|
|
218
|
-
campusId?: string | null;
|
|
219
|
-
city: string | null;
|
|
220
|
-
code: string;
|
|
221
|
-
country: string | null;
|
|
222
|
-
createdAt: string;
|
|
223
|
-
enabled: boolean;
|
|
224
|
-
id: string;
|
|
225
|
-
name: string;
|
|
226
|
-
phone: string | null;
|
|
227
|
-
schoolId: string;
|
|
228
|
-
state: string | null;
|
|
229
|
-
updatedAt: string;
|
|
230
|
-
school?: SchoolBE;
|
|
231
|
-
_count?: {
|
|
232
|
-
classes: number;
|
|
233
|
-
teachers: number;
|
|
234
|
-
studentProfiles: number;
|
|
235
|
-
};
|
|
236
|
-
}
|
|
1
|
+
import './enums.js';
|
|
2
|
+
export { g as CampusBE, P as PermissionBE, h as PlanBE, i as RoleBE, j as RolePermissionBE, k as SchoolBE, l as UserBE, W as WorkspaceBE, m as WorkspaceUserBE, n as WorkspaceUserPermissionBE } from './admission.js';
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* TypeScript Types Generated from Prisma Schema - User Management
|
|
4
|
-
*
|
|
5
|
-
* This file contains TypeScript interfaces for user, workspace, role,
|
|
6
|
-
* permission, plan, school, and campus domain models.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
var t=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var c=(s,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of a(e))!l.call(s,r)&&r!==o&&t(s,r,{get:()=>e[r],enumerable:!(n=i(e,r))||n.enumerable});return s};var u=s=>c(t({},"__esModule",{value:!0}),s);var d={};module.exports=u(d);
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { TableColumn, HeaderAction, COMPONENT_TYPE, RowAction } from '@appcorp/shadcn/components/enhanced-table';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Generic Component Factory
|
|
3
6
|
*
|
|
4
7
|
* Reusable UI components for CRUD modules with customizable configuration.
|
|
5
8
|
* Generates tables, forms, drawers, and other common UI patterns.
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const DRAWER_TYPES: {
|
|
10
|
+
|
|
11
|
+
declare const DRAWER_TYPES: {
|
|
10
12
|
FORM_DRAWER: string;
|
|
11
13
|
FILTER_DRAWER: string;
|
|
12
14
|
VIEW_DRAWER: string;
|
|
13
15
|
MORE_ACTIONS_DRAWER: string;
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
interface ComponentConfig {
|
|
16
18
|
cancelLabel?: string;
|
|
17
19
|
drawerDescription?: string;
|
|
18
20
|
drawerFormTitle: string;
|
|
@@ -40,7 +42,7 @@ export interface ComponentConfig {
|
|
|
40
42
|
viewContent: React.ReactNode;
|
|
41
43
|
viewDrawerValue?: string;
|
|
42
44
|
}
|
|
43
|
-
|
|
45
|
+
interface TableBodyCol {
|
|
44
46
|
key?: string | string[];
|
|
45
47
|
componentType: COMPONENT_TYPE | string;
|
|
46
48
|
textFormatter?: (value: unknown, row: unknown) => React.ReactNode;
|
|
@@ -53,7 +55,7 @@ interface GenericTableProps {
|
|
|
53
55
|
rowActions?: any[];
|
|
54
56
|
tableBodyCols: TableBodyCol[];
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
declare const GenericTable: FC<GenericTableProps>;
|
|
57
59
|
interface GenericDrawerProps {
|
|
58
60
|
config: ComponentConfig;
|
|
59
61
|
context: any;
|
|
@@ -62,7 +64,7 @@ interface GenericDrawerProps {
|
|
|
62
64
|
filterContent?: React.ReactNode;
|
|
63
65
|
moreActionsContent?: React.ReactNode;
|
|
64
66
|
}
|
|
65
|
-
|
|
67
|
+
declare const GenericDrawer: FC<GenericDrawerProps>;
|
|
66
68
|
interface GenericModulePageProps {
|
|
67
69
|
context: any;
|
|
68
70
|
headerActions?: HeaderAction[];
|
|
@@ -71,5 +73,6 @@ interface GenericModulePageProps {
|
|
|
71
73
|
rowActions?: RowAction[];
|
|
72
74
|
tableBodyCols: TableBodyCol[];
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
declare const createGenericModulePage: () => React.FC<GenericModulePageProps>;
|
|
77
|
+
|
|
78
|
+
export { type ComponentConfig, DRAWER_TYPES, GenericDrawer, GenericTable, type TableBodyCol, createGenericModulePage };
|
|
@@ -1,131 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Generic Component Factory
|
|
3
|
-
*
|
|
4
|
-
* Reusable UI components for CRUD modules with customizable configuration.
|
|
5
|
-
* Generates tables, forms, drawers, and other common UI patterns.
|
|
6
|
-
*/
|
|
7
|
-
'use client';
|
|
8
|
-
"use strict";
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.createGenericModulePage = exports.GenericDrawer = exports.GenericTable = exports.DRAWER_TYPES = void 0;
|
|
44
|
-
var react_1 = __importStar(require("react"));
|
|
45
|
-
var general_1 = require("../general");
|
|
46
|
-
var use_rtl_1 = require("../hooks/use-rtl");
|
|
47
|
-
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
48
|
-
var sonner_1 = require("@appcorp/shadcn/components/ui/sonner");
|
|
49
|
-
var drawer_generic_1 = require("@appcorp/shadcn/components/drawer-generic");
|
|
50
|
-
var enhanced_drawer_header_1 = require("@appcorp/shadcn/components/enhanced-drawer-header");
|
|
51
|
-
var enhanced_drawer_footer_1 = require("@appcorp/shadcn/components/enhanced-drawer-footer");
|
|
52
|
-
// ============================================================================
|
|
53
|
-
// CONSTANTS
|
|
54
|
-
// ============================================================================
|
|
55
|
-
exports.DRAWER_TYPES = {
|
|
56
|
-
FORM_DRAWER: 'FORM_DRAWER',
|
|
57
|
-
FILTER_DRAWER: 'FILTER_DRAWER',
|
|
58
|
-
VIEW_DRAWER: 'VIEW_DRAWER',
|
|
59
|
-
MORE_ACTIONS_DRAWER: 'MORE_ACTIONS_DRAWER',
|
|
60
|
-
};
|
|
61
|
-
var GenericTable = function (_a) {
|
|
62
|
-
var config = _a.config, context = _a.context, headerActions = _a.headerActions, rowActions = _a.rowActions, tableBodyCols = _a.tableBodyCols;
|
|
63
|
-
var isRTL = (0, use_rtl_1.useRTL)();
|
|
64
|
-
var tableHeadItems = (0, react_1.useMemo)(function () {
|
|
65
|
-
return config.tableColumns.map(function (col) { return ({
|
|
66
|
-
label: col.label,
|
|
67
|
-
width: col.width,
|
|
68
|
-
}); });
|
|
69
|
-
}, [config.tableColumns]);
|
|
70
|
-
var totalPages = (0, general_1.calculatePages)(context.state.count, context.state.pageLimit);
|
|
71
|
-
// Build header actions from context or props
|
|
72
|
-
var allHeaderActions = (0, react_1.useMemo)(function () { return headerActions || context.headerActions || []; }, [headerActions, context.headerActions]);
|
|
73
|
-
var numberOfFilters = (0, react_1.useMemo)(function () {
|
|
74
|
-
return Object.keys(context.state).filter(function (k) {
|
|
75
|
-
if (k.startsWith('filter')) {
|
|
76
|
-
return (context.state[k] !== undefined &&
|
|
77
|
-
context.state[k] !== '' &&
|
|
78
|
-
context.state[k] !== null &&
|
|
79
|
-
context.state[k] !== false);
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
}).length;
|
|
83
|
-
}, [context.state]);
|
|
84
|
-
return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? 'rtl' : 'ltr'), dir: isRTL ? 'rtl' : 'ltr' },
|
|
85
|
-
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(context.state.currentPage), handleNextOnClick: context.handlePageChange, handleOnSelect: context.handlePageLimitChange, handlePreviousOnClick: function () {
|
|
86
|
-
return context.handlePageChange(context.state.currentPage - 1);
|
|
87
|
-
}, handleSearchInput: function (key, value) { var _a; return (_a = context.handleSearch) === null || _a === void 0 ? void 0 : _a.call(context, value); }, headerActions: allHeaderActions, isNextDisabled: (0, general_1.isNextButtonDisabled)(context.state.currentPage, totalPages), isPreviousDisabled: (0, general_1.isPreviousButtonDisabled)(context.state.currentPage), listOptions: (0, general_1.getAvailablePageLimits)(context.state.count), loading: context.listLoading, nodeSelectKey: "pageLimit", numberOfFilters: numberOfFilters, onClearFilters: config.onClearFilters, pageLimit: context.state.pageLimit, rowActions: rowActions || context.rowActions || [], searchDisabled: false, searchEnabled: true, searchId: "".concat(config.moduleName.toLowerCase(), "-search"), searchPlaceholder: config.searchPlaceholder, searchValue: context.state.searchQuery, tableBodyCols: tableBodyCols, tableBodyRows: context.state.items, tableDescription: config.tableDescription, tableHeading: config.tableTitle, tableHeadItems: tableHeadItems, totalPages: Number(totalPages) })));
|
|
88
|
-
};
|
|
89
|
-
exports.GenericTable = GenericTable;
|
|
90
|
-
var GenericDrawer = function (_a) {
|
|
91
|
-
var _b, _c, _d, _e, _f, _g;
|
|
92
|
-
var config = _a.config, context = _a.context, formContent = _a.formContent, viewContent = _a.viewContent, filterContent = _a.filterContent, moreActionsContent = _a.moreActionsContent;
|
|
93
|
-
var isRTL = (0, use_rtl_1.useRTL)();
|
|
94
|
-
var closeDrawer = context.closeDrawer || context.handleCloseDrawer;
|
|
95
|
-
var _h = context.state, disableSaveButton = _h.disableSaveButton, drawer = _h.drawer;
|
|
96
|
-
var isFormDrawer = drawer === exports.DRAWER_TYPES.FORM_DRAWER;
|
|
97
|
-
var isViewDrawer = drawer === exports.DRAWER_TYPES.VIEW_DRAWER;
|
|
98
|
-
var isFilterDrawer = drawer === exports.DRAWER_TYPES.FILTER_DRAWER;
|
|
99
|
-
var isMoreActionsDrawer = drawer === exports.DRAWER_TYPES.MORE_ACTIONS_DRAWER;
|
|
100
|
-
var isOpen = isFormDrawer || isViewDrawer || isFilterDrawer || isMoreActionsDrawer;
|
|
101
|
-
var drawerFormTitle = config.drawerFormTitle;
|
|
102
|
-
var drawerFormDescription = config.drawerFormDescription;
|
|
103
|
-
var drawerViewTitle = config.drawerViewTitle;
|
|
104
|
-
var drawerViewDescription = config.drawerViewDescription;
|
|
105
|
-
var drawerFilterTitle = config.drawerFilterTitle;
|
|
106
|
-
var drawerFilterDescription = config.drawerFilterDescription;
|
|
107
|
-
var drawerMoreActionsTitle = config.drawerMoreActionsTitle;
|
|
108
|
-
var drawerMoreActionsDescription = config.drawerMoreActionsDescription;
|
|
109
|
-
var errors = (_b = context.state.errors) !== null && _b !== void 0 ? _b : {};
|
|
110
|
-
var formHeader = isFormDrawer ? (react_1.default.createElement(enhanced_drawer_header_1.EnhancedDrawerHeader, { title: drawerFormTitle, description: drawerFormDescription })) : null;
|
|
111
|
-
var viewHeader = isViewDrawer ? (react_1.default.createElement(enhanced_drawer_header_1.EnhancedDrawerHeader, { title: drawerViewTitle, description: drawerViewDescription })) : null;
|
|
112
|
-
var filterHeader = isFilterDrawer ? (react_1.default.createElement(enhanced_drawer_header_1.EnhancedDrawerHeader, { title: drawerFilterTitle, description: drawerFilterDescription })) : null;
|
|
113
|
-
var moreActionsHeader = isMoreActionsDrawer ? (react_1.default.createElement(enhanced_drawer_header_1.EnhancedDrawerHeader, { title: drawerMoreActionsTitle, description: drawerMoreActionsDescription })) : null;
|
|
114
|
-
var formFooter = isFormDrawer ? (react_1.default.createElement(enhanced_drawer_footer_1.EnhancedDrawerFooter, { applyFilters: function () { }, clearFilters: function () { }, closeDrawer: closeDrawer, disableSaveButton: disableSaveButton, drawerType: enhanced_drawer_footer_1.DRAWER_FOOTER_COMPONENT_TYPE.FORM_DRAWER, errors: errors, handleSubmit: context.handleSubmit, updateLoading: (_c = context.updateLoading) !== null && _c !== void 0 ? _c : false })) : null;
|
|
115
|
-
var viewFooter = isViewDrawer ? (react_1.default.createElement(enhanced_drawer_footer_1.EnhancedDrawerFooter, { applyFilters: function () { }, clearFilters: function () { }, closeDrawer: closeDrawer, disableSaveButton: false, drawerType: enhanced_drawer_footer_1.DRAWER_FOOTER_COMPONENT_TYPE.VIEW_DRAWER, errors: errors, handleSubmit: function () { }, updateLoading: false })) : null;
|
|
116
|
-
var filterFooter = isFilterDrawer ? (react_1.default.createElement(enhanced_drawer_footer_1.EnhancedDrawerFooter, { applyFilters: (_d = context.applyFilters) !== null && _d !== void 0 ? _d : (function () { }), clearFilters: (_e = context.clearFilters) !== null && _e !== void 0 ? _e : (function () { }), closeDrawer: closeDrawer, disableSaveButton: false, drawerType: enhanced_drawer_footer_1.DRAWER_FOOTER_COMPONENT_TYPE.FILTER_DRAWER, errors: errors, handleSubmit: (_f = context.handleSubmit) !== null && _f !== void 0 ? _f : (function () { }), updateLoading: false })) : null;
|
|
117
|
-
var moreActionsFooter = isMoreActionsDrawer ? (react_1.default.createElement(enhanced_drawer_footer_1.EnhancedDrawerFooter, { applyFilters: function () { }, clearFilters: function () { }, closeDrawer: closeDrawer, disableSaveButton: false, drawerType: enhanced_drawer_footer_1.DRAWER_FOOTER_COMPONENT_TYPE.MORE_ACTIONS_DRAWER, errors: errors, handleSubmit: function () { }, updateLoading: false })) : null;
|
|
118
|
-
return (react_1.default.createElement(drawer_generic_1.DrawerGeneric, { direction: isRTL ? 'left' : 'right', filterDrawer: isFilterDrawer ? filterContent : null, filterDrawerFooter: filterFooter, filterDrawerHeader: filterHeader, formDrawer: isFormDrawer ? formContent : null, formDrawerFooter: formFooter, formDrawerHeader: formHeader, moreActionsDrawer: isMoreActionsDrawer ? moreActionsContent : null, moreActionsDrawerFooter: moreActionsFooter, moreActionsDrawerHeader: moreActionsHeader, onOpenChange: function (open) { return !open && closeDrawer(); }, open: isOpen, viewDrawer: isViewDrawer ? viewContent : null, viewDrawerFooter: viewFooter, viewDrawerHeader: viewHeader, width: (_g = config.size) !== null && _g !== void 0 ? _g : 'small' }));
|
|
119
|
-
};
|
|
120
|
-
exports.GenericDrawer = GenericDrawer;
|
|
121
|
-
var createGenericModulePage = function () {
|
|
122
|
-
var GenericModulePage = function (_a) {
|
|
123
|
-
var context = _a.context, headerActions = _a.headerActions, iconMap = _a.iconMap, overrideConfig = _a.overrideConfig, rowActions = _a.rowActions, tableBodyCols = _a.tableBodyCols;
|
|
124
|
-
return (react_1.default.createElement("div", { className: "space-y-6" },
|
|
125
|
-
react_1.default.createElement(exports.GenericTable, { config: overrideConfig, context: context, tableBodyCols: tableBodyCols, headerActions: headerActions, rowActions: rowActions, iconMap: iconMap }),
|
|
126
|
-
react_1.default.createElement(exports.GenericDrawer, { config: overrideConfig, context: context, filterContent: overrideConfig.filterContent, formContent: overrideConfig.formContent, moreActionsContent: overrideConfig.moreActionsContent, viewContent: overrideConfig.viewContent }),
|
|
127
|
-
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
128
|
-
};
|
|
129
|
-
return GenericModulePage;
|
|
130
|
-
};
|
|
131
|
-
exports.createGenericModulePage = createGenericModulePage;
|
|
1
|
+
"use client";var J=Object.create;var A=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var ee=(r,e)=>{for(var o in e)A(r,o,{get:e[o],enumerable:!0})},g=(r,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of X(e))!x.call(r,a)&&a!==o&&A(r,a,{get:()=>e[a],enumerable:!(s=U(e,a))||s.enumerable});return r};var re=(r,e,o)=>(o=r!=null?J(Z(r)):{},g(e||!r||!r.__esModule?A(o,"default",{value:r,enumerable:!0}):o,r)),te=r=>g(A({},"__esModule",{value:!0}),r);var oe={};ee(oe,{DRAWER_TYPES:()=>u,GenericDrawer:()=>M,GenericTable:()=>N,createGenericModulePage:()=>ae});module.exports=te(oe);var t=re(require("react")),T=require("../general/calculate-pages"),h=require("../general/get-available-page-limit"),f=require("../general/is-next-button-disabled"),E=require("../general/is-previous-button-disabled"),F=require("../hooks/use-rtl"),y=require("@appcorp/shadcn/components/enhanced-table"),P=require("@appcorp/shadcn/components/ui/sonner"),O=require("@appcorp/shadcn/components/drawer-generic"),p=require("@appcorp/shadcn/components/enhanced-drawer-header"),n=require("@appcorp/shadcn/components/enhanced-drawer-footer");const u={FORM_DRAWER:"FORM_DRAWER",FILTER_DRAWER:"FILTER_DRAWER",VIEW_DRAWER:"VIEW_DRAWER",MORE_ACTIONS_DRAWER:"MORE_ACTIONS_DRAWER"},N=({config:r,context:e,headerActions:o,rowActions:s,tableBodyCols:a})=>{const d=(0,F.useRTL)(),m=(0,t.useMemo)(()=>r.tableColumns.map(i=>({label:i.label,width:i.width})),[r.tableColumns]),l=(0,T.calculatePages)(e.state.count,e.state.pageLimit),C=(0,t.useMemo)(()=>o||e.headerActions||[],[o,e.headerActions]),c=(0,t.useMemo)(()=>Object.keys(e.state).filter(i=>i.startsWith("filter")?e.state[i]!==void 0&&e.state[i]!==""&&e.state[i]!==null&&e.state[i]!==!1:!1).length,[e.state]);return t.default.createElement("div",{className:`space-y-4 ${d?"rtl":"ltr"}`,dir:d?"rtl":"ltr"},t.default.createElement(y.EnhancedTable,{currentPage:Number(e.state.currentPage),handleNextOnClick:e.handlePageChange,handleOnSelect:e.handlePageLimitChange,handlePreviousOnClick:()=>e.handlePageChange(e.state.currentPage-1),handleSearchInput:(i,w)=>e.handleSearch?.(w),headerActions:C,isNextDisabled:(0,f.isNextButtonDisabled)(e.state.currentPage,l),isPreviousDisabled:(0,E.isPreviousButtonDisabled)(e.state.currentPage),listOptions:(0,h.getAvailablePageLimits)(e.state.count),loading:e.listLoading,nodeSelectKey:"pageLimit",numberOfFilters:c,onClearFilters:r.onClearFilters,pageLimit:e.state.pageLimit,rowActions:s||e.rowActions||[],searchDisabled:!1,searchEnabled:!0,searchId:`${r.moduleName.toLowerCase()}-search`,searchPlaceholder:r.searchPlaceholder,searchValue:e.state.searchQuery,tableBodyCols:a,tableBodyRows:e.state.items,tableDescription:r.tableDescription,tableHeading:r.tableTitle,tableHeadItems:m,totalPages:Number(l)}))},M=({config:r,context:e,formContent:o,viewContent:s,filterContent:a,moreActionsContent:d})=>{const m=(0,F.useRTL)(),l=e.closeDrawer||e.handleCloseDrawer,{disableSaveButton:C,drawer:c}=e.state,i=c===u.FORM_DRAWER,w=c===u.VIEW_DRAWER,D=c===u.FILTER_DRAWER,R=c===u.MORE_ACTIONS_DRAWER,_=i||w||D||R,W=r.drawerFormTitle,v=r.drawerFormDescription,L=r.drawerViewTitle,S=r.drawerViewDescription,H=r.drawerFilterTitle,I=r.drawerFilterDescription,B=r.drawerMoreActionsTitle,V=r.drawerMoreActionsDescription,b=e.state.errors??{},G=i?t.default.createElement(p.EnhancedDrawerHeader,{title:W,description:v}):null,k=w?t.default.createElement(p.EnhancedDrawerHeader,{title:L,description:S}):null,Y=D?t.default.createElement(p.EnhancedDrawerHeader,{title:H,description:I}):null,z=R?t.default.createElement(p.EnhancedDrawerHeader,{title:B,description:V}):null,$=i?t.default.createElement(n.EnhancedDrawerFooter,{applyFilters:()=>{},clearFilters:()=>{},closeDrawer:l,disableSaveButton:C,drawerType:n.DRAWER_FOOTER_COMPONENT_TYPE.FORM_DRAWER,errors:b,handleSubmit:e.handleSubmit,updateLoading:e.updateLoading??!1}):null,j=w?t.default.createElement(n.EnhancedDrawerFooter,{applyFilters:()=>{},clearFilters:()=>{},closeDrawer:l,disableSaveButton:!1,drawerType:n.DRAWER_FOOTER_COMPONENT_TYPE.VIEW_DRAWER,errors:b,handleSubmit:()=>{},updateLoading:!1}):null,K=D?t.default.createElement(n.EnhancedDrawerFooter,{applyFilters:e.applyFilters??(()=>{}),clearFilters:e.clearFilters??(()=>{}),closeDrawer:l,disableSaveButton:!1,drawerType:n.DRAWER_FOOTER_COMPONENT_TYPE.FILTER_DRAWER,errors:b,handleSubmit:e.handleSubmit??(()=>{}),updateLoading:!1}):null,Q=R?t.default.createElement(n.EnhancedDrawerFooter,{applyFilters:()=>{},clearFilters:()=>{},closeDrawer:l,disableSaveButton:!1,drawerType:n.DRAWER_FOOTER_COMPONENT_TYPE.MORE_ACTIONS_DRAWER,errors:b,handleSubmit:()=>{},updateLoading:!1}):null;return t.default.createElement(O.DrawerGeneric,{direction:m?"left":"right",filterDrawer:D?a:null,filterDrawerFooter:K,filterDrawerHeader:Y,formDrawer:i?o:null,formDrawerFooter:$,formDrawerHeader:G,moreActionsDrawer:R?d:null,moreActionsDrawerFooter:Q,moreActionsDrawerHeader:z,onOpenChange:q=>!q&&l(),open:_,viewDrawer:w?s:null,viewDrawerFooter:j,viewDrawerHeader:k,width:r.size??"small"})},ae=()=>({context:e,headerActions:o,iconMap:s,overrideConfig:a,rowActions:d,tableBodyCols:m})=>t.default.createElement("div",{className:"space-y-6"},t.default.createElement(N,{config:a,context:e,tableBodyCols:m,headerActions:o,rowActions:d,iconMap:s}),t.default.createElement(M,{config:a,context:e,filterContent:a.filterContent,formContent:a.formContent,moreActionsContent:a.moreActionsContent,viewContent:a.viewContent}),t.default.createElement(P.Toaster,null));0&&(module.exports={DRAWER_TYPES,GenericDrawer,GenericTable,createGenericModulePage});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Generic Module Factory - Minimal Version
|
|
3
5
|
*
|
|
4
6
|
* Provides reusable reducer and context structure for CRUD modules.
|
|
5
7
|
* API integration is handled by individual modules for maximum flexibility.
|
|
6
8
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
interface ModuleConfig<T = any> {
|
|
9
11
|
name: string;
|
|
10
12
|
displayName: string;
|
|
11
13
|
initialState: T;
|
|
@@ -17,11 +19,11 @@ export interface ModuleConfig<T = any> {
|
|
|
17
19
|
customActions?: Record<string, (state: any, payload?: any) => any>;
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
interface GenericModuleContext<T = any> {
|
|
21
23
|
state: T;
|
|
22
24
|
dispatch: React.Dispatch<any>;
|
|
23
25
|
}
|
|
24
|
-
|
|
26
|
+
declare const GENERIC_ACTION_TYPES: {
|
|
25
27
|
readonly RESET_FORM: "RESET_FORM";
|
|
26
28
|
readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE";
|
|
27
29
|
readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT";
|
|
@@ -34,24 +36,24 @@ export declare const GENERIC_ACTION_TYPES: {
|
|
|
34
36
|
readonly SET_ERRORS: "SET_ERRORS";
|
|
35
37
|
readonly SET_FILTERS: "SET_FILTERS";
|
|
36
38
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
declare const createGenericReducer: <T>(config: ModuleConfig<T>) => (state: T, action: any) => T;
|
|
40
|
+
declare const createGenericModuleHook: <T>(config: ModuleConfig<T>) => () => GenericModuleContextWithHandlers<T>;
|
|
41
|
+
declare const createGenericModuleProvider: <T>(config: ModuleConfig<T>) => {
|
|
40
42
|
Provider: React.FC<{
|
|
41
43
|
children: React.ReactNode;
|
|
42
44
|
}>;
|
|
43
45
|
useContext: () => GenericModuleContextWithHandlers<T>;
|
|
44
46
|
Context: React.Context<GenericModuleContextWithHandlers<T> | undefined>;
|
|
45
47
|
};
|
|
46
|
-
|
|
48
|
+
interface GenericModuleContextWithHandlers<T = any> extends GenericModuleContext<T> {
|
|
47
49
|
handleSearch?: (query: string) => void;
|
|
48
50
|
handlePageChange?: (page: number) => void;
|
|
49
51
|
handlePageLimitChange?: (limit: number) => void;
|
|
50
52
|
handleCloseDrawer?: () => void;
|
|
51
53
|
handleSubmit?: (data: any) => void;
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
declare const createGenericHandlers: <T>(dispatch: React.Dispatch<any>) => Omit<GenericModuleContextWithHandlers<T>, "state" | "dispatch">;
|
|
56
|
+
declare const createGenericModule: <T>(config: ModuleConfig<T>) => {
|
|
55
57
|
reducer: (state: T, action: any) => T;
|
|
56
58
|
Provider: React.FC<{
|
|
57
59
|
children: React.ReactNode;
|
|
@@ -74,3 +76,5 @@ export declare const createGenericModule: <T>(config: ModuleConfig<T>) => {
|
|
|
74
76
|
initialState: T;
|
|
75
77
|
createHandlers: <T_1>(dispatch: React.Dispatch<any>) => Omit<GenericModuleContextWithHandlers<T_1>, "state" | "dispatch">;
|
|
76
78
|
};
|
|
79
|
+
|
|
80
|
+
export { GENERIC_ACTION_TYPES, type GenericModuleContext, type GenericModuleContextWithHandlers, type ModuleConfig, createGenericHandlers, createGenericModule, createGenericModuleHook, createGenericModuleProvider, createGenericReducer };
|