lkt-item-crud 2.0.5 → 2.0.6

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.
@@ -91,10 +91,11 @@ declare const __VLS_self: import("vue").DefineComponent<ItemCrudConfig, {
91
91
  mode: ItemCrudMode;
92
92
  modelValue: LktObject;
93
93
  editing: boolean;
94
- editModeButton: import("lkt-vue-kernel").ButtonConfig;
95
- dropButton: import("lkt-vue-kernel").ButtonConfig;
96
- createButton: import("lkt-vue-kernel").ButtonConfig;
97
- updateButton: import("lkt-vue-kernel").ButtonConfig;
94
+ perms: import("lkt-vue-kernel").ValidTablePermission[];
95
+ editModeButton: import("lkt-vue-kernel").ButtonConfig | false;
96
+ dropButton: import("lkt-vue-kernel").ButtonConfig | false;
97
+ createButton: import("lkt-vue-kernel").ButtonConfig | false;
98
+ updateButton: import("lkt-vue-kernel").ButtonConfig | false;
98
99
  buttonNavPosition: ItemCrudButtonNavPosition;
99
100
  buttonNavVisibility: import("lkt-vue-kernel").ItemCrudButtonNavVisibility;
100
101
  modalConfig: import("lkt-vue-kernel").ModalConfig;
@@ -138,10 +139,11 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
138
139
  mode: ItemCrudMode;
139
140
  modelValue: LktObject;
140
141
  editing: boolean;
141
- editModeButton: import("lkt-vue-kernel").ButtonConfig;
142
- dropButton: import("lkt-vue-kernel").ButtonConfig;
143
- createButton: import("lkt-vue-kernel").ButtonConfig;
144
- updateButton: import("lkt-vue-kernel").ButtonConfig;
142
+ perms: import("lkt-vue-kernel").ValidTablePermission[];
143
+ editModeButton: import("lkt-vue-kernel").ButtonConfig | false;
144
+ dropButton: import("lkt-vue-kernel").ButtonConfig | false;
145
+ createButton: import("lkt-vue-kernel").ButtonConfig | false;
146
+ updateButton: import("lkt-vue-kernel").ButtonConfig | false;
145
147
  buttonNavPosition: ItemCrudButtonNavPosition;
146
148
  buttonNavVisibility: import("lkt-vue-kernel").ItemCrudButtonNavVisibility;
147
149
  modalConfig: import("lkt-vue-kernel").ModalConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -36,19 +36,17 @@
36
36
  "vue": "^3.3.0",
37
37
  "vue-tsc": "^2.2.0"
38
38
  },
39
- "dependencies": {
40
- },
41
39
  "peerDependencies": {
42
- "lkt-button": "^2.0.4",
43
- "lkt-data-state": "^1.0.9",
44
- "lkt-http-client": "^1.0.12",
45
- "lkt-http-info": "^1.0.2",
46
- "lkt-i18n": "^1.0.4",
47
- "lkt-loader": "^1.0.2",
48
- "lkt-modal": "^2.0.2",
49
- "lkt-string-tools": "^1.0.2",
50
- "lkt-toast": "^1.0.1",
51
- "lkt-vue-kernel": "^1.0.27",
40
+ "lkt-button": "^2.0.12",
41
+ "lkt-data-state": "^1.0.11",
42
+ "lkt-http-client": "^1.0.34",
43
+ "lkt-http-info": "^1.1.1",
44
+ "lkt-i18n": "^1.1.0",
45
+ "lkt-loader": "^1.2.0",
46
+ "lkt-modal": "^2.0.5",
47
+ "lkt-string-tools": "^1.1.0",
48
+ "lkt-toast": "^1.1.1",
49
+ "lkt-vue-kernel": "^1.0.48",
52
50
  "vue": "^3.3.0"
53
51
  }
54
52
  }
@@ -27,10 +27,10 @@
27
27
  view: ItemCrudView
28
28
  mode: ItemCrudMode
29
29
 
30
- createButton?: ButtonConfig
31
- updateButton?: ButtonConfig
32
- dropButton?: ButtonConfig
33
- editModeButton?: ButtonConfig
30
+ createButton?: ButtonConfig|false
31
+ updateButton?: ButtonConfig|false
32
+ dropButton?: ButtonConfig|false
33
+ editModeButton?: ButtonConfig|false
34
34
 
35
35
  dataChanged: boolean
36
36
 
@@ -141,7 +141,7 @@
141
141
  return true;
142
142
  }),
143
143
  showDropButton = computed(() => {
144
- if (!props.canDrop) return false;
144
+ if (!props.canDrop || props.dropButton === false) return false;
145
145
  if (!props.canUpdate && props.canDrop) return true;
146
146
 
147
147
  return !isLoading.value
@@ -149,10 +149,14 @@
149
149
  && props.httpSuccessRead;
150
150
  }),
151
151
  showSaveButton = computed(() => {
152
+ if (props.mode === ItemCrudMode.Create && props.createButton === false) return false;
153
+ if (props.mode === ItemCrudMode.Update && props.updateButton === false) return false;
152
154
  if (props.dataChanged) return true;
153
155
  if (isLoading.value) return false;
154
156
 
155
- if (props.mode === ItemCrudMode.Create) return true;
157
+ if (props.mode === ItemCrudMode.Create) {
158
+ return true;
159
+ }
156
160
 
157
161
  if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
158
162
  return false;
@@ -162,6 +166,7 @@
162
166
  && props.httpSuccessRead;
163
167
  }),
164
168
  showSwitchButton = computed(() => {
169
+ if (props.editModeButton === false) return false;
165
170
  if (!props.canSwitchEditMode) return false;
166
171
  if (!props.canUpdate && !props.canDrop) return false;
167
172
  if (!props.canUpdate && props.canDrop) return false;
@@ -22,6 +22,9 @@
22
22
  import ButtonNav from '../components/ButtonNav.vue';
23
23
  import { openToast } from 'lkt-toast';
24
24
 
25
+ // defineOptions({
26
+ // inheritAttrs: false
27
+ // })
25
28
 
26
29
  const props = withDefaults(defineProps<ItemCrudConfig>(), getDefaultValues(ItemCrud));
27
30
 
@@ -40,11 +43,9 @@
40
43
  'modified-data',
41
44
  ]);
42
45
 
43
- let basePerms: string[] = [];
44
-
45
46
  const isLoading = ref(true),
46
47
  item = ref(props.modelValue),
47
- perms = ref(basePerms),
48
+ perms = ref(props.perms),
48
49
  editMode = ref(props.editing),
49
50
  httpSuccessRead = ref(false),
50
51
  showStoreMessage = ref(false),
@@ -145,6 +146,14 @@
145
146
  dataState.value.increment(item.value).turnStoredIntoOriginal();
146
147
  dataChanged.value = dataState.value.changed();
147
148
  }
149
+ // Offline mode
150
+ else {
151
+ httpSuccessRead.value = true;
152
+ editMode.value = true;
153
+ isLoading.value = false;
154
+ dataState.value.increment(item.value).turnStoredIntoOriginal();
155
+ dataChanged.value = dataState.value.changed();
156
+ }
148
157
  });
149
158
 
150
159
  const ensureValidResourceSave = (r: HTTPResponse, resource?: string) => {
@@ -310,8 +319,8 @@
310
319
  },
311
320
  ...props.modalConfig,
312
321
  ...{
313
- 'before-close': crudBeforeClose,
314
- 'close-confirm': closeConfirm.value,
322
+ beforeClose: crudBeforeClose,
323
+ closeConfirm: closeConfirm.value,
315
324
  },
316
325
  };
317
326
  }