@iankibetsh/shframework 0.1.9 → 0.2.0

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.
Files changed (3) hide show
  1. package/dist/library.js +328 -266
  2. package/dist/library.mjs +328 -266
  3. package/package.json +1 -1
package/dist/library.js CHANGED
@@ -2824,11 +2824,14 @@ var script$1 = {
2824
2824
  windowWidth: function () {
2825
2825
  return window.innerWidth
2826
2826
  },
2827
+ user () {
2828
+ return null
2829
+ },
2827
2830
  hasDefaultSlot () {
2828
2831
  return !!this.$slots.default
2829
2832
  },
2830
- user () {
2831
- return this.global.state.user
2833
+ hasRecordsSlot () {
2834
+ return !!this.$slots.records
2832
2835
  }
2833
2836
  }
2834
2837
  };
@@ -2858,22 +2861,46 @@ const _hoisted_12 = /*#__PURE__*/vue.createElementVNode("span", { class: "sh-sea
2858
2861
  /*#__PURE__*/vue.createElementVNode("i", { class: "bi bi-search mb-0" })
2859
2862
  ], -1 /* HOISTED */);
2860
2863
  const _hoisted_13 = {
2861
- key: 2,
2864
+ key: 0,
2865
+ class: "text-center"
2866
+ };
2867
+ const _hoisted_14 = /*#__PURE__*/vue.createElementVNode("span", { colspan: 2 }, [
2868
+ /*#__PURE__*/vue.createElementVNode("img", { src: "/src/views/assets/images/loading.gif" })
2869
+ ], -1 /* HOISTED */);
2870
+ const _hoisted_15 = [
2871
+ _hoisted_14
2872
+ ];
2873
+ const _hoisted_16 = { key: 1 };
2874
+ const _hoisted_17 = { colspan: 2 };
2875
+ const _hoisted_18 = {
2876
+ key: 0,
2877
+ class: "text-center"
2878
+ };
2879
+ const _hoisted_19 = /*#__PURE__*/vue.createElementVNode("span", { colspan: 2 }, [
2880
+ /*#__PURE__*/vue.createElementVNode("img", { src: "/src/views/assets/images/loading.gif" })
2881
+ ], -1 /* HOISTED */);
2882
+ const _hoisted_20 = [
2883
+ _hoisted_19
2884
+ ];
2885
+ const _hoisted_21 = { key: 1 };
2886
+ const _hoisted_22 = { colspan: 2 };
2887
+ const _hoisted_23 = {
2888
+ key: 4,
2862
2889
  class: "table"
2863
2890
  };
2864
- const _hoisted_14 = ["onClick"];
2865
- const _hoisted_15 = ["onClick"];
2866
- const _hoisted_16 = ["onClick"];
2867
- const _hoisted_17 = {
2891
+ const _hoisted_24 = ["onClick"];
2892
+ const _hoisted_25 = ["onClick"];
2893
+ const _hoisted_26 = ["onClick"];
2894
+ const _hoisted_27 = {
2868
2895
  key: 0,
2869
2896
  class: "text-capitalize"
2870
2897
  };
2871
- const _hoisted_18 = {
2898
+ const _hoisted_28 = {
2872
2899
  key: 0,
2873
2900
  class: "text-center"
2874
2901
  };
2875
- const _hoisted_19 = ["colspan"];
2876
- const _hoisted_20 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-center" }, [
2902
+ const _hoisted_29 = ["colspan"];
2903
+ const _hoisted_30 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-center" }, [
2877
2904
  /*#__PURE__*/vue.createElementVNode("div", {
2878
2905
  class: "spinner-border",
2879
2906
  role: "status"
@@ -2881,46 +2908,46 @@ const _hoisted_20 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-ce
2881
2908
  /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2882
2909
  ])
2883
2910
  ], -1 /* HOISTED */);
2884
- const _hoisted_21 = [
2885
- _hoisted_20
2911
+ const _hoisted_31 = [
2912
+ _hoisted_30
2886
2913
  ];
2887
- const _hoisted_22 = {
2914
+ const _hoisted_32 = {
2888
2915
  key: 1,
2889
2916
  class: "text-center alert alert-danger"
2890
2917
  };
2891
- const _hoisted_23 = ["colspan"];
2892
- const _hoisted_24 = {
2918
+ const _hoisted_33 = ["colspan"];
2919
+ const _hoisted_34 = {
2893
2920
  key: 2,
2894
2921
  class: "text-center alert alert-info no_records"
2895
2922
  };
2896
- const _hoisted_25 = ["colspan"];
2897
- const _hoisted_26 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */);
2898
- const _hoisted_27 = /*#__PURE__*/vue.createTextVNode(" No records found ");
2899
- const _hoisted_28 = [
2900
- _hoisted_26,
2901
- _hoisted_27
2923
+ const _hoisted_35 = ["colspan"];
2924
+ const _hoisted_36 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */);
2925
+ const _hoisted_37 = /*#__PURE__*/vue.createTextVNode(" No records found ");
2926
+ const _hoisted_38 = [
2927
+ _hoisted_36,
2928
+ _hoisted_37
2902
2929
  ];
2903
- const _hoisted_29 = ["onClick"];
2904
- const _hoisted_30 = { key: 1 };
2905
- const _hoisted_31 = {
2930
+ const _hoisted_39 = ["onClick"];
2931
+ const _hoisted_40 = { key: 1 };
2932
+ const _hoisted_41 = {
2906
2933
  key: 2,
2907
2934
  class: "text-success fw-bold"
2908
2935
  };
2909
- const _hoisted_32 = { key: 3 };
2910
- const _hoisted_33 = ["innerHTML"];
2911
- const _hoisted_34 = ["innerHTML"];
2912
- const _hoisted_35 = ["innerHTML"];
2913
- const _hoisted_36 = {
2936
+ const _hoisted_42 = { key: 3 };
2937
+ const _hoisted_43 = ["innerHTML"];
2938
+ const _hoisted_44 = ["innerHTML"];
2939
+ const _hoisted_45 = ["innerHTML"];
2940
+ const _hoisted_46 = {
2914
2941
  key: 0,
2915
2942
  style: {"white-space":"nowrap"}
2916
2943
  };
2917
- const _hoisted_37 = ["title", "onClick"];
2918
- const _hoisted_38 = { key: 3 };
2919
- const _hoisted_39 = {
2944
+ const _hoisted_47 = ["title", "onClick"];
2945
+ const _hoisted_48 = { key: 5 };
2946
+ const _hoisted_49 = {
2920
2947
  key: 0,
2921
2948
  class: "text-center"
2922
2949
  };
2923
- const _hoisted_40 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-center" }, [
2950
+ const _hoisted_50 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-center" }, [
2924
2951
  /*#__PURE__*/vue.createElementVNode("div", {
2925
2952
  class: "spinner-border",
2926
2953
  role: "status"
@@ -2928,38 +2955,38 @@ const _hoisted_40 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-ce
2928
2955
  /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2929
2956
  ])
2930
2957
  ], -1 /* HOISTED */);
2931
- const _hoisted_41 = [
2932
- _hoisted_40
2958
+ const _hoisted_51 = [
2959
+ _hoisted_50
2933
2960
  ];
2934
- const _hoisted_42 = { key: 1 };
2935
- const _hoisted_43 = {
2961
+ const _hoisted_52 = { key: 1 };
2962
+ const _hoisted_53 = {
2936
2963
  key: 2,
2937
2964
  class: "mobile-list-items"
2938
2965
  };
2939
- const _hoisted_44 = ["onClick"];
2940
- const _hoisted_45 = {
2966
+ const _hoisted_54 = ["onClick"];
2967
+ const _hoisted_55 = {
2941
2968
  key: 0,
2942
2969
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2943
2970
  };
2944
- const _hoisted_46 = {
2971
+ const _hoisted_56 = {
2945
2972
  key: 1,
2946
2973
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2947
2974
  };
2948
- const _hoisted_47 = {
2975
+ const _hoisted_57 = {
2949
2976
  key: 2,
2950
2977
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2951
2978
  };
2952
- const _hoisted_48 = { key: 1 };
2953
- const _hoisted_49 = {
2979
+ const _hoisted_58 = { key: 1 };
2980
+ const _hoisted_59 = {
2954
2981
  key: 2,
2955
2982
  class: "text-primary fw-bold"
2956
2983
  };
2957
- const _hoisted_50 = ["innerHTML"];
2958
- const _hoisted_51 = ["innerHTML"];
2959
- const _hoisted_52 = ["innerHTML"];
2960
- const _hoisted_53 = /*#__PURE__*/vue.createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
2961
- const _hoisted_54 = { key: 0 };
2962
- const _hoisted_55 = ["title", "onClick"];
2984
+ const _hoisted_60 = ["innerHTML"];
2985
+ const _hoisted_61 = ["innerHTML"];
2986
+ const _hoisted_62 = ["innerHTML"];
2987
+ const _hoisted_63 = /*#__PURE__*/vue.createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
2988
+ const _hoisted_64 = { key: 0 };
2989
+ const _hoisted_65 = ["title", "onClick"];
2963
2990
 
2964
2991
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
2965
2992
  const _component_router_link = vue.resolveComponent("router-link");
@@ -3003,169 +3030,103 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3003
3030
  ])
3004
3031
  ]))
3005
3032
  : vue.createCommentVNode("v-if", true),
3006
- ($options.windowWidth > 700)
3007
- ? (vue.openBlock(), vue.createElementBlock("table", _hoisted_13, [
3008
- vue.createElementVNode("thead", null, [
3009
- vue.createElementVNode("tr", null, [
3010
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (title) => {
3011
- return (vue.openBlock(), vue.createElementBlock("th", {
3012
- key: title[0]
3013
- }, [
3014
- (typeof title === 'string')
3015
- ? (vue.openBlock(), vue.createElementBlock("a", {
3016
- key: 0,
3017
- class: "text-capitalize",
3018
- onClick: $event => ($options.changeKey('order_by',title))
3019
- }, vue.toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_14))
3020
- : (typeof title === 'function')
3033
+ ($options.hasDefaultSlot)
3034
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3035
+ ($data.loading === 'loading')
3036
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, _hoisted_15))
3037
+ : ($data.loading === 'error')
3038
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, [
3039
+ vue.createElementVNode("span", _hoisted_17, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
3040
+ ]))
3041
+ : vue.createCommentVNode("v-if", true),
3042
+ ($data.loading === 'done')
3043
+ ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList($data.records, (record) => {
3044
+ return vue.renderSlot(_ctx.$slots, "default", {
3045
+ key: record.id,
3046
+ record: record
3047
+ })
3048
+ }), 128 /* KEYED_FRAGMENT */))
3049
+ : vue.createCommentVNode("v-if", true)
3050
+ ], 64 /* STABLE_FRAGMENT */))
3051
+ : vue.createCommentVNode("v-if", true),
3052
+ ($options.hasRecordsSlot)
3053
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
3054
+ ($data.loading === 'loading')
3055
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18, _hoisted_20))
3056
+ : ($data.loading === 'error')
3057
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_21, [
3058
+ vue.createElementVNode("span", _hoisted_22, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
3059
+ ]))
3060
+ : vue.createCommentVNode("v-if", true),
3061
+ ($data.loading === 'done')
3062
+ ? vue.renderSlot(_ctx.$slots, "records", {
3063
+ key: 2,
3064
+ records: $data.records
3065
+ })
3066
+ : vue.createCommentVNode("v-if", true)
3067
+ ], 64 /* STABLE_FRAGMENT */))
3068
+ : ($options.windowWidth > 700)
3069
+ ? (vue.openBlock(), vue.createElementBlock("table", _hoisted_23, [
3070
+ vue.createElementVNode("thead", null, [
3071
+ vue.createElementVNode("tr", null, [
3072
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (title) => {
3073
+ return (vue.openBlock(), vue.createElementBlock("th", {
3074
+ key: title[0]
3075
+ }, [
3076
+ (typeof title === 'string')
3021
3077
  ? (vue.openBlock(), vue.createElementBlock("a", {
3022
- key: 1,
3078
+ key: 0,
3023
3079
  class: "text-capitalize",
3024
3080
  onClick: $event => ($options.changeKey('order_by',title))
3025
- }, vue.toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_15))
3026
- : (vue.openBlock(), vue.createElementBlock("a", {
3027
- key: 2,
3028
- class: "text-capitalize",
3029
- onClick: $event => ($options.changeKey('order_by',title[0]))
3030
- }, vue.toDisplayString(title[1].replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_16))
3031
- ]))
3032
- }), 128 /* KEYED_FRAGMENT */)),
3033
- ($props.actions)
3034
- ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_17, vue.toDisplayString($props.actions.label), 1 /* TEXT */))
3035
- : vue.createCommentVNode("v-if", true)
3036
- ])
3037
- ]),
3038
- vue.createElementVNode("tbody", null, [
3039
- ($data.loading === 'loading')
3040
- ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_18, [
3041
- vue.createElementVNode("td", {
3042
- colspan: $props.headers.length
3043
- }, _hoisted_21, 8 /* PROPS */, _hoisted_19)
3044
- ]))
3045
- : ($data.loading === 'error')
3046
- ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_22, [
3081
+ }, vue.toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_24))
3082
+ : (typeof title === 'function')
3083
+ ? (vue.openBlock(), vue.createElementBlock("a", {
3084
+ key: 1,
3085
+ class: "text-capitalize",
3086
+ onClick: $event => ($options.changeKey('order_by',title))
3087
+ }, vue.toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_25))
3088
+ : (vue.openBlock(), vue.createElementBlock("a", {
3089
+ key: 2,
3090
+ class: "text-capitalize",
3091
+ onClick: $event => ($options.changeKey('order_by',title[0]))
3092
+ }, vue.toDisplayString(title[1].replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_26))
3093
+ ]))
3094
+ }), 128 /* KEYED_FRAGMENT */)),
3095
+ ($props.actions)
3096
+ ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_27, vue.toDisplayString($props.actions.label), 1 /* TEXT */))
3097
+ : vue.createCommentVNode("v-if", true)
3098
+ ])
3099
+ ]),
3100
+ vue.createElementVNode("tbody", null, [
3101
+ ($data.loading === 'loading')
3102
+ ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_28, [
3047
3103
  vue.createElementVNode("td", {
3048
3104
  colspan: $props.headers.length
3049
- }, vue.toDisplayString($data.loading_error), 9 /* TEXT, PROPS */, _hoisted_23)
3105
+ }, _hoisted_31, 8 /* PROPS */, _hoisted_29)
3050
3106
  ]))
3051
- : ($data.records.length === 0)
3052
- ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_24, [
3107
+ : ($data.loading === 'error')
3108
+ ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_32, [
3053
3109
  vue.createElementVNode("td", {
3054
- colspan: $props.actions ? $props.headers.length + 1 : $props.headers.length
3055
- }, _hoisted_28, 8 /* PROPS */, _hoisted_25)
3110
+ colspan: $props.headers.length
3111
+ }, vue.toDisplayString($data.loading_error), 9 /* TEXT, PROPS */, _hoisted_33)
3056
3112
  ]))
3057
- : ($data.loading === 'done')
3058
- ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 3 }, vue.renderList($data.records, (record, index) => {
3059
- return (vue.openBlock(), vue.createElementBlock("tr", {
3060
- key: record.id,
3061
- class: vue.normalizeClass(record.class),
3062
- onClick: $event => ($options.rowSelected(record))
3063
- }, [
3064
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (key) => {
3065
- return (vue.openBlock(), vue.createElementBlock("td", {
3066
- key: key[0]
3067
- }, [
3068
- (typeof key === 'string' && $props.links && $props.links[key])
3069
- ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3070
- key: 0,
3071
- to: $options.replaceLinkUrl($props.links[key],record),
3072
- class: vue.normalizeClass($options.getLinkClass($props.links[key])),
3073
- innerHTML: record[key]
3074
- }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3075
- : ($options.getFieldType(key) === 'numeric')
3076
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_30, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3077
- : ($options.getFieldType(key) === 'money')
3078
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_31, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3079
- : ($options.getFieldType(key) === 'date')
3080
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_32, vue.toDisplayString($options.formatDate(record[key])), 1 /* TEXT */))
3081
- : (typeof key === 'string')
3082
- ? (vue.openBlock(), vue.createElementBlock("span", {
3083
- key: 4,
3084
- innerHTML: record[key]
3085
- }, null, 8 /* PROPS */, _hoisted_33))
3086
- : (typeof key === 'function')
3087
- ? (vue.openBlock(), vue.createElementBlock("span", {
3088
- key: 5,
3089
- innerHTML: key(record, index)
3090
- }, null, 8 /* PROPS */, _hoisted_34))
3091
- : (vue.openBlock(), vue.createElementBlock("span", {
3092
- key: 6,
3093
- innerHTML: record[key[0]]
3094
- }, null, 8 /* PROPS */, _hoisted_35))
3095
- ]))
3096
- }), 128 /* KEYED_FRAGMENT */)),
3097
- ($props.actions)
3098
- ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_36, [
3099
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.actions.actions, (act) => {
3100
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3101
- key: act.path
3102
- }, [
3103
- (!act.permission || $options.user.isAllowedTo(act.permission))
3104
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3105
- (!act.validator || act.validator(record))
3106
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3107
- (act.emits)
3108
- ? (vue.openBlock(), vue.createElementBlock("button", {
3109
- key: 0,
3110
- title: act.title,
3111
- class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3112
- onClick: $event => ($options.doEmitAction(act.emits,record))
3113
- }, vue.toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_37))
3114
- : vue.createCommentVNode("v-if", true),
3115
- (!act.emits)
3116
- ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3117
- key: 1,
3118
- title: act.title,
3119
- to: $options.replaceActionUrl(act.path,record),
3120
- class: vue.normalizeClass(act.class)
3121
- }, {
3122
- default: vue.withCtx(() => [
3123
- vue.createTextVNode(vue.toDisplayString(act.label), 1 /* TEXT */)
3124
- ]),
3125
- _: 2 /* DYNAMIC */
3126
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3127
- : vue.createCommentVNode("v-if", true)
3128
- ], 64 /* STABLE_FRAGMENT */))
3129
- : vue.createCommentVNode("v-if", true)
3130
- ], 64 /* STABLE_FRAGMENT */))
3131
- : vue.createCommentVNode("v-if", true)
3132
- ], 64 /* STABLE_FRAGMENT */))
3133
- }), 128 /* KEYED_FRAGMENT */))
3134
- ]))
3135
- : vue.createCommentVNode("v-if", true)
3136
- ], 10 /* CLASS, PROPS */, _hoisted_29))
3137
- }), 128 /* KEYED_FRAGMENT */))
3138
- : vue.createCommentVNode("v-if", true)
3139
- ])
3140
- ]))
3141
- : (vue.openBlock(), vue.createElementBlock("div", _hoisted_38, [
3142
- ($data.loading === 'loading')
3143
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_39, _hoisted_41))
3144
- : ($data.loading === 'error')
3145
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_42, [
3146
- vue.createElementVNode("span", null, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
3147
- ]))
3148
- : ($data.loading === 'done')
3149
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_43, [
3150
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.records, (record, index) => {
3151
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3152
- key: record.id
3153
- }, [
3154
- vue.createElementVNode("h3", null, vue.toDisplayString(_ctx.mobile_view), 1 /* TEXT */),
3155
- vue.createElementVNode("div", {
3156
- class: "single-mobile-req bg-light p-3",
3157
- onClick: $event => ($options.rowSelected(record))
3158
- }, [
3159
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (key) => {
3160
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3161
- key: key[0]
3162
- }, [
3163
- (typeof key === 'string' )
3164
- ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_45, vue.toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3165
- : (typeof key === 'function')
3166
- ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_46, vue.toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3167
- : (vue.openBlock(), vue.createElementBlock("p", _hoisted_47, vue.toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3168
- vue.createElementVNode("span", null, [
3113
+ : ($data.records.length === 0)
3114
+ ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_34, [
3115
+ vue.createElementVNode("td", {
3116
+ colspan: $props.actions ? $props.headers.length + 1 : $props.headers.length
3117
+ }, _hoisted_38, 8 /* PROPS */, _hoisted_35)
3118
+ ]))
3119
+ : ($data.loading === 'done')
3120
+ ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 3 }, vue.renderList($data.records, (record, index) => {
3121
+ return (vue.openBlock(), vue.createElementBlock("tr", {
3122
+ key: record.id,
3123
+ class: vue.normalizeClass(record.class),
3124
+ onClick: $event => ($options.rowSelected(record))
3125
+ }, [
3126
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (key) => {
3127
+ return (vue.openBlock(), vue.createElementBlock("td", {
3128
+ key: key[0]
3129
+ }, [
3169
3130
  (typeof key === 'string' && $props.links && $props.links[key])
3170
3131
  ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3171
3132
  key: 0,
@@ -3174,75 +3135,176 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3174
3135
  innerHTML: record[key]
3175
3136
  }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3176
3137
  : ($options.getFieldType(key) === 'numeric')
3177
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_48, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3138
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_40, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3178
3139
  : ($options.getFieldType(key) === 'money')
3179
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_49, "KES " + vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3180
- : (typeof key === 'string')
3181
- ? (vue.openBlock(), vue.createElementBlock("span", {
3182
- key: 3,
3183
- innerHTML: record[key]
3184
- }, null, 8 /* PROPS */, _hoisted_50))
3185
- : (typeof key === 'function')
3140
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_41, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3141
+ : ($options.getFieldType(key) === 'date')
3142
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_42, vue.toDisplayString($options.formatDate(record[key])), 1 /* TEXT */))
3143
+ : (typeof key === 'string')
3186
3144
  ? (vue.openBlock(), vue.createElementBlock("span", {
3187
3145
  key: 4,
3188
- innerHTML: key(record, index )
3189
- }, null, 8 /* PROPS */, _hoisted_51))
3190
- : (vue.openBlock(), vue.createElementBlock("span", {
3191
- key: 5,
3192
- innerHTML: record[key[0]]
3193
- }, null, 8 /* PROPS */, _hoisted_52))
3194
- ]),
3195
- _hoisted_53
3196
- ], 64 /* STABLE_FRAGMENT */))
3197
- }), 128 /* KEYED_FRAGMENT */)),
3198
- ($props.actions)
3199
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_54, [
3200
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.actions.actions, (act) => {
3201
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3202
- key: act.path
3203
- }, [
3204
- (!act.permission || $options.user.isAllowedTo(act.permission))
3205
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3206
- (!act.validator || act.validator(record))
3207
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3208
- (act.emits)
3209
- ? (vue.openBlock(), vue.createElementBlock("button", {
3210
- key: 0,
3211
- title: act.title,
3212
- class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3213
- onClick: $event => ($options.doEmitAction(act.emits,record))
3214
- }, vue.toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_55))
3215
- : vue.createCommentVNode("v-if", true),
3216
- (!act.emits)
3217
- ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3218
- key: 1,
3219
- title: act.title,
3220
- to: $options.replaceActionUrl(act.path,record),
3221
- class: vue.normalizeClass(act.class)
3222
- }, {
3223
- default: vue.withCtx(() => [
3224
- vue.createTextVNode(vue.toDisplayString(act.label), 1 /* TEXT */)
3225
- ]),
3226
- _: 2 /* DYNAMIC */
3227
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3228
- : vue.createCommentVNode("v-if", true)
3229
- ], 64 /* STABLE_FRAGMENT */))
3230
- : vue.createCommentVNode("v-if", true)
3231
- ], 64 /* STABLE_FRAGMENT */))
3232
- : vue.createCommentVNode("v-if", true)
3233
- ], 64 /* STABLE_FRAGMENT */))
3234
- }), 128 /* KEYED_FRAGMENT */))
3146
+ innerHTML: record[key]
3147
+ }, null, 8 /* PROPS */, _hoisted_43))
3148
+ : (typeof key === 'function')
3149
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3150
+ key: 5,
3151
+ innerHTML: key(record, index)
3152
+ }, null, 8 /* PROPS */, _hoisted_44))
3153
+ : (vue.openBlock(), vue.createElementBlock("span", {
3154
+ key: 6,
3155
+ innerHTML: record[key[0]]
3156
+ }, null, 8 /* PROPS */, _hoisted_45))
3235
3157
  ]))
3236
- : vue.createCommentVNode("v-if", true)
3237
- ], 8 /* PROPS */, _hoisted_44)
3238
- ], 64 /* STABLE_FRAGMENT */))
3239
- }), 128 /* KEYED_FRAGMENT */))
3158
+ }), 128 /* KEYED_FRAGMENT */)),
3159
+ ($props.actions)
3160
+ ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_46, [
3161
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.actions.actions, (act) => {
3162
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3163
+ key: act.path
3164
+ }, [
3165
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3166
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3167
+ (!act.validator || act.validator(record))
3168
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3169
+ (act.emits)
3170
+ ? (vue.openBlock(), vue.createElementBlock("button", {
3171
+ key: 0,
3172
+ title: act.title,
3173
+ class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3174
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3175
+ }, vue.toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_47))
3176
+ : vue.createCommentVNode("v-if", true),
3177
+ (!act.emits)
3178
+ ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3179
+ key: 1,
3180
+ title: act.title,
3181
+ to: $options.replaceActionUrl(act.path,record),
3182
+ class: vue.normalizeClass(act.class)
3183
+ }, {
3184
+ default: vue.withCtx(() => [
3185
+ vue.createTextVNode(vue.toDisplayString(act.label), 1 /* TEXT */)
3186
+ ]),
3187
+ _: 2 /* DYNAMIC */
3188
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3189
+ : vue.createCommentVNode("v-if", true)
3190
+ ], 64 /* STABLE_FRAGMENT */))
3191
+ : vue.createCommentVNode("v-if", true)
3192
+ ], 64 /* STABLE_FRAGMENT */))
3193
+ : vue.createCommentVNode("v-if", true)
3194
+ ], 64 /* STABLE_FRAGMENT */))
3195
+ }), 128 /* KEYED_FRAGMENT */))
3196
+ ]))
3197
+ : vue.createCommentVNode("v-if", true)
3198
+ ], 10 /* CLASS, PROPS */, _hoisted_39))
3199
+ }), 128 /* KEYED_FRAGMENT */))
3200
+ : vue.createCommentVNode("v-if", true)
3201
+ ])
3202
+ ]))
3203
+ : (vue.openBlock(), vue.createElementBlock("div", _hoisted_48, [
3204
+ ($data.loading === 'loading')
3205
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_49, _hoisted_51))
3206
+ : ($data.loading === 'error')
3207
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_52, [
3208
+ vue.createElementVNode("span", null, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
3240
3209
  ]))
3241
- : vue.createCommentVNode("v-if", true)
3242
- ])),
3210
+ : ($data.loading === 'done')
3211
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_53, [
3212
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.records, (record, index) => {
3213
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3214
+ key: record.id
3215
+ }, [
3216
+ vue.createElementVNode("h3", null, vue.toDisplayString(_ctx.mobile_view), 1 /* TEXT */),
3217
+ vue.createElementVNode("div", {
3218
+ class: "single-mobile-req bg-light p-3",
3219
+ onClick: $event => ($options.rowSelected(record))
3220
+ }, [
3221
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (key) => {
3222
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3223
+ key: key[0]
3224
+ }, [
3225
+ (typeof key === 'string' )
3226
+ ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_55, vue.toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3227
+ : (typeof key === 'function')
3228
+ ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_56, vue.toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3229
+ : (vue.openBlock(), vue.createElementBlock("p", _hoisted_57, vue.toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3230
+ vue.createElementVNode("span", null, [
3231
+ (typeof key === 'string' && $props.links && $props.links[key])
3232
+ ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3233
+ key: 0,
3234
+ to: $options.replaceLinkUrl($props.links[key],record),
3235
+ class: vue.normalizeClass($options.getLinkClass($props.links[key])),
3236
+ innerHTML: record[key]
3237
+ }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3238
+ : ($options.getFieldType(key) === 'numeric')
3239
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_58, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3240
+ : ($options.getFieldType(key) === 'money')
3241
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_59, "KES " + vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3242
+ : (typeof key === 'string')
3243
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3244
+ key: 3,
3245
+ innerHTML: record[key]
3246
+ }, null, 8 /* PROPS */, _hoisted_60))
3247
+ : (typeof key === 'function')
3248
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3249
+ key: 4,
3250
+ innerHTML: key(record, index )
3251
+ }, null, 8 /* PROPS */, _hoisted_61))
3252
+ : (vue.openBlock(), vue.createElementBlock("span", {
3253
+ key: 5,
3254
+ innerHTML: record[key[0]]
3255
+ }, null, 8 /* PROPS */, _hoisted_62))
3256
+ ]),
3257
+ _hoisted_63
3258
+ ], 64 /* STABLE_FRAGMENT */))
3259
+ }), 128 /* KEYED_FRAGMENT */)),
3260
+ ($props.actions)
3261
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_64, [
3262
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.actions.actions, (act) => {
3263
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3264
+ key: act.path
3265
+ }, [
3266
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3267
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3268
+ (!act.validator || act.validator(record))
3269
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3270
+ (act.emits)
3271
+ ? (vue.openBlock(), vue.createElementBlock("button", {
3272
+ key: 0,
3273
+ title: act.title,
3274
+ class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3275
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3276
+ }, vue.toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_65))
3277
+ : vue.createCommentVNode("v-if", true),
3278
+ (!act.emits)
3279
+ ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3280
+ key: 1,
3281
+ title: act.title,
3282
+ to: $options.replaceActionUrl(act.path,record),
3283
+ class: vue.normalizeClass(act.class)
3284
+ }, {
3285
+ default: vue.withCtx(() => [
3286
+ vue.createTextVNode(vue.toDisplayString(act.label), 1 /* TEXT */)
3287
+ ]),
3288
+ _: 2 /* DYNAMIC */
3289
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3290
+ : vue.createCommentVNode("v-if", true)
3291
+ ], 64 /* STABLE_FRAGMENT */))
3292
+ : vue.createCommentVNode("v-if", true)
3293
+ ], 64 /* STABLE_FRAGMENT */))
3294
+ : vue.createCommentVNode("v-if", true)
3295
+ ], 64 /* STABLE_FRAGMENT */))
3296
+ }), 128 /* KEYED_FRAGMENT */))
3297
+ ]))
3298
+ : vue.createCommentVNode("v-if", true)
3299
+ ], 8 /* PROPS */, _hoisted_54)
3300
+ ], 64 /* STABLE_FRAGMENT */))
3301
+ }), 128 /* KEYED_FRAGMENT */))
3302
+ ]))
3303
+ : vue.createCommentVNode("v-if", true)
3304
+ ])),
3243
3305
  ($data.pagination_data)
3244
3306
  ? (vue.openBlock(), vue.createBlock(_component_pagination, {
3245
- key: 4,
3307
+ key: 6,
3246
3308
  onLoadMoreRecords: $options.loadMoreRecords,
3247
3309
  "hide-load-more": $props.hideLoadMore,
3248
3310
  "hide-count": $props.hideCount,