@g1cloud/open-bluesea-grid 1.0.0-alpha.1 → 1.0.0-alpha.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.
@@ -1,4 +1,4 @@
1
- import { markRaw, reactive, ref, nextTick, defineComponent, createElementBlock, openBlock, withDirectives, createElementVNode, normalizeStyle, unref, vShow, computed, useSlots, withModifiers, normalizeClass, renderSlot, createVNode, createCommentVNode, toDisplayString, watch, createTextVNode, createBlock, Fragment, renderList, createSlots, withCtx, watchEffect, onBeforeUnmount, onMounted, mergeProps, toHandlers, defineAsyncComponent, withKeys, vModelText, resolveComponent } from "vue";
1
+ import { markRaw, reactive, ref, nextTick, defineComponent, createElementBlock, openBlock, withDirectives, createElementVNode, normalizeStyle, unref, vShow, computed, useSlots, withModifiers, normalizeClass, renderSlot, createVNode, createCommentVNode, toDisplayString, watch, createTextVNode, createBlock, Fragment, renderList, createSlots, withCtx, watchEffect, onBeforeUnmount, onMounted, mergeProps, toHandlers, defineAsyncComponent, withKeys, vModelText } from "vue";
2
2
  import dayjs from "dayjs";
3
3
  import { notNull, formatUtil, waitDuring, useContextMenu, vTooltip, componentUtil, provideSavePoint, provideFieldContext, emptyKeyProvider, useSavePoint, cancelProvidedSavePoint, BSLoadingIcon, BSPageNavigation, useModalHandle, BSModalFrame, BSButton, BSNumberInput, BSCheckbox, useModal, BSSelect, useBlueseaConfig, BSRadioButtonGroup, BSDateRange } from "@g1cloud/open-bluesea-core";
4
4
  class AbstractFilter {
@@ -1115,7 +1115,7 @@ const _export_sfc = (sfc, props) => {
1115
1115
  };
1116
1116
  const BSGridHeaderCellResizeHandle = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-3bda3a20"]]);
1117
1117
  const _hoisted_1$d = ["data-property-id"];
1118
- const _hoisted_2$8 = { class: "bs-layout-horizontal align-items-center" };
1118
+ const _hoisted_2$8 = { class: "flex align-items-center" };
1119
1119
  const _hoisted_3$4 = ["textContent"];
1120
1120
  const _hoisted_4$4 = ["textContent"];
1121
1121
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
@@ -1223,7 +1223,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1223
1223
  };
1224
1224
  }
1225
1225
  });
1226
- const BSGridHeaderCell = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-e140e95e"]]);
1226
+ const BSGridHeaderCell = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-fbb8ef01"]]);
1227
1227
  const _hoisted_1$c = { class: "checkbox bs-clickable" };
1228
1228
  const _hoisted_2$7 = { class: "font-icon" };
1229
1229
  const _sfc_main$f = /* @__PURE__ */ defineComponent({
@@ -2098,8 +2098,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2098
2098
  });
2099
2099
  const _hoisted_1$4 = { class: "text-center" };
2100
2100
  const _hoisted_2$4 = { class: "text-center" };
2101
- const _hoisted_3$2 = { class: "bs-layout-horizontal" };
2102
- const _hoisted_4$2 = { class: "bs-layout-horizontal grow justify-content-end gap-8" };
2101
+ const _hoisted_3$2 = { class: "flex" };
2102
+ const _hoisted_4$2 = { class: "flex grow justify-content-end gap-8" };
2103
2103
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2104
2104
  __name: "BSGridColumnSettingModal",
2105
2105
  props: {
@@ -2408,15 +2408,31 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2408
2408
  setup(__props, { emit: __emit }) {
2409
2409
  const props = __props;
2410
2410
  const emit = __emit;
2411
- const likeTextFilterItems = computed(() => props.textFilterItems);
2412
- const inTextFilterItems = computed(() => props.textFilterItems.filter((filter) => filter.allowMultiLineFilter));
2413
- const hasTextAreaFilterItem = computed(() => inTextFilterItems.value.length > 0);
2411
+ const likeTextFilterItems = computed(
2412
+ () => props.textFilterItems
2413
+ );
2414
+ const inTextFilterItems = computed(
2415
+ () => props.textFilterItems.filter((filter) => filter.allowMultiLineFilter)
2416
+ );
2417
+ const hasTextAreaFilterItem = computed(
2418
+ () => inTextFilterItems.value.length > 0
2419
+ );
2414
2420
  const filterMode = ref("INPUT");
2415
2421
  const changeFilterMode = (mode) => filterMode.value = mode;
2416
- const likeFilterItems = computed(() => likeTextFilterItems.value.filter((item) => !item.filterCreator && item.filterType !== "NUMBER"));
2417
- const equalFilterItemPropertyIds = computed(() => likeTextFilterItems.value.filter((item) => !item.filterCreator && item.filterType === "NUMBER").map((item) => item.propertyId));
2418
- const customFilterItems = computed(() => likeTextFilterItems.value.filter((item) => item.filterCreator));
2419
- const inFilterItemPropertyIds = computed(() => inTextFilterItems.value.map((filter) => filter.propertyId));
2422
+ const likeFilterItems = computed(
2423
+ () => likeTextFilterItems.value.filter(
2424
+ (item) => !item.filterCreator && item.filterType !== "NUMBER"
2425
+ )
2426
+ );
2427
+ const equalFilterItemPropertyIds = computed(
2428
+ () => likeTextFilterItems.value.filter((item) => !item.filterCreator && item.filterType === "NUMBER").map((item) => item.propertyId)
2429
+ );
2430
+ const customFilterItems = computed(
2431
+ () => likeTextFilterItems.value.filter((item) => item.filterCreator)
2432
+ );
2433
+ const inFilterItemPropertyIds = computed(
2434
+ () => inTextFilterItems.value.map((filter) => filter.propertyId)
2435
+ );
2420
2436
  const getFilterKeyword = (filter) => {
2421
2437
  const actualFilter = filter instanceof OrFilter ? filter.filters[0] : filter;
2422
2438
  if (actualFilter && "getFilterValueString" in actualFilter) {
@@ -2447,13 +2463,31 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2447
2463
  };
2448
2464
  const makeLikeFilters = (items, keyword) => {
2449
2465
  if (items.length === 0) return [];
2450
- const prefixSuffix = items.map((item) => (item.prefix === false ? "f" : "t") + (item.suffix === false ? "f" : "t"));
2466
+ const prefixSuffix = items.map(
2467
+ (item) => (item.prefix === false ? "f" : "t") + (item.suffix === false ? "f" : "t")
2468
+ );
2451
2469
  if (prefixSuffix.every((val) => val === prefixSuffix[0])) {
2452
2470
  const likeNames = likeFilterItems.value.map((item) => item.propertyId);
2453
2471
  const first = items[0];
2454
- return [likeFilter(likeNames, keyword, first.prefix !== false, first.suffix !== false, true)];
2472
+ return [
2473
+ likeFilter(
2474
+ likeNames,
2475
+ keyword,
2476
+ first.prefix !== false,
2477
+ first.suffix !== false,
2478
+ true
2479
+ )
2480
+ ];
2455
2481
  } else {
2456
- return items.map((item) => likeFilter([item.propertyId], keyword, item.prefix !== false, item.suffix !== false, true));
2482
+ return items.map(
2483
+ (item) => likeFilter(
2484
+ [item.propertyId],
2485
+ keyword,
2486
+ item.prefix !== false,
2487
+ item.suffix !== false,
2488
+ true
2489
+ )
2490
+ );
2457
2491
  }
2458
2492
  };
2459
2493
  const createFilter = async (text) => {
@@ -2463,13 +2497,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2463
2497
  const like = makeLikeFilters(likeFilterItems.value, keyword);
2464
2498
  const equalNames = equalFilterItemPropertyIds.value;
2465
2499
  const equal = equalNames.length > 0 && !Number.isNaN(Number(keyword)) ? equalFilter(equalNames, Number(keyword), true) : void 0;
2466
- const customFilters = (await Promise.all(customFilterItems.value.map(async (item) => {
2467
- let created = item.filterCreator?.(item.propertyId, keyword);
2468
- if (created && created instanceof Promise) {
2469
- created = await created;
2470
- }
2471
- return created || [];
2472
- }))).flatMap((item) => item);
2500
+ const customFilters = (await Promise.all(
2501
+ customFilterItems.value.map(async (item) => {
2502
+ let created = item.filterCreator?.(item.propertyId, keyword);
2503
+ if (created && created instanceof Promise) {
2504
+ created = await created;
2505
+ }
2506
+ return created || [];
2507
+ })
2508
+ )).flatMap((item) => item);
2473
2509
  const allFilters = [...like, equal, ...customFilters].filter(notNull);
2474
2510
  if (allFilters.length >= 2) return orFilter(allFilters);
2475
2511
  else return allFilters[0];
@@ -2502,7 +2538,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2502
2538
  ]),
2503
2539
  hasTextAreaFilterItem.value ? (openBlock(), createElementBlock("span", {
2504
2540
  key: 0,
2505
- class: "filter-mode-btn font-icon bs-clickable mr-4 mt-5",
2541
+ class: "filter-mode-btn font-icon bs-clickable pr-2 pt-1",
2506
2542
  onClick: _cache[2] || (_cache[2] = ($event) => changeFilterMode("TEXTAREA"))
2507
2543
  }, "south")) : createCommentVNode("", true)
2508
2544
  ], 512), [
@@ -2517,7 +2553,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2517
2553
  [vModelText, textareaText.value]
2518
2554
  ]),
2519
2555
  createElementVNode("span", {
2520
- class: "font-icon bs-clickable mr-4 mt-5",
2556
+ class: "filter-mode-btn font-icon bs-clickable pr-2 pt-1",
2521
2557
  onClick: _cache[4] || (_cache[4] = ($event) => changeFilterMode("INPUT"))
2522
2558
  }, "north")
2523
2559
  ], 512), [
@@ -2844,12 +2880,81 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2844
2880
  };
2845
2881
  }
2846
2882
  });
2883
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2884
+ __name: "BSDateRangeFilter",
2885
+ props: {
2886
+ idFrom: {},
2887
+ idTo: {},
2888
+ nameFrom: {},
2889
+ nameTo: {},
2890
+ modelValue: {},
2891
+ disabled: { type: Boolean },
2892
+ width: { default: "300px" },
2893
+ resolution: { default: "DAY" },
2894
+ displayFormat: {},
2895
+ popupDisplayFormat: {},
2896
+ popupStartYear: {},
2897
+ popupEndYear: {},
2898
+ timeZone: {}
2899
+ },
2900
+ emits: ["update:modelValue"],
2901
+ setup(__props, { emit: __emit }) {
2902
+ const props = __props;
2903
+ const emit = __emit;
2904
+ const fromValue = ref();
2905
+ const toValue = ref();
2906
+ watch(
2907
+ () => props.modelValue,
2908
+ () => {
2909
+ fromValue.value = props.modelValue?.from;
2910
+ toValue.value = props.modelValue?.to;
2911
+ },
2912
+ { immediate: true }
2913
+ );
2914
+ const emitValue = () => {
2915
+ const value = {
2916
+ from: fromValue.value,
2917
+ to: toValue.value
2918
+ };
2919
+ emit("update:modelValue", value);
2920
+ };
2921
+ return (_ctx, _cache) => {
2922
+ return openBlock(), createBlock(unref(BSDateRange), {
2923
+ "from-value": fromValue.value,
2924
+ "onUpdate:fromValue": [
2925
+ _cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
2926
+ emitValue
2927
+ ],
2928
+ "to-value": toValue.value,
2929
+ "onUpdate:toValue": [
2930
+ _cache[1] || (_cache[1] = ($event) => toValue.value = $event),
2931
+ emitValue
2932
+ ],
2933
+ "disabled-from": __props.disabled,
2934
+ "disabled-to": __props.disabled,
2935
+ "display-format": __props.displayFormat,
2936
+ "id-from": __props.idFrom,
2937
+ "id-to": __props.idTo,
2938
+ "name-from": __props.nameFrom,
2939
+ "name-to": __props.nameTo,
2940
+ "popup-display-format": __props.popupDisplayFormat,
2941
+ "popup-end-year": __props.popupEndYear,
2942
+ "popup-start-year": __props.popupStartYear,
2943
+ resolution: __props.resolution,
2944
+ "time-zone": __props.timeZone,
2945
+ "validate-date-order": false,
2946
+ width: __props.width,
2947
+ "hide-extra-date": ""
2948
+ }, null, 8, ["from-value", "to-value", "disabled-from", "disabled-to", "display-format", "id-from", "id-to", "name-from", "name-to", "popup-display-format", "popup-end-year", "popup-start-year", "resolution", "time-zone", "width"]);
2949
+ };
2950
+ }
2951
+ });
2847
2952
  const _hoisted_1$1 = {
2848
2953
  key: 0,
2849
- class: "date-filters .bs-layout-vertical mr-16"
2954
+ class: "date-filters flex flex-col"
2850
2955
  };
2851
2956
  const _hoisted_2$1 = ["onClick"];
2852
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2957
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2853
2958
  __name: "BSDateRangeFilters",
2854
2959
  props: {
2855
2960
  dateFilter: {},
@@ -2965,23 +3070,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2965
3070
  return props.dateFilter.filterItems.find((item) => item.propertyId === propertyId)?.filterWidth || props.filterWidth;
2966
3071
  };
2967
3072
  return (_ctx, _cache) => {
2968
- const _component_BSDateRangeFilter = resolveComponent("BSDateRangeFilter");
2969
3073
  return __props.dateFilter.filterItems ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
2970
3074
  (openBlock(true), createElementBlock(Fragment, null, renderList(dateFilterValues.value, (item, index) => {
2971
3075
  return openBlock(), createElementBlock("div", {
2972
3076
  key: index,
2973
- class: "bs-layout-horizontal mb-4 flex-align-center"
3077
+ class: "flex gap-1 mb-1 flex-align-center"
2974
3078
  }, [
2975
3079
  index === 0 ? (openBlock(), createElementBlock("span", {
2976
3080
  key: 0,
2977
3081
  class: normalizeClass([{
2978
3082
  disabled: dateFilterValues.value.length >= __props.dateFilter.filterItems.length
2979
- }, "font-icon bs-clickable mr-4"]),
3083
+ }, "font-icon bs-clickable"]),
2980
3084
  "data-id": "addDateFilterBtn",
2981
3085
  onClick: addDateFilter
2982
3086
  }, "add", 2)) : (openBlock(), createElementBlock("span", {
2983
3087
  key: 1,
2984
- class: "font-icon bs-clickable mr-4",
3088
+ class: "font-icon bs-clickable",
2985
3089
  "data-id": "removeDateFilterBtn",
2986
3090
  onClick: ($event) => removeDateFilter(index)
2987
3091
  }, "remove", 8, _hoisted_2$1)),
@@ -2991,11 +3095,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2991
3095
  "model-value": item.propertyId,
2992
3096
  style: normalizeStyle({ minWidth: __props.captionMinWidth }),
2993
3097
  "value-provider": (filter) => filter.propertyId,
2994
- class: "mr-4",
2995
3098
  "data-id": "filterItemSelect",
2996
3099
  "onUpdate:modelValue": ($event) => setDateFilterPropertyId(index, $event)
2997
3100
  }, null, 8, ["items", "label-provider", "model-value", "style", "value-provider", "onUpdate:modelValue"]),
2998
- createVNode(_component_BSDateRangeFilter, {
3101
+ createVNode(_sfc_main$2, {
2999
3102
  "display-format": dateFormatOfFilterItem(item.propertyId),
3000
3103
  "from-id": `${item.propertyId}From`,
3001
3104
  "model-value": item.value,
@@ -3017,8 +3120,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3017
3120
  (value, preset) => setDateFilterValue(index, value, preset)
3018
3121
  ],
3019
3122
  presets: __props.presets,
3020
- "time-zone": timeZoneOfFilterItem(item.propertyId),
3021
- class: "ml-4"
3123
+ "time-zone": timeZoneOfFilterItem(item.propertyId)
3022
3124
  }, null, 8, ["modelValue", "onUpdate:modelValue", "presets", "time-zone"])
3023
3125
  ]);
3024
3126
  }), 128))
@@ -3026,9 +3128,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3026
3128
  };
3027
3129
  }
3028
3130
  });
3029
- const _hoisted_1 = { class: "bs-grid-lookup bs-layout-horizontal flex-align-start" };
3030
- const _hoisted_2 = { class: "text-nowrap" };
3031
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3131
+ const _hoisted_1 = { class: "bs-grid-lookup flex flex-align-start" };
3132
+ const _hoisted_2 = { class: "text-nowrap flex gap-1" };
3133
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3032
3134
  __name: "BSGridLookup",
3033
3135
  props: {
3034
3136
  gridId: {},
@@ -3126,10 +3228,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3126
3228
  emitUpdateModelValueAndSearch
3127
3229
  ],
3128
3230
  keyword: __props.keyword,
3129
- "text-filter-items": __props.config.textFilter.filterItems,
3130
- class: "mr-16"
3231
+ "text-filter-items": __props.config.textFilter.filterItems
3131
3232
  }, null, 8, ["modelValue", "keyword", "text-filter-items"])) : createCommentVNode("", true),
3132
- __props.config?.dateFilter ? (openBlock(), createBlock(_sfc_main$2, {
3233
+ __props.config?.dateFilter ? (openBlock(), createBlock(_sfc_main$1, {
3133
3234
  key: 1,
3134
3235
  modelValue: dateFilterValue.value,
3135
3236
  "onUpdate:modelValue": [
@@ -3156,12 +3257,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3156
3257
  __props.config?.dateFilter ? (openBlock(), createBlock(unref(BSButton), {
3157
3258
  key: 0,
3158
3259
  caption: "Save",
3159
- class: "ml-4",
3160
3260
  onClick: saveSearchCondition
3161
3261
  })) : createCommentVNode("", true),
3162
3262
  createVNode(unref(BSButton), {
3163
3263
  caption: "Reset",
3164
- class: "ml-4",
3165
3264
  onClick: resetSearchCondition
3166
3265
  })
3167
3266
  ])
@@ -3169,80 +3268,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3169
3268
  };
3170
3269
  }
3171
3270
  });
3172
- const _sfc_main = /* @__PURE__ */ defineComponent({
3173
- __name: "BSDateRangeFilter",
3174
- props: {
3175
- idFrom: {},
3176
- idTo: {},
3177
- nameFrom: {},
3178
- nameTo: {},
3179
- modelValue: {},
3180
- disabled: { type: Boolean },
3181
- width: { default: "300px" },
3182
- resolution: { default: "DAY" },
3183
- displayFormat: {},
3184
- popupDisplayFormat: {},
3185
- popupStartYear: {},
3186
- popupEndYear: {},
3187
- timeZone: {}
3188
- },
3189
- emits: ["update:modelValue"],
3190
- setup(__props, { emit: __emit }) {
3191
- const props = __props;
3192
- const emit = __emit;
3193
- const fromValue = ref();
3194
- const toValue = ref();
3195
- watch(
3196
- () => props.modelValue,
3197
- () => {
3198
- fromValue.value = props.modelValue?.from;
3199
- toValue.value = props.modelValue?.to;
3200
- },
3201
- { immediate: true }
3202
- );
3203
- const emitValue = () => {
3204
- const value = {
3205
- from: fromValue.value,
3206
- to: toValue.value
3207
- };
3208
- emit("update:modelValue", value);
3209
- };
3210
- return (_ctx, _cache) => {
3211
- return openBlock(), createBlock(unref(BSDateRange), {
3212
- "from-value": fromValue.value,
3213
- "onUpdate:fromValue": [
3214
- _cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
3215
- emitValue
3216
- ],
3217
- "to-value": toValue.value,
3218
- "onUpdate:toValue": [
3219
- _cache[1] || (_cache[1] = ($event) => toValue.value = $event),
3220
- emitValue
3221
- ],
3222
- "disabled-from": __props.disabled,
3223
- "disabled-to": __props.disabled,
3224
- "display-format": __props.displayFormat,
3225
- "id-from": __props.idFrom,
3226
- "id-to": __props.idTo,
3227
- "name-from": __props.nameFrom,
3228
- "name-to": __props.nameTo,
3229
- "popup-display-format": __props.popupDisplayFormat,
3230
- "popup-end-year": __props.popupEndYear,
3231
- "popup-start-year": __props.popupStartYear,
3232
- resolution: __props.resolution,
3233
- "time-zone": __props.timeZone,
3234
- "validate-date-order": false,
3235
- width: __props.width,
3236
- "hide-extra-date": ""
3237
- }, null, 8, ["from-value", "to-value", "disabled-from", "disabled-to", "display-format", "id-from", "id-to", "name-from", "name-to", "popup-display-format", "popup-end-year", "popup-start-year", "resolution", "time-zone", "width"]);
3238
- };
3239
- }
3240
- });
3241
3271
  export {
3242
3272
  AbstractFilter,
3243
3273
  AndFilter,
3244
- _sfc_main as BSDateRangeFilter,
3245
- _sfc_main$2 as BSDateRangeFilters,
3274
+ _sfc_main$2 as BSDateRangeFilter,
3275
+ _sfc_main$1 as BSDateRangeFilters,
3246
3276
  _sfc_main$3 as BSDateRangePresets,
3247
3277
  _sfc_main$7 as BSGrid,
3248
3278
  _sfc_main$d as BSGridCell,
@@ -3256,7 +3286,7 @@ export {
3256
3286
  _sfc_main$f as BSGridHeaderCellCheckbox,
3257
3287
  BSGridHeaderCellResizeHandle,
3258
3288
  BSGridHeaderCellSerialNo,
3259
- _sfc_main$1 as BSGridLookup,
3289
+ _sfc_main as BSGridLookup,
3260
3290
  _sfc_main$8 as BSGridRow,
3261
3291
  _sfc_main$4 as BSTextFilter,
3262
3292
  BetweenDateFilter,