dinocollab-core 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/dist/_virtual/_rollupPluginBabelHelpers.js +67 -10
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/{src/api-context → api-context}/alert-global.js +49 -34
- package/dist/api-context/alert-global.js.map +1 -0
- package/dist/{src/api-context → api-context}/drawer-global.js +40 -33
- package/dist/api-context/drawer-global.js.map +1 -0
- package/dist/{src/api-context → api-context}/global-modal.js +40 -32
- package/dist/api-context/global-modal.js.map +1 -0
- package/dist/{src/api-context → api-context}/popover-global.js +44 -36
- package/dist/api-context/popover-global.js.map +1 -0
- package/dist/api-context/popover.js +94 -0
- package/dist/api-context/popover.js.map +1 -0
- package/dist/{src/api-context → api-context}/ui.units.js +12 -10
- package/dist/api-context/ui.units.js.map +1 -0
- package/dist/components/breadcrumbs.js +65 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/{src/components → components}/copy-to-clipboard.js +39 -32
- package/dist/components/copy-to-clipboard.js.map +1 -0
- package/dist/components/help-tooltip.js +104 -0
- package/dist/components/help-tooltip.js.map +1 -0
- package/dist/components/image-with-fallback.js +51 -0
- package/dist/components/image-with-fallback.js.map +1 -0
- package/dist/{src/components → components}/text-editor.js +24 -23
- package/dist/components/text-editor.js.map +1 -0
- package/dist/components/text-editor.preview.js +27 -0
- package/dist/components/text-editor.preview.js.map +1 -0
- package/dist/form/create.autocomplete.chips.js +228 -0
- package/dist/form/create.autocomplete.chips.js.map +1 -0
- package/dist/{src/form → form}/create.date-expired.js +71 -61
- package/dist/form/create.date-expired.js.map +1 -0
- package/dist/{src/form → form}/create.date-picker.js +40 -37
- package/dist/form/create.date-picker.js.map +1 -0
- package/dist/{src/form → form}/create.form-base.js +47 -41
- package/dist/form/create.form-base.js.map +1 -0
- package/dist/form/create.form-comfirm.js +131 -0
- package/dist/form/create.form-comfirm.js.map +1 -0
- package/dist/form/create.form-grid-layout.js +188 -0
- package/dist/form/create.form-grid-layout.js.map +1 -0
- package/dist/{src/form → form}/create.form-grid-layout.units.js +17 -14
- package/dist/form/create.form-grid-layout.units.js.map +1 -0
- package/dist/form/create.input.file.js +79 -0
- package/dist/form/create.input.file.js.map +1 -0
- package/dist/form/create.input.js +276 -0
- package/dist/form/create.input.js.map +1 -0
- package/dist/form/create.select-simple.js +114 -0
- package/dist/form/create.select-simple.js.map +1 -0
- package/dist/form/create.select-with-api.js +277 -0
- package/dist/form/create.select-with-api.js.map +1 -0
- package/dist/form/create.text-editor.js +181 -0
- package/dist/form/create.text-editor.js.map +1 -0
- package/dist/{src/form → form}/dino-form.js +17 -18
- package/dist/form/dino-form.js.map +1 -0
- package/dist/{src/form → form}/helper.js +14 -14
- package/dist/form/helper.js.map +1 -0
- package/dist/{src/form → form}/modal-wrapper.js +32 -25
- package/dist/form/modal-wrapper.js.map +1 -0
- package/dist/{src/form → form}/validator.js +47 -43
- package/dist/form/validator.js.map +1 -0
- package/dist/{src/hooks → hooks}/index.js +1 -1
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +928 -0
- package/dist/{src/index.js → index.js} +10 -3
- package/dist/{src/index.js.map → index.js.map} +1 -1
- package/dist/redux/create.hoc-lazy.js +71 -0
- package/dist/redux/create.hoc-lazy.js.map +1 -0
- package/dist/{src/redux → redux}/dino.js +2 -2
- package/dist/redux/dino.js.map +1 -0
- package/dist/redux/types.js.map +1 -0
- package/dist/redux/ui.error-page.js +89 -0
- package/dist/redux/ui.error-page.js.map +1 -0
- package/dist/redux/vector-404.webp.js.map +1 -0
- package/dist/{src/table → table}/context.js +5 -2
- package/dist/table/context.js.map +1 -0
- package/dist/table/create.action-row.js +144 -0
- package/dist/table/create.action-row.js.map +1 -0
- package/dist/table/create.table.js +246 -0
- package/dist/table/create.table.js.map +1 -0
- package/dist/{src/table → table}/custom.filter-operators.js +2 -2
- package/dist/table/custom.filter-operators.js.map +1 -0
- package/dist/table/dino.js +136 -0
- package/dist/table/dino.js.map +1 -0
- package/dist/{src/table → table}/helpers.js +31 -32
- package/dist/table/helpers.js.map +1 -0
- package/dist/table/model-filter.js.map +1 -0
- package/dist/table/toolbar-pannel.js +143 -0
- package/dist/table/toolbar-pannel.js.map +1 -0
- package/dist/table/ui.buttons.js +67 -0
- package/dist/table/ui.buttons.js.map +1 -0
- package/dist/table/ui.units.js +248 -0
- package/dist/table/ui.units.js.map +1 -0
- package/dist/types/api-context/alert-global.d.ts +29 -0
- package/dist/types/api-context/drawer-global.d.ts +32 -0
- package/dist/types/api-context/global-modal.d.ts +37 -0
- package/dist/types/api-context/index.d.ts +9 -0
- package/dist/types/api-context/popover-global.d.ts +37 -0
- package/dist/types/api-context/popover.d.ts +32 -0
- package/dist/types/api-context/ui.units.d.ts +2 -0
- package/dist/types/components/breadcrumbs.d.ts +13 -0
- package/dist/types/components/copy-to-clipboard.d.ts +26 -0
- package/dist/types/components/help-tooltip.d.ts +15 -0
- package/dist/types/components/image-with-fallback.d.ts +13 -0
- package/dist/types/components/index.d.ts +11 -0
- package/dist/types/components/input-debounce-timer.d.ts +9 -0
- package/dist/types/components/loading-buttons.d.ts +6 -0
- package/dist/types/components/text-editor.d.ts +26 -0
- package/dist/types/components/text-editor.preview.d.ts +5 -0
- package/dist/types/form/create.autocomplete.chips.d.ts +16 -0
- package/dist/types/form/create.date-expired.d.ts +19 -0
- package/dist/types/form/create.date-picker.d.ts +19 -0
- package/dist/types/form/create.form-base.d.ts +30 -0
- package/dist/types/form/create.form-comfirm.d.ts +20 -0
- package/dist/types/form/create.form-grid-layout.d.ts +44 -0
- package/dist/types/form/create.form-grid-layout.units.d.ts +8 -0
- package/dist/types/form/create.input.d.ts +29 -0
- package/dist/types/form/create.input.file.d.ts +16 -0
- package/dist/types/form/create.select-simple.d.ts +24 -0
- package/dist/types/form/create.select-with-api.d.ts +29 -0
- package/dist/types/form/create.text-editor.d.ts +42 -0
- package/dist/types/form/dino-form.d.ts +26 -0
- package/dist/types/form/helper.d.ts +14 -0
- package/dist/types/form/index.d.ts +7 -0
- package/dist/types/form/modal-wrapper.d.ts +14 -0
- package/dist/types/form/types.d.ts +15 -0
- package/dist/types/form/validator.d.ts +64 -0
- package/dist/types/hooks/index.d.ts +4 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/lab/create.autocomplete.simple.d.ts +19 -0
- package/dist/types/lab/create.dino-store.d.ts +1 -0
- package/dist/types/lab/create.multi-select-dropdown.d.ts +23 -0
- package/dist/types/lab/create.select-mul-with-api/index.d.ts +26 -0
- package/dist/types/lab/create.select-mul-with-api/table-custom.d.ts +43 -0
- package/dist/types/lab/create.select-mul-with-api/types.d.ts +21 -0
- package/dist/types/lab/create.select-mul-with-api/ui.units.d.ts +29 -0
- package/dist/types/lab/filter-bar/base.d.ts +34 -0
- package/dist/types/lab/filter-bar/create.filter-bar.d.ts +92 -0
- package/dist/types/lab/filter-bar/create.filter-menu.d.ts +66 -0
- package/dist/types/lab/filter-bar/create.filter-panel.d.ts +117 -0
- package/dist/types/lab/filter-bar/create.filtered.d.ts +59 -0
- package/dist/types/lab/filter-bar/create.sort-menu.d.ts +7 -0
- package/dist/types/lab/filter-bar/demo.d.ts +3 -0
- package/dist/types/lab/filter-bar/index.d.ts +4 -0
- package/dist/types/lab/filter-bar/types.d.ts +81 -0
- package/dist/types/lab/filter-bar/ui.units.d.ts +13 -0
- package/dist/types/lab/grafana-dashboard/configs.d.ts +4 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/absolute-time-rage.d.ts +14 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/helpers.d.ts +36 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/index.d.ts +24 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/menu-wrap.d.ts +19 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/quick-ranges.d.ts +20 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/types.d.ts +8 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/units.d.ts +2 -0
- package/dist/types/lab/grafana-dashboard/helper.d.ts +7 -0
- package/dist/types/lab/grafana-dashboard/hooks.d.ts +10 -0
- package/dist/types/lab/grafana-dashboard/icons.d.ts +5 -0
- package/dist/types/lab/grafana-dashboard/index.d.ts +12 -0
- package/dist/types/lab/grafana-dashboard/top-bar.d.ts +19 -0
- package/dist/types/lab/grafana-dashboard/top-bar.types.d.ts +4 -0
- package/dist/types/lab/grafana-dashboard/types.d.ts +8 -0
- package/dist/types/lab/media-player.core1.d.ts +14 -0
- package/dist/types/lab/media-player.muted.d.ts +10 -0
- package/dist/types/lab/media-player.units.d.ts +36 -0
- package/dist/types/lab/table-grid/create.table-grid.d.ts +4 -0
- package/dist/types/lab/table-grid/demo.d.ts +3 -0
- package/dist/types/lab/table-grid/dino.d.ts +6 -0
- package/dist/types/lab/table-grid/helpers.d.ts +11 -0
- package/dist/types/lab/table-grid/index.d.ts +2 -0
- package/dist/types/lab/table-grid/item-actions.d.ts +93 -0
- package/dist/types/lab/table-grid/toolbar-pannel.d.ts +27 -0
- package/dist/types/lab/table-grid/types.d.ts +56 -0
- package/dist/types/redux/create.hoc-lazy.d.ts +19 -0
- package/dist/types/redux/dino.d.ts +6 -0
- package/dist/types/redux/index.d.ts +4 -0
- package/dist/types/redux/types.d.ts +22 -0
- package/dist/types/redux/ui.error-page.d.ts +3 -0
- package/dist/types/redux/ui.units.d.ts +9 -0
- package/dist/types/table/context.d.ts +8 -0
- package/dist/types/table/create.action-row.d.ts +16 -0
- package/dist/types/table/create.table.d.ts +33 -0
- package/dist/types/table/custom.filter-operators.d.ts +2 -0
- package/dist/types/table/dino.d.ts +41 -0
- package/dist/types/table/helpers.d.ts +23 -0
- package/dist/types/table/index.d.ts +7 -0
- package/dist/types/table/model-filter.d.ts +38 -0
- package/dist/types/table/toolbar-pannel.d.ts +18 -0
- package/dist/types/table/types.d.ts +40 -0
- package/dist/types/table/ui.buttons.d.ts +16 -0
- package/dist/types/table/ui.units.d.ts +62 -0
- package/dist/types/utils/dayjs-config.d.ts +2 -0
- package/dist/types/utils/helpers.d.ts +35 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/json-object.d.ts +9 -0
- package/dist/types/utils/mfe-events.d.ts +12 -0
- package/dist/types/utils/query-param.d.ts +25 -0
- package/dist/utils/dayjs-config.js.map +1 -0
- package/dist/{src/utils → utils}/helpers.js +11 -9
- package/dist/utils/helpers.js.map +1 -0
- package/dist/{src/utils → utils}/json-object.js +13 -13
- package/dist/utils/json-object.js.map +1 -0
- package/dist/{src/utils → utils}/query-param.js +17 -17
- package/dist/utils/query-param.js.map +1 -0
- package/package.json +18 -4
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@1_d0d2002d9033600b6738d939bd598bc6/node_modules/tslib/tslib.es6.js +0 -46
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@1_d0d2002d9033600b6738d939bd598bc6/node_modules/tslib/tslib.es6.js.map +0 -1
- package/dist/src/api-context/alert-global.js.map +0 -1
- package/dist/src/api-context/drawer-global.js.map +0 -1
- package/dist/src/api-context/global-modal.js.map +0 -1
- package/dist/src/api-context/popover-global.js.map +0 -1
- package/dist/src/api-context/popover.js +0 -86
- package/dist/src/api-context/popover.js.map +0 -1
- package/dist/src/api-context/ui.units.js.map +0 -1
- package/dist/src/components/copy-to-clipboard.js.map +0 -1
- package/dist/src/components/custom.breadcrumbs.js +0 -61
- package/dist/src/components/custom.breadcrumbs.js.map +0 -1
- package/dist/src/components/help-tooltip.js +0 -91
- package/dist/src/components/help-tooltip.js.map +0 -1
- package/dist/src/components/image-with-fallback.js +0 -48
- package/dist/src/components/image-with-fallback.js.map +0 -1
- package/dist/src/components/text-editor.js.map +0 -1
- package/dist/src/form/create.autocomplete.chips.js +0 -218
- package/dist/src/form/create.autocomplete.chips.js.map +0 -1
- package/dist/src/form/create.date-expired.js.map +0 -1
- package/dist/src/form/create.date-picker.js.map +0 -1
- package/dist/src/form/create.form-base.js.map +0 -1
- package/dist/src/form/create.form-comfirm.js +0 -119
- package/dist/src/form/create.form-comfirm.js.map +0 -1
- package/dist/src/form/create.form-grid-layout.js +0 -177
- package/dist/src/form/create.form-grid-layout.js.map +0 -1
- package/dist/src/form/create.form-grid-layout.units.js.map +0 -1
- package/dist/src/form/create.input-base.js +0 -260
- package/dist/src/form/create.input-base.js.map +0 -1
- package/dist/src/form/create.input.file.js +0 -74
- package/dist/src/form/create.input.file.js.map +0 -1
- package/dist/src/form/create.select-simple.js +0 -104
- package/dist/src/form/create.select-simple.js.map +0 -1
- package/dist/src/form/create.select-with-api.js +0 -271
- package/dist/src/form/create.select-with-api.js.map +0 -1
- package/dist/src/form/create.text-editor.js +0 -156
- package/dist/src/form/create.text-editor.js.map +0 -1
- package/dist/src/form/dino-form.js.map +0 -1
- package/dist/src/form/helper.js.map +0 -1
- package/dist/src/form/modal-wrapper.js.map +0 -1
- package/dist/src/form/validator.js.map +0 -1
- package/dist/src/hooks/index.js.map +0 -1
- package/dist/src/redux/create.hoc-lazy.js +0 -67
- package/dist/src/redux/create.hoc-lazy.js.map +0 -1
- package/dist/src/redux/dino.js.map +0 -1
- package/dist/src/redux/types.js.map +0 -1
- package/dist/src/redux/ui.error-page.js +0 -80
- package/dist/src/redux/ui.error-page.js.map +0 -1
- package/dist/src/redux/vector-404.webp.js.map +0 -1
- package/dist/src/table/context.js.map +0 -1
- package/dist/src/table/create.action-row.js +0 -135
- package/dist/src/table/create.action-row.js.map +0 -1
- package/dist/src/table/create.status-cell.js +0 -49
- package/dist/src/table/create.status-cell.js.map +0 -1
- package/dist/src/table/create.table.js +0 -233
- package/dist/src/table/create.table.js.map +0 -1
- package/dist/src/table/custom.filter-operators.js.map +0 -1
- package/dist/src/table/dino.js +0 -129
- package/dist/src/table/dino.js.map +0 -1
- package/dist/src/table/helpers.js.map +0 -1
- package/dist/src/table/model-filter.js.map +0 -1
- package/dist/src/table/toolbar-pannel.js +0 -134
- package/dist/src/table/toolbar-pannel.js.map +0 -1
- package/dist/src/table/ui.buttons.js +0 -60
- package/dist/src/table/ui.buttons.js.map +0 -1
- package/dist/src/table/ui.units.js +0 -201
- package/dist/src/table/ui.units.js.map +0 -1
- package/dist/src/utils/dayjs-config.js.map +0 -1
- package/dist/src/utils/helpers.js.map +0 -1
- package/dist/src/utils/json-object.js.map +0 -1
- package/dist/src/utils/query-param.js.map +0 -1
- package/rollup.config.js +0 -39
- package/src/@types/global.d.ts +0 -5
- package/src/api-context/alert-global.tsx +0 -174
- package/src/api-context/drawer-global.tsx +0 -116
- package/src/api-context/global-modal.tsx +0 -109
- package/src/api-context/index.ts +0 -13
- package/src/api-context/popover-global.tsx +0 -107
- package/src/api-context/popover.tsx +0 -89
- package/src/api-context/ui.units.tsx +0 -10
- package/src/components/copy-to-clipboard.tsx +0 -86
- package/src/components/custom.breadcrumbs.tsx +0 -67
- package/src/components/help-tooltip.tsx +0 -75
- package/src/components/image-with-fallback.tsx +0 -51
- package/src/components/index.tsx +0 -1
- package/src/components/input-debounce-timer.tsx +0 -138
- package/src/components/loading-buttons.tsx +0 -35
- package/src/components/text-editor.preview.tsx +0 -30
- package/src/components/text-editor.tsx +0 -125
- package/src/form/README.md +0 -55
- package/src/form/create.autocomplete.chips.tsx +0 -199
- package/src/form/create.date-expired.tsx +0 -195
- package/src/form/create.date-picker.tsx +0 -122
- package/src/form/create.form-base.tsx +0 -102
- package/src/form/create.form-comfirm.tsx +0 -83
- package/src/form/create.form-grid-layout.tsx +0 -170
- package/src/form/create.form-grid-layout.units.tsx +0 -37
- package/src/form/create.input-base.tsx +0 -222
- package/src/form/create.input.file.tsx +0 -76
- package/src/form/create.select-simple.tsx +0 -101
- package/src/form/create.select-with-api.tsx +0 -213
- package/src/form/create.text-editor.tsx +0 -161
- package/src/form/dino-form.tsx +0 -40
- package/src/form/helper.ts +0 -132
- package/src/form/index.ts +0 -12
- package/src/form/modal-wrapper.tsx +0 -75
- package/src/form/types.ts +0 -16
- package/src/form/validator.ts +0 -202
- package/src/hooks/index.ts +0 -44
- package/src/index.ts +0 -7
- package/src/lab/create.autocomplete.simple.tsx +0 -57
- package/src/lab/create.dino-store.ts +0 -59
- package/src/lab/create.multi-select-dropdown.tsx +0 -189
- package/src/lab/create.select-mul-with-api/index.tsx +0 -271
- package/src/lab/create.select-mul-with-api/table-custom.tsx +0 -194
- package/src/lab/create.select-mul-with-api/types.ts +0 -26
- package/src/lab/create.select-mul-with-api/ui.units.tsx +0 -163
- package/src/lab/filter-bar/base.tsx +0 -162
- package/src/lab/filter-bar/create.filter-bar.tsx +0 -190
- package/src/lab/filter-bar/create.filter-menu.tsx +0 -156
- package/src/lab/filter-bar/create.filter-panel.tsx +0 -95
- package/src/lab/filter-bar/create.filtered.tsx +0 -41
- package/src/lab/filter-bar/create.sort-menu.tsx +0 -43
- package/src/lab/filter-bar/demo.tsx +0 -50
- package/src/lab/filter-bar/index.ts +0 -6
- package/src/lab/filter-bar/types.ts +0 -105
- package/src/lab/filter-bar/ui.units.tsx +0 -70
- package/src/lab/grafana-dashboard/configs.ts +0 -43
- package/src/lab/grafana-dashboard/date-time-range/absolute-time-rage.tsx +0 -137
- package/src/lab/grafana-dashboard/date-time-range/helpers.ts +0 -126
- package/src/lab/grafana-dashboard/date-time-range/index.tsx +0 -62
- package/src/lab/grafana-dashboard/date-time-range/menu-wrap.tsx +0 -101
- package/src/lab/grafana-dashboard/date-time-range/quick-ranges.tsx +0 -161
- package/src/lab/grafana-dashboard/date-time-range/types.ts +0 -9
- package/src/lab/grafana-dashboard/date-time-range/units.tsx +0 -18
- package/src/lab/grafana-dashboard/helper.ts +0 -25
- package/src/lab/grafana-dashboard/hooks.tsx +0 -79
- package/src/lab/grafana-dashboard/icons.tsx +0 -67
- package/src/lab/grafana-dashboard/index.tsx +0 -120
- package/src/lab/grafana-dashboard/top-bar.tsx +0 -62
- package/src/lab/grafana-dashboard/top-bar.types.ts +0 -5
- package/src/lab/grafana-dashboard/types.ts +0 -8
- package/src/lab/media-player.core1.tsx +0 -273
- package/src/lab/media-player.muted.tsx +0 -62
- package/src/lab/media-player.units.ts +0 -80
- package/src/lab/table-grid/create.table-grid.tsx +0 -183
- package/src/lab/table-grid/demo.tsx +0 -53
- package/src/lab/table-grid/dino.tsx +0 -8
- package/src/lab/table-grid/helpers.tsx +0 -11
- package/src/lab/table-grid/index.ts +0 -3
- package/src/lab/table-grid/item-actions.tsx +0 -138
- package/src/lab/table-grid/toolbar-pannel.tsx +0 -98
- package/src/lab/table-grid/types.ts +0 -68
- package/src/redux/create.hoc-lazy.tsx +0 -80
- package/src/redux/dino.ts +0 -9
- package/src/redux/index.ts +0 -6
- package/src/redux/types.ts +0 -27
- package/src/redux/ui.error-page.tsx +0 -62
- package/src/redux/ui.units.tsx +0 -41
- package/src/redux/vector-404.webp +0 -0
- package/src/table/context.tsx +0 -16
- package/src/table/create.action-row.tsx +0 -91
- package/src/table/create.status-cell.tsx +0 -51
- package/src/table/create.table.tsx +0 -239
- package/src/table/custom.filter-operators.ts +0 -94
- package/src/table/dino.tsx +0 -120
- package/src/table/helpers.ts +0 -94
- package/src/table/index.ts +0 -13
- package/src/table/model-filter.ts +0 -43
- package/src/table/toolbar-pannel.tsx +0 -106
- package/src/table/types.ts +0 -50
- package/src/table/ui.buttons.tsx +0 -54
- package/src/table/ui.units.tsx +0 -189
- package/src/utils/dayjs-config.ts +0 -13
- package/src/utils/helpers.ts +0 -171
- package/src/utils/index.ts +0 -7
- package/src/utils/json-object.ts +0 -29
- package/src/utils/mfe-events.tsx +0 -34
- package/src/utils/query-param.ts +0 -129
- package/tsconfig.json +0 -20
- /package/dist/{src/redux → redux}/types.js +0 -0
- /package/dist/{src/redux → redux}/vector-404.webp.js +0 -0
- /package/dist/{src/table → table}/model-filter.js +0 -0
- /package/dist/{src/utils → utils}/dayjs-config.js +0 -0
package/src/form/validator.ts
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { formatFileSize } from '../utils'
|
|
2
|
-
|
|
3
|
-
declare type ModelBase = { [key: string]: any }
|
|
4
|
-
|
|
5
|
-
export enum SingleRuleValidate {
|
|
6
|
-
Required = 'Required',
|
|
7
|
-
Regex = 'Regex',
|
|
8
|
-
RequiredValue = 'RequiredValue',
|
|
9
|
-
Array = 'Array',
|
|
10
|
-
Number = 'Number',
|
|
11
|
-
Email = 'Email',
|
|
12
|
-
PhoneNumber = 'PhoneNumber',
|
|
13
|
-
Url = 'Url',
|
|
14
|
-
File = 'File',
|
|
15
|
-
FileRequired = 'FileRequired',
|
|
16
|
-
Custom = 'Custom'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const MessageDefault = {
|
|
20
|
-
Required: 'The {0} is required',
|
|
21
|
-
Regex: 'The {0} is not match {1}',
|
|
22
|
-
RequiredValue: 'the {0} is not equal {1}',
|
|
23
|
-
Array: 'The {0} is not valid',
|
|
24
|
-
Number: '{0} must be a number',
|
|
25
|
-
Email: 'The {0} is not valid',
|
|
26
|
-
PhoneNumber: 'The {0} is not valid',
|
|
27
|
-
Url: 'The {0} is not valid',
|
|
28
|
-
File: 'File size must be less than {1}',
|
|
29
|
-
FileRequired: 'The {0} is required',
|
|
30
|
-
Custom: 'Error Custom'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface RuleOptions {
|
|
34
|
-
File: {
|
|
35
|
-
maxSize: number
|
|
36
|
-
// toal size of files
|
|
37
|
-
all?: boolean
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const MapRuleOptions = <TK extends keyof RuleOptions>(key: TK, options?: RuleOptions[TK]) => options
|
|
42
|
-
|
|
43
|
-
export interface IRuleOption<TModel = any> {
|
|
44
|
-
rule: SingleRuleValidate
|
|
45
|
-
message?: string
|
|
46
|
-
Value?: RegExp | ((value: any, model: TModel) => boolean) | number | Array<any> | boolean
|
|
47
|
-
options?: any
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface IConfigValue<TModel = any> {
|
|
51
|
-
Rules: IRuleOption<TModel>[]
|
|
52
|
-
label?: string
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface IModelError {
|
|
56
|
-
message: string
|
|
57
|
-
error: boolean
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type IFormValidatorConfig<TModel> = {
|
|
61
|
-
[key in keyof Extract<TModel, ModelBase>]?: IConfigValue<TModel>
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type PartialError<TModel> = {
|
|
65
|
-
[key in keyof TModel]?: IRuleOption<TModel>[]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default class FormValidator<TModel> {
|
|
69
|
-
configs: IFormValidatorConfig<TModel>
|
|
70
|
-
constructor(configs: IFormValidatorConfig<TModel>) {
|
|
71
|
-
this.configs = configs
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static initial = <T>(configs: IFormValidatorConfig<T>) => new FormValidator(configs)
|
|
75
|
-
|
|
76
|
-
AddRules = (key: keyof TModel, ...rule: IRuleOption<TModel>[]) => {
|
|
77
|
-
let fieldConfig = this.configs[key]
|
|
78
|
-
if (!fieldConfig) {
|
|
79
|
-
fieldConfig = { Rules: [] }
|
|
80
|
-
this.configs[key] = fieldConfig
|
|
81
|
-
}
|
|
82
|
-
fieldConfig.Rules.push(...rule)
|
|
83
|
-
return this
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
Required = (RuleOption: IRuleOption, value: any) => {
|
|
87
|
-
return value === null || value === undefined || value === ''
|
|
88
|
-
}
|
|
89
|
-
Regex = (RuleOption: IRuleOption, value: string, Regex: RegExp) => {
|
|
90
|
-
if (!value) return false
|
|
91
|
-
return !(RuleOption.Value as RegExp).test(value)
|
|
92
|
-
}
|
|
93
|
-
RequiredValue = (RuleOption: IRuleOption, value: any) => {
|
|
94
|
-
if (!value) return false
|
|
95
|
-
return value !== RuleOption.Value
|
|
96
|
-
}
|
|
97
|
-
Custom = (RuleOption: IRuleOption, value: any, model: any) => {
|
|
98
|
-
if (typeof RuleOption.Value === 'function') {
|
|
99
|
-
return RuleOption.Value(value, model)
|
|
100
|
-
}
|
|
101
|
-
return true
|
|
102
|
-
}
|
|
103
|
-
Array = (RuleOption: IRuleOption, value: any) => {
|
|
104
|
-
if (!value) return false
|
|
105
|
-
if (typeof RuleOption.Value === 'number') {
|
|
106
|
-
return Array.isArray(value) ? value.length <= RuleOption.Value : true
|
|
107
|
-
}
|
|
108
|
-
return true
|
|
109
|
-
}
|
|
110
|
-
Number = (RuleOption: IRuleOption, value: any) => {
|
|
111
|
-
if (!value) return false
|
|
112
|
-
return isNaN(Number(value))
|
|
113
|
-
}
|
|
114
|
-
Email = (RuleOption: IRuleOption, value: any) => {
|
|
115
|
-
if (!value) return false
|
|
116
|
-
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
|
|
117
|
-
return !regex.test(value)
|
|
118
|
-
}
|
|
119
|
-
PhoneNumber = (RuleOption: IRuleOption, value: any) => {
|
|
120
|
-
if (!value) return false
|
|
121
|
-
const phoneRegex = /^(\+?\d{1,4}[\s-]?)?((\(\d{1,4}\))|\d{1,4})[\s-]?\d{1,4}[\s-]?\d{1,9}$/
|
|
122
|
-
return !phoneRegex.test((value ?? '').trim())
|
|
123
|
-
}
|
|
124
|
-
Url = (RuleOption: IRuleOption, value: any) => {
|
|
125
|
-
if (!value) return false
|
|
126
|
-
try {
|
|
127
|
-
new URL(value)
|
|
128
|
-
return false
|
|
129
|
-
} catch (err) {
|
|
130
|
-
return true
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
File = (RuleOption: IRuleOption, value: any) => {
|
|
134
|
-
if (!value) return false
|
|
135
|
-
const options = MapRuleOptions('File', RuleOption.options)
|
|
136
|
-
const files: File[] = Array.isArray(value) ? value : [value]
|
|
137
|
-
if (!options) return false
|
|
138
|
-
if (options.all === true) {
|
|
139
|
-
const size = files.reduce((a, b) => {
|
|
140
|
-
a += b.size
|
|
141
|
-
return a
|
|
142
|
-
}, 0)
|
|
143
|
-
return size > options.maxSize
|
|
144
|
-
} else {
|
|
145
|
-
return files.some((x) => x.size > options.maxSize)
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
FileRequired = (RuleOption: IRuleOption, value: any) => {
|
|
149
|
-
const files: File[] = Array.isArray(value) ? value : [value]
|
|
150
|
-
return !!files.filter((x) => !!x).some((x) => x.size <= 0)
|
|
151
|
-
}
|
|
152
|
-
RenderMessage = (RuleOption: IRuleOption, key: string, label?: string) => {
|
|
153
|
-
if (!RuleOption.message) {
|
|
154
|
-
RuleOption.message = MessageDefault[RuleOption.rule].replace('{0}', label ?? key)
|
|
155
|
-
switch (RuleOption.rule) {
|
|
156
|
-
case SingleRuleValidate.Regex: {
|
|
157
|
-
RuleOption.message = RuleOption.message.replace('{1}', (RuleOption.Value as RegExp).source)
|
|
158
|
-
break
|
|
159
|
-
}
|
|
160
|
-
case SingleRuleValidate.RequiredValue: {
|
|
161
|
-
RuleOption.message = RuleOption.message.replace('{1}', RuleOption.Value?.toString() ?? '')
|
|
162
|
-
break
|
|
163
|
-
}
|
|
164
|
-
case SingleRuleValidate.File: {
|
|
165
|
-
const options = MapRuleOptions('File', RuleOption.options)
|
|
166
|
-
if (options?.all === true) {
|
|
167
|
-
RuleOption.message = `Total file size must be less than ${formatFileSize((options?.maxSize ?? 0) / 1024)}`
|
|
168
|
-
} else {
|
|
169
|
-
RuleOption.message = RuleOption.message.replace('{1}', formatFileSize((options?.maxSize ?? 0) / 1024))
|
|
170
|
-
}
|
|
171
|
-
break
|
|
172
|
-
}
|
|
173
|
-
default:
|
|
174
|
-
break
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
RuleOption.message = RuleOption.message.replace('{0}', key)
|
|
178
|
-
return RuleOption
|
|
179
|
-
}
|
|
180
|
-
run = (model: TModel) => {
|
|
181
|
-
const keys = Object.keys(this.configs)
|
|
182
|
-
const data: PartialError<TModel> = {}
|
|
183
|
-
keys.forEach((key) => {
|
|
184
|
-
const config = this.configs[key]
|
|
185
|
-
if (!config) return
|
|
186
|
-
const tmp = this.Executed(config, (model as any)[key], model)
|
|
187
|
-
if (tmp.length < 1) return
|
|
188
|
-
;(data as any)[key] = tmp.map((x) => this.RenderMessage(x, key, config.label))
|
|
189
|
-
})
|
|
190
|
-
return data
|
|
191
|
-
}
|
|
192
|
-
Executed = (Config: IConfigValue, valueField: any, model: any) => {
|
|
193
|
-
return Config.Rules.filter((Value) => {
|
|
194
|
-
const action = (this as any)[Value.rule.toString()]
|
|
195
|
-
return action && action(Value, valueField, model)
|
|
196
|
-
})
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export const CreateFormValidator = <TModel>() => {
|
|
201
|
-
return new FormValidator<Partial<TModel>>({})
|
|
202
|
-
}
|
package/src/hooks/index.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps*/
|
|
2
|
-
import { useEffect, useState } from 'react'
|
|
3
|
-
|
|
4
|
-
export const useCheckScrolled = () => {
|
|
5
|
-
const [isScrolled, setIsScrolled] = useState(false)
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const handleScroll = () => {
|
|
9
|
-
const scrolled = window.scrollY > 0
|
|
10
|
-
if (scrolled !== isScrolled) setIsScrolled(scrolled)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
window.addEventListener('scroll', handleScroll)
|
|
14
|
-
return () => window.removeEventListener('scroll', handleScroll)
|
|
15
|
-
}, [isScrolled])
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const scrolled = window.scrollY > 0
|
|
19
|
-
if (scrolled !== isScrolled) setIsScrolled(scrolled)
|
|
20
|
-
}, [])
|
|
21
|
-
|
|
22
|
-
return { isScrolled }
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const useDebounce = <T>(value: T, delay: number): T => {
|
|
26
|
-
const [debouncedValue, setDebouncedValue] = useState<T>(value)
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (delay <= 0) {
|
|
30
|
-
setDebouncedValue(value)
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const handler = setTimeout(() => {
|
|
35
|
-
setDebouncedValue(value)
|
|
36
|
-
}, delay)
|
|
37
|
-
|
|
38
|
-
return () => {
|
|
39
|
-
clearTimeout(handler)
|
|
40
|
-
}
|
|
41
|
-
}, [value, delay])
|
|
42
|
-
|
|
43
|
-
return debouncedValue
|
|
44
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Autocomplete, AutocompleteProps, TextField } from '@mui/material'
|
|
2
|
-
import React, { Component } from 'react'
|
|
3
|
-
import { IFormInputBase } from '../form/types'
|
|
4
|
-
|
|
5
|
-
interface AutocompleteSimpleModel<O = any> {
|
|
6
|
-
value: string
|
|
7
|
-
label?: string
|
|
8
|
-
other?: O
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type OptionsGetter<T, O = any> = (value: any, model: T) => AutocompleteSimpleModel<O>
|
|
12
|
-
|
|
13
|
-
interface ISlots<O> {
|
|
14
|
-
options?: AutocompleteSimpleModel<O>[]
|
|
15
|
-
autocompleteProps?: AutocompleteProps<any, any, any, any>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface IProps<T, O> extends IFormInputBase<T>, ISlots<O> {}
|
|
19
|
-
|
|
20
|
-
interface IState {}
|
|
21
|
-
|
|
22
|
-
function CreateAutocompleteSimple<T, O = any>(params: ISlots<O>) {
|
|
23
|
-
class AutocompleteSimple extends Component<IProps<T, O>> {
|
|
24
|
-
private _cachedSlots: ISlots<O> = {}
|
|
25
|
-
constructor(props: IProps<T, O>) {
|
|
26
|
-
super(props)
|
|
27
|
-
this._cachedSlots = this.mergeSlots(props.slots) ?? {}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get slots() {
|
|
31
|
-
return this._cachedSlots
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get defaulValue(): string {
|
|
35
|
-
const { data, name } = this.props
|
|
36
|
-
return this.props.defaultValue ?? (!!data && !!name ? data[name]?.toString() : undefined)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
mergeSlots = (currentSlots?: ISlots<O>): ISlots<O> => ({
|
|
40
|
-
options: currentSlots?.options ?? params.options
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
render() {
|
|
44
|
-
return (
|
|
45
|
-
<Autocomplete
|
|
46
|
-
disablePortal
|
|
47
|
-
options={this.slots.options ?? []}
|
|
48
|
-
sx={{ width: 300 }}
|
|
49
|
-
renderInput={(params) => <TextField {...params} label='Movie' />}
|
|
50
|
-
/>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return AutocompleteSimple
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default CreateAutocompleteSimple
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { mergeObjects, QueryParam, tryParseObject } from '../utils'
|
|
2
|
-
|
|
3
|
-
export interface DinoSubFilter {}
|
|
4
|
-
|
|
5
|
-
interface DinoQueryModel {
|
|
6
|
-
meta?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface DinoStoreParams<T> {
|
|
10
|
-
key: string
|
|
11
|
-
enableQueryParam?: boolean
|
|
12
|
-
enableLocalStorage?: boolean
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function DinoStore<T = any>(params: DinoStoreParams<T>) {
|
|
16
|
-
const storeKey = 'dino_store'
|
|
17
|
-
class DinoStoreBase {
|
|
18
|
-
data: Record<string, any> = {}
|
|
19
|
-
defaultValue: DinoSubFilter = { isTracked: false, listNumber: 0 }
|
|
20
|
-
|
|
21
|
-
setStore = (value: any) => {
|
|
22
|
-
localStorage.setItem(storeKey, JSON.stringify(value))
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
private getStore = () => {
|
|
26
|
-
const value = localStorage.getItem(storeKey)
|
|
27
|
-
return tryParseObject(value, {})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// setQueryUrl = (value: DinoSubFilter) => {
|
|
31
|
-
// let obj: DinoSubFilter | undefined = value
|
|
32
|
-
// // if (value.listNumber === this.defaultValue.listNumber && value.isTracked === this.defaultValue.isTracked) obj = undefined
|
|
33
|
-
// QueryParam.Patch<DinoQueryModel>({ meta: obj ? JSON.stringify(obj) : undefined })
|
|
34
|
-
// }
|
|
35
|
-
// getQueryUrl = (): DinoSubFilter => {
|
|
36
|
-
// const obj = QueryParam.Gets<DinoQueryModel>('meta')
|
|
37
|
-
// return tryParseObject(obj.meta, {})
|
|
38
|
-
// }
|
|
39
|
-
// setLocaStorage = (value: DinoSubFilter) => {
|
|
40
|
-
// localStorage.setItem(params.storeKey, JSON.stringify(value))
|
|
41
|
-
// }
|
|
42
|
-
// getLocalStorage = () => {
|
|
43
|
-
// const value = localStorage.getItem(params.storeKey)
|
|
44
|
-
// return tryParseObject(value, {})
|
|
45
|
-
// }
|
|
46
|
-
// setAll = (value: DinoSubFilter) => {
|
|
47
|
-
// this.setQueryUrl(value)
|
|
48
|
-
// this.setLocaStorage(value)
|
|
49
|
-
// }
|
|
50
|
-
// getAll = () => {
|
|
51
|
-
// const obj1 = this.getQueryUrl()
|
|
52
|
-
// const obj2 = this.getLocalStorage()
|
|
53
|
-
// return mergeObjects(obj2, obj1)
|
|
54
|
-
// }
|
|
55
|
-
}
|
|
56
|
-
return new DinoStoreBase()
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export {}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import React, { FC, useEffect, useState } from 'react'
|
|
2
|
-
import { FormControlLabel, List, ListItem, Popover, styled, TextField, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material'
|
|
3
|
-
import { Badge, badgeClasses, Box, BoxProps, Button, ButtonProps, Checkbox } from '@mui/material'
|
|
4
|
-
import FilterAltOutlinedIcon from '@mui/icons-material/FilterAltOutlined'
|
|
5
|
-
import { mergeObjects } from '../utils'
|
|
6
|
-
import HelpTooltip from '../components/help-tooltip'
|
|
7
|
-
|
|
8
|
-
enum ELogic {
|
|
9
|
-
AND = 'and',
|
|
10
|
-
OR = 'or'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface MultiSelectDropdownFilter {
|
|
14
|
-
logic?: ELogic
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface ISlots {
|
|
18
|
-
buttonProps?: ButtonProps
|
|
19
|
-
contentPorps?: BoxProps
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface IProps {
|
|
23
|
-
options?: string[]
|
|
24
|
-
value?: string[]
|
|
25
|
-
onChange?: (value: string[], filter?: MultiSelectDropdownFilter) => void
|
|
26
|
-
slots?: ISlots
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface IParams extends ISlots {
|
|
30
|
-
btnText: string
|
|
31
|
-
options?: string[]
|
|
32
|
-
placeholder?: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function CreateMultiSelectDropdown(params: IParams) {
|
|
36
|
-
const MenuSelectMultiple: FC<IProps> = (props) => {
|
|
37
|
-
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
|
|
38
|
-
const [selectedOptions, setSelectedOptions] = useState<string[]>([])
|
|
39
|
-
const [options, setOptions] = useState<string[]>(props.options ?? params.options ?? [])
|
|
40
|
-
const [search, setSearch] = useState('')
|
|
41
|
-
const [filterLogic, setFilterLogic] = useState<ELogic>(ELogic.AND)
|
|
42
|
-
|
|
43
|
-
const mergeConfig = {
|
|
44
|
-
buttonProps: mergeObjects<ButtonProps>(params?.buttonProps, props.slots?.buttonProps),
|
|
45
|
-
contentProps: props.slots?.contentPorps ?? params?.contentPorps ?? {}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
49
|
-
setAnchorEl(event.currentTarget)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const handleClose = (event?: {}, reason?: 'backdropClick' | 'escapeKeyDown') => {
|
|
53
|
-
setAnchorEl(null)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const handleToggle = (value: string) => {
|
|
57
|
-
setSelectedOptions((prev) => (prev.includes(value) ? prev.filter((t) => t !== value) : [...prev, value]))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const handleClear = () => {
|
|
61
|
-
setSelectedOptions([])
|
|
62
|
-
props.onChange && props.onChange([])
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const handleCancel = () => {
|
|
66
|
-
setSelectedOptions(props.value ?? [])
|
|
67
|
-
handleClose()
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const handleApply = () => {
|
|
71
|
-
props.onChange && props.onChange(selectedOptions)
|
|
72
|
-
handleClose()
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const getOptions = () => {
|
|
76
|
-
const values = props.value ?? []
|
|
77
|
-
const list = options.filter((x) => x.toLowerCase().includes(search.toLowerCase())).sort((a, b) => a.localeCompare(b))
|
|
78
|
-
|
|
79
|
-
const prioritized = list.filter((x) => values.includes(x))
|
|
80
|
-
const others = list.filter((x) => !values.includes(x))
|
|
81
|
-
|
|
82
|
-
return [...prioritized, ...others]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
if (props.options && props.options.length > 0) setOptions(props.options)
|
|
87
|
-
}, [props.options])
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
setSelectedOptions(props.value ?? [])
|
|
91
|
-
}, [props.value])
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<>
|
|
95
|
-
<Button color='inherit' endIcon={<FilterAltOutlinedIcon />} {...mergeConfig.buttonProps} onClick={handleOpen}>
|
|
96
|
-
{params.btnText}
|
|
97
|
-
<ButtonBadge badgeContent={props.value?.length} color='error' overlap='circular' sx={{ transform: 'translateY(-50%) translateX(24px)' }} />
|
|
98
|
-
</Button>
|
|
99
|
-
<CustomPopover open={Boolean(anchorEl)} anchorEl={anchorEl} onClose={handleClose} anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}>
|
|
100
|
-
<WrapActions className='top'>
|
|
101
|
-
<TextField
|
|
102
|
-
size='small'
|
|
103
|
-
placeholder={params.placeholder ?? 'Search'}
|
|
104
|
-
fullWidth
|
|
105
|
-
value={search}
|
|
106
|
-
onChange={(e) => setSearch(e.target.value)}
|
|
107
|
-
/>
|
|
108
|
-
<ToggleButtonGroup
|
|
109
|
-
size='small'
|
|
110
|
-
exclusive
|
|
111
|
-
color='primary'
|
|
112
|
-
value={filterLogic}
|
|
113
|
-
onChange={(_, value) => {
|
|
114
|
-
if (value) setFilterLogic(value)
|
|
115
|
-
}}
|
|
116
|
-
>
|
|
117
|
-
<ToggleButton value={ELogic.AND}>AND</ToggleButton>
|
|
118
|
-
<ToggleButton value={ELogic.OR}>OR</ToggleButton>
|
|
119
|
-
</ToggleButtonGroup>
|
|
120
|
-
<HelpTooltip title='Filter Logic' small>
|
|
121
|
-
<Typography variant='body2' color='text.secondary'>
|
|
122
|
-
Choose how multiple categories are applied.
|
|
123
|
-
<br />
|
|
124
|
-
<strong> AND </strong> requires all selected categories, while
|
|
125
|
-
<br />
|
|
126
|
-
<strong> OR </strong> matches any.
|
|
127
|
-
</Typography>
|
|
128
|
-
</HelpTooltip>
|
|
129
|
-
</WrapActions>
|
|
130
|
-
<Box className='menu-content' {...mergeConfig.contentProps}>
|
|
131
|
-
<List>
|
|
132
|
-
{getOptions().map((x) => (
|
|
133
|
-
<ListItem key={x} sx={{ whiteSpace: 'nowrap' }}>
|
|
134
|
-
<FormControlLabel label={x} control={<Checkbox checked={selectedOptions.includes(x)} onChange={() => handleToggle(x)} />} />
|
|
135
|
-
</ListItem>
|
|
136
|
-
))}
|
|
137
|
-
</List>
|
|
138
|
-
</Box>
|
|
139
|
-
<WrapActions>
|
|
140
|
-
<Button size='small' onClick={handleClear} color='inherit'>
|
|
141
|
-
Clear
|
|
142
|
-
</Button>
|
|
143
|
-
<Box sx={{ flex: 1 }} />
|
|
144
|
-
<Button size='small' onClick={handleCancel} color='inherit'>
|
|
145
|
-
Cancel
|
|
146
|
-
</Button>
|
|
147
|
-
<Button size='small' variant='contained' onClick={handleApply}>
|
|
148
|
-
Apply
|
|
149
|
-
</Button>
|
|
150
|
-
</WrapActions>
|
|
151
|
-
</CustomPopover>
|
|
152
|
-
</>
|
|
153
|
-
)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return MenuSelectMultiple
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export default CreateMultiSelectDropdown
|
|
160
|
-
|
|
161
|
-
const heightItem = 58
|
|
162
|
-
const CustomPopover = styled(Popover)({
|
|
163
|
-
'.MuiPaper-root': {
|
|
164
|
-
overflow: 'hidden',
|
|
165
|
-
position: 'relative',
|
|
166
|
-
width: '360px'
|
|
167
|
-
},
|
|
168
|
-
'.menu-content': {
|
|
169
|
-
overflowY: 'auto',
|
|
170
|
-
// minWidth: '300px',
|
|
171
|
-
maxHeight: `${heightItem * 5}px`,
|
|
172
|
-
margin: '2px 2px 2px 0'
|
|
173
|
-
}
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
const ButtonBadge = styled(Badge)({
|
|
177
|
-
[`& .${badgeClasses.badge}`]: {
|
|
178
|
-
top: '-12px',
|
|
179
|
-
right: '-6px'
|
|
180
|
-
}
|
|
181
|
-
})
|
|
182
|
-
const WrapActions = styled(Box)({
|
|
183
|
-
alignItems: 'center',
|
|
184
|
-
display: 'flex',
|
|
185
|
-
gap: '6px',
|
|
186
|
-
height: '58px',
|
|
187
|
-
padding: '8px 10px',
|
|
188
|
-
boxShadow: 'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px'
|
|
189
|
-
})
|