Alerts
2 years ago
BoxActions
2 years ago
PaymentsPage
2 years ago
TableColumns
2 years ago
VuiBoxes
2 years ago
ActionsWithFilters.vue
2 years ago
ChooseAction.vue
2 years ago
ClearFiltersButton.vue
2 years ago
DetailsTableWithStore.vue
2 years ago
EntriesList.vue
2 years ago
EntriesTable.vue
2 years ago
EntriesTableSkeleton.vue
2 years ago
EntryColumnList.vue
2 years ago
EntryColumnsTable.vue
2 years ago
FormBuilderPage.vue
2 years ago
PageActions.vue
2 years ago
PostBoxContainer.vue
2 years ago
PostBoxGrid.vue
2 years ago
PostBoxSimple.vue
2 years ago
PostBoxSkeleton.vue
2 years ago
PostBoxTable.vue
2 years ago
SideBarBoxes.vue
2 years ago
TablePagination.vue
2 years ago
EntryColumnList.vue
113 lines
| 1 | <template> |
| 2 | <div> |
| 3 | <div |
| 4 | v-if="record.editable && isEnableEdit" |
| 5 | class="list-table-item__cell--body-value jfb-control" |
| 6 | > |
| 7 | <keep-alive> |
| 8 | <component |
| 9 | :is="getComponentEditControl" |
| 10 | :options="record.control_options" |
| 11 | v-model="editedCellValue" |
| 12 | /> |
| 13 | </keep-alive> |
| 14 | </div> |
| 15 | <template v-else-if="getItemComponentColumn"> |
| 16 | <component |
| 17 | v-bind:is="getItemComponentColumn" |
| 18 | :value="value" |
| 19 | :full-entry="list" |
| 20 | :scope="scope" |
| 21 | /> |
| 22 | </template> |
| 23 | <template v-else-if="getItemComponentType"> |
| 24 | <component |
| 25 | v-bind:is="getItemComponentType" |
| 26 | :value="value" |
| 27 | :full-entry="list" |
| 28 | :scope="scope" |
| 29 | /> |
| 30 | </template> |
| 31 | <div v-else v-html="value"/> |
| 32 | </div> |
| 33 | </template> |
| 34 | |
| 35 | <script> |
| 36 | import GetColumnComponent from '../mixins/GetColumnComponent'; |
| 37 | import ScopeStoreMixin from '../mixins/ScopeStoreMixin'; |
| 38 | |
| 39 | export default { |
| 40 | name: 'EntryColumnList', |
| 41 | props: { |
| 42 | column: String, |
| 43 | list: Object, |
| 44 | }, |
| 45 | mixins: [ GetColumnComponent, ScopeStoreMixin ], |
| 46 | computed: { |
| 47 | record() { |
| 48 | return this.list[ this.column ]; |
| 49 | }, |
| 50 | value() { |
| 51 | return this.record.editable ? this.editedCellValue : this.initialValue; |
| 52 | }, |
| 53 | initialValue() { |
| 54 | /** |
| 55 | * Such nesting can be subject |
| 56 | * to the use of a component with settings |
| 57 | * |
| 58 | * For example status with icon (icon_status) |
| 59 | */ |
| 60 | return this.record?.value ?? this.record?.value?.value ?? false; |
| 61 | }, |
| 62 | isEnableEdit() { |
| 63 | jfbEventBus.reactiveCounter; |
| 64 | |
| 65 | return this.getter( 'isEnableEdit' ); |
| 66 | }, |
| 67 | getItemComponentColumn() { |
| 68 | return this.getColumnComponentByPrefix( this.column, 'item' ); |
| 69 | }, |
| 70 | getItemComponentType() { |
| 71 | return this.getColumnComponentByPrefix( this.getColumnType, 'item' ); |
| 72 | }, |
| 73 | getComponentEditControl() { |
| 74 | return this.getColumnComponentByPrefix( this.record?.control, 'control' ); |
| 75 | }, |
| 76 | getColumnType() { |
| 77 | return this.record.type ?? false; |
| 78 | }, |
| 79 | editedCellValue: { |
| 80 | get() { |
| 81 | jfbEventBus.reactiveCounter; |
| 82 | |
| 83 | return this.getter( |
| 84 | 'editedCellValue', |
| 85 | [ this.column, this.initialValue ], |
| 86 | ); |
| 87 | }, |
| 88 | set( value ) { |
| 89 | this.commit( 'updateEditableCell', { |
| 90 | column: this.column, |
| 91 | initial: this.initialValue, |
| 92 | props: { |
| 93 | value, |
| 94 | }, |
| 95 | } ); |
| 96 | jfbEventBus.reactiveCounter++; |
| 97 | }, |
| 98 | }, |
| 99 | }, |
| 100 | methods: { |
| 101 | revertChangesColumn() { |
| 102 | this.commit( 'revertChangesColumn', { |
| 103 | column: this.column, |
| 104 | } ); |
| 105 | jfbEventBus.reactiveCounter++; |
| 106 | }, |
| 107 | }, |
| 108 | }; |
| 109 | </script> |
| 110 | |
| 111 | <style> |
| 112 | |
| 113 | </style> |