lkt-item-crud 2.0.0 → 2.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/build.js CHANGED
@@ -86,13 +86,13 @@ const b = (...k) => {
86
86
  });
87
87
  const T = g(() => {
88
88
  var t, r;
89
- return a.mode !== E.Create && !a.canUpdate ? !1 : typeof ((t = M.value) == null ? void 0 : t.disabled) == "function" ? M.value.disabled(a.item) : typeof ((r = M.value) == null ? void 0 : r.disabled) == "boolean" ? M.value.disabled : a.dataChanged;
89
+ return a.mode !== E.Create && !a.canUpdate || !a.dataChanged ? !1 : typeof ((t = M.value) == null ? void 0 : t.disabled) == "function" ? !M.value.disabled(a.item) : typeof ((r = M.value) == null ? void 0 : r.disabled) == "boolean" ? !M.value.disabled : !0;
90
90
  }), _ = g(() => {
91
91
  var t, r;
92
- return a.mode !== E.Create ? !1 : typeof ((t = v.value) == null ? void 0 : t.disabled) == "function" ? v.value.disabled(a.item) : typeof ((r = v.value) == null ? void 0 : r.disabled) == "boolean" ? v.value.disabled : a.dataChanged;
92
+ return a.mode !== E.Create || !a.dataChanged ? !1 : typeof ((t = v.value) == null ? void 0 : t.disabled) == "function" ? !v.value.disabled(a.item) : typeof ((r = v.value) == null ? void 0 : r.disabled) == "boolean" ? !v.value.disabled : !0;
93
93
  }), z = g(() => {
94
94
  var t, r;
95
- return a.canDrop ? typeof ((t = n.value) == null ? void 0 : t.disabled) == "function" ? n.value.disabled(a.item) : typeof ((r = n.value) == null ? void 0 : r.disabled) == "boolean" ? n.value.disabled : !0 : !1;
95
+ return a.canDrop ? typeof ((t = n.value) == null ? void 0 : t.disabled) == "function" ? !n.value.disabled(a.item) : typeof ((r = n.value) == null ? void 0 : r.disabled) == "boolean" ? !n.value.disabled : !0 : !1;
96
96
  }), A = g(() => a.canDrop ? !a.canUpdate && a.canDrop ? !0 : !m.value && a.editing && a.httpSuccessRead : !1), P = g(() => a.dataChanged ? !0 : m.value ? !1 : a.mode === E.Create ? !0 : a.buttonNavVisibility === te.Never ? !1 : a.editing && a.httpSuccessRead), F = g(() => !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !m.value && a.mode !== E.Create && a.httpSuccessRead), G = g(() => a.buttonNavVisibility === te.Always && (T.value || _.value || z.value) || c["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === te.Never ? !1 : P.value || A.value || F.value);
97
97
  return (t, r) => {
98
98
  const H = oe("lkt-button");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -8,7 +8,7 @@
8
8
  ".": {
9
9
  "import": "./dist/build.js"
10
10
  },
11
- "./styles": "./dist/style.css"
11
+ "./styles": "./dist/build.css"
12
12
  },
13
13
  "types": "./dist/build.d.ts",
14
14
  "files": [
@@ -112,26 +112,28 @@
112
112
 
113
113
  const ableToUpdate = computed(() => {
114
114
  if (props.mode !== ItemCrudMode.Create && !props.canUpdate) return false;
115
+ if (!props.dataChanged) return false;
115
116
 
116
- if (typeof safeUpdateButton.value?.disabled === 'function') return safeUpdateButton.value.disabled(props.item);
117
- if (typeof safeUpdateButton.value?.disabled === 'boolean') return safeUpdateButton.value.disabled;
117
+ if (typeof safeUpdateButton.value?.disabled === 'function') return !safeUpdateButton.value.disabled(props.item);
118
+ if (typeof safeUpdateButton.value?.disabled === 'boolean') return !safeUpdateButton.value.disabled;
118
119
 
119
- return props.dataChanged;
120
+ return true;
120
121
  }),
121
122
  ableToCreate = computed(() => {
122
123
  if (props.mode !== ItemCrudMode.Create) return false;
124
+ if (!props.dataChanged) return false;
123
125
 
124
- if (typeof safeCreateButton.value?.disabled === 'function') return safeCreateButton.value.disabled(props.item);
125
- if (typeof safeCreateButton.value?.disabled === 'boolean') return safeCreateButton.value.disabled;
126
+ if (typeof safeCreateButton.value?.disabled === 'function') return !safeCreateButton.value.disabled(props.item);
127
+ if (typeof safeCreateButton.value?.disabled === 'boolean') return !safeCreateButton.value.disabled;
126
128
 
127
- return props.dataChanged;
129
+ return true;
128
130
  }),
129
131
  ableToDrop = computed(() => {
130
132
 
131
133
  if (!props.canDrop) return false;
132
134
 
133
- if (typeof safeDropButton.value?.disabled === 'function') return safeDropButton.value.disabled(props.item);
134
- if (typeof safeDropButton.value?.disabled === 'boolean') return safeDropButton.value.disabled;
135
+ if (typeof safeDropButton.value?.disabled === 'function') return !safeDropButton.value.disabled(props.item);
136
+ if (typeof safeDropButton.value?.disabled === 'boolean') return !safeDropButton.value.disabled;
135
137
 
136
138
  return true;
137
139
  }),