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
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { inherits as _inherits, createClass as _createClass, classCallCheck as _classCallCheck, callSuper as _callSuper, defineProperty as _defineProperty, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Component } from 'react';
|
|
4
|
+
import { styled, Button, Box, Card, DialogTitle, DialogContent, DialogActions } from '@mui/material';
|
|
5
|
+
import { fetchDelay } from '../utils/helpers.js';
|
|
6
|
+
import '../utils/query-param.js';
|
|
7
|
+
import '../utils/dayjs-config.js';
|
|
8
|
+
import '../api-context/alert-global.js';
|
|
9
|
+
import '../api-context/drawer-global.js';
|
|
10
|
+
import { MapGlobalModalContext } from '../api-context/global-modal.js';
|
|
11
|
+
|
|
12
|
+
var CreateFormComfirm = function CreateFormComfirm(param) {
|
|
13
|
+
var FormConfirm = /*#__PURE__*/function (_Component) {
|
|
14
|
+
function FormConfirm(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
_classCallCheck(this, FormConfirm);
|
|
17
|
+
_this = _callSuper(this, FormConfirm, [props]);
|
|
18
|
+
_defineProperty(_this, "handleClickNo", function (context) {
|
|
19
|
+
context.close();
|
|
20
|
+
_this.props.onCancel && _this.props.onCancel();
|
|
21
|
+
});
|
|
22
|
+
_defineProperty(_this, "handleClickYes", /*#__PURE__*/function () {
|
|
23
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(context) {
|
|
24
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
if (_this.props.onSubmit) {
|
|
28
|
+
_context.next = 2;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
return _context.abrupt("return");
|
|
32
|
+
case 2:
|
|
33
|
+
_context.prev = 2;
|
|
34
|
+
_this.setState({
|
|
35
|
+
loading: true
|
|
36
|
+
});
|
|
37
|
+
_context.next = 6;
|
|
38
|
+
return fetchDelay(function () {
|
|
39
|
+
return _this.props.onSubmit(_this.props.data);
|
|
40
|
+
}, 700);
|
|
41
|
+
case 6:
|
|
42
|
+
context.close();
|
|
43
|
+
_context.next = 12;
|
|
44
|
+
break;
|
|
45
|
+
case 9:
|
|
46
|
+
_context.prev = 9;
|
|
47
|
+
_context.t0 = _context["catch"](2);
|
|
48
|
+
console.log(_context.t0);
|
|
49
|
+
case 12:
|
|
50
|
+
_context.prev = 12;
|
|
51
|
+
_this.setState({
|
|
52
|
+
loading: false
|
|
53
|
+
});
|
|
54
|
+
return _context.finish(12);
|
|
55
|
+
case 15:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context.stop();
|
|
58
|
+
}
|
|
59
|
+
}, _callee, null, [[2, 9, 12, 15]]);
|
|
60
|
+
}));
|
|
61
|
+
return function (_x) {
|
|
62
|
+
return _ref.apply(this, arguments);
|
|
63
|
+
};
|
|
64
|
+
}());
|
|
65
|
+
_this.state = {
|
|
66
|
+
loading: false
|
|
67
|
+
};
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
_inherits(FormConfirm, _Component);
|
|
71
|
+
return _createClass(FormConfirm, [{
|
|
72
|
+
key: "render",
|
|
73
|
+
value: function render() {
|
|
74
|
+
var _ref2,
|
|
75
|
+
_this$props$title,
|
|
76
|
+
_this2 = this;
|
|
77
|
+
var content = this.props.children || (param !== null && param !== void 0 && param.content ? param === null || param === void 0 ? void 0 : param.content(this.props.data) : undefined);
|
|
78
|
+
var title = (_ref2 = (_this$props$title = this.props.title) !== null && _this$props$title !== void 0 ? _this$props$title : param === null || param === void 0 ? void 0 : param.title) !== null && _ref2 !== void 0 ? _ref2 : 'Are you sure?';
|
|
79
|
+
return jsx(Box, {
|
|
80
|
+
sx: {
|
|
81
|
+
flex: 1,
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
justifyContent: 'center'
|
|
85
|
+
},
|
|
86
|
+
children: MapGlobalModalContext(function (context) {
|
|
87
|
+
var _param$colors, _param$colors2;
|
|
88
|
+
return jsxs(Card, {
|
|
89
|
+
children: [jsx(DialogTitle, {
|
|
90
|
+
id: 'alert-dialog-title',
|
|
91
|
+
children: title
|
|
92
|
+
}), jsx(DialogContent, {
|
|
93
|
+
sx: {
|
|
94
|
+
minWidth: '300px'
|
|
95
|
+
},
|
|
96
|
+
children: content
|
|
97
|
+
}), jsxs(DialogActions, {
|
|
98
|
+
children: [jsx(CustomButton, {
|
|
99
|
+
disabled: _this2.state.loading,
|
|
100
|
+
color: (param === null || param === void 0 || (_param$colors = param.colors) === null || _param$colors === void 0 ? void 0 : _param$colors.no) || 'inherit',
|
|
101
|
+
onClick: function onClick() {
|
|
102
|
+
return _this2.handleClickNo(context);
|
|
103
|
+
},
|
|
104
|
+
children: "No"
|
|
105
|
+
}), jsx(CustomButton, {
|
|
106
|
+
color: (param === null || param === void 0 || (_param$colors2 = param.colors) === null || _param$colors2 === void 0 ? void 0 : _param$colors2.yes) || 'error',
|
|
107
|
+
disabled: _this2.state.loading,
|
|
108
|
+
onClick: function onClick() {
|
|
109
|
+
return _this2.handleClickYes(context);
|
|
110
|
+
},
|
|
111
|
+
children: "Yes"
|
|
112
|
+
})]
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}]);
|
|
119
|
+
}(Component);
|
|
120
|
+
return FormConfirm;
|
|
121
|
+
};
|
|
122
|
+
var CustomButton = styled(Button)({
|
|
123
|
+
textTransform: 'capitalize',
|
|
124
|
+
fontWeight: 600,
|
|
125
|
+
'&.MuiButton-colorInherit': {
|
|
126
|
+
color: '#606060!important'
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export { CreateFormComfirm as default };
|
|
131
|
+
//# sourceMappingURL=create.form-comfirm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.form-comfirm.js","sources":["../../src/form/create.form-comfirm.tsx"],"sourcesContent":["import React, { Component, ComponentType } from 'react'\r\nimport { Box, Button, Card, DialogActions, DialogContent, DialogTitle, styled } from '@mui/material'\r\nimport { fetchDelay } from '../utils'\r\nimport { IGlobalModalContext, MapGlobalModalContext } from '../api-context'\r\n\r\nexport interface IFormComfirmParam<T> {\r\n title?: string\r\n content: (value?: T) => JSX.Element\r\n colors?: {\r\n yes?: 'inherit' | 'error' | 'primary' | 'secondary' | 'success' | 'info' | 'warning'\r\n no?: 'inherit' | 'error' | 'primary' | 'secondary' | 'success' | 'info' | 'warning'\r\n }\r\n}\r\n\r\nexport interface IFormComfirmProps<T> {\r\n data?: T\r\n title?: string\r\n onSubmit: (value?: T) => Promise<void>\r\n onCancel?: () => void\r\n}\r\n\r\nexport interface IFormComfirmState {\r\n loading?: boolean\r\n}\r\n\r\nconst CreateFormComfirm = function <T = any>(param?: IFormComfirmParam<T>): ComponentType<React.PropsWithChildren<IFormComfirmProps<T>>> {\r\n class FormConfirm extends Component<React.PropsWithChildren<IFormComfirmProps<T>>, IFormComfirmState> {\r\n constructor(props: IFormComfirmProps<T>) {\r\n super(props)\r\n this.state = { loading: false }\r\n }\r\n\r\n render() {\r\n const content = this.props.children || (param?.content ? param?.content(this.props.data) : undefined)\r\n const title = this.props.title ?? param?.title ?? 'Are you sure?'\r\n return (\r\n <Box sx={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\r\n {MapGlobalModalContext((context) => (\r\n <Card>\r\n <DialogTitle id='alert-dialog-title'>{title}</DialogTitle>\r\n <DialogContent sx={{ minWidth: '300px' }}>{content}</DialogContent>\r\n <DialogActions>\r\n <CustomButton disabled={this.state.loading} color={param?.colors?.no || 'inherit'} onClick={() => this.handleClickNo(context)}>\r\n No\r\n </CustomButton>\r\n <CustomButton color={param?.colors?.yes || 'error'} disabled={this.state.loading} onClick={() => this.handleClickYes(context)}>\r\n Yes\r\n </CustomButton>\r\n </DialogActions>\r\n </Card>\r\n ))}\r\n </Box>\r\n )\r\n }\r\n\r\n handleClickNo = (context: IGlobalModalContext) => {\r\n context.close()\r\n this.props.onCancel && this.props.onCancel()\r\n }\r\n\r\n handleClickYes = async (context: IGlobalModalContext) => {\r\n if (!this.props.onSubmit) return\r\n try {\r\n this.setState({ loading: true })\r\n await fetchDelay(() => this.props.onSubmit(this.props.data), 700)\r\n context.close()\r\n } catch (error) {\r\n console.log(error)\r\n } finally {\r\n this.setState({ loading: false })\r\n }\r\n }\r\n }\r\n return FormConfirm\r\n}\r\nexport default CreateFormComfirm\r\n\r\nconst CustomButton = styled(Button)({\r\n textTransform: 'capitalize',\r\n fontWeight: 600,\r\n '&.MuiButton-colorInherit': {\r\n color: '#606060!important'\r\n }\r\n})\r\n"],"names":["CreateFormComfirm","param","FormConfirm","_Component","props","_this","_classCallCheck","_callSuper","_defineProperty","context","close","onCancel","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_callee$","_context","prev","next","onSubmit","abrupt","setState","loading","fetchDelay","data","t0","console","log","finish","stop","_x","apply","arguments","state","_inherits","_createClass","key","value","render","_ref2","_this$props$title","_this2","content","children","undefined","title","_jsx","Box","sx","flex","display","alignItems","justifyContent","MapGlobalModalContext","_param$colors","_param$colors2","_jsxs","Card","DialogTitle","id","DialogContent","minWidth","DialogActions","CustomButton","disabled","color","colors","no","onClick","handleClickNo","yes","handleClickYes","Component","styled","Button","textTransform","fontWeight"],"mappings":";;;;;;;;;;;AAyBA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAsBC,KAA4B,EAAA;EAAA,IACjEC,WAAY,0BAAAC,UAAA,EAAA;IAChB,SAAAD,WAAAA,CAAYE,KAA2B,EAAA;AAAA,MAAA,IAAAC,KAAA;AAAAC,MAAAA,eAAA,OAAAJ,WAAA,CAAA;AACrCG,MAAAA,KAAA,GAAAE,UAAA,CAAAL,IAAAA,EAAAA,WAAA,GAAME,KAAK,CAAA,CAAA;AAACI,MAAAA,eAAA,CAAAH,KAAA,EA2BE,eAAA,EAAA,UAACI,OAA4B,EAAI;QAC/C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D,aAAA,GAALxD,KAAK,CAAEoE,MAAM,cAAAZ,aAAA,KAAA,MAAA,GAAA,MAAA,GAAbA,aAAA,CAAea,EAAE,KAAI,SAAS;kBAAEC,OAAO,EAAE,SAATA,OAAOA,GAAA;AAAA,oBAAA,OAAQ3B,MAAI,CAAC4B,aAAa,CAAC/D,OAAO,CAAC;AAAA,mBAAA;AAAAqC,kBAAAA,QAAA,EAAA;AAAA,iBAAA,CAE9G,EACfG,GAAA,CAACiB,YAAY,EAAA;AAACE,kBAAAA,KAAK,EAAE,CAAAnE,KAAK,aAALA,KAAK,KAAA,MAAA,IAAA,CAAAyD,cAAA,GAALzD,KAAK,CAAEoE,MAAM,cAAAX,cAAA,KAAA,MAAA,GAAA,MAAA,GAAbA,cAAA,CAAee,GAAG,KAAI,OAAO;AAAEN,kBAAAA,QAAQ,EAAEvB,MAAI,CAACR,KAAK,CAACX,OAAO;kBAAE8C,OAAO,EAAE,SAATA,OAAOA,GAAA;AAAA,oBAAA,OAAQ3B,MAAI,CAAC8B,cAAc,CAACjE,OAAO,CAAC;AAAA,mBAAA;AAE9GqC,kBAAAA,QAAA,EAAA;AAAA,iBAAA,CAAA;AAAA,eAAA,CACD;AACX,aAAA,CAAA;WACR;AAAC,SAAA,CACE;AAEV;AAAC,KAAA,CAAA,CAAA;AAAA,GAAA,CA3BuB6B,SAA2E,CAAA;AA+CrG,EAAA,OAAOzE,WAAW;AACpB;AAGA,IAAMgE,YAAY,GAAGU,MAAM,CAACC,MAAM,CAAC,CAAC;AAClCC,EAAAA,aAAa,EAAE,YAAY;AAC3BC,EAAAA,UAAU,EAAE,GAAG;AACf,EAAA,0BAA0B,EAAE;AAC1BX,IAAAA,KAAK,EAAE;AACR;AACF,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { inherits as _inherits, createClass as _createClass, classCallCheck as _classCallCheck, callSuper as _callSuper, defineProperty as _defineProperty, objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Fragment, Component } from 'react';
|
|
4
|
+
import { Grid } from '@mui/material';
|
|
5
|
+
import '../api-context/alert-global.js';
|
|
6
|
+
import '../api-context/drawer-global.js';
|
|
7
|
+
import { MapGlobalModalContext } from '../api-context/global-modal.js';
|
|
8
|
+
import { CreateFormBottomBar, ContentWrap } from './create.form-grid-layout.units.js';
|
|
9
|
+
import CreateInput from './create.input.js';
|
|
10
|
+
import CreateFormBase from './create.form-base.js';
|
|
11
|
+
|
|
12
|
+
var _excluded = ["slots"];
|
|
13
|
+
var CreateFormGridLayout = function CreateFormGridLayout(params) {
|
|
14
|
+
var FormBaseInstance = CreateFormBase();
|
|
15
|
+
var BottomBarInstance = CreateFormBottomBar();
|
|
16
|
+
var InputBaseInstance = CreateInput({
|
|
17
|
+
maxLength: 250
|
|
18
|
+
});
|
|
19
|
+
var FormGridLayout = /*#__PURE__*/function (_Component) {
|
|
20
|
+
function FormGridLayout(props) {
|
|
21
|
+
var _this;
|
|
22
|
+
_classCallCheck(this, FormGridLayout);
|
|
23
|
+
_this = _callSuper(this, FormGridLayout, [props]);
|
|
24
|
+
_defineProperty(_this, "renderContent", function () {
|
|
25
|
+
var _this$props;
|
|
26
|
+
var slots = _this.props.slots;
|
|
27
|
+
return jsxs(ContentWrap, _objectSpread2(_objectSpread2({}, (_this$props = _this.props) === null || _this$props === void 0 || (_this$props = _this$props.slots) === null || _this$props === void 0 ? void 0 : _this$props.contentProps), {}, {
|
|
28
|
+
children: [(slots === null || slots === void 0 ? void 0 : slots.contentBefore) && (slots === null || slots === void 0 ? void 0 : slots.contentBefore), params === null || params === void 0 ? void 0 : params.contentBefore, jsx(Grid, {
|
|
29
|
+
container: true,
|
|
30
|
+
spacing: 2,
|
|
31
|
+
children: params.configs.map(function (config, index) {
|
|
32
|
+
var _this$configMerged$in;
|
|
33
|
+
var visibility = (_this$configMerged$in = _this.configMerged.inputVisibility) !== null && _this$configMerged$in !== void 0 && _this$configMerged$in[config.key] ? true : undefined;
|
|
34
|
+
if (visibility) return jsx(Fragment, {}, config.key.toString() + index);
|
|
35
|
+
return jsx(Fragment, {
|
|
36
|
+
children: jsx(Grid, _objectSpread2(_objectSpread2({
|
|
37
|
+
item: true,
|
|
38
|
+
xs: 12
|
|
39
|
+
}, config.reponsives), {}, {
|
|
40
|
+
children: _this.renderFormFieldElement(config)
|
|
41
|
+
}))
|
|
42
|
+
}, config.key.toString() + index);
|
|
43
|
+
})
|
|
44
|
+
}), params === null || params === void 0 ? void 0 : params.contentAfter, (slots === null || slots === void 0 ? void 0 : slots.contentAfter) && (slots === null || slots === void 0 ? void 0 : slots.contentAfter)]
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
_defineProperty(_this, "renderFormFieldElement", function (config) {
|
|
48
|
+
var _config$inputElement, _otherProps$data$conf, _otherProps$data, _this$configMerged$in2;
|
|
49
|
+
var _this$props2 = _this.props;
|
|
50
|
+
_this$props2.slots;
|
|
51
|
+
var otherProps = _objectWithoutProperties(_this$props2, _excluded);
|
|
52
|
+
var ElementComponent = (_config$inputElement = config.inputElement) !== null && _config$inputElement !== void 0 ? _config$inputElement : InputBaseInstance;
|
|
53
|
+
var dValue = (_otherProps$data$conf = (_otherProps$data = otherProps.data) === null || _otherProps$data === void 0 ? void 0 : _otherProps$data[config.key]) !== null && _otherProps$data$conf !== void 0 ? _otherProps$data$conf : config === null || config === void 0 ? void 0 : config.defaultValue;
|
|
54
|
+
var disabled = (_this$configMerged$in2 = _this.configMerged.inputDisabled) !== null && _this$configMerged$in2 !== void 0 && _this$configMerged$in2[config.key] ? true : undefined;
|
|
55
|
+
return FormBaseInstance.contextMapping(function (context) {
|
|
56
|
+
return jsx(ElementComponent, {
|
|
57
|
+
data: _this.props.data,
|
|
58
|
+
onBlur: context.onBlur,
|
|
59
|
+
messageErrors: context.messageErrors,
|
|
60
|
+
name: config.key,
|
|
61
|
+
label: config.label,
|
|
62
|
+
placeholder: config.placeholder,
|
|
63
|
+
disabled: disabled,
|
|
64
|
+
defaultValue: dValue
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
_defineProperty(_this, "loading", function () {
|
|
69
|
+
return _this.setState({
|
|
70
|
+
loadding: true
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
_defineProperty(_this, "unloading", function () {
|
|
74
|
+
return _this.setState({
|
|
75
|
+
loadding: false
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
_defineProperty(_this, "onSubmit", /*#__PURE__*/function () {
|
|
79
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(value, close) {
|
|
80
|
+
var _params$submitMapping;
|
|
81
|
+
var slots, mapping, data, _this$abortController;
|
|
82
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
83
|
+
while (1) switch (_context.prev = _context.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
slots = _this.props.slots;
|
|
86
|
+
mapping = (_params$submitMapping = params.submitMapping) !== null && _params$submitMapping !== void 0 ? _params$submitMapping : _this.submitMapping;
|
|
87
|
+
data = mapping(value, _this.props.data);
|
|
88
|
+
_context.prev = 3;
|
|
89
|
+
_this.loading();
|
|
90
|
+
(_this$abortController = _this.abortController) === null || _this$abortController === void 0 || _this$abortController.abort();
|
|
91
|
+
_this.abortController = new AbortController();
|
|
92
|
+
_context.next = 9;
|
|
93
|
+
return _this.props.onSubmit(data, _this.abortController.signal);
|
|
94
|
+
case 9:
|
|
95
|
+
if (!(slots !== null && slots !== void 0 && slots.closeState) || slots.closeState.Success !== false) {
|
|
96
|
+
close && close();
|
|
97
|
+
_this.props.onClose && _this.props.onClose();
|
|
98
|
+
}
|
|
99
|
+
_context.next = 16;
|
|
100
|
+
break;
|
|
101
|
+
case 12:
|
|
102
|
+
_context.prev = 12;
|
|
103
|
+
_context.t0 = _context["catch"](3);
|
|
104
|
+
if (slots !== null && slots !== void 0 && slots.closeState && slots.closeState.Fail === true) {
|
|
105
|
+
close && close();
|
|
106
|
+
_this.props.onClose && _this.props.onClose();
|
|
107
|
+
}
|
|
108
|
+
if (_this.props.onError) _this.props.onError(_context.t0);
|
|
109
|
+
case 16:
|
|
110
|
+
_context.prev = 16;
|
|
111
|
+
_this.unloading();
|
|
112
|
+
return _context.finish(16);
|
|
113
|
+
case 19:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context.stop();
|
|
116
|
+
}
|
|
117
|
+
}, _callee, null, [[3, 12, 16, 19]]);
|
|
118
|
+
}));
|
|
119
|
+
return function (_x, _x2) {
|
|
120
|
+
return _ref.apply(this, arguments);
|
|
121
|
+
};
|
|
122
|
+
}());
|
|
123
|
+
_defineProperty(_this, "submitMapping", function (value, oldValue) {
|
|
124
|
+
return Object.assign({}, oldValue, value);
|
|
125
|
+
});
|
|
126
|
+
_defineProperty(_this, "getSxProps", function () {
|
|
127
|
+
var isLoading = _this.state.loadding;
|
|
128
|
+
return _objectSpread2(_objectSpread2({}, _this.props.sx), {}, {
|
|
129
|
+
opacity: isLoading ? 0.7 : 1,
|
|
130
|
+
pointerEvents: isLoading ? 'none' : 'auto'
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
_this.state = {
|
|
134
|
+
loadding: false
|
|
135
|
+
};
|
|
136
|
+
return _this;
|
|
137
|
+
}
|
|
138
|
+
_inherits(FormGridLayout, _Component);
|
|
139
|
+
return _createClass(FormGridLayout, [{
|
|
140
|
+
key: "configMerged",
|
|
141
|
+
get: function get() {
|
|
142
|
+
var _this$props$slots$inp, _this$props$slots, _this$props$slots$inp2, _this$props$slots2;
|
|
143
|
+
return {
|
|
144
|
+
inputVisibility: (_this$props$slots$inp = (_this$props$slots = this.props.slots) === null || _this$props$slots === void 0 ? void 0 : _this$props$slots.inputVisibility) !== null && _this$props$slots$inp !== void 0 ? _this$props$slots$inp : params.inputVisibility,
|
|
145
|
+
inputDisabled: (_this$props$slots$inp2 = (_this$props$slots2 = this.props.slots) === null || _this$props$slots2 === void 0 ? void 0 : _this$props$slots2.inputDisabled) !== null && _this$props$slots$inp2 !== void 0 ? _this$props$slots$inp2 : params.inputDisabled
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "render",
|
|
150
|
+
value: function render() {
|
|
151
|
+
var _ref2,
|
|
152
|
+
_params$action,
|
|
153
|
+
_this$props$slots3,
|
|
154
|
+
_this2 = this;
|
|
155
|
+
var BottomBar = (_ref2 = (_params$action = params === null || params === void 0 ? void 0 : params.action) !== null && _params$action !== void 0 ? _params$action : (_this$props$slots3 = this.props.slots) === null || _this$props$slots3 === void 0 ? void 0 : _this$props$slots3.action) !== null && _ref2 !== void 0 ? _ref2 : BottomBarInstance;
|
|
156
|
+
return MapGlobalModalContext(function (_ref3) {
|
|
157
|
+
var close = _ref3.close;
|
|
158
|
+
return jsxs(FormBaseInstance.Form, {
|
|
159
|
+
validate: params.validate,
|
|
160
|
+
onSubmit: function onSubmit(v) {
|
|
161
|
+
return _this2.onSubmit(v, close);
|
|
162
|
+
},
|
|
163
|
+
sx: _this2.getSxProps(),
|
|
164
|
+
children: [_this2.renderContent(), FormBaseInstance.contextMapping(function (context) {
|
|
165
|
+
var _this2$props$slots;
|
|
166
|
+
return jsx(BottomBar, {
|
|
167
|
+
data: _this2.props.data,
|
|
168
|
+
onBlur: context.onBlur,
|
|
169
|
+
messageErrors: context.messageErrors,
|
|
170
|
+
before: (_this2$props$slots = _this2.props.slots) === null || _this2$props$slots === void 0 ? void 0 : _this2$props$slots.actionBefore
|
|
171
|
+
});
|
|
172
|
+
})]
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}, {
|
|
177
|
+
key: "componentWillUnmount",
|
|
178
|
+
value: function componentWillUnmount() {
|
|
179
|
+
var _this$abortController2;
|
|
180
|
+
(_this$abortController2 = this.abortController) === null || _this$abortController2 === void 0 || _this$abortController2.abort();
|
|
181
|
+
}
|
|
182
|
+
}]);
|
|
183
|
+
}(Component);
|
|
184
|
+
return FormGridLayout;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export { CreateFormGridLayout as default };
|
|
188
|
+
//# sourceMappingURL=create.form-grid-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.form-grid-layout.js","sources":["../../src/form/create.form-grid-layout.tsx"],"sourcesContent":["import React, { Component, ComponentType, Fragment } from 'react'\r\nimport { BoxProps, Grid, RegularBreakpoints, SxProps, Theme } from '@mui/material'\r\nimport { IFormBase, IFormInputBase } from './types'\r\nimport { MapGlobalModalContext } from '../api-context'\r\nimport { ContentWrap, CreateFormBottomBar } from './create.form-grid-layout.units'\r\nimport FormValidator from './validator'\r\nimport CreateInput from './create.input'\r\nimport CreateFormBase from './create.form-base'\r\n\r\nexport interface IFormGridLayoutConfig<T> {\r\n key: keyof T\r\n label?: string\r\n placeholder?: string\r\n reponsives?: RegularBreakpoints\r\n defaultValue?: any\r\n inputElement?: React.ComponentType<IFormInputBase<T>>\r\n}\r\n\r\nexport type SubmitMappingEvent<T> = (value: Partial<T>, oldValue?: T) => Partial<T>\r\n\r\nexport interface IFormGridLayoutSlots<T> {\r\n action?: React.ComponentType<IFormBase<T>>\r\n actionBefore?: JSX.Element\r\n contentBefore?: JSX.Element\r\n contentAfter?: JSX.Element\r\n inputVisibility?: Partial<Record<keyof T, boolean>>\r\n inputDisabled?: Partial<Record<keyof T, boolean>>\r\n closeState?: { Success?: boolean; Fail?: boolean }\r\n contentProps?: BoxProps\r\n}\r\n\r\nexport interface IFormGridLayoutParams<T> extends IFormGridLayoutSlots<T> {\r\n configs: IFormGridLayoutConfig<T>[]\r\n validate: FormValidator<Partial<T>>\r\n submitMapping?: SubmitMappingEvent<T>\r\n}\r\n\r\nexport interface IFormGridLayoutProps<T> {\r\n data?: T\r\n onSubmit: (value: Partial<T>, signal?: AbortSignal) => Promise<void>\r\n onError?: (error: any) => void\r\n onClose?: () => void\r\n sx?: SxProps<Theme>\r\n slots?: IFormGridLayoutSlots<T>\r\n}\r\n\r\nexport interface IFormGridLayoutState {\r\n loadding?: boolean\r\n}\r\n\r\nconst CreateFormGridLayout = function <T>(params: IFormGridLayoutParams<T>): ComponentType<IFormGridLayoutProps<T>> {\r\n const FormBaseInstance = CreateFormBase<T>()\r\n const BottomBarInstance = CreateFormBottomBar<T>()\r\n const InputBaseInstance = CreateInput<T>({ maxLength: 250 })\r\n\r\n class FormGridLayout extends Component<IFormGridLayoutProps<T>, IFormGridLayoutState> {\r\n private abortController?: AbortController\r\n constructor(props: IFormGridLayoutProps<T>) {\r\n super(props)\r\n this.state = { loadding: false }\r\n }\r\n\r\n get configMerged() {\r\n return {\r\n inputVisibility: this.props.slots?.inputVisibility ?? params.inputVisibility,\r\n inputDisabled: this.props.slots?.inputDisabled ?? params.inputDisabled\r\n }\r\n }\r\n\r\n render() {\r\n const BottomBar = params?.action ?? this.props.slots?.action ?? BottomBarInstance\r\n return MapGlobalModalContext(({ close }) => (\r\n <FormBaseInstance.Form validate={params.validate} onSubmit={(v) => this.onSubmit(v, close)} sx={this.getSxProps()}>\r\n {this.renderContent()}\r\n {FormBaseInstance.contextMapping((context) => (\r\n <BottomBar data={this.props.data} onBlur={context.onBlur} messageErrors={context.messageErrors} before={this.props.slots?.actionBefore} />\r\n ))}\r\n </FormBaseInstance.Form>\r\n ))\r\n }\r\n\r\n renderContent = () => {\r\n const { slots } = this.props\r\n return (\r\n <ContentWrap {...this.props?.slots?.contentProps}>\r\n {slots?.contentBefore && slots?.contentBefore}\r\n {params?.contentBefore}\r\n <Grid container spacing={2}>\r\n {params.configs.map((config, index) => {\r\n const visibility: boolean | undefined = this.configMerged.inputVisibility?.[config.key] ? true : undefined\r\n if (visibility) return <Fragment key={config.key.toString() + index} />\r\n return (\r\n <Fragment key={config.key.toString() + index}>\r\n <Grid item xs={12} {...config.reponsives}>\r\n {this.renderFormFieldElement(config)}\r\n </Grid>\r\n </Fragment>\r\n )\r\n })}\r\n </Grid>\r\n {params?.contentAfter}\r\n {slots?.contentAfter && slots?.contentAfter}\r\n </ContentWrap>\r\n )\r\n }\r\n\r\n renderFormFieldElement = (config: IFormGridLayoutConfig<T>) => {\r\n const { slots, ...otherProps } = this.props\r\n const ElementComponent = config.inputElement ?? InputBaseInstance\r\n const dValue = otherProps.data?.[config.key] ?? config?.defaultValue\r\n const disabled: boolean | undefined = this.configMerged.inputDisabled?.[config.key] ? true : undefined\r\n return FormBaseInstance.contextMapping((context) => (\r\n <ElementComponent\r\n data={this.props.data}\r\n onBlur={context.onBlur}\r\n messageErrors={context.messageErrors}\r\n name={config.key}\r\n label={config.label}\r\n placeholder={config.placeholder}\r\n disabled={disabled}\r\n defaultValue={dValue}\r\n />\r\n ))\r\n }\r\n\r\n loading = () => this.setState({ loadding: true })\r\n\r\n unloading = () => this.setState({ loadding: false })\r\n\r\n componentWillUnmount(): void {\r\n this.abortController?.abort()\r\n }\r\n\r\n onSubmit = async (value: Partial<T>, close?: () => void) => {\r\n const { slots } = this.props\r\n const mapping = params.submitMapping ?? this.submitMapping\r\n const data = mapping(value, this.props.data)\r\n try {\r\n this.loading()\r\n this.abortController?.abort()\r\n this.abortController = new AbortController()\r\n await this.props.onSubmit(data, this.abortController.signal)\r\n if (!slots?.closeState || slots.closeState.Success !== false) {\r\n close && close()\r\n this.props.onClose && this.props.onClose()\r\n }\r\n } catch (error) {\r\n if (slots?.closeState && slots.closeState.Fail === true) {\r\n close && close()\r\n this.props.onClose && this.props.onClose()\r\n }\r\n if (this.props.onError) this.props.onError(error)\r\n } finally {\r\n this.unloading()\r\n }\r\n }\r\n\r\n submitMapping: SubmitMappingEvent<T> = (value, oldValue) => {\r\n return Object.assign({}, oldValue, value)\r\n }\r\n\r\n getSxProps = (): SxProps<Theme> => {\r\n const isLoading = this.state.loadding\r\n return { ...this.props.sx, opacity: isLoading ? 0.7 : 1, pointerEvents: isLoading ? 'none' : 'auto' }\r\n }\r\n }\r\n return FormGridLayout\r\n}\r\n\r\nexport default CreateFormGridLayout\r\n"],"names":["CreateFormGridLayout","params","FormBaseInstance","CreateFormBase","BottomBarInstance","CreateFormBottomBar","InputBaseInstance","CreateInput","maxLength","FormGridLayout","_Component","props","_this","_classCallCheck","_callSuper","_defineProperty","_this$props","slots","_jsxs","ContentWrap","_objectSpread","contentProps","children","contentBefore","_jsx","Grid","container","spacing","configs","map","config","index","_this$configMerged$in","visibility","configMerged","inputVisibility","key","undefined","Fragment","toString","item","xs","reponsives","renderFormFieldElement","contentAfter","_config$inputElement","_otherProps$data$conf","_otherProps$data","_this$configMerged$in2","_this$props2","otherProps","_objectWithoutProperties","_excluded","ElementComponent","inputElement","dValue","data","defaultValue","disabled","inputDisabled","contextMapping","context","onBlur","messageErrors","name","label","placeholder","setState","loadding","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","value","close","_params$submitMapping","mapping","_this$abortController","wrap","_callee$","_context","prev","next","submitMapping","loading","abortController","abort","AbortController","onSubmit","signal","closeState","Success","onClose","t0","Fail","onError","unloading","finish","stop","_x","_x2","apply","arguments","oldValue","Object","assign","isLoading","state","sx","opacity","pointerEvents","_inherits","_createClass","get","_this$props$slots$inp","_this$props$slots","_this$props$slots$inp2","_this$props$slots2","render","_ref2","_params$action","_this$props$slots3","_this2","BottomBar","action","MapGlobalModalContext","_ref3","Form","validate","v","getSxProps","renderContent","_this2$props$slots","before","actionBefore","componentWillUnmount","_this$abortController2","Component"],"mappings":";;;;;;;;;;;;AAkDA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAgBC,MAAgC,EAAA;AACxE,EAAA,IAAMC,gBAAgB,GAAGC,cAAc,EAAK;AAC5C,EAAA,IAAMC,iBAAiB,GAAGC,mBAAmB,EAAK;EAClD,IAAMC,iBAAiB,GAAGC,WAAW,CAAI;AAAEC,IAAAA,SAAS,E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ApBA,sBAAA,CAAsBlD,KAAK,EAAE;AAC/B;AAAC,KAAA,CAAA,CAAA;AAAA,GAAA,CA5E0BmD,SAAwD,CAAA;AA+GrF,EAAA,OAAOjI,cAAc;AACvB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { styled, Box, Button } from '@mui/material';
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { styled, Box, colors, Button } from '@mui/material';
|
|
3
3
|
|
|
4
4
|
var ContentWrap = styled(Box)({
|
|
5
5
|
padding: '16px 12px 3px',
|
|
@@ -9,17 +9,20 @@ var ContentWrap = styled(Box)({
|
|
|
9
9
|
});
|
|
10
10
|
function CreateFormBottomBar() {
|
|
11
11
|
var FormBottomBar = function FormBottomBar(props) {
|
|
12
|
-
return
|
|
13
|
-
className:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
return jsxs(FormBottomBarWrap, {
|
|
13
|
+
className: 'bottom-bar',
|
|
14
|
+
children: [jsx(Box, {
|
|
15
|
+
sx: {
|
|
16
|
+
flex: 1
|
|
17
|
+
},
|
|
18
|
+
children: props.before
|
|
19
|
+
}), jsx(Button, {
|
|
20
|
+
variant: 'contained',
|
|
21
|
+
type: 'submit',
|
|
22
|
+
size: 'small',
|
|
23
|
+
children: "Submit"
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
23
26
|
};
|
|
24
27
|
return FormBottomBar;
|
|
25
28
|
}
|
|
@@ -30,7 +33,7 @@ var FormBottomBarWrap = styled(Box)({
|
|
|
30
33
|
boxShadow: 'rgba(145, 158, 171, 0.2) 0px 0px 2px 0px,rgba(145, 158, 171, 0.12) 0px 12px 24px -4px',
|
|
31
34
|
position: 'sticky',
|
|
32
35
|
bottom: 0,
|
|
33
|
-
backgroundColor:
|
|
36
|
+
backgroundColor: colors.common.white,
|
|
34
37
|
zIndex: 1,
|
|
35
38
|
height: '48px'
|
|
36
39
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.form-grid-layout.units.js","sources":["../../src/form/create.form-grid-layout.units.tsx"],"sourcesContent":["import React, { FC, ReactNode } from 'react'\r\nimport { Box, Button, colors, styled } from '@mui/material'\r\nimport { IFormBase } from './types'\r\n\r\nexport const ContentWrap = styled(Box)({\r\n padding: '16px 12px 3px',\r\n maxHeight: `calc(100vh - ${48 * 2 + 12 * 2}px)`,\r\n overflowY: 'auto',\r\n overflowX: 'hidden'\r\n})\r\n\r\nexport interface IFormBottomBarProps<T> extends IFormBase<T> {\r\n before?: ReactNode\r\n}\r\n\r\nexport function CreateFormBottomBar<T>() {\r\n const FormBottomBar: FC<IFormBottomBarProps<T>> = (props) => (\r\n <FormBottomBarWrap className='bottom-bar'>\r\n <Box sx={{ flex: 1 }}>{props.before}</Box>\r\n <Button variant='contained' type='submit' size='small'>\r\n Submit\r\n </Button>\r\n </FormBottomBarWrap>\r\n )\r\n return FormBottomBar\r\n}\r\n\r\nexport const FormBottomBarWrap = styled(Box)({\r\n display: 'flex',\r\n alignItems: 'center',\r\n padding: '0 12px',\r\n boxShadow: 'rgba(145, 158, 171, 0.2) 0px 0px 2px 0px,rgba(145, 158, 171, 0.12) 0px 12px 24px -4px',\r\n position: 'sticky',\r\n bottom: 0,\r\n backgroundColor: colors.common.white,\r\n zIndex: 1,\r\n height: '48px'\r\n})\r\n"],"names":["ContentWrap","styled","Box","padding","maxHeight","concat","overflowY","overflowX","CreateFormBottomBar","FormBottomBar","props","_jsxs","FormBottomBarWrap","className","_jsx","sx","flex","children","before","Button","variant","type","size","display","alignItems","boxShadow","position","bottom","backgroundColor","colors","common","white","zIndex","height"],"mappings":";;;IAIaA,WAAW,GAAGC,MAAM,CAACC,GAAG,CAAC,CAAC;AACrCC,EAAAA,OAAO,EAAE,eAAe;EACxBC,SAAS,EAAA,eAAA,CAAAC,MAAA,CAAkB,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAK,KAAA,CAAA;AAC/CC,EAAAA,SAAS,EAAE,MAAM;AACjBC,EAAAA,SAAS,EAAE;AACZ,CAAA;SAMeC,mBAAmBA,GAAA;AACjC,EAAA,IAAMC,aAAa,GAA+B,SAA5CA,aAAaA,CAAgCC,KAAK,EAAA;IAAA,OACtDC,IAAA,CAACC,iBAAiB,EAAA;AAACC,MAAAA,SAAS,EAAC,YAAY;iBACvCC,GAAC,CAAAZ,GAAG;AAACa,QAAAA,EAAE,EAAE;AAAEC,UAAAA,IAAI,EAAE;SAAG;QAAGC,QAAA,EAAAP,KAAK,CAACQ;AAAM,OAAA,CAAO,EAC1CJ,GAAC,CAAAK,MAAM,EAAC;AAAAC,QAAAA,OAAO,EAAC,WAAW;AAACC,QAAAA,IAAI,EAAC,QAAQ;AAACC,QAAAA,IAAI,EAAC,OAAO;AAAAL,QAAAA,QAAA,EAAA;AAAA,OAAA,CAE7C;AACS,KAAA,CAAA;GACrB;AACD,EAAA,OAAOR,aAAa;AACtB;IAEaG,iBAAiB,GAAGX,MAAM,CAACC,GAAG,CAAC,CAAC;AAC3CqB,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,UAAU,EAAE,QAAQ;AACpBrB,EAAAA,OAAO,EAAE,QAAQ;AACjBsB,EAAAA,SAAS,EAAE,uFAAuF;AAClGC,EAAAA,QAAQ,EAAE,QAAQ;AAClBC,EAAAA,MAAM,EAAE,CAAC;AACTC,EAAAA,eAAe,EAAEC,MAAM,CAACC,MAAM,CAACC,KAAK;AACpCC,EAAAA,MAAM,EAAE,CAAC;AACTC,EAAAA,MAAM,EAAE;AACT,CAAA;;;;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { inherits as _inherits, createClass as _createClass, objectSpread2 as _objectSpread2, classCallCheck as _classCallCheck, callSuper as _callSuper, defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Component } from 'react';
|
|
4
|
+
import { TextField } from '@mui/material';
|
|
5
|
+
import { getErrorMessage } from './helper.js';
|
|
6
|
+
|
|
7
|
+
function CreateInputFile(params) {
|
|
8
|
+
var FormInputFile = /*#__PURE__*/function (_Component) {
|
|
9
|
+
function FormInputFile() {
|
|
10
|
+
var _this;
|
|
11
|
+
_classCallCheck(this, FormInputFile);
|
|
12
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
|
+
args[_key] = arguments[_key];
|
|
14
|
+
}
|
|
15
|
+
_this = _callSuper(this, FormInputFile, [].concat(args));
|
|
16
|
+
_defineProperty(_this, "refInput", null);
|
|
17
|
+
_defineProperty(_this, "getMergeConfig", function () {
|
|
18
|
+
var _params$accept, _ref, _params$multiple;
|
|
19
|
+
return {
|
|
20
|
+
accept: (_params$accept = params === null || params === void 0 ? void 0 : params.accept) !== null && _params$accept !== void 0 ? _params$accept : _this.props.accept,
|
|
21
|
+
multiple: (_ref = (_params$multiple = params === null || params === void 0 ? void 0 : params.multiple) !== null && _params$multiple !== void 0 ? _params$multiple : _this.props.multiple) !== null && _ref !== void 0 ? _ref : false
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
_defineProperty(_this, "handleChange", function (e) {
|
|
25
|
+
if (!_this.props.name) return;
|
|
26
|
+
_this.props.onBlur && _this.props.onBlur(_this.props.name);
|
|
27
|
+
});
|
|
28
|
+
_defineProperty(_this, "isExploreOpen", false);
|
|
29
|
+
_defineProperty(_this, "handleClick", function (e) {
|
|
30
|
+
_this.isExploreOpen = true;
|
|
31
|
+
});
|
|
32
|
+
_defineProperty(_this, "handleFocus", function (e) {
|
|
33
|
+
if (_this.isExploreOpen === true) {
|
|
34
|
+
_this.isExploreOpen = false;
|
|
35
|
+
if (!_this.props.name) return;
|
|
36
|
+
_this.props.onBlur && _this.props.onBlur(_this.props.name);
|
|
37
|
+
setTimeout(function () {
|
|
38
|
+
_this.refInput && _this.refInput.blur();
|
|
39
|
+
}, 50);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
_inherits(FormInputFile, _Component);
|
|
45
|
+
return _createClass(FormInputFile, [{
|
|
46
|
+
key: "render",
|
|
47
|
+
value: function render() {
|
|
48
|
+
var _this2 = this,
|
|
49
|
+
_this$props$name,
|
|
50
|
+
_this$props$textField;
|
|
51
|
+
var eMessage = getErrorMessage(this.props.messageErrors, this.props.name);
|
|
52
|
+
var configs = this.getMergeConfig();
|
|
53
|
+
return jsx(TextField, _objectSpread2(_objectSpread2({
|
|
54
|
+
inputRef: function inputRef(ref) {
|
|
55
|
+
return _this2.refInput = ref;
|
|
56
|
+
},
|
|
57
|
+
name: (_this$props$name = this.props.name) === null || _this$props$name === void 0 ? void 0 : _this$props$name.toString(),
|
|
58
|
+
error: eMessage.error,
|
|
59
|
+
helperText: eMessage.message,
|
|
60
|
+
variant: 'outlined',
|
|
61
|
+
type: 'file',
|
|
62
|
+
fullWidth: true,
|
|
63
|
+
onChange: this.handleChange,
|
|
64
|
+
onClick: this.handleClick,
|
|
65
|
+
onFocus: this.handleFocus
|
|
66
|
+
}, this.props.textFieldProps), {}, {
|
|
67
|
+
inputProps: _objectSpread2({
|
|
68
|
+
accept: configs.accept,
|
|
69
|
+
multiple: configs.multiple
|
|
70
|
+
}, (_this$props$textField = this.props.textFieldProps) === null || _this$props$textField === void 0 ? void 0 : _this$props$textField.inputProps)
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}]);
|
|
74
|
+
}(Component);
|
|
75
|
+
return FormInputFile;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { CreateInputFile as default };
|
|
79
|
+
//# sourceMappingURL=create.input.file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.input.file.js","sources":["../../src/form/create.input.file.tsx"],"sourcesContent":["import React, { Component, ComponentType } from 'react'\r\nimport { TextField, TextFieldProps } from '@mui/material'\r\nimport { IFormInputBase } from './types'\r\nimport { getErrorMessage } from './helper'\r\n\r\nexport interface IInputFileProps<T> extends IFormInputBase<T> {\r\n accept?: string\r\n multiple?: boolean\r\n textFieldProps?: TextFieldProps\r\n}\r\n\r\nexport interface IInputFileState {}\r\n\r\nexport interface IInputFileParams {\r\n accept?: string\r\n multiple?: boolean\r\n}\r\n\r\nfunction CreateInputFile<T>(params?: IInputFileParams): ComponentType<IFormInputBase<T>> {\r\n class FormInputFile extends Component<IInputFileProps<T>, IInputFileState> {\r\n refInput: HTMLInputElement | null = null\r\n\r\n render() {\r\n const eMessage = getErrorMessage(this.props.messageErrors, this.props.name)\r\n const configs = this.getMergeConfig()\r\n return (\r\n <TextField\r\n inputRef={(ref) => (this.refInput = ref)}\r\n name={this.props.name?.toString()}\r\n error={eMessage.error}\r\n helperText={eMessage.message}\r\n variant='outlined'\r\n type='file'\r\n fullWidth\r\n onChange={this.handleChange}\r\n onClick={this.handleClick}\r\n onFocus={this.handleFocus}\r\n {...this.props.textFieldProps}\r\n inputProps={{\r\n accept: configs.accept,\r\n multiple: configs.multiple,\r\n ...this.props.textFieldProps?.inputProps\r\n }}\r\n />\r\n )\r\n }\r\n\r\n getMergeConfig = () => ({\r\n accept: params?.accept ?? this.props.accept,\r\n multiple: params?.multiple ?? this.props.multiple ?? false\r\n })\r\n\r\n handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\r\n if (!this.props.name) return\r\n this.props.onBlur && this.props.onBlur(this.props.name)\r\n }\r\n\r\n isExploreOpen = false\r\n\r\n handleClick: React.MouseEventHandler<HTMLDivElement> = (e) => {\r\n this.isExploreOpen = true\r\n }\r\n\r\n handleFocus: React.FocusEventHandler<HTMLInputElement> = (e) => {\r\n if (this.isExploreOpen === true) {\r\n this.isExploreOpen = false\r\n if (!this.props.name) return\r\n this.props.onBlur && this.props.onBlur(this.props.name)\r\n setTimeout(() => {\r\n this.refInput && this.refInput.blur()\r\n }, 50)\r\n }\r\n }\r\n }\r\n return FormInputFile\r\n}\r\n\r\nexport default CreateInputFile\r\n"],"names":["CreateInputFile","params","FormInputFile","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","_params$accept","_ref","_params$multiple","accept","props","multiple","e","name","onBlur","isExploreOpen","setTimeout","refInput","blur","_inherits","_createClass","key","value","render","_this2","_this$props$name","_this$props$textField","eMessage","getErrorMessage","messageErrors","configs","getMergeConfig","_jsx","TextField","_objectSpread","inputRef","ref","toString","error","helperText","message","variant","type","fullWidth","onChange","handleChange","onClick","handleClick","onFocus","handleFocus","textFieldProps","inputProps","Component"],"mappings":";;;;;;AAkBA,SAASA,eAAeA,CAAIC,MAAyB,EAAA;EAAA,IAC7CC,aAAc,0BAAAC,UAAA,EAAA;AAAA,IAAA,SAAAD,aAAA,GAAA;AAAA,MAAA,IAAAE,KAAA;AAAAC,MAAAA,eAAA,OAAAH,aAAA,CAAA;AAAA,MAAA,KAAA,IAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,GAAAC,IAAAA,KAAA,CAAAJ,IAAA,GAAAK,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,EAAA,EAAA;AAAAF,QAAAA,IAAA,CAAAE,IAAA,CAAAJ,GAAAA,SAAA,CAAAI,IAAA,CAAA;AAAA;AAAAP,MAAAA,KAAA,GAAAQ,UAAA,CAAA,IAAA,EAAAV,aAAA,EAAAW,EAAAA,CAAAA,MAAA,CAAAJ,IAAA,CAAA,CAAA;MAAAK,eAAA,CAAAV,KAAA,EAAA,UAAA,EACkB,IAAI,CAAA;MAAAU,eAAA,CAAAV,KAAA,EA2BvB,gBAAA,EAAA,YAAA;AAAA,QAAA,IAAAW,cAAA,EAAAC,IAAA,EAAAC,gBAAA;QAAA,OAAO;AACtBC,UAAAA,MAAM,GAAAH,cAAA,GAAEd,MAAM,KAANA,IAAA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